Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 65d1c1922df7
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c25e2afcde0d
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Jul 26, 2016

  1. 1
    Copy the full SHA
    23f19b3 View commit details
  2. [Truffle] Remove useless allocate node.

    * The layout is gone it would seem.
    eregon committed Jul 26, 2016
    Copy the full SHA
    c25e2af View commit details
Original file line number Diff line number Diff line change
@@ -170,7 +170,7 @@ public AllocateNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public DynamicObject allocate(DynamicObject rubyClass) {
return allocateObjectNode.allocate(rubyClass, EMPTY_ASCII_8BIT_ROPE, null);
return allocateObjectNode.allocate(rubyClass, EMPTY_ASCII_8BIT_ROPE);
}

}
@@ -268,7 +268,7 @@ public DynamicObject multiply(DynamicObject string, int times,
@Cached("create()") MakeRepeatingNode makeRepeatingNode) {
final Rope repeated = makeRepeatingNode.executeMake(rope(string), times);

return allocateObjectNode.allocate(Layouts.BASIC_OBJECT.getLogicalClass(string), repeated, null);
return allocateObjectNode.allocate(Layouts.BASIC_OBJECT.getLogicalClass(string), repeated);
}

@Specialization(guards = "isRubyBignum(times)")
@@ -528,7 +528,7 @@ private Object sliceRange(VirtualFrame frame, DynamicObject string, int begin, i
if (begin == stringLength) {
final ByteList byteList = new ByteList();
byteList.setEncoding(encoding(string));
return allocateObjectNode.allocate(Layouts.BASIC_OBJECT.getLogicalClass(string), RopeOperations.withEncodingVerySlow(RopeConstants.EMPTY_ASCII_8BIT_ROPE, encoding(string)), null);
return allocateObjectNode.allocate(Layouts.BASIC_OBJECT.getLogicalClass(string), RopeOperations.withEncodingVerySlow(RopeConstants.EMPTY_ASCII_8BIT_ROPE, encoding(string)));
}

end = StringOperations.normalizeIndex(stringLength, end);
@@ -1123,7 +1123,7 @@ private Object substr(Rope rope, DynamicObject string, int beg, int len) {
}

// TODO (nirvdrum 08-Jan-16) For CR_7BIT, we should always be able set to CR_7BIT. CR_VALID is trickier because any one character could be 7-bit.
final DynamicObject ret = allocateObjectNode.allocate(Layouts.BASIC_OBJECT.getLogicalClass(string), substringRope, null);
final DynamicObject ret = allocateObjectNode.allocate(Layouts.BASIC_OBJECT.getLogicalClass(string), substringRope);

return taintResultNode.maybeTaint(string, ret);
}
@@ -1710,7 +1710,7 @@ public DynamicObject dumpAsciiCompatible(DynamicObject string) {
ByteList outputBytes = dumpCommon(string);
outputBytes.setEncoding(encoding(string));

final DynamicObject result = allocateObjectNode.allocate(Layouts.BASIC_OBJECT.getLogicalClass(string), StringOperations.ropeFromByteList(outputBytes, CodeRange.CR_7BIT), null);
final DynamicObject result = allocateObjectNode.allocate(Layouts.BASIC_OBJECT.getLogicalClass(string), StringOperations.ropeFromByteList(outputBytes, CodeRange.CR_7BIT));

return result;
}
@@ -1734,7 +1734,7 @@ public DynamicObject dump(DynamicObject string) {

outputBytes.setEncoding(ASCIIEncoding.INSTANCE);

final DynamicObject result = allocateObjectNode.allocate(Layouts.BASIC_OBJECT.getLogicalClass(string), StringOperations.ropeFromByteList(outputBytes, CodeRange.CR_7BIT), null);
final DynamicObject result = allocateObjectNode.allocate(Layouts.BASIC_OBJECT.getLogicalClass(string), StringOperations.ropeFromByteList(outputBytes, CodeRange.CR_7BIT));

return result;
}
@@ -2813,7 +2813,7 @@ public Object stringByteSubstring(DynamicObject string, int index, int length,
}

final Rope substringRope = makeSubstringNode.executeMake(rope, normalizedIndex, length);
final DynamicObject result = allocateObjectNode.allocate(Layouts.BASIC_OBJECT.getLogicalClass(string), substringRope, null);
final DynamicObject result = allocateObjectNode.allocate(Layouts.BASIC_OBJECT.getLogicalClass(string), substringRope);

return taintResultNode.maybeTaint(string, result);
}
@@ -3144,7 +3144,7 @@ public Object stringFindCharacterSingleByte(DynamicObject string, int offset) {

final Rope rope = rope(string);

final DynamicObject ret = allocateObjectNode.allocate(Layouts.BASIC_OBJECT.getLogicalClass(string), makeSubstringNode.executeMake(rope, offset, 1), null);
final DynamicObject ret = allocateObjectNode.allocate(Layouts.BASIC_OBJECT.getLogicalClass(string), makeSubstringNode.executeMake(rope, offset, 1));

return propagate(string, ret);
}
@@ -3161,10 +3161,10 @@ public Object stringFindCharacter(DynamicObject string, int offset) {

final DynamicObject ret;
if (StringSupport.MBCLEN_CHARFOUND_P(clen)) {
ret = allocateObjectNode.allocate(Layouts.BASIC_OBJECT.getLogicalClass(string), makeSubstringNode.executeMake(rope, offset, clen), null);
ret = allocateObjectNode.allocate(Layouts.BASIC_OBJECT.getLogicalClass(string), makeSubstringNode.executeMake(rope, offset, clen));
} else {
// TODO (nirvdrum 13-Jan-16) We know that the code range is CR_7BIT. Ensure we're not wasting time figuring that out again in the substring creation.
ret = allocateObjectNode.allocate(Layouts.BASIC_OBJECT.getLogicalClass(string), makeSubstringNode.executeMake(rope, offset, 1), null);
ret = allocateObjectNode.allocate(Layouts.BASIC_OBJECT.getLogicalClass(string), makeSubstringNode.executeMake(rope, offset, 1));
}

return propagate(string, ret);
@@ -3867,15 +3867,15 @@ public StringPatternPrimitiveNode(RubyContext context, SourceSection sourceSecti
public DynamicObject stringPatternZero(DynamicObject stringClass, int size, int value) {
final Rope repeatingRope = makeRepeatingNode.executeMake(RopeConstants.ASCII_8BIT_SINGLE_BYTE_ROPES[value], size);

return allocateObjectNode.allocate(stringClass, repeatingRope, null);
return allocateObjectNode.allocate(stringClass, repeatingRope);
}

@Specialization(guards = { "isRubyString(string)", "patternFitsEvenly(string, size)" })
public DynamicObject stringPatternFitsEvenly(DynamicObject stringClass, int size, DynamicObject string) {
final Rope rope = rope(string);
final Rope repeatingRope = makeRepeatingNode.executeMake(rope, size / rope.byteLength());

return allocateObjectNode.allocate(stringClass, repeatingRope, null);
return allocateObjectNode.allocate(stringClass, repeatingRope);
}

@Specialization(guards = { "isRubyString(string)", "!patternFitsEvenly(string, size)" })
@@ -3897,7 +3897,7 @@ public DynamicObject stringPattern(DynamicObject stringClass, int size, DynamicO
final CodeRange codeRange = rope.getCodeRange() == CodeRange.CR_7BIT ? CodeRange.CR_7BIT : CodeRange.CR_UNKNOWN;
final Object characterLength = codeRange == CodeRange.CR_7BIT ? size : NotProvided.INSTANCE;

return allocateObjectNode.allocate(stringClass, makeLeafRopeNode.executeMake(bytes, encoding(string), codeRange, characterLength), null);
return allocateObjectNode.allocate(stringClass, makeLeafRopeNode.executeMake(bytes, encoding(string), codeRange, characterLength));
}

protected boolean patternFitsEvenly(DynamicObject string, int size) {
@@ -4305,8 +4305,7 @@ private DynamicObject makeRope(DynamicObject string, Rope rope, int beg, int len

final DynamicObject ret = allocateNode.allocate(
Layouts.BASIC_OBJECT.getLogicalClass(string),
makeSubstringNode.executeMake(rope, beg, len),
null);
makeSubstringNode.executeMake(rope, beg, len));

taintResultNode.maybeTaint(string, ret);

@@ -4330,8 +4329,7 @@ private DynamicObject makeBuffer(DynamicObject string, int beg, int len) {

final DynamicObject ret = allocateNode.allocate(
Layouts.BASIC_OBJECT.getLogicalClass(string),
new RopeBuffer(new ByteList(buffer.getByteList(), beg, len), buffer.getCodeRange(), buffer.isSingleByteOptimizable(), len),
null);
new RopeBuffer(new ByteList(buffer.getByteList(), beg, len), buffer.getCodeRange(), buffer.isSingleByteOptimizable(), len));

taintResultNode.maybeTaint(string, ret);

Original file line number Diff line number Diff line change
@@ -64,8 +64,6 @@
import org.jruby.truffle.language.SnippetNode;
import org.jruby.truffle.language.dispatch.CallDispatchHeadNode;
import org.jruby.truffle.language.dispatch.DoesRespondDispatchHeadNode;
import org.jruby.truffle.language.objects.AllocateObjectNode;
import org.jruby.truffle.language.objects.AllocateObjectNodeGen;
import org.jruby.truffle.language.objects.ReadObjectFieldNode;
import org.jruby.truffle.language.objects.ReadObjectFieldNodeGen;
import org.jruby.truffle.language.objects.TaintNode;
@@ -97,23 +95,6 @@
@CoreClass("Psych::Parser")
public abstract class PsychParserNodes {

@CoreMethod(names = "allocate", constructor = true)
public abstract static class AllocateNode extends CoreMethodArrayArgumentsNode {

@Child private AllocateObjectNode allocateNode;

public AllocateNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
allocateNode = AllocateObjectNodeGen.create(context, sourceSection, null, null);
}

@Specialization
public DynamicObject allocate(DynamicObject rubyClass) {
return allocateNode.allocate(rubyClass, null, null);
}

}

@CoreMethod(names = "parse", required = 1, optional = 1)
public abstract static class ParseNode extends CoreMethodArrayArgumentsNode {