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: 8f29582c90b6
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7c68ee927fcf
Choose a head ref
  • 2 commits
  • 7 files changed
  • 1 contributor

Commits on Jan 10, 2017

  1. [Truffle] Fix 2 specs.

    eregon committed Jan 10, 2017
    Copy the full SHA
    98cf1bd View commit details
  2. Copy the full SHA
    7c68ee9 View commit details
Original file line number Diff line number Diff line change
@@ -1239,7 +1239,7 @@ private DynamicObject finishPack(int formatLength, BytesResult result) {

if (makeLeafRopeNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
makeLeafRopeNode = insert(RopeNodesFactory.MakeLeafRopeNodeGen.create(null, null, null, null));
makeLeafRopeNode = insert(RopeNodes.MakeLeafRopeNode.create());
}

final DynamicObject string = createString(makeLeafRopeNode.executeMake(
Original file line number Diff line number Diff line change
@@ -116,7 +116,7 @@ public DynamicObject allocate(DynamicObject rubyClass) {
@Primitive(name = "encoding_converter_primitive_convert")
public static abstract class PrimitiveConvertNode extends PrimitiveArrayArgumentsNode {

@Child private RopeNodes.MakeSubstringNode makeSubstringNode = RopeNodesFactory.MakeSubstringNodeGen.create(null, null, null);
@Child private RopeNodes.MakeSubstringNode makeSubstringNode = RopeNodes.MakeSubstringNode.create();

@Specialization(guards = {"isRubyString(source)", "isRubyString(target)", "isRubyHash(options)"})
public Object encodingConverterPrimitiveConvert(DynamicObject encodingConverter, DynamicObject source,
Original file line number Diff line number Diff line change
@@ -1594,7 +1594,7 @@ private DynamicObject finishFormat(int formatLength, BytesResult result) {

if (makeLeafRopeNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
makeLeafRopeNode = insert(RopeNodesFactory.MakeLeafRopeNodeGen.create(null, null, null, null));
makeLeafRopeNode = insert(RopeNodes.MakeLeafRopeNode.create());
}

final DynamicObject string = createString(makeLeafRopeNode.executeMake(
Original file line number Diff line number Diff line change
@@ -375,7 +375,7 @@ public static boolean isSuitableMatchDataType(RubyContext context, DynamicObject
public abstract static class MatchOperatorNode extends CoreMethodArrayArgumentsNode {

@Child private CallDispatchHeadNode dupNode = DispatchHeadNodeFactory.createMethodCall();
@Child private RopeNodes.MakeSubstringNode makeSubstringNode = RopeNodesFactory.MakeSubstringNodeGen.create(null, null, null);
@Child private RopeNodes.MakeSubstringNode makeSubstringNode = RopeNodes.MakeSubstringNode.create();
@Child private RegexpSetLastMatchPrimitiveNode setLastMatchNode = RegexpSetLastMatchPrimitiveNodeFactory.create(null);
@Child private CallDispatchHeadNode toSNode;
@Child private ToStrNode toStrNode;
@@ -455,7 +455,7 @@ public int hash(DynamicObject regexp) {
public abstract static class MatchStartNode extends CoreMethodArrayArgumentsNode {

@Child private CallDispatchHeadNode dupNode = DispatchHeadNodeFactory.createMethodCall();
@Child private RopeNodes.MakeSubstringNode makeSubstringNode = RopeNodesFactory.MakeSubstringNodeGen.create(null, null, null);
@Child private RopeNodes.MakeSubstringNode makeSubstringNode = RopeNodes.MakeSubstringNode.create();

@Specialization(guards = "isRubyString(string)")
public Object matchStart(VirtualFrame frame, DynamicObject regexp, DynamicObject string, int startPos) {
@@ -618,7 +618,7 @@ public DynamicObject quote(VirtualFrame frame, Object raw) {
public abstract static class SearchFromNode extends CoreMethodArrayArgumentsNode {

@Child private CallDispatchHeadNode dupNode = DispatchHeadNodeFactory.createMethodCall();
@Child private RopeNodes.MakeSubstringNode makeSubstringNode = RopeNodesFactory.MakeSubstringNodeGen.create(null, null, null);
@Child private RopeNodes.MakeSubstringNode makeSubstringNode = RopeNodes.MakeSubstringNode.create();

@Specialization(guards = "isRubyString(string)")
public Object searchFrom(VirtualFrame frame, DynamicObject regexp, DynamicObject string, int startPos) {
Original file line number Diff line number Diff line change
@@ -219,7 +219,7 @@ private Rope makeSubstringNon7Bit(Rope base, int offset, int byteLength) {
} else {
if (makeLeafRopeNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
makeLeafRopeNode = insert(RopeNodesFactory.MakeLeafRopeNodeGen.create(null, null, null, null));
makeLeafRopeNode = insert(RopeNodes.MakeLeafRopeNode.create());
}

final byte[] bytes = RopeOperations.extractRange(base, offset, byteLength);
Original file line number Diff line number Diff line change
@@ -888,7 +888,7 @@ private Object deleteBangSlow(DynamicObject string, DynamicObject[] otherStrings
@ImportStatic(StringGuards.class)
public abstract static class DowncaseBangNode extends CoreMethodArrayArgumentsNode {

@Child private RopeNodes.MakeLeafRopeNode makeLeafRopeNode = RopeNodesFactory.MakeLeafRopeNodeGen.create(null, null, null, null);
@Child private RopeNodes.MakeLeafRopeNode makeLeafRopeNode = RopeNodes.MakeLeafRopeNode.create();

@Specialization(guards = { "isEmpty(string)", "isSingleByteOptimizable(string)" })
public DynamicObject downcaseSingleByteEmpty(DynamicObject string) {
@@ -978,7 +978,7 @@ public DynamicObject eachByte(VirtualFrame frame, DynamicObject string, DynamicO
public abstract static class EachCharNode extends YieldingCoreMethodNode {

@Child private AllocateObjectNode allocateObjectNode = AllocateObjectNode.create();
@Child private RopeNodes.MakeSubstringNode makeSubstringNode = RopeNodesFactory.MakeSubstringNodeGen.create(null, null, null);
@Child private RopeNodes.MakeSubstringNode makeSubstringNode = RopeNodes.MakeSubstringNode.create();
@Child private TaintResultNode taintResultNode;

@Specialization(guards = "!isBrokenCodeRange(string)")
@@ -1187,7 +1187,7 @@ public Object initializeCopy(DynamicObject self, DynamicObject from,
@ImportStatic(StringGuards.class)
public abstract static class LstripBangNode extends CoreMethodArrayArgumentsNode {

@Child private RopeNodes.MakeSubstringNode makeSubstringNode = RopeNodesFactory.MakeSubstringNodeGen.create(null, null, null);
@Child private RopeNodes.MakeSubstringNode makeSubstringNode = RopeNodes.MakeSubstringNode.create();

@Specialization(guards = "isEmpty(string)")
public DynamicObject lstripBangEmptyString(DynamicObject string) {
@@ -1297,7 +1297,7 @@ public DynamicObject replace(DynamicObject string, DynamicObject other,
@ImportStatic(StringGuards.class)
public abstract static class RstripBangNode extends CoreMethodArrayArgumentsNode {

@Child private RopeNodes.MakeSubstringNode makeSubstringNode = RopeNodesFactory.MakeSubstringNodeGen.create(null, null, null);
@Child private RopeNodes.MakeSubstringNode makeSubstringNode = RopeNodes.MakeSubstringNode.create();

@Specialization(guards = "isEmpty(string)")
public DynamicObject rstripBangEmptyString(DynamicObject string) {
@@ -1508,7 +1508,7 @@ public Object yield(VirtualFrame frame, DynamicObject block, Object... arguments
@ImportStatic(StringGuards.class)
public abstract static class SwapcaseBangNode extends CoreMethodArrayArgumentsNode {

@Child private RopeNodes.MakeLeafRopeNode makeLeafRopeNode = RopeNodesFactory.MakeLeafRopeNodeGen.create(null, null, null, null);
@Child private RopeNodes.MakeLeafRopeNode makeLeafRopeNode = RopeNodes.MakeLeafRopeNode.create();

@TruffleBoundary(throwsControlFlowException = true)
@Specialization
@@ -1756,11 +1756,11 @@ private int codePointX(Encoding enc, byte[] bytes, int p, int end) {
public abstract static class SetByteNode extends CoreMethodNode {

@Child private CheckIndexNode checkIndexNode = StringNodesFactory.CheckIndexNodeGen.create(null, null);
@Child private RopeNodes.MakeConcatNode composedMakeConcatNode = RopeNodesFactory.MakeConcatNodeGen.create(null, null, null);
@Child private RopeNodes.MakeConcatNode middleMakeConcatNode = RopeNodesFactory.MakeConcatNodeGen.create(null, null, null);
@Child private RopeNodes.MakeLeafRopeNode makeLeafRopeNode = RopeNodesFactory.MakeLeafRopeNodeGen.create(null, null, null, null);
@Child private RopeNodes.MakeSubstringNode leftMakeSubstringNode = RopeNodesFactory.MakeSubstringNodeGen.create(null, null, null);
@Child private RopeNodes.MakeSubstringNode rightMakeSubstringNode = RopeNodesFactory.MakeSubstringNodeGen.create(null, null, null);
@Child private RopeNodes.MakeConcatNode composedMakeConcatNode = RopeNodes.MakeConcatNode.create();
@Child private RopeNodes.MakeConcatNode middleMakeConcatNode = RopeNodes.MakeConcatNode.create();
@Child private RopeNodes.MakeLeafRopeNode makeLeafRopeNode = RopeNodes.MakeLeafRopeNode.create();
@Child private RopeNodes.MakeSubstringNode leftMakeSubstringNode = RopeNodes.MakeSubstringNode.create();
@Child private RopeNodes.MakeSubstringNode rightMakeSubstringNode = RopeNodes.MakeSubstringNode.create();

@CreateCast("index") public RubyNode coerceIndexToInt(RubyNode index) {
return FixnumLowerNodeGen.create(ToIntNodeGen.create(index));
@@ -2114,7 +2114,7 @@ public DynamicObject toSym(DynamicObject string) {
@ImportStatic(StringGuards.class)
public abstract static class ReverseBangNode extends CoreMethodArrayArgumentsNode {

@Child private RopeNodes.MakeLeafRopeNode makeLeafRopeNode = RopeNodesFactory.MakeLeafRopeNodeGen.create(null, null, null, null);
@Child private RopeNodes.MakeLeafRopeNode makeLeafRopeNode = RopeNodes.MakeLeafRopeNode.create();

@Specialization(guards = "reverseIsEqualToSelf(string)")
public DynamicObject reverseNoOp(DynamicObject string) {
@@ -2364,7 +2364,7 @@ protected int getCacheLimit() {
@ImportStatic(StringGuards.class)
public abstract static class UpcaseBangNode extends CoreMethodArrayArgumentsNode {

@Child private RopeNodes.MakeLeafRopeNode makeLeafRopeNode = RopeNodesFactory.MakeLeafRopeNodeGen.create(null, null, null, null);
@Child private RopeNodes.MakeLeafRopeNode makeLeafRopeNode = RopeNodes.MakeLeafRopeNode.create();

@Specialization(guards = "isSingleByteOptimizable(string)")
public DynamicObject upcaseSingleByte(DynamicObject string,
@@ -2445,7 +2445,7 @@ public boolean validEncodingQuery(DynamicObject string) {
public abstract static class CapitalizeBangNode extends CoreMethodArrayArgumentsNode {

@Child private RopeNodes.GetCodePointNode getCodePointNode = RopeNodes.GetCodePointNode.create();
@Child private RopeNodes.MakeLeafRopeNode makeLeafRopeNode = RopeNodesFactory.MakeLeafRopeNodeGen.create(null, null, null, null);
@Child private RopeNodes.MakeLeafRopeNode makeLeafRopeNode = RopeNodes.MakeLeafRopeNode.create();

@Specialization
@TruffleBoundary(throwsControlFlowException = true)
@@ -2572,7 +2572,7 @@ public DynamicObject stringAppend(DynamicObject string, DynamicObject other) {
public static abstract class StringAwkSplitPrimitiveNode extends PrimitiveArrayArgumentsNode {

@Child private RopeNodes.GetCodePointNode getCodePointNode = RopeNodes.GetCodePointNode.create();
@Child private RopeNodes.MakeSubstringNode makeSubstringNode = RopeNodesFactory.MakeSubstringNodeGen.create(null, null, null);
@Child private RopeNodes.MakeSubstringNode makeSubstringNode = RopeNodes.MakeSubstringNode.create();
@Child private TaintResultNode taintResultNode = new TaintResultNode();

@TruffleBoundary
@@ -2652,7 +2652,7 @@ public static abstract class StringByteSubstringPrimitiveNode extends PrimitiveN

@Child private AllocateObjectNode allocateObjectNode = AllocateObjectNode.create();
@Child private NormalizeIndexNode normalizeIndexNode = StringNodesFactory.NormalizeIndexNodeGen.create(null, null);
@Child private RopeNodes.MakeSubstringNode makeSubstringNode = RopeNodesFactory.MakeSubstringNodeGen.create(null, null, null);
@Child private RopeNodes.MakeSubstringNode makeSubstringNode = RopeNodes.MakeSubstringNode.create();
@Child private TaintResultNode taintResultNode = new TaintResultNode();

public static StringByteSubstringPrimitiveNode create() {
@@ -3115,7 +3115,7 @@ private static String escapedCharFormat(int c, boolean isUnicode) {
public static abstract class StringFindCharacterNode extends PrimitiveArrayArgumentsNode {

@Child private AllocateObjectNode allocateObjectNode = AllocateObjectNode.create();
@Child private RopeNodes.MakeSubstringNode makeSubstringNode = RopeNodesFactory.MakeSubstringNodeGen.create(null, null, null);
@Child private RopeNodes.MakeSubstringNode makeSubstringNode = RopeNodes.MakeSubstringNode.create();
@Child private TaintResultNode taintResultNode;

@Specialization(guards = "offset < 0")
@@ -3891,25 +3891,10 @@ protected boolean patternFitsEvenly(DynamicObject string, int size) {
@ImportStatic(StringGuards.class)
public static abstract class StringSplicePrimitiveNode extends PrimitiveArrayArgumentsNode {

@Child private RopeNodes.MakeConcatNode appendMakeConcatNode;
@Child private RopeNodes.MakeConcatNode prependMakeConcatNode;
@Child private RopeNodes.MakeConcatNode leftMakeConcatNode;
@Child private RopeNodes.MakeConcatNode rightMakeConcatNode;
@Child private RopeNodes.MakeSubstringNode prependMakeSubstringNode;
@Child private RopeNodes.MakeSubstringNode leftMakeSubstringNode;
@Child private RopeNodes.MakeSubstringNode rightMakeSubstringNode;

@Specialization(guards = { "indexAtStartBound(spliceByteIndex)", "isRubyString(other)", "isRubyEncoding(rubyEncoding)" })
public Object splicePrepend(DynamicObject string, DynamicObject other, int spliceByteIndex, int byteCountToReplace, DynamicObject rubyEncoding) {
if (prependMakeSubstringNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
prependMakeSubstringNode = insert(RopeNodesFactory.MakeSubstringNodeGen.create(null, null, null));
}

if (prependMakeConcatNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
prependMakeConcatNode = insert(RopeNodesFactory.MakeConcatNodeGen.create(null, null, null));
}
public Object splicePrepend(DynamicObject string, DynamicObject other, int spliceByteIndex, int byteCountToReplace, DynamicObject rubyEncoding,
@Cached("create()") RopeNodes.MakeSubstringNode prependMakeSubstringNode,
@Cached("create()") RopeNodes.MakeConcatNode prependMakeConcatNode) {

final Encoding encoding = EncodingOperations.getEncoding(rubyEncoding);
final Rope original = rope(string);
@@ -3922,44 +3907,25 @@ public Object splicePrepend(DynamicObject string, DynamicObject other, int splic
}

@Specialization(guards = { "indexAtEndBound(string, spliceByteIndex)", "isRubyString(other)", "isRubyEncoding(rubyEncoding)" })
public Object spliceAppend(DynamicObject string, DynamicObject other, int spliceByteIndex, int byteCountToReplace, DynamicObject rubyEncoding) {
public Object spliceAppend(DynamicObject string, DynamicObject other, int spliceByteIndex, int byteCountToReplace, DynamicObject rubyEncoding,
@Cached("create()") RopeNodes.MakeConcatNode appendMakeConcatNode) {
final Encoding encoding = EncodingOperations.getEncoding(rubyEncoding);
final Rope left = rope(string);
final Rope right = rope(other);

if (appendMakeConcatNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
appendMakeConcatNode = insert(RopeNodesFactory.MakeConcatNodeGen.create(null, null, null));
}

StringOperations.setRope(string, appendMakeConcatNode.executeMake(left, right, encoding));

return string;
}

@Specialization(guards = { "!indexAtEitherBounds(string, spliceByteIndex)", "isRubyString(other)", "isRubyEncoding(rubyEncoding)", "!isRopeBuffer(string)" })
public DynamicObject splice(DynamicObject string, DynamicObject other, int spliceByteIndex, int byteCountToReplace, DynamicObject rubyEncoding,
@Cached("createBinaryProfile()") ConditionProfile insertStringIsEmptyProfile,
@Cached("createBinaryProfile()") ConditionProfile splitRightIsEmptyProfile) {
if (leftMakeSubstringNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
leftMakeSubstringNode = insert(RopeNodesFactory.MakeSubstringNodeGen.create(null, null, null));
}

if (rightMakeSubstringNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
rightMakeSubstringNode = insert(RopeNodesFactory.MakeSubstringNodeGen.create(null, null, null));
}

if (leftMakeConcatNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
leftMakeConcatNode = insert(RopeNodesFactory.MakeConcatNodeGen.create(null, null, null));
}

if (rightMakeConcatNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
rightMakeConcatNode = insert(RopeNodesFactory.MakeConcatNodeGen.create(null, null, null));
}
@Cached("createBinaryProfile()") ConditionProfile insertStringIsEmptyProfile,
@Cached("createBinaryProfile()") ConditionProfile splitRightIsEmptyProfile,
@Cached("create()") RopeNodes.MakeSubstringNode leftMakeSubstringNode,
@Cached("create()") RopeNodes.MakeSubstringNode rightMakeSubstringNode,
@Cached("create()") RopeNodes.MakeConcatNode leftMakeConcatNode,
@Cached("create()") RopeNodes.MakeConcatNode rightMakeConcatNode) {

final Encoding encoding = EncodingOperations.getEncoding(rubyEncoding);
final Rope source = rope(string);
@@ -4057,8 +4023,8 @@ public Object stringToInum(DynamicObject string, int fixBase, boolean strict,
@Primitive(name = "string_byte_append")
public static abstract class StringByteAppendPrimitiveNode extends PrimitiveArrayArgumentsNode {

@Child private RopeNodes.MakeConcatNode makeConcatNode = RopeNodesFactory.MakeConcatNodeGen.create(null, null, null);
@Child private RopeNodes.MakeLeafRopeNode makeLeafRopeNode = RopeNodesFactory.MakeLeafRopeNodeGen.create(null, null, null, null);
@Child private RopeNodes.MakeConcatNode makeConcatNode = RopeNodes.MakeConcatNode.create();
@Child private RopeNodes.MakeLeafRopeNode makeLeafRopeNode = RopeNodes.MakeLeafRopeNode.create();

@Specialization(guards = "isRubyString(other)")
public DynamicObject stringByteAppend(DynamicObject string, DynamicObject other) {
@@ -4262,7 +4228,7 @@ private DynamicObject makeRope(DynamicObject string, Rope rope, int beg, int len

if (makeSubstringNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
makeSubstringNode = insert(RopeNodesFactory.MakeSubstringNodeGen.create(null, null, null));
makeSubstringNode = insert(RopeNodes.MakeSubstringNode.create());
}

if (taintResultNode == null) {
@@ -4331,7 +4297,7 @@ public DynamicObject stringFromByteArray(DynamicObject bytes, int start, int cou
public static abstract class StringAppendNode extends RubyNode {

@Child private EncodingNodes.CheckEncodingNode checkEncodingNode = EncodingNodesFactory.CheckEncodingNodeGen.create(null, null);
@Child private RopeNodes.MakeConcatNode makeConcatNode = RopeNodesFactory.MakeConcatNodeGen.create(null, null, null);
@Child private RopeNodes.MakeConcatNode makeConcatNode = RopeNodes.MakeConcatNode.create();

public static StringAppendNode create() {
return StringNodesFactory.StringAppendNodeGen.create(null, null);
Loading