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

Commits on Jun 5, 2015

  1. Revert "[Truffle] Remove use of Java 8 method."

    This reverts commit c4249fa.
    chrisseaton committed Jun 5, 2015
    Copy the full SHA
    cb97f5a View commit details
  2. Revert "Merge branch 'truffle-symbol-refactor'"

    This reverts commit f4a988b, reversing
    changes made to 8f4ec6b.
    chrisseaton committed Jun 5, 2015
    Copy the full SHA
    bbdd0ab View commit details
Showing with 380 additions and 476 deletions.
  1. +2 −5 truffle/src/main/java/org/jruby/truffle/nodes/RubyGuards.java
  2. +0 −8 truffle/src/main/java/org/jruby/truffle/nodes/RubyNode.java
  3. +3 −3 truffle/src/main/java/org/jruby/truffle/nodes/cast/StringToSymbolNode.java
  4. +3 −3 truffle/src/main/java/org/jruby/truffle/nodes/coerce/NameToJavaStringNode.java
  5. +3 −2 truffle/src/main/java/org/jruby/truffle/nodes/coerce/NameToSymbolOrStringNode.java
  6. +2 −2 truffle/src/main/java/org/jruby/truffle/nodes/constants/GetConstantNode.java
  7. +5 −6 truffle/src/main/java/org/jruby/truffle/nodes/conversion/ToSymbolNode.java
  8. +5 −5 truffle/src/main/java/org/jruby/truffle/nodes/core/BindingNodes.java
  9. +8 −8 truffle/src/main/java/org/jruby/truffle/nodes/core/EncodingNodes.java
  10. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/FloatNodes.java
  11. +6 −6 truffle/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
  12. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/MatchDataNodes.java
  13. +2 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/MethodNodes.java
  14. +16 −17 truffle/src/main/java/org/jruby/truffle/nodes/core/ModuleNodes.java
  15. +4 −5 truffle/src/main/java/org/jruby/truffle/nodes/core/ProcessNodes.java
  16. +2 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/RegexpNodes.java
  17. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/ReturnEnumeratorIfNoBlockNode.java
  18. +4 −4 truffle/src/main/java/org/jruby/truffle/nodes/core/StringNodes.java
  19. +26 −105 truffle/src/main/java/org/jruby/truffle/nodes/core/SymbolNodes.java
  20. +1 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/TrufflePrimitiveNodes.java
  21. +3 −6 truffle/src/main/java/org/jruby/truffle/nodes/core/UnboundMethodNodes.java
  22. +4 −4 truffle/src/main/java/org/jruby/truffle/nodes/core/array/ArrayNodes.java
  23. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/hash/HashNodes.java
  24. +2 −2 truffle/src/main/java/org/jruby/truffle/nodes/dispatch/CachedBoxedSymbolDispatchNode.java
  25. +5 −7 truffle/src/main/java/org/jruby/truffle/nodes/dispatch/CachedDispatchNode.java
  26. +2 −2 truffle/src/main/java/org/jruby/truffle/nodes/dispatch/RubyCallNode.java
  27. +2 −1 truffle/src/main/java/org/jruby/truffle/nodes/dispatch/UnresolvedDispatchNode.java
  28. +5 −1 truffle/src/main/java/org/jruby/truffle/nodes/ext/BigDecimalNodes.java
  29. +8 −9 truffle/src/main/java/org/jruby/truffle/nodes/interop/InteropNode.java
  30. +3 −3 truffle/src/main/java/org/jruby/truffle/nodes/methods/AddMethodNode.java
  31. +4 −3 truffle/src/main/java/org/jruby/truffle/nodes/objects/FreezeNode.java
  32. +3 −2 truffle/src/main/java/org/jruby/truffle/nodes/objects/IsFrozenNode.java
  33. +3 −2 truffle/src/main/java/org/jruby/truffle/nodes/objects/IsTaintedNode.java
  34. +4 −3 truffle/src/main/java/org/jruby/truffle/nodes/objects/TaintNode.java
  35. +16 −19 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/EncodingConverterPrimitiveNodes.java
  36. +3 −4 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/EncodingPrimitiveNodes.java
  37. +3 −3 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/SymbolPrimitiveNodes.java
  38. +18 −10 truffle/src/main/java/org/jruby/truffle/runtime/RubyContext.java
  39. +2 −2 ...java/org/jruby/truffle/runtime/core/{StringCodeRangeableWrapper.java → CodeRangeableWrapper.java}
  40. +0 −2 truffle/src/main/java/org/jruby/truffle/runtime/core/RubyBasicObject.java
  41. +5 −5 truffle/src/main/java/org/jruby/truffle/runtime/core/RubyModule.java
  42. +1 −1 truffle/src/main/java/org/jruby/truffle/runtime/core/RubyString.java
  43. +187 −6 truffle/src/main/java/org/jruby/truffle/runtime/core/RubySymbol.java
  44. +0 −85 truffle/src/main/java/org/jruby/truffle/runtime/core/SymbolCodeRangeableWrapper.java
  45. +0 −102 truffle/src/main/java/org/jruby/truffle/runtime/core/SymbolTable.java
  46. +1 −3 truffle/src/main/java/org/jruby/truffle/translator/BodyTranslator.java
7 changes: 2 additions & 5 deletions truffle/src/main/java/org/jruby/truffle/nodes/RubyGuards.java
Original file line number Diff line number Diff line change
@@ -10,12 +10,9 @@
package org.jruby.truffle.nodes;

import com.oracle.truffle.api.interop.TruffleObject;
import org.jruby.truffle.nodes.core.BignumNodes;
import org.jruby.truffle.nodes.core.MethodNodes;
import org.jruby.truffle.nodes.core.StringNodes;
import org.jruby.truffle.nodes.core.UnboundMethodNodes;
import org.jruby.truffle.nodes.core.hash.HashNodes;
import org.jruby.truffle.nodes.core.*;
import org.jruby.truffle.nodes.ext.BigDecimalNodes;
import org.jruby.truffle.nodes.core.hash.HashNodes;
import org.jruby.truffle.runtime.NotProvided;
import org.jruby.truffle.runtime.ThreadLocalObject;
import org.jruby.truffle.runtime.core.*;
8 changes: 0 additions & 8 deletions truffle/src/main/java/org/jruby/truffle/nodes/RubyNode.java
Original file line number Diff line number Diff line change
@@ -239,14 +239,6 @@ protected RubyBasicObject nil() {
return getContext().getCoreLibrary().getNilObject();
}

public RubyBasicObject getSymbol(String name) {
return getContext().getSymbol(name);
}

public RubyBasicObject getSymbol(ByteList name) {
return getContext().getSymbol(name);
}

protected RubyBasicObject createEmptyString() {
return StringNodes.createEmptyString(getContext().getCoreLibrary().getStringClass());
}
Original file line number Diff line number Diff line change
@@ -14,8 +14,8 @@
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.core.RubyBasicObject;
import org.jruby.truffle.runtime.core.RubyString;
import org.jruby.truffle.runtime.core.RubySymbol;

/**
* Creates a symbol from a string.
@@ -28,8 +28,8 @@ public StringToSymbolNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization
public RubyBasicObject doString(RubyString string) {
return getSymbol(string.toString());
public RubySymbol doString(RubyString string) {
return getContext().getSymbol(string.toString());
}

}
Original file line number Diff line number Diff line change
@@ -20,8 +20,8 @@
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;
import org.jruby.truffle.runtime.core.RubySymbol;

/**
* Take a Symbol or some object accepting #to_str
@@ -39,8 +39,8 @@ public NameToJavaStringNode(RubyContext context, SourceSection sourceSection) {

public abstract String executeToJavaString(VirtualFrame frame, Object name);

@Specialization(guards = "isRubySymbol(symbol)")
public String coerceRubySymbol(RubyBasicObject symbol) {
@Specialization
public String coerceRubySymbol(RubySymbol symbol) {
return symbol.toString();
}

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

/**
* Take a Symbol or some object accepting #to_str
@@ -39,8 +40,8 @@ public NameToSymbolOrStringNode(RubyContext context, SourceSection sourceSection

public abstract RubyBasicObject executeToSymbolOrString(VirtualFrame frame, Object name);

@Specialization(guards = "isRubySymbol(symbol)")
public RubyBasicObject coerceRubySymbol(RubyBasicObject symbol) {
@Specialization
public RubySymbol coerceRubySymbol(RubySymbol symbol) {
return symbol;
}

Original file line number Diff line number Diff line change
@@ -24,9 +24,9 @@
import org.jruby.truffle.runtime.RubyConstant;
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.RubyModule;
import org.jruby.truffle.runtime.core.RubyString;
import org.jruby.truffle.runtime.core.RubySymbol;
import org.jruby.util.IdUtil;

@NodeChildren({
@@ -63,7 +63,7 @@ protected Object autoloadConstant(VirtualFrame frame, RubyModule module, String
protected Object missingConstant(VirtualFrame frame, RubyModule module, String name, Object constant,
@Cached("isValidConstantName(name)") boolean isValidConstantName,
@Cached("createConstMissingNode()") CallDispatchHeadNode constMissingNode,
@Cached("getSymbol(name)") RubyBasicObject symbolName) {
@Cached("getContext().getSymbol(name)") RubySymbol symbolName) {
if (!isValidConstantName) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().nameError(String.format("wrong constant name %s", name), name, this));
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@
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.RubyBasicObject;
import org.jruby.truffle.runtime.core.RubyString;
import org.jruby.truffle.runtime.core.RubySymbol;

@@ -32,18 +31,18 @@ public ToSymbolNode(RubyContext context, SourceSection sourceSection) {
// TODO(CS): cache the conversion to a symbol? Or should the user do that themselves?

@Specialization
protected RubyBasicObject toSymbol(RubySymbol symbol) {
protected RubySymbol toSymbol(RubySymbol symbol) {
return symbol;
}

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

@Specialization
protected RubyBasicObject toSymbol(String string) {
return getSymbol(string);
protected RubySymbol toSymbol(String string) {
return getContext().getSymbol(string);
}

}
Original file line number Diff line number Diff line change
@@ -68,11 +68,11 @@ public Object initializeCopy(RubyBinding self, RubyBinding from) {
@CoreMethod(names = "local_variable_get", required = 1)
public abstract static class LocalVariableGetNode extends CoreMethodArrayArgumentsNode {

private final RubyBasicObject dollarUnderscore;
private final RubySymbol dollarUnderscore;

public LocalVariableGetNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
dollarUnderscore = getSymbol("$_");
dollarUnderscore = getContext().getSymbol("$_");
}

@Specialization(guards = {
@@ -164,11 +164,11 @@ protected boolean isLastLine(RubySymbol symbol) {
@CoreMethod(names = "local_variable_set", required = 2)
public abstract static class LocalVariableSetNode extends CoreMethodArrayArgumentsNode {

private final RubyBasicObject dollarUnderscore;
private final RubySymbol dollarUnderscore;

public LocalVariableSetNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
dollarUnderscore = getSymbol("$_");
dollarUnderscore = getContext().getSymbol("$_");
}

@Specialization(guards = {
@@ -249,7 +249,7 @@ public RubyBasicObject localVariables(RubyBinding binding) {
while (frame != null) {
for (Object name : frame.getFrameDescriptor().getIdentifiers()) {
if (name instanceof String) {
ArrayNodes.slowPush(array, getSymbol((String) name));
ArrayNodes.slowPush(array, getContext().getSymbol((String) name));
}
}

Original file line number Diff line number Diff line change
@@ -115,7 +115,7 @@ public Object isCompatible(RubyRegexp first, RubyRegexp second) {
@TruffleBoundary
@Specialization
public Object isCompatible(RubyRegexp first, RubySymbol second) {
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(first.getRegex().getEncoding(), SymbolNodes.getByteList(second).getEncoding());
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(first.getRegex().getEncoding(), second.getByteList().getEncoding());

if (compatibleEncoding != null) {
return RubyEncoding.getEncoding(compatibleEncoding);
@@ -127,7 +127,7 @@ public Object isCompatible(RubyRegexp first, RubySymbol second) {
@TruffleBoundary
@Specialization
public Object isCompatible(RubySymbol first, RubyRegexp second) {
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(SymbolNodes.getByteList(first).getEncoding(), second.getRegex().getEncoding());
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(first.getByteList().getEncoding(), second.getRegex().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(StringNodes.getCodeRangeable(first), SymbolNodes.getCodeRangeable(second));
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(StringNodes.getCodeRangeable(first), second);

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

if (compatibleEncoding != null) {
return RubyEncoding.getEncoding(compatibleEncoding);
@@ -362,19 +362,19 @@ public Object encodingMap(VirtualFrame frame) {

final Encoding defaultInternalEncoding = getContext().getRuntime().getDefaultInternalEncoding();
final Object internalTuple = getContext().makeTuple(frame, newTupleNode, createString("internal"), indexLookup(encodings, defaultInternalEncoding));
lookupTableWriteNode.call(frame, ret, "[]=", null, getSymbol("INTERNAL"), internalTuple);
lookupTableWriteNode.call(frame, ret, "[]=", null, getContext().getSymbol("INTERNAL"), internalTuple);

final Encoding defaultExternalEncoding = getContext().getRuntime().getDefaultExternalEncoding();
final Object externalTuple = getContext().makeTuple(frame, newTupleNode, createString("external"), indexLookup(encodings, defaultExternalEncoding));
lookupTableWriteNode.call(frame, ret, "[]=", null, getSymbol("EXTERNAL"), externalTuple);
lookupTableWriteNode.call(frame, ret, "[]=", null, getContext().getSymbol("EXTERNAL"), externalTuple);

final Encoding localeEncoding = getContext().getRuntime().getEncodingService().getLocaleEncoding();
final Object localeTuple = getContext().makeTuple(frame, newTupleNode, createString("locale"), indexLookup(encodings, localeEncoding));
lookupTableWriteNode.call(frame, ret, "[]=", null, getSymbol("LOCALE"), localeTuple);
lookupTableWriteNode.call(frame, ret, "[]=", null, getContext().getSymbol("LOCALE"), localeTuple);

final Encoding filesystemEncoding = getContext().getRuntime().getEncodingService().getLocaleEncoding();
final Object filesystemTuple = getContext().makeTuple(frame, newTupleNode, createString("filesystem"), indexLookup(encodings, filesystemEncoding));
lookupTableWriteNode.call(frame, ret, "[]=", null, getSymbol("FILESYSTEM"), filesystemTuple);
lookupTableWriteNode.call(frame, ret, "[]=", null, getContext().getSymbol("FILESYSTEM"), filesystemTuple);

return ret;
}
Original file line number Diff line number Diff line change
@@ -203,7 +203,7 @@ public Object div(VirtualFrame frame, double a, Object b) {
redoCoercedNode = insert(DispatchHeadNodeFactory.createMethodCallOnSelf(getContext()));
}

return redoCoercedNode.call(frame, a, "redo_coerced", null, getSymbol("/"), b);
return redoCoercedNode.call(frame, a, "redo_coerced", null, getContext().getSymbolTable().getSymbol("/"), b);
}

}
Original file line number Diff line number Diff line change
@@ -299,10 +299,10 @@ public CalleeNameNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization
public RubyBasicObject calleeName() {
public RubySymbol calleeName() {
CompilerDirectives.transferToInterpreter();
// the "called name" of a method.
return getSymbol(RubyCallStack.getCallingMethod(getContext()).getName());
return getContext().getSymbolTable().getSymbol(RubyCallStack.getCallingMethod(getContext()).getName());
}
}

@@ -924,7 +924,7 @@ public RubyBasicObject instanceVariables(RubyBasicObject self) {

for (Object name : instanceVariableNames) {
if (name instanceof String) {
ArrayNodes.slowPush(array, getSymbol((String) name));
ArrayNodes.slowPush(array, getContext().getSymbolTable().getSymbol((String) name));
}
}

@@ -1037,7 +1037,7 @@ public RubyBasicObject localVariables() {

for (Object name : Truffle.getRuntime().getCallerFrame().getFrame(FrameInstance.FrameAccess.READ_ONLY, false).getFrameDescriptor().getIdentifiers()) {
if (name instanceof String) {
ArrayNodes.slowPush(array, getSymbol((String) name));
ArrayNodes.slowPush(array, getContext().getSymbol((String) name));
}
}

@@ -1054,10 +1054,10 @@ public MethodNameNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization
public RubyBasicObject methodName() {
public RubySymbol methodName() {
CompilerDirectives.transferToInterpreter();
// the "original/definition name" of the method.
return getSymbol(RubyCallStack.getCallingMethod(getContext()).getSharedMethodInfo().getName());
return getContext().getSymbolTable().getSymbol(RubyCallStack.getCallingMethod(getContext()).getSharedMethodInfo().getName());
}

}
Original file line number Diff line number Diff line change
@@ -70,7 +70,7 @@ public Object getIndex(RubyMatchData matchData, RubySymbol index, NotProvided le
CompilerDirectives.transferToInterpreter();

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

return getIndex(matchData, i, NotProvided.INSTANCE);
} catch (final ValueException e) {
Original file line number Diff line number Diff line change
@@ -161,10 +161,10 @@ public NameNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization
public RubyBasicObject name(RubyBasicObject method) {
public RubySymbol name(RubyBasicObject method) {
CompilerDirectives.transferToInterpreter();

return getSymbol(getMethod(method).getName());
return getContext().getSymbol(getMethod(method).getName());
}

}
Loading