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

Commits on Mar 19, 2015

  1. [Truffle] Remove CoreMethodNode.name.

    * Better to simply rely on the current method name.
    eregon committed Mar 19, 2015
    Copy the full SHA
    199c217 View commit details
  2. [Truffle] The reverse call acutally always use "==", and not "===".

    * `3 === Object.new` calls object.==(3).
    eregon committed Mar 19, 2015
    Copy the full SHA
    4f0cda6 View commit details
Original file line number Diff line number Diff line change
@@ -43,6 +43,7 @@
import org.jruby.truffle.runtime.control.RedoException;
import org.jruby.truffle.runtime.core.*;
import org.jruby.truffle.runtime.methods.Arity;
import org.jruby.truffle.runtime.methods.InternalMethod;
import org.jruby.truffle.runtime.methods.SharedMethodInfo;
import org.jruby.truffle.runtime.util.ArrayUtils;
import org.jruby.util.ByteList;
@@ -329,8 +330,9 @@ public Object fallback(VirtualFrame frame, RubyArray array, RubyArray args) {
fallbackNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

InternalMethod method = RubyArguments.getMethod(frame.getArguments());
return fallbackNode.call(frame, array, "element_reference_fallback", null,
getContext().makeString(getName()), args);
getContext().makeString(method.getName()), args);
}

}
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@
*/
package org.jruby.truffle.nodes.core;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.nodes.RubyNode;
@@ -18,31 +17,12 @@
@NodeChild(value = "arguments", type = RubyNode[].class)
public abstract class CoreMethodNode extends RubyNode {

@CompilerDirectives.CompilationFinal private String name;

public CoreMethodNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public CoreMethodNode(CoreMethodNode prev) {
super(prev);
name = prev.name;
}

public String getName() {
if (name == null) {
throw new UnsupportedOperationException();
}

return name;
}

public void setName(String name) {
if (this.name != null) {
throw new UnsupportedOperationException();
}

this.name = name;
}

}
Original file line number Diff line number Diff line change
@@ -119,12 +119,6 @@ private static void addMethod(RubyModule module, RubyRootNode rootNode, List<Str
for (String name : names) {
final RubyRootNode rootNodeCopy = NodeUtil.cloneNode(rootNode);

final CoreMethodNode coreMethodNode = NodeUtil.findFirstNodeInstance(rootNodeCopy, CoreMethodNode.class);

if (coreMethodNode != null) {
coreMethodNode.setName(name);
}

final InternalMethod method = new InternalMethod(rootNodeCopy.getSharedMethodInfo(), name, module, visibility, false,
Truffle.getRuntime().createCallTarget(rootNodeCopy), null);

Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@
import org.jruby.truffle.nodes.dispatch.DispatchHeadNode;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNodeFactory;
import org.jruby.truffle.nodes.methods.UnsupportedOperationBehavior;
import org.jruby.truffle.runtime.RubyArguments;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.control.RaiseException;
@@ -32,6 +33,7 @@
import org.jruby.truffle.runtime.core.RubyBignum;
import org.jruby.truffle.runtime.core.RubyNilClass;
import org.jruby.truffle.runtime.core.RubyString;
import org.jruby.truffle.runtime.methods.InternalMethod;

import java.math.BigInteger;

@@ -875,7 +877,7 @@ public boolean equal(long a, RubyBignum b) {
"!isRubyBignum(arguments[1])"
})
public Object equal(VirtualFrame frame, Object a, Object b) {
return reverseCallNode.call(frame, b, getName(), null, a);
return reverseCallNode.call(frame, b, "==", null, a);
}

}
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@
import org.jruby.truffle.nodes.hash.FindEntryNode;
import org.jruby.truffle.nodes.yield.YieldDispatchHeadNode;
import org.jruby.truffle.runtime.DebugOperations;
import org.jruby.truffle.runtime.RubyArguments;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.control.RaiseException;
@@ -34,6 +35,7 @@
import org.jruby.truffle.runtime.hash.HashOperations;
import org.jruby.truffle.runtime.hash.HashSearchResult;
import org.jruby.truffle.runtime.hash.KeyValue;
import org.jruby.truffle.runtime.methods.InternalMethod;

import java.util.ArrayList;
import java.util.Arrays;
@@ -716,7 +718,8 @@ public Object each(VirtualFrame frame, RubyHash hash, UndefinedPlaceholder block
toEnumNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), true));
}

return toEnumNode.call(frame, hash, "to_enum", null, getContext().getSymbolTable().getSymbol(getName()));
InternalMethod method = RubyArguments.getMethod(frame.getArguments());
return toEnumNode.call(frame, hash, "to_enum", null, getContext().getSymbolTable().getSymbol(method.getName()));
}

}