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

Commits on Jun 5, 2015

  1. Copy the full SHA
    8aafce4 View commit details

Commits on Jun 8, 2015

  1. Copy the full SHA
    4c8ee62 View commit details
  2. Copy the full SHA
    72e4bc8 View commit details
  3. Copy the full SHA
    73543a3 View commit details
  4. Copy the full SHA
    48ea137 View commit details
  5. Copy the full SHA
    d4a9b11 View commit details
Showing with 229 additions and 375 deletions.
  1. +2 −1 truffle/src/main/java/org/jruby/truffle/nodes/coerce/NameToJavaStringNode.java
  2. +2 −1 truffle/src/main/java/org/jruby/truffle/nodes/conversion/ToJavaStringNode.java
  3. +2 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/BasicObjectNodes.java
  4. +9 −9 truffle/src/main/java/org/jruby/truffle/nodes/core/BindingNodes.java
  5. +4 −4 truffle/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
  6. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/MatchDataNodes.java
  7. +8 −8 truffle/src/main/java/org/jruby/truffle/nodes/core/ModuleNodes.java
  8. +2 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/ProcessNodes.java
  9. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/RegexpNodes.java
  10. +28 −313 truffle/src/main/java/org/jruby/truffle/nodes/core/SymbolNodes.java
  11. +2 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/TruffleInteropNodes.java
  12. +21 −4 truffle/src/main/java/org/jruby/truffle/nodes/dispatch/UnresolvedDispatchNode.java
  13. +2 −1 truffle/src/main/java/org/jruby/truffle/nodes/interop/InteropNode.java
  14. +2 −1 truffle/src/main/java/org/jruby/truffle/nodes/interop/RubyToIndexLabelNode.java
  15. +3 −2 truffle/src/main/java/org/jruby/truffle/runtime/core/RubyBasicObject.java
  16. +3 −1 truffle/src/main/java/org/jruby/truffle/runtime/core/RubySymbol.java
  17. +19 −6 truffle/src/main/java/org/jruby/truffle/runtime/core/SymbolCodeRangeableWrapper.java
  18. +40 −16 truffle/src/main/java/org/jruby/truffle/runtime/core/SymbolTable.java
  19. +2 −0 truffle/src/main/ruby/core.rb
  20. +15 −0 truffle/src/main/ruby/core/pre.rb
  21. +61 −0 truffle/src/main/ruby/core/rubinius/common/symbol.rb
Original file line number Diff line number Diff line change
@@ -16,6 +16,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.SymbolNodes;
import org.jruby.truffle.nodes.dispatch.CallDispatchHeadNode;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNodeFactory;
import org.jruby.truffle.runtime.RubyContext;
@@ -41,7 +42,7 @@ public NameToJavaStringNode(RubyContext context, SourceSection sourceSection) {

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

@Specialization
Original file line number Diff line number Diff line change
@@ -15,6 +15,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.SymbolNodes;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.core.RubyString;
import org.jruby.truffle.runtime.core.RubySymbol;
@@ -33,7 +34,7 @@ public ToJavaStringNode(RubyContext context, SourceSection sourceSection) {
@TruffleBoundary
@Specialization
protected String toJavaString(RubySymbol symbol) {
return symbol.toString();
return SymbolNodes.getString(symbol);
}

@TruffleBoundary
Original file line number Diff line number Diff line change
@@ -244,11 +244,11 @@ private Object methodMissing(Object self, RubySymbol name, Object[] args, RubyPr
if (lastCallWasVCall()) {
throw new RaiseException(
getContext().getCoreLibrary().nameErrorUndefinedLocalVariableOrMethod(
name.toString(),
SymbolNodes.getString(name),
getContext().getCoreLibrary().getLogicalClass(self).getName(),
this));
} else {
throw new RaiseException(getContext().getCoreLibrary().noMethodErrorOnReceiver(name.toString(), self, this));
throw new RaiseException(getContext().getCoreLibrary().noMethodErrorOnReceiver(SymbolNodes.getString(name), self, this));
}
}

Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ public Object localVariableGetCached(RubyBinding binding, RubySymbol symbol,
@Cached("createReadNode(cachedFrameSlot)") ReadFrameSlotNode readLocalVariableNode) {
if (cachedFrameSlot == null) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().nameErrorLocalVariableNotDefined(symbol.toString(), binding, this));
throw new RaiseException(getContext().getCoreLibrary().nameErrorLocalVariableNotDefined(SymbolNodes.getString(symbol), binding, this));
} else {
return readLocalVariableNode.executeRead(binding.getFrame());
}
@@ -98,10 +98,10 @@ public Object localVariableGetCached(RubyBinding binding, RubySymbol symbol,
@Specialization(guards = "!isLastLine(symbol)")
public Object localVariableGetUncached(RubyBinding binding, RubySymbol symbol) {
final MaterializedFrame frame = binding.getFrame();
final FrameSlot frameSlot = frame.getFrameDescriptor().findFrameSlot(symbol.toString());
final FrameSlot frameSlot = frame.getFrameDescriptor().findFrameSlot(SymbolNodes.getString(symbol));

if (frameSlot == null) {
throw new RaiseException(getContext().getCoreLibrary().nameErrorLocalVariableNotDefined(symbol.toString(), binding, this));
throw new RaiseException(getContext().getCoreLibrary().nameErrorLocalVariableNotDefined(SymbolNodes.getString(symbol), binding, this));
}

return frame.getValue(frameSlot);
@@ -111,10 +111,10 @@ public Object localVariableGetUncached(RubyBinding binding, RubySymbol symbol) {
@Specialization(guards = "isLastLine(symbol)")
public Object localVariableGetLastLine(RubyBinding binding, RubySymbol symbol) {
final MaterializedFrame frame = binding.getFrame();
final FrameSlot frameSlot = frame.getFrameDescriptor().findFrameSlot(symbol.toString());
final FrameSlot frameSlot = frame.getFrameDescriptor().findFrameSlot(SymbolNodes.getString(symbol));

if (frameSlot == null) {
throw new RaiseException(getContext().getCoreLibrary().nameErrorLocalVariableNotDefined(symbol.toString(), binding, this));
throw new RaiseException(getContext().getCoreLibrary().nameErrorLocalVariableNotDefined(SymbolNodes.getString(symbol), binding, this));
}

final Object value = frame.getValue(frameSlot);
@@ -130,7 +130,7 @@ protected FrameDescriptor getFrameDescriptor(RubyBinding binding) {
}

protected FrameSlot findFrameSlot(RubyBinding binding, RubySymbol symbol) {
final String symbolString = symbol.toString();
final String symbolString = SymbolNodes.getString(symbol);

MaterializedFrame frame = binding.getFrame();

@@ -187,7 +187,7 @@ public Object localVariableSetCached(RubyBinding binding, RubySymbol symbol, Obj
@Specialization(guards = "!isLastLine(symbol)")
public Object localVariableSetUncached(RubyBinding binding, RubySymbol symbol, Object value) {
final MaterializedFrame frame = binding.getFrame();
final FrameSlot frameSlot = frame.getFrameDescriptor().findFrameSlot(symbol.toString());
final FrameSlot frameSlot = frame.getFrameDescriptor().findFrameSlot(SymbolNodes.getString(symbol));
frame.setObject(frameSlot, value);
return value;
}
@@ -196,7 +196,7 @@ public Object localVariableSetUncached(RubyBinding binding, RubySymbol symbol, O
@Specialization(guards = "isLastLine(symbol)")
public Object localVariableSetLastLine(RubyBinding binding, RubySymbol symbol, Object value) {
final MaterializedFrame frame = binding.getFrame();
final FrameSlot frameSlot = frame.getFrameDescriptor().findFrameSlot(symbol.toString());
final FrameSlot frameSlot = frame.getFrameDescriptor().findFrameSlot(SymbolNodes.getString(symbol));
frame.setObject(frameSlot, ThreadLocalObject.wrap(getContext(), value));
return value;
}
@@ -206,7 +206,7 @@ protected FrameDescriptor getFrameDescriptor(RubyBinding binding) {
}

protected FrameSlot findFrameSlot(RubyBinding binding, RubySymbol symbol) {
final String symbolString = symbol.toString();
final String symbolString = SymbolNodes.getString(symbol);

MaterializedFrame frame = binding.getFrame();

Original file line number Diff line number Diff line change
@@ -850,7 +850,7 @@ public boolean isInstanceVariableDefined(RubyBasicObject object, RubyString name
public boolean isInstanceVariableDefined(RubyBasicObject object, RubySymbol name) {
CompilerDirectives.transferToInterpreter();

return object.isFieldDefined(RubyContext.checkInstanceVariableName(getContext(), name.toString(), this));
return object.isFieldDefined(RubyContext.checkInstanceVariableName(getContext(), SymbolNodes.getString(name), this));
}

}
@@ -871,7 +871,7 @@ public Object instanceVariableGet(RubyBasicObject object, RubyString name) {
@TruffleBoundary
@Specialization
public Object instanceVariableGet(RubyBasicObject object, RubySymbol name) {
return instanceVariableGet(object, name.toString());
return instanceVariableGet(object, SymbolNodes.getString(name));
}

private Object instanceVariableGet(RubyBasicObject object, String name) {
@@ -899,7 +899,7 @@ public Object instanceVariableSet(RubyBasicObject object, RubyString name, Objec
@TruffleBoundary
@Specialization
public Object instanceVariableSet(RubyBasicObject object, RubySymbol name, Object value) {
RubyBasicObject.setInstanceVariable(object, RubyContext.checkInstanceVariableName(getContext(), name.toString(), this), value);
RubyBasicObject.setInstanceVariable(object, RubyContext.checkInstanceVariableName(getContext(), SymbolNodes.getString(name), this), value);
return value;
}

@@ -1071,7 +1071,7 @@ public MethodNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyBasicObject method(Object object, RubySymbol name) {
return method(object, name.toString());
return method(object, SymbolNodes.getString(name));
}

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

throw new RaiseException(
getContext().getCoreLibrary().indexError(String.format("undefined group name reference: %s", index.toString()), this));
getContext().getCoreLibrary().indexError(String.format("undefined group name reference: %s", SymbolNodes.getString(index)), this));
}
}

Original file line number Diff line number Diff line change
@@ -530,7 +530,7 @@ public AutoloadNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyBasicObject autoload(RubyModule module, RubySymbol name, RubyString filename) {
return autoload(module, name.toString(), filename);
return autoload(module, SymbolNodes.getString(name), filename);
}

@Specialization
@@ -564,7 +564,7 @@ public AutoloadQueryNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object autoloadQuery(RubyModule module, RubySymbol name) {
return autoloadQuery(module, name.toString());
return autoloadQuery(module, SymbolNodes.getString(name));
}

@Specialization
@@ -713,7 +713,7 @@ public boolean isClassVariableDefined(RubyModule module, RubyString name) {
public boolean isClassVariableDefined(RubyModule module, RubySymbol name) {
CompilerDirectives.transferToInterpreter();

return module.getClassVariables().containsKey(name.toString());
return module.getClassVariables().containsKey(SymbolNodes.getString(name));
}

}
@@ -881,12 +881,12 @@ public Object getConstant(VirtualFrame frame, RubyModule module, RubySymbol name

@Specialization(guards = "inherit")
public Object getConstant(VirtualFrame frame, RubyModule module, RubySymbol name, boolean inherit) {
return getConstantNode.executeGetConstant(frame, module, name.toString());
return getConstantNode.executeGetConstant(frame, module, SymbolNodes.getString(name));
}

@Specialization(guards = "!inherit")
public Object getConstantNoInherit(VirtualFrame frame, RubyModule module, RubySymbol name, boolean inherit) {
return getConstantNoInherit(module, name.toString(), this);
return getConstantNoInherit(module, SymbolNodes.getString(name), this);
}

// String
@@ -1645,7 +1645,7 @@ public RubyModule privateConstant(RubyModule module, Object[] args) {

for (Object name : args) {
if (RubyGuards.isRubySymbol(name)) {
module.changeConstantVisibility(this, name.toString(), true);
module.changeConstantVisibility(this, SymbolNodes.getString((RubyBasicObject) name), true);
} else {
throw new UnsupportedOperationException();
}
@@ -1667,7 +1667,7 @@ public RubyModule publicConstant(RubyModule module, Object[] args) {

for (Object name : args) {
if (RubyGuards.isRubySymbol(name)) {
module.changeConstantVisibility(this, name.toString(), false);
module.changeConstantVisibility(this, SymbolNodes.getString((RubyBasicObject) name), false);
} else {
throw new UnsupportedOperationException();
}
@@ -1712,7 +1712,7 @@ public RubyModule removeClassVariable(RubyModule module, RubyString name) {
public RubyModule removeClassVariable(RubyModule module, RubySymbol name) {
CompilerDirectives.transferToInterpreter();

module.removeClassVariable(this, name.toString());
module.removeClassVariable(this, SymbolNodes.getString(name));
return module;
}

Original file line number Diff line number Diff line change
@@ -65,7 +65,7 @@ Object timeToUnit(long time, RubySymbol unit) {
} else if (unit == floatSecondSymbol) {
return time / 1e9;
} else {
throw new UnsupportedOperationException(unit.toString());
throw new UnsupportedOperationException(SymbolNodes.getString(unit));
}
}

@@ -92,7 +92,7 @@ public int kill(RubySymbol signalName, int pid) {
int self = posix().getpid();

if (self == pid) {
Signal signal = new Signal(signalName.toString());
Signal signal = new Signal(SymbolNodes.getString(signalName));

SignalOperations.raise(signal);
return 1;
Original file line number Diff line number Diff line change
@@ -142,7 +142,7 @@ public RubyBasicObject quote(RubyBasicObject raw) {

@Specialization
public RubyBasicObject quote(RubySymbol raw) {
return quote(StringNodes.createString(raw.getContext().getCoreLibrary().getStringClass(), raw.toString()));
return quote(StringNodes.createString(raw.getContext().getCoreLibrary().getStringClass(), SymbolNodes.getString(raw)));
}

}
Loading