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

Commits on May 31, 2015

  1. Copy the full SHA
    fa70421 View commit details
  2. Copy the full SHA
    5cea5c1 View commit details
Showing with 267 additions and 246 deletions.
  1. +6 −6 truffle/src/main/java/org/jruby/truffle/nodes/RubyNode.java
  2. +5 −4 truffle/src/main/java/org/jruby/truffle/nodes/cast/ToSNode.java
  3. +2 −2 truffle/src/main/java/org/jruby/truffle/nodes/coerce/NameToSymbolOrStringNode.java
  4. +3 −2 truffle/src/main/java/org/jruby/truffle/nodes/coerce/ToStrNode.java
  5. +3 −2 truffle/src/main/java/org/jruby/truffle/nodes/control/TraceNode.java
  6. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/BigDecimalNodes.java
  7. +2 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/BignumNodes.java
  8. +4 −4 truffle/src/main/java/org/jruby/truffle/nodes/core/EncodingNodes.java
  9. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/FloatNodes.java
  10. +3 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/InterpolatedStringNode.java
  11. +10 −10 truffle/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
  12. +4 −4 truffle/src/main/java/org/jruby/truffle/nodes/core/MatchDataNodes.java
  13. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/MethodNodes.java
  14. +4 −4 truffle/src/main/java/org/jruby/truffle/nodes/core/ModuleNodes.java
  15. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/ProcNodes.java
  16. +10 −10 truffle/src/main/java/org/jruby/truffle/nodes/core/RegexpNodes.java
  17. +116 −102 truffle/src/main/java/org/jruby/truffle/nodes/core/StringNodes.java
  18. +2 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/SymbolNodes.java
  19. +2 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/ThreadBacktraceLocationNodes.java
  20. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/ThreadNodes.java
  21. +6 −6 truffle/src/main/java/org/jruby/truffle/nodes/core/TrufflePrimitiveNodes.java
  22. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/UnboundMethodNodes.java
  23. +6 −6 truffle/src/main/java/org/jruby/truffle/nodes/core/array/ArrayNodes.java
  24. +5 −5 truffle/src/main/java/org/jruby/truffle/nodes/core/fixnum/FixnumNodes.java
  25. +2 −2 truffle/src/main/java/org/jruby/truffle/nodes/ext/DigestNodes.java
  26. +2 −2 truffle/src/main/java/org/jruby/truffle/nodes/ext/ZlibNodes.java
  27. +2 −1 truffle/src/main/java/org/jruby/truffle/nodes/interop/IndexLabelToRubyNode.java
  28. +3 −3 truffle/src/main/java/org/jruby/truffle/nodes/literal/StringLiteralNode.java
  29. +3 −3 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/EncodingConverterPrimitiveNodes.java
  30. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/IOPrimitiveNodes.java
  31. +3 −3 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/PointerPrimitiveNodes.java
  32. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/PosixNodes.java
  33. +20 −20 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/StringPrimitiveNodes.java
  34. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/TimePrimitiveNodes.java
  35. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/VMPrimitiveNodes.java
  36. +3 −2 truffle/src/main/java/org/jruby/truffle/nodes/time/ReadTimeZoneNode.java
  37. +2 −2 truffle/src/main/java/org/jruby/truffle/runtime/RubyContext.java
  38. +2 −2 truffle/src/main/java/org/jruby/truffle/runtime/core/CoreLibrary.java
  39. +9 −9 truffle/src/main/java/org/jruby/truffle/runtime/core/RubyMatchData.java
  40. +9 −9 truffle/src/main/java/org/jruby/truffle/runtime/core/RubyRegexp.java
  41. +1 −1 truffle/src/main/java/org/jruby/truffle/runtime/core/RubySymbol.java
  42. +1 −1 truffle/src/main/java/org/jruby/truffle/runtime/rubinius/DefaultRubiniusConfiguration.java
  43. +2 −1 truffle/src/main/java/org/jruby/truffle/runtime/subsystems/FeatureManager.java
12 changes: 6 additions & 6 deletions truffle/src/main/java/org/jruby/truffle/nodes/RubyNode.java
Original file line number Diff line number Diff line change
@@ -249,27 +249,27 @@ protected RubyBasicObject nil() {
return getContext().getCoreLibrary().getNilObject();
}

protected RubyString createEmptyString() {
protected RubyBasicObject createEmptyString() {
return StringNodes.createEmptyString(getContext().getCoreLibrary().getStringClass());
}

protected RubyString createString(String string) {
protected RubyBasicObject createString(String string) {
return StringNodes.createString(getContext().getCoreLibrary().getStringClass(), string);
}

protected RubyString createString(String string, Encoding encoding) {
protected RubyBasicObject createString(String string, Encoding encoding) {
return StringNodes.createString(getContext().getCoreLibrary().getStringClass(), string, encoding);
}

protected RubyString createString(byte[] bytes) {
protected RubyBasicObject createString(byte[] bytes) {
return StringNodes.createString(getContext().getCoreLibrary().getStringClass(), bytes);
}

protected RubyString createString(ByteBuffer bytes) {
protected RubyBasicObject createString(ByteBuffer bytes) {
return StringNodes.createString(getContext().getCoreLibrary().getStringClass(), bytes);
}

protected RubyString createString(ByteList bytes) {
protected RubyBasicObject createString(ByteList bytes) {
return StringNodes.createString(getContext().getCoreLibrary().getStringClass(), bytes);
}

Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@
import org.jruby.truffle.nodes.dispatch.CallDispatchHeadNode;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNodeFactory;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.core.RubyBasicObject;
import org.jruby.truffle.runtime.core.RubyString;

@NodeChild(type = RubyNode.class)
@@ -34,7 +35,7 @@ public ToSNode(RubyContext context, SourceSection sourceSection) {
callToSNode = DispatchHeadNodeFactory.createMethodCall(context, true);
}

protected RubyString kernelToS(VirtualFrame frame, Object object) {
protected RubyBasicObject kernelToS(VirtualFrame frame, Object object) {
if (kernelToSNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
kernelToSNode = insert(KernelNodesFactory.ToSNodeFactory.create(getContext(), getSourceSection(), new RubyNode[] {null}));
@@ -46,12 +47,12 @@ protected RubyString kernelToS(VirtualFrame frame, Object object) {
public abstract RubyString executeRubyString(VirtualFrame frame);

@Specialization
public RubyString toS(RubyString string) {
public RubyBasicObject toS(RubyString string) {
return string;
}

@Specialization(guards = "!isRubyString(object)", rewriteOn = UnexpectedResultException.class)
public RubyString toS(VirtualFrame frame, Object object) throws UnexpectedResultException {
public RubyBasicObject toS(VirtualFrame frame, Object object) throws UnexpectedResultException {
final Object value = callToSNode.call(frame, object, "to_s", null);

if (value instanceof RubyString) {
@@ -62,7 +63,7 @@ public RubyString toS(VirtualFrame frame, Object object) throws UnexpectedResult
}

@Specialization(guards = "!isRubyString(object)")
public RubyString toSFallback(VirtualFrame frame, Object object) {
public RubyBasicObject toSFallback(VirtualFrame frame, Object object) {
final Object value = callToSNode.call(frame, object, "to_s", null);

if (value instanceof RubyString) {
Original file line number Diff line number Diff line change
@@ -46,12 +46,12 @@ public RubySymbol coerceRubySymbol(RubySymbol symbol) {
}

@Specialization
public RubyString coerceRubyString(RubyString string) {
public RubyBasicObject coerceRubyString(RubyString string) {
return string;
}

@Specialization(guards = { "!isRubySymbol(object)", "!isRubyString(object)" })
public RubyString coerceObject(VirtualFrame frame, Object object) {
public RubyBasicObject coerceObject(VirtualFrame frame, Object object) {
final Object coerced;

try {
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@
import org.jruby.truffle.nodes.dispatch.DispatchHeadNodeFactory;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.core.RubyBasicObject;
import org.jruby.truffle.runtime.core.RubyString;

@NodeChild(value = "child", type = RubyNode.class)
@@ -35,12 +36,12 @@ public ToStrNode(RubyContext context, SourceSection sourceSection) {
public abstract RubyString executeRubyString(VirtualFrame frame, Object object);

@Specialization
public RubyString coerceRubyString(RubyString string) {
public RubyBasicObject coerceRubyString(RubyString string) {
return string;
}

@Specialization(guards = "!isRubyString(object)")
public RubyString coerceObject(VirtualFrame frame, Object object) {
public RubyBasicObject coerceObject(VirtualFrame frame, Object object) {
final Object coerced;

try {
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.runtime.RubyArguments;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.core.RubyBasicObject;
import org.jruby.truffle.runtime.core.RubyBinding;
import org.jruby.truffle.runtime.core.RubyProc;
import org.jruby.truffle.runtime.core.RubyString;
@@ -31,8 +32,8 @@ public class TraceNode extends RubyNode {
@CompilerDirectives.CompilationFinal private RubyProc traceFunc;
@Child private DirectCallNode callNode;

private final RubyString event;
private final RubyString file;
private final RubyBasicObject event;
private final RubyBasicObject file;
private final int line;

public TraceNode(RubyContext context, SourceSection sourceSection) {
Original file line number Diff line number Diff line change
@@ -475,7 +475,7 @@ public ToSNode(RubyContext context, SourceSection sourceSection) {

@TruffleBoundary
@Specialization
public RubyString toS(RubyBasicObject value) {
public RubyBasicObject toS(RubyBasicObject value) {
final BigDecimal bigDecimal = getBigDecimalValue(value);
final boolean negative = bigDecimal.signum() == -1;

Original file line number Diff line number Diff line change
@@ -663,13 +663,13 @@ public ToSNode(RubyContext context, SourceSection sourceSection) {

@TruffleBoundary
@Specialization
public RubyString toS(RubyBasicObject value, NotProvided base) {
public RubyBasicObject toS(RubyBasicObject value, NotProvided base) {
return createString(getBigIntegerValue(value).toString());
}

@TruffleBoundary
@Specialization
public RubyString toS(RubyBasicObject value, int base) {
public RubyBasicObject toS(RubyBasicObject value, int base) {
if (base < 2 || base > 36) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentErrorInvalidRadix(base, this));
Original file line number Diff line number Diff line change
@@ -249,7 +249,7 @@ public RubyBasicObject defaultInternal(Object encoding) {
}

@Specialization(guards = { "!isRubyEncoding(encoding)", "!isNil(encoding)" })
public RubyString defaultInternal(VirtualFrame frame, Object encoding) {
public RubyBasicObject defaultInternal(VirtualFrame frame, Object encoding) {
CompilerDirectives.transferToInterpreter();

if (toStrNode == null) {
@@ -291,7 +291,7 @@ public LocaleCharacterMapNode(RubyContext context, SourceSection sourceSection)
}

@Specialization
public RubyString localeCharacterMap() {
public RubyBasicObject localeCharacterMap() {
CompilerDirectives.transferToInterpreter();
final ByteList name = new ByteList(getContext().getRuntime().getEncodingService().getLocaleEncoding().getName());
return createString(name);
@@ -352,7 +352,7 @@ public Object encodingMap(VirtualFrame frame) {

final Object upcased = upcaseNode.call(frame, createString(new ByteList(e.bytes, e.p, e.end - e.p)), "upcase", null);
final Object key = toSymNode.call(frame, upcased, "to_sym", null);
final RubyString alias = createString(new ByteList(e.bytes, e.p, e.end - e.p));
final RubyBasicObject alias = createString(new ByteList(e.bytes, e.p, e.end - e.p));
final int index = e.value.getIndex();


@@ -405,7 +405,7 @@ public ToSNode(RubyContext context, SourceSection sourceSection) {

@TruffleBoundary
@Specialization
public RubyString toS(RubyEncoding encoding) {
public RubyBasicObject toS(RubyEncoding encoding) {
final ByteList name = encoding.getName().dup();
name.setEncoding(ASCIIEncoding.INSTANCE);
return createString(name);
Original file line number Diff line number Diff line change
@@ -665,7 +665,7 @@ public ToSNode(RubyContext context, SourceSection sourceSection) {

@TruffleBoundary
@Specialization
public RubyString toS(double value) {
public RubyBasicObject toS(double value) {
return createString(Double.toString(value));
}

Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@
import org.jruby.truffle.nodes.objects.TaintNodeGen;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.core.RubyBasicObject;
import org.jruby.truffle.runtime.core.RubyString;

/**
@@ -56,7 +57,7 @@ public Object execute(VirtualFrame frame) {
tainted |= isTaintedNode.isTainted(toInterpolate);
}

final RubyString string = concat(strings);
final RubyBasicObject string = concat(strings);

if (taintProfile.profile(tainted)) {
taintNode.taint(string);
@@ -66,7 +67,7 @@ public Object execute(VirtualFrame frame) {
}

@TruffleBoundary
private RubyString concat(RubyString[] strings) {
private RubyBasicObject concat(RubyString[] strings) {
// TODO(CS): there is a lot of copying going on here - and I think this is sometimes inner loop stuff

org.jruby.RubyString builder = null;
20 changes: 10 additions & 10 deletions truffle/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@ public BacktickNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization
public RubyString backtick(RubyString command) {
public RubyBasicObject backtick(RubyString command) {
// Command is lexically a string interoplation, so variables will already have been expanded

CompilerDirectives.transferToInterpreter();
@@ -683,7 +683,7 @@ public GetsNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization
public RubyString gets(VirtualFrame frame) {
public RubyBasicObject gets(VirtualFrame frame) {
CompilerDirectives.transferToInterpreter();

// TODO(CS): having some trouble interacting with JRuby stdin - so using this hack
@@ -700,7 +700,7 @@ public String block() throws InterruptedException {
}
});

final RubyString rubyLine = createString(line);
final RubyBasicObject rubyLine = createString(line);

// Set the local variable $_ in the caller

@@ -1571,7 +1571,7 @@ public StringNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization
public RubyString string(RubyString value) {
public RubyBasicObject string(RubyString value) {
return value;
}

@@ -1674,7 +1674,7 @@ public FormatNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization(guards = {"isRubyString(firstArgument(arguments))", "byteListsEqual(asRubyString(firstArgument(arguments)), cachedFormat)"})
public RubyString formatCached(
public RubyBasicObject formatCached(
VirtualFrame frame,
Object[] arguments,
@Cached("privatizeByteList(asRubyString(firstArgument(arguments)))") ByteList cachedFormat,
@@ -1694,7 +1694,7 @@ public RubyString formatCached(
}

@Specialization(guards = "isRubyString(firstArgument(arguments))", contains = "formatCached")
public RubyString formatUncached(
public RubyBasicObject formatUncached(
VirtualFrame frame,
Object[] arguments,
@Cached("create()") IndirectCallNode callPackNode) {
@@ -1731,8 +1731,8 @@ private RuntimeException handleException(PackException exception) {
}
}

private RubyString finishFormat(ByteList format, PackResult result) {
final RubyString string = createString(new ByteList(result.getOutput(), 0, result.getOutputLength()));
private RubyBasicObject finishFormat(ByteList format, PackResult result) {
final RubyBasicObject string = createString(new ByteList(result.getOutput(), 0, result.getOutputLength()));

if (format.length() == 0) {
StringNodes.forceEncoding(string, USASCIIEncoding.INSTANCE);
@@ -1904,10 +1904,10 @@ public ToSNode(RubyContext context, SourceSection sourceSection) {
toHexStringNode = KernelNodesFactory.ToHexStringNodeFactory.create(context, sourceSection, new RubyNode[]{null});
}

public abstract RubyString executeToS(VirtualFrame frame, Object self);
public abstract RubyBasicObject executeToS(VirtualFrame frame, Object self);

@Specialization
public RubyString toS(VirtualFrame frame, Object self) {
public RubyBasicObject toS(VirtualFrame frame, Object self) {
CompilerDirectives.transferToInterpreter();

String className = classNode.executeGetClass(frame, self).getName();
Original file line number Diff line number Diff line change
@@ -211,7 +211,7 @@ public PreMatchNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization
public RubyString preMatch(RubyMatchData matchData) {
public RubyBasicObject preMatch(RubyMatchData matchData) {
return matchData.getPre();
}

@@ -225,7 +225,7 @@ public PostMatchNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization
public RubyString postMatch(RubyMatchData matchData) {
public RubyBasicObject postMatch(RubyMatchData matchData) {
return matchData.getPost();
}

@@ -254,7 +254,7 @@ public ToSNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization
public RubyString toS(RubyMatchData matchData) {
public RubyBasicObject toS(RubyMatchData matchData) {
CompilerDirectives.transferToInterpreter();

final ByteList bytes = StringNodes.getByteList(matchData.getGlobal()).dup();
@@ -293,7 +293,7 @@ public RubiniusSourceNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization
public RubyString rubiniusSource(RubyMatchData matchData) {
public RubyBasicObject rubiniusSource(RubyMatchData matchData) {
return matchData.getSource();
}
}
Original file line number Diff line number Diff line change
@@ -233,7 +233,7 @@ public Object sourceLocation(RubyBasicObject method) {
if (sourceSection instanceof NullSourceSection) {
return nil();
} else {
RubyString file = createString(sourceSection.getSource().getName());
RubyBasicObject file = createString(sourceSection.getSource().getName());
return ArrayNodes.fromObjects(getContext().getCoreLibrary().getArrayClass(),
file, sourceSection.getStartLine());
}
Original file line number Diff line number Diff line change
@@ -583,7 +583,7 @@ protected RubyBinding getCallerBinding(VirtualFrame frame) {
return bindingNode.executeRubyBinding(frame);
}

protected RubyString toStr(VirtualFrame frame, Object object) {
protected RubyBasicObject toStr(VirtualFrame frame, Object object) {
if (toStrNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
toStrNode = insert(ToStrNodeGen.create(getContext(), getSourceSection(), null));
@@ -608,7 +608,7 @@ public Object classEval(VirtualFrame frame, RubyModule module, RubyString code,

@Specialization(guards = "wasProvided(code)")
public Object classEval(VirtualFrame frame, RubyModule module, Object code, NotProvided file, NotProvided line, NotProvided block) {
return classEvalSource(frame, module, toStr(frame, code), file.toString());
return classEvalSource(frame, module, (RubyString) toStr(frame, code), file.toString());
}

@Specialization(guards = "wasProvided(file)")
@@ -1756,7 +1756,7 @@ public ToSNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization
public RubyString toS(RubyModule module) {
public RubyBasicObject toS(RubyModule module) {
CompilerDirectives.transferToInterpreter();

return createString(module.getName());
@@ -1802,7 +1802,7 @@ public GetUserHomeNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization
public RubyString userHome(RubyString uname) {
public RubyBasicObject userHome(RubyString uname) {
CompilerDirectives.transferToInterpreter();
// TODO BJF 30-APR-2015 Review the more robust getHomeDirectoryPath implementation
final Passwd passwd = getContext().getPosix().getpwnam(uname.toString());
Original file line number Diff line number Diff line change
@@ -188,7 +188,7 @@ public Object sourceLocation(RubyProc proc) {
if (sourceSection instanceof NullSourceSection) {
return nil();
} else {
RubyString file = createString(sourceSection.getSource().getName());
RubyBasicObject file = createString(sourceSection.getSource().getName());
return ArrayNodes.fromObjects(getContext().getCoreLibrary().getArrayClass(),
file, sourceSection.getStartLine());
}
Loading