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

Commits on May 30, 2015

  1. Copy the full SHA
    755f0a2 View commit details
  2. Copy the full SHA
    d92c6b0 View commit details
Showing with 544 additions and 525 deletions.
  1. +2 −1 truffle/src/main/java/org/jruby/truffle/nodes/conversion/ToSymbolNode.java
  2. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/BasicObjectNodes.java
  3. +5 −5 truffle/src/main/java/org/jruby/truffle/nodes/core/EncodingNodes.java
  4. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/InteroplatedRegexpNode.java
  5. +1 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/InterpolatedStringNode.java
  6. +8 −8 truffle/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
  7. +2 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/MatchDataNodes.java
  8. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/ModuleNodes.java
  9. +3 −3 truffle/src/main/java/org/jruby/truffle/nodes/core/RegexpNodes.java
  10. +6 −6 truffle/src/main/java/org/jruby/truffle/nodes/core/StringGuards.java
  11. +264 −184 truffle/src/main/java/org/jruby/truffle/nodes/core/StringNodes.java
  12. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/TrufflePrimitiveNodes.java
  13. +3 −3 truffle/src/main/java/org/jruby/truffle/nodes/core/array/ArrayNodes.java
  14. +3 −2 truffle/src/main/java/org/jruby/truffle/nodes/dispatch/CachedDispatchNode.java
  15. +2 −2 truffle/src/main/java/org/jruby/truffle/nodes/ext/DigestNodes.java
  16. +4 −4 truffle/src/main/java/org/jruby/truffle/nodes/ext/ZlibNodes.java
  17. +5 −4 truffle/src/main/java/org/jruby/truffle/nodes/interop/InteropNode.java
  18. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/literal/StringLiteralNode.java
  19. +3 −3 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/ByteArrayNodes.java
  20. +10 −10 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/EncodingConverterPrimitiveNodes.java
  21. +2 −1 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/EncodingPrimitiveNodes.java
  22. +3 −2 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/IOBufferPrimitiveNodes.java
  23. +11 −11 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/IOPrimitiveNodes.java
  24. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/PointerPrimitiveNodes.java
  25. +11 −11 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/PosixNodes.java
  26. +5 −5 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/RegexpPrimitiveNodes.java
  27. +2 −1 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/StatPrimitiveNodes.java
  28. +70 −70 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/StringPrimitiveNodes.java
  29. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/TimePrimitiveNodes.java
  30. +5 −4 truffle/src/main/java/org/jruby/truffle/pack/nodes/type/ToStringNode.java
  31. +1 −2 truffle/src/main/java/org/jruby/truffle/runtime/RubyContext.java
  32. +80 −0 truffle/src/main/java/org/jruby/truffle/runtime/core/CodeRangeableWrapper.java
  33. +8 −2 truffle/src/main/java/org/jruby/truffle/runtime/core/RubyBasicObject.java
  34. +17 −17 truffle/src/main/java/org/jruby/truffle/runtime/core/RubyRegexp.java
  35. +1 −153 truffle/src/main/java/org/jruby/truffle/runtime/core/RubyString.java
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.core.StringNodes;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.core.RubyString;
import org.jruby.truffle.runtime.core.RubySymbol;
@@ -36,7 +37,7 @@ protected RubySymbol toSymbol(RubySymbol symbol) {

@Specialization
protected RubySymbol toSymbol(RubyString string) {
return getContext().getSymbol(string.getByteList());
return getContext().getSymbol(StringNodes.getByteList(string));
}

@Specialization
Original file line number Diff line number Diff line change
@@ -180,7 +180,7 @@ public InstanceEvalNode(RubyContext context, SourceSection sourceSection) {
public Object instanceEval(VirtualFrame frame, Object receiver, RubyString string, NotProvided block) {
CompilerDirectives.transferToInterpreter();

return getContext().instanceEval(string.getByteList(), receiver, this);
return getContext().instanceEval(StringNodes.getByteList(string), receiver, this);
}

@Specialization
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ public CompatibleQueryNode(RubyContext context, SourceSection sourceSection) {
@TruffleBoundary
@Specialization
public Object isCompatible(RubyString first, RubyString second) {
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(first.getCodeRangeable(), second.getCodeRangeable());
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(StringNodes.getCodeRangeable(first), StringNodes.getCodeRangeable(second));

if (compatibleEncoding != null) {
return RubyEncoding.getEncoding(compatibleEncoding);
@@ -79,7 +79,7 @@ public Object isCompatible(RubyEncoding first, RubyEncoding second) {
@TruffleBoundary
@Specialization
public Object isCompatible(RubyString first, RubyRegexp second) {
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(first.getByteList().getEncoding(), second.getRegex().getEncoding());
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(StringNodes.getByteList(first).getEncoding(), second.getRegex().getEncoding());

if (compatibleEncoding != null) {
return RubyEncoding.getEncoding(compatibleEncoding);
@@ -91,7 +91,7 @@ public Object isCompatible(RubyString first, RubyRegexp second) {
@TruffleBoundary
@Specialization
public Object isCompatible(RubyRegexp first, RubyString second) {
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(first.getRegex().getEncoding(), second.getByteList().getEncoding());
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(first.getRegex().getEncoding(), StringNodes.getByteList(second).getEncoding());

if (compatibleEncoding != null) {
return RubyEncoding.getEncoding(compatibleEncoding);
@@ -139,7 +139,7 @@ public Object isCompatible(RubySymbol first, RubyRegexp second) {
@TruffleBoundary
@Specialization
public Object isCompatible(RubyString first, RubySymbol second) {
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(first.getCodeRangeable(), second);
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(StringNodes.getCodeRangeable(first), second);

if (compatibleEncoding != null) {
return RubyEncoding.getEncoding(compatibleEncoding);
@@ -163,7 +163,7 @@ public Object isCompatible(RubySymbol first, RubySymbol second) {
@TruffleBoundary
@Specialization
public Object isCompatible(RubyString first, RubyEncoding second) {
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(first.getByteList().getEncoding(), second.getEncoding());
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(StringNodes.getByteList(first).getEncoding(), second.getEncoding());

if (compatibleEncoding != null) {
return RubyEncoding.getEncoding(compatibleEncoding);
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ public RubyRegexp executeRubyRegexp(VirtualFrame frame) {

for (int n = 0; n < children.length; n++) {
final Object child = children[n].execute(frame);
strings[n] = org.jruby.RubyString.newString(getContext().getRuntime(), ((RubyString) toS.call(frame, child, "to_s", null)).getByteList());
strings[n] = org.jruby.RubyString.newString(getContext().getRuntime(), StringNodes.getByteList(((RubyString) toS.call(frame, child, "to_s", null))));
}

// TODO 27-APR=2015 BJF Adding workaround to temporarily fix CGI error until Regex overhaul https://github.com/jruby/jruby/issues/2802
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@
*/
package org.jruby.truffle.nodes.core;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.ExplodeLoop;
@@ -80,7 +79,7 @@ private RubyString concat(RubyString[] strings) {
try {
builder.append19(getContext().toJRuby(string));
} catch (org.jruby.exceptions.RaiseException e) {
throw new RaiseException(getContext().getCoreLibrary().encodingCompatibilityErrorIncompatible(builder.getEncoding().getCharsetName(), string.getByteList().getEncoding().getCharsetName(), this));
throw new RaiseException(getContext().getCoreLibrary().encodingCompatibilityErrorIncompatible(builder.getEncoding().getCharsetName(), StringNodes.getByteList(string).getEncoding().getCharsetName(), this));
}
}
}
Original file line number Diff line number Diff line change
@@ -471,7 +471,7 @@ protected RubyBinding getCallerBinding(VirtualFrame frame) {
public Object eval(VirtualFrame frame, RubyString source, NotProvided binding, NotProvided filename, NotProvided lineNumber) {
CompilerDirectives.transferToInterpreter();

return getContext().eval(source.getByteList(), getCallerBinding(frame), true, this);
return getContext().eval(StringNodes.getByteList(source), getCallerBinding(frame), true, this);
}

@Specialization(guards = "isNil(noBinding)")
@@ -486,21 +486,21 @@ public Object eval(VirtualFrame frame, RubyString source, Object noBinding, Ruby
public Object eval(RubyString source, RubyBinding binding, NotProvided filename, NotProvided lineNumber) {
CompilerDirectives.transferToInterpreter();

return getContext().eval(source.getByteList(), binding, false, this);
return getContext().eval(StringNodes.getByteList(source), binding, false, this);
}

@Specialization
public Object eval(RubyString source, RubyBinding binding, RubyString filename, NotProvided lineNumber) {
CompilerDirectives.transferToInterpreter();

return getContext().eval(source.getByteList(), binding, false, filename.toString(), this);
return getContext().eval(StringNodes.getByteList(source), binding, false, filename.toString(), this);
}

@Specialization
public Object eval(RubyString source, RubyBinding binding, RubyString filename, int lineNumber) {
CompilerDirectives.transferToInterpreter();

return getContext().eval(source.getByteList(), binding, false, filename.toString(), this);
return getContext().eval(StringNodes.getByteList(source), binding, false, filename.toString(), this);
}

@Specialization(guards = "!isRubyBinding(badBinding)")
@@ -1709,7 +1709,7 @@ public RubyString formatUncached(
throw handleException(e);
}

return finishFormat(format.getByteList(), result);
return finishFormat(StringNodes.getByteList(format), result);
}

private RuntimeException handleException(PackException exception) {
@@ -1764,16 +1764,16 @@ private RubyString finishFormat(ByteList format, PackResult result) {
}

protected ByteList privatizeByteList(RubyString string) {
return string.getByteList().dup();
return StringNodes.getByteList(string).dup();
}

protected boolean byteListsEqual(RubyString string, ByteList byteList) {
return string.getByteList().equal(byteList);
return StringNodes.getByteList(string).equal(byteList);
}

protected CallTarget compileFormat(RubyString format) {
try {
return new FormatParser(getContext()).parse(format.getByteList());
return new FormatParser(getContext()).parse(StringNodes.getByteList(format));
} catch (FormatException e) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError(e.getMessage(), this));
Original file line number Diff line number Diff line change
@@ -85,7 +85,7 @@ public Object getIndex(RubyMatchData matchData, RubyString index, NotProvided le
CompilerDirectives.transferToInterpreter();

try {
final int i = matchData.getBackrefNumber(index.getByteList());
final int i = matchData.getBackrefNumber(StringNodes.getByteList(index));

return getIndex(matchData, i, NotProvided.INSTANCE);
}
@@ -257,7 +257,7 @@ public ToSNode(RubyContext context, SourceSection sourceSection) {
public RubyString toS(RubyMatchData matchData) {
CompilerDirectives.transferToInterpreter();

final ByteList bytes = matchData.getGlobal().getByteList().dup();
final ByteList bytes = StringNodes.getByteList(matchData.getGlobal()).dup();
return createString(bytes);
}
}
Original file line number Diff line number Diff line change
@@ -624,7 +624,7 @@ public Object classEval(VirtualFrame frame, RubyModule module, RubyString code,

private Object classEvalSource(VirtualFrame frame, RubyModule module, RubyString code, String file) {
RubyBinding binding = getCallerBinding(frame);
Encoding encoding = code.getByteList().getEncoding();
Encoding encoding = StringNodes.getByteList(code).getEncoding();

CompilerDirectives.transferToInterpreter();
Source source = Source.fromText(code.toString(), file);
Original file line number Diff line number Diff line change
@@ -150,7 +150,7 @@ public EscapeNode(RubyContext context, SourceSection sourceSection) {
@TruffleBoundary
@Specialization
public RubyString escape(RubyString pattern) {
return createString(org.jruby.RubyRegexp.quote19(new ByteList(pattern.getByteList()), true).toString());
return createString(org.jruby.RubyRegexp.quote19(new ByteList(StringNodes.getByteList(pattern)), true).toString());
}

}
@@ -257,8 +257,8 @@ public QuoteNode(RubyContext context, SourceSection sourceSection) {
@TruffleBoundary
@Specialization
public RubyString quote(RubyString raw) {
boolean isAsciiOnly = raw.getByteList().getEncoding().isAsciiCompatible() && raw.scanForCodeRange() == CR_7BIT;
return createString(org.jruby.RubyRegexp.quote19(raw.getByteList(), isAsciiOnly));
boolean isAsciiOnly = StringNodes.getByteList(raw).getEncoding().isAsciiCompatible() && StringNodes.scanForCodeRange(raw) == CR_7BIT;
return createString(org.jruby.RubyRegexp.quote19(StringNodes.getByteList(raw), isAsciiOnly));
}

@Specialization
Original file line number Diff line number Diff line change
@@ -18,30 +18,30 @@
public class StringGuards {

public static boolean isSingleByteOptimizable(RubyString string) {
return StringSupport.isSingleByteOptimizable(string.getCodeRangeable(), string.getByteList().getEncoding());
return StringSupport.isSingleByteOptimizable(StringNodes.getCodeRangeable(string), StringNodes.getByteList(string).getEncoding());
}

public static boolean isAsciiCompatible(RubyString string) {
return string.getByteList().getEncoding().isAsciiCompatible();
return StringNodes.getByteList(string).getEncoding().isAsciiCompatible();
}

public static boolean isSingleByteOptimizableOrAsciiCompatible(RubyString string) {
return isSingleByteOptimizable(string) || isAsciiCompatible(string);
}

public static boolean isSingleByte(RubyString string) {
return string.getByteList().getEncoding().isSingleByte();
return StringNodes.getByteList(string).getEncoding().isSingleByte();
}

public static boolean isValidOr7BitEncoding(RubyString string) {
return string.isCodeRangeValid() || CodeRangeSupport.isCodeRangeAsciiOnly(string.getCodeRangeable());
return StringNodes.isCodeRangeValid(string) || CodeRangeSupport.isCodeRangeAsciiOnly(StringNodes.getCodeRangeable(string));
}

public static boolean isFixedWidthEncoding(RubyString string) {
return string.getByteList().getEncoding().isFixedWidth();
return StringNodes.getByteList(string).getEncoding().isFixedWidth();
}

public static boolean isValidUtf8(RubyString string) {
return string.isCodeRangeValid() && string.getByteList().getEncoding() instanceof UTF8Encoding;
return StringNodes.isCodeRangeValid(string) && StringNodes.getByteList(string).getEncoding() instanceof UTF8Encoding;
}
}
Loading