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

Commits on Jun 5, 2015

  1. Copy the full SHA
    bba95d0 View commit details
  2. Copy the full SHA
    79a877f View commit details
  3. Copy the full SHA
    e668c85 View commit details
  4. Copy the full SHA
    9265f44 View commit details
  5. Copy the full SHA
    fc1693c View commit details
  6. Copy the full SHA
    e107fe0 View commit details
  7. Copy the full SHA
    7678439 View commit details
  8. Copy the full SHA
    5ebc5a0 View commit details
  9. Copy the full SHA
    f4a988b View commit details
Showing with 452 additions and 380 deletions.
  1. +5 −2 truffle/src/main/java/org/jruby/truffle/nodes/RubyGuards.java
  2. +8 −0 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. +2 −3 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. +6 −5 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. +17 −16 truffle/src/main/java/org/jruby/truffle/nodes/core/ModuleNodes.java
  15. +5 −4 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. +105 −26 truffle/src/main/java/org/jruby/truffle/nodes/core/SymbolNodes.java
  20. +2 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/TrufflePrimitiveNodes.java
  21. +6 −3 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. +7 −5 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. +1 −2 truffle/src/main/java/org/jruby/truffle/nodes/dispatch/UnresolvedDispatchNode.java
  28. +1 −5 truffle/src/main/java/org/jruby/truffle/nodes/ext/BigDecimalNodes.java
  29. +9 −8 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. +3 −4 truffle/src/main/java/org/jruby/truffle/nodes/objects/FreezeNode.java
  32. +2 −3 truffle/src/main/java/org/jruby/truffle/nodes/objects/IsFrozenNode.java
  33. +2 −3 truffle/src/main/java/org/jruby/truffle/nodes/objects/IsTaintedNode.java
  34. +3 −4 truffle/src/main/java/org/jruby/truffle/nodes/objects/TaintNode.java
  35. +19 −16 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/EncodingConverterPrimitiveNodes.java
  36. +4 −3 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. +10 −18 truffle/src/main/java/org/jruby/truffle/runtime/RubyContext.java
  39. +2 −0 truffle/src/main/java/org/jruby/truffle/runtime/core/RubyBasicObject.java
  40. +5 −5 truffle/src/main/java/org/jruby/truffle/runtime/core/RubyModule.java
  41. +1 −1 truffle/src/main/java/org/jruby/truffle/runtime/core/RubyString.java
  42. +6 −187 truffle/src/main/java/org/jruby/truffle/runtime/core/RubySymbol.java
  43. +2 −2 ...java/org/jruby/truffle/runtime/core/{CodeRangeableWrapper.java → StringCodeRangeableWrapper.java}
  44. +85 −0 truffle/src/main/java/org/jruby/truffle/runtime/core/SymbolCodeRangeableWrapper.java
  45. +78 −0 truffle/src/main/java/org/jruby/truffle/runtime/core/SymbolTable.java
  46. +3 −1 truffle/src/main/java/org/jruby/truffle/translator/BodyTranslator.java
7 changes: 5 additions & 2 deletions truffle/src/main/java/org/jruby/truffle/nodes/RubyGuards.java
Original file line number Diff line number Diff line change
@@ -10,9 +10,12 @@
package org.jruby.truffle.nodes;

import com.oracle.truffle.api.interop.TruffleObject;
import org.jruby.truffle.nodes.core.*;
import org.jruby.truffle.nodes.ext.BigDecimalNodes;
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.ext.BigDecimalNodes;
import org.jruby.truffle.runtime.NotProvided;
import org.jruby.truffle.runtime.ThreadLocalObject;
import org.jruby.truffle.runtime.core.*;
8 changes: 8 additions & 0 deletions truffle/src/main/java/org/jruby/truffle/nodes/RubyNode.java
Original file line number Diff line number Diff line change
@@ -239,6 +239,14 @@ 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 RubySymbol doString(RubyString string) {
return getContext().getSymbol(string.toString());
public RubyBasicObject doString(RubyString string) {
return 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
public String coerceRubySymbol(RubySymbol symbol) {
@Specialization(guards = "isRubySymbol(symbol)")
public String coerceRubySymbol(RubyBasicObject symbol) {
return symbol.toString();
}

Original file line number Diff line number Diff line change
@@ -22,7 +22,6 @@
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
@@ -40,8 +39,8 @@ public NameToSymbolOrStringNode(RubyContext context, SourceSection sourceSection

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

@Specialization
public RubySymbol coerceRubySymbol(RubySymbol symbol) {
@Specialization(guards = "isRubySymbol(symbol)")
public RubyBasicObject coerceRubySymbol(RubyBasicObject 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("getContext().getSymbol(name)") RubySymbol symbolName) {
@Cached("getSymbol(name)") RubyBasicObject 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,6 +16,7 @@
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;

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

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

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

@Specialization
protected RubySymbol toSymbol(String string) {
return getContext().getSymbol(string);
protected RubyBasicObject toSymbol(String string) {
return 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 RubySymbol dollarUnderscore;
private final RubyBasicObject dollarUnderscore;

public LocalVariableGetNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
dollarUnderscore = getContext().getSymbol("$_");
dollarUnderscore = 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 RubySymbol dollarUnderscore;
private final RubyBasicObject dollarUnderscore;

public LocalVariableSetNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
dollarUnderscore = getContext().getSymbol("$_");
dollarUnderscore = 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, getContext().getSymbol((String) name));
ArrayNodes.slowPush(array, 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(), second.getByteList().getEncoding());
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(first.getRegex().getEncoding(), SymbolNodes.getByteList(second).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(first.getByteList().getEncoding(), second.getRegex().getEncoding());
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(SymbolNodes.getByteList(first).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), second);
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(StringNodes.getCodeRangeable(first), SymbolNodes.getCodeRangeable(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(first, second);
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(SymbolNodes.getCodeRangeable(first), SymbolNodes.getCodeRangeable(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, getContext().getSymbol("INTERNAL"), internalTuple);
lookupTableWriteNode.call(frame, ret, "[]=", null, 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, getContext().getSymbol("EXTERNAL"), externalTuple);
lookupTableWriteNode.call(frame, ret, "[]=", null, 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, getContext().getSymbol("LOCALE"), localeTuple);
lookupTableWriteNode.call(frame, ret, "[]=", null, 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, getContext().getSymbol("FILESYSTEM"), filesystemTuple);
lookupTableWriteNode.call(frame, ret, "[]=", null, 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, getContext().getSymbolTable().getSymbol("/"), b);
return redoCoercedNode.call(frame, a, "redo_coerced", null, getSymbol("/"), b);
}

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

@Specialization
public RubySymbol calleeName() {
public RubyBasicObject calleeName() {
CompilerDirectives.transferToInterpreter();
// the "called name" of a method.
return getContext().getSymbolTable().getSymbol(RubyCallStack.getCallingMethod(getContext()).getName());
return 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, getContext().getSymbolTable().getSymbol((String) name));
ArrayNodes.slowPush(array, 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, getContext().getSymbol((String) name));
ArrayNodes.slowPush(array, getSymbol((String) name));
}
}

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

@Specialization
public RubySymbol methodName() {
public RubyBasicObject methodName() {
CompilerDirectives.transferToInterpreter();
// the "original/definition name" of the method.
return getContext().getSymbolTable().getSymbol(RubyCallStack.getCallingMethod(getContext()).getSharedMethodInfo().getName());
return 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(index.getSymbolBytes());
final int i = matchData.getBackrefNumber(SymbolNodes.getByteList(index));

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 RubySymbol name(RubyBasicObject method) {
public RubyBasicObject name(RubyBasicObject method) {
CompilerDirectives.transferToInterpreter();

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

}
Loading