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

Commits on May 25, 2015

  1. Copy the full SHA
    e8f33ba View commit details
  2. [Truffle] Revisit usages of DispatchHeadNodeFactory.

    * There were some null passed and useless usages of the most complex form.
    * Use createMethodCallOnSelf() when the visibility is ignored because
      we are just delegating on self and doing a fcall (no explicit receiver).
    eregon committed May 25, 2015
    Copy the full SHA
    6219d60 View commit details
  3. [Truffle] Fix warning.

    eregon committed May 25, 2015
    Copy the full SHA
    c0c086e View commit details
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ public WhenSplatNode(RubyContext context, SourceSection sourceSection, RubyNode
super(context, sourceSection);
this.readCaseExpression = readCaseExpression;
this.splat = splat;
dispatchCaseEqual = DispatchHeadNodeFactory.createMethodCall(context, false, false, null);
dispatchCaseEqual = DispatchHeadNodeFactory.createMethodCall(context);
}

@Override
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.nodes.NodeUtil;
import com.oracle.truffle.api.source.SourceSection;

import org.jruby.runtime.Visibility;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.cast.BooleanCastNodeGen;
@@ -98,7 +99,7 @@ public abstract static class NotEqualNode extends CoreMethodArrayArgumentsNode {

public NotEqualNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
equalNode = DispatchHeadNodeFactory.createMethodCall(context, false, false, null);
equalNode = DispatchHeadNodeFactory.createMethodCall(context);
}

@Specialization
@@ -270,7 +271,9 @@ public abstract static class SendNode extends CoreMethodArrayArgumentsNode {
public SendNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);

dispatchNode = DispatchHeadNodeFactory.createMethodCall(context, true, DispatchNode.DISPATCH_METAPROGRAMMING_ALWAYS_INDIRECT, MissingBehavior.CALL_METHOD_MISSING);
dispatchNode = new CallDispatchHeadNode(context, true,
DispatchNode.DISPATCH_METAPROGRAMMING_ALWAYS_INDIRECT,
MissingBehavior.CALL_METHOD_MISSING);

if (DispatchNode.DISPATCH_METAPROGRAMMING_ALWAYS_UNCACHED) {
dispatchNode.forceUncached();
Original file line number Diff line number Diff line change
@@ -224,7 +224,7 @@ public double div(double a, RubyBasicObject b) {
public Object div(VirtualFrame frame, double a, Object b) {
if (redoCoercedNode == null) {
CompilerDirectives.transferToInterpreter();
redoCoercedNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), true));
redoCoercedNode = insert(DispatchHeadNodeFactory.createMethodCallOnSelf(getContext()));
}

return redoCoercedNode.call(frame, a, "redo_coerced", null, getContext().getSymbolTable().getSymbol("/"), b);
@@ -407,7 +407,7 @@ public boolean equal(double a, RubyBasicObject b) {
public Object equal(VirtualFrame frame, double a, RubyBasicObject b) {
if (fallbackCallNode == null) {
CompilerDirectives.transferToInterpreter();
fallbackCallNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), true));
fallbackCallNode = insert(DispatchHeadNodeFactory.createMethodCallOnSelf(getContext()));
}

return fallbackCallNode.call(frame, a, "equal_fallback", null, b);
Original file line number Diff line number Diff line change
@@ -163,7 +163,7 @@ private boolean areSame(VirtualFrame frame, Object left, Object right) {
private boolean areEqual(VirtualFrame frame, Object left, Object right) {
if (equalNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
equalNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), false, false, null));
equalNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

return equalNode.callBoolean(frame, left, "==", null, right);
@@ -192,7 +192,7 @@ public abstract static class NotMatchNode extends CoreMethodArrayArgumentsNode {

public NotMatchNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
matchNode = DispatchHeadNodeFactory.createMethodCall(context, false, false, null);
matchNode = DispatchHeadNodeFactory.createMethodCall(context);
}

@Specialization
@@ -387,7 +387,7 @@ public CloneNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
copyNode = CopyNodeFactory.create(context, sourceSection, null);
// Calls private initialize_clone on the new copy.
initializeCloneNode = DispatchHeadNodeFactory.createMethodCall(context, true, MissingBehavior.CALL_METHOD_MISSING);
initializeCloneNode = DispatchHeadNodeFactory.createMethodCallOnSelf(context);
isFrozenNode = IsFrozenNodeGen.create(context, sourceSection, null);
freezeNode = FreezeNodeGen.create(context, sourceSection, null);
singletonClassNode = SingletonClassNodeGen.create(context, sourceSection, null);
@@ -425,7 +425,7 @@ public DupNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
copyNode = CopyNodeFactory.create(context, sourceSection, null);
// Calls private initialize_dup on the new copy.
initializeDupNode = DispatchHeadNodeFactory.createMethodCall(context, true, MissingBehavior.CALL_METHOD_MISSING);
initializeDupNode = DispatchHeadNodeFactory.createMethodCallOnSelf(context);
}

@Specialization
Original file line number Diff line number Diff line change
@@ -1176,7 +1176,7 @@ public long leftShiftNeg(long a, int b) {
public Object leftShiftFallback(VirtualFrame frame, Object a, Object b) {
if (fallbackCallNode == null) {
CompilerDirectives.transferToInterpreter();
fallbackCallNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), true));
fallbackCallNode = insert(DispatchHeadNodeFactory.createMethodCallOnSelf(getContext()));
}

return fallbackCallNode.call(frame, a, "left_shift_fallback", null, b);
@@ -1304,7 +1304,7 @@ public int rightShift(long a, RubyBasicObject b) {
public Object rightShiftFallback(VirtualFrame frame, Object a, Object b) {
if (fallbackCallNode == null) {
CompilerDirectives.transferToInterpreter();
fallbackCallNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), true));
fallbackCallNode = insert(DispatchHeadNodeFactory.createMethodCallOnSelf(getContext()));
}

return fallbackCallNode.call(frame, a, "right_shift_fallback", null, b);
Original file line number Diff line number Diff line change
@@ -105,7 +105,7 @@ public static class SmallHashLiteralNode extends HashLiteralNode {
public SmallHashLiteralNode(RubyContext context, SourceSection sourceSection, RubyNode[] keyValues) {
super(context, sourceSection, keyValues);
hashNode = new HashNode(context, sourceSection);
equalNode = DispatchHeadNodeFactory.createMethodCall(context, false, false, null);
equalNode = DispatchHeadNodeFactory.createMethodCall(context);
}

@ExplodeLoop
Original file line number Diff line number Diff line change
@@ -137,7 +137,7 @@ public abstract static class GetIndexNode extends CoreMethodArrayArgumentsNode {
public GetIndexNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
hashNode = new HashNode(context, sourceSection);
eqlNode = DispatchHeadNodeFactory.createMethodCall(context, false, false, null);
eqlNode = DispatchHeadNodeFactory.createMethodCall(context);
equalNode = BasicObjectNodesFactory.ReferenceEqualNodeFactory.create(context, sourceSection, null, null);
callDefaultNode = DispatchHeadNodeFactory.createMethodCall(context);
lookupEntryNode = new LookupEntryNode(context, sourceSection);
@@ -252,7 +252,7 @@ public abstract static class SetIndexNode extends CoreMethodArrayArgumentsNode {
public SetIndexNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
hashNode = new HashNode(context, sourceSection);
eqlNode = DispatchHeadNodeFactory.createMethodCall(context, false, false, null);
eqlNode = DispatchHeadNodeFactory.createMethodCall(context);
equalNode = BasicObjectNodesFactory.ReferenceEqualNodeFactory.create(context, sourceSection, null, null);
}

@@ -481,7 +481,7 @@ public abstract static class DeleteNode extends CoreMethodArrayArgumentsNode {
public DeleteNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
hashNode = new HashNode(context, sourceSection);
eqlNode = DispatchHeadNodeFactory.createMethodCall(context, false, false, null);
eqlNode = DispatchHeadNodeFactory.createMethodCall(context);
lookupEntryNode = new LookupEntryNode(context, sourceSection);
yieldNode = new YieldDispatchHeadNode(context);
}
@@ -642,7 +642,7 @@ private Collection<KeyValue> verySlowToKeyValues(RubyHash hash) {
public Object each(VirtualFrame frame, RubyHash hash, UndefinedPlaceholder block) {
if (toEnumNode == null) {
CompilerDirectives.transferToInterpreter();
toEnumNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), true));
toEnumNode = insert(DispatchHeadNodeFactory.createMethodCallOnSelf(getContext()));
}

InternalMethod method = RubyArguments.getMethod(frame.getArguments());
@@ -856,7 +856,7 @@ public abstract static class MergeNode extends YieldingCoreMethodNode {

public MergeNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
eqlNode = DispatchHeadNodeFactory.createMethodCall(context, false, false, null);
eqlNode = DispatchHeadNodeFactory.createMethodCall(context);
}

@Specialization(guards = {"isPackedArrayStorage(hash)", "isNullStorage(other)", "!isCompareByIdentity(hash)"})
@@ -1021,7 +1021,7 @@ public RubyHash merge(VirtualFrame frame, RubyHash hash, RubyHash other, RubyPro
public Object merge(VirtualFrame frame, RubyHash hash, Object other, Object block) {
if (fallbackCallNode == null) {
CompilerDirectives.transferToInterpreter();
fallbackCallNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), true));
fallbackCallNode = insert(DispatchHeadNodeFactory.createMethodCallOnSelf(getContext()));
}

final RubyProc blockProc;
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ public class LookupEntryNode extends RubyNode {
public LookupEntryNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
hashNode = new HashNode(context, sourceSection);
eqlNode = DispatchHeadNodeFactory.createMethodCall(context, false, false, null);
eqlNode = DispatchHeadNodeFactory.createMethodCall(context);
equalNode = BasicObjectNodesFactory.ReferenceEqualNodeFactory.create(context, sourceSection, null, null);
}

Original file line number Diff line number Diff line change
@@ -11,9 +11,9 @@

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.VirtualFrame;

import org.jruby.truffle.nodes.cast.BooleanCastNode;
import org.jruby.truffle.nodes.cast.BooleanCastNodeGen;
import org.jruby.truffle.runtime.LexicalScope;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.core.RubyProc;
@@ -22,7 +22,7 @@ public class CallDispatchHeadNode extends DispatchHeadNode {

@Child private BooleanCastNode booleanCastNode;

public CallDispatchHeadNode(RubyContext context, boolean ignoreVisibility, boolean indirect, MissingBehavior missingBehavior, LexicalScope lexicalScope) {
public CallDispatchHeadNode(RubyContext context, boolean ignoreVisibility, boolean indirect, MissingBehavior missingBehavior) {
super(context, ignoreVisibility, indirect, missingBehavior, DispatchAction.CALL_METHOD);
}

Original file line number Diff line number Diff line change
@@ -18,48 +18,35 @@ public static CallDispatchHeadNode createMethodCall(RubyContext context) {
context,
false,
false,
MissingBehavior.CALL_METHOD_MISSING,
null);
MissingBehavior.CALL_METHOD_MISSING);
}

public static CallDispatchHeadNode createMethodCallOnSelf(RubyContext context) {
return createMethodCall(context, true);
}

public static CallDispatchHeadNode createMethodCall(RubyContext context, boolean ignoreVisibility) {
return new CallDispatchHeadNode(
context,
ignoreVisibility,
false,
MissingBehavior.CALL_METHOD_MISSING,
null);
MissingBehavior.CALL_METHOD_MISSING);
}

public static CallDispatchHeadNode createMethodCall(RubyContext context, MissingBehavior missingBehavior) {
return new CallDispatchHeadNode(
context,
false,
false,
missingBehavior,
null);
missingBehavior);
}

public static CallDispatchHeadNode createMethodCall(RubyContext context, boolean ignoreVisibility, MissingBehavior missingBehavior) {
return new CallDispatchHeadNode(
context,
ignoreVisibility,
false,
missingBehavior,
null);
}

public static CallDispatchHeadNode createMethodCall(RubyContext context, boolean ignoreVisibility, boolean indirect, MissingBehavior missingBehavior) {
return new CallDispatchHeadNode(
context,
ignoreVisibility,
indirect,
missingBehavior,
null);
}

public static CallDispatchHeadNode createMethodCallOnSelf(RubyContext context) {
return createMethodCall(context, true);
missingBehavior);
}

}
Original file line number Diff line number Diff line change
@@ -90,7 +90,7 @@ public RubyCallNode(RubyContext context, SourceSection section, String methodNam
this.isSplatted = isSplatted;
this.isVCall = isVCall;

dispatchHead = DispatchHeadNodeFactory.createMethodCall(context, ignoreVisibility, false, MissingBehavior.CALL_METHOD_MISSING);
dispatchHead = DispatchHeadNodeFactory.createMethodCall(context, ignoreVisibility);
respondToMissing = DispatchHeadNodeFactory.createMethodCall(context, true, MissingBehavior.RETURN_MISSING);
respondToMissingCast = BooleanCastNodeGen.create(context, section, null);

Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ public DefineOrGetClassNode(RubyContext context, SourceSection sourceSection, St
private void callInherited(VirtualFrame frame, RubyClass superClass, RubyClass subClass) {
if (inheritedNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
inheritedNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), true));
inheritedNode = insert(DispatchHeadNodeFactory.createMethodCallOnSelf(getContext()));
}
inheritedNode.call(frame, superClass, "inherited", null, subClass);
}
2 changes: 1 addition & 1 deletion truffle/src/main/ruby/core/thread.rb
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ def __thread_local_variables
end

def self.start(&block)
Thread.new &block
Thread.new(&block)
end

end