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

Commits on Jan 7, 2015

  1. Copy the full SHA
    44fc96e View commit details
  2. Copy the full SHA
    2168abb View commit details
8 changes: 4 additions & 4 deletions core/src/main/java/org/jruby/truffle/nodes/RubyNode.java
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ public Object isDefined(VirtualFrame frame) {
return getContext().makeString("expression");
}

public String executeJavaString(VirtualFrame frame) throws UnexpectedResultException {
public String executeString(VirtualFrame frame) throws UnexpectedResultException {
return RubyTypesGen.RUBYTYPES.expectString(execute(frame));
}

@@ -170,7 +170,7 @@ public RubyTime executeRubyTime(VirtualFrame frame) throws UnexpectedResultExcep
return RubyTypesGen.RUBYTYPES.expectRubyTime(execute(frame));
}

public RubyString executeString(VirtualFrame frame) throws UnexpectedResultException {
public RubyString executeRubyString(VirtualFrame frame) throws UnexpectedResultException {
return RubyTypesGen.RUBYTYPES.expectRubyString(execute(frame));
}
public RubyEncoding executeRubyEncoding(VirtualFrame frame) throws UnexpectedResultException {
@@ -189,11 +189,11 @@ public RubyEncodingConverter executeRubyEncodingConverter(VirtualFrame frame) th
return RubyTypesGen.RUBYTYPES.expectRubyEncodingConverter(execute(frame));
}

public Dispatch.DispatchAction executeDispatchAction(VirtualFrame frame) {
public Dispatch.DispatchAction executeDispatchAction(VirtualFrame frame) throws UnexpectedResultException {
throw new UnsupportedOperationException();
}

public LexicalScope executeLexicalScope(VirtualFrame frame) {
public LexicalScope executeLexicalScope(VirtualFrame frame) throws UnexpectedResultException {
throw new UnsupportedOperationException();
}

2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/truffle/nodes/RubyTypes.java
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
package org.jruby.truffle.nodes;

import com.oracle.truffle.api.dsl.TypeSystem;
import com.oracle.truffle.api.dsl.internal.DSLOptions;
import com.oracle.truffle.api.interop.TruffleObject;
import org.jruby.truffle.nodes.dispatch.Dispatch;
import org.jruby.truffle.runtime.LexicalScope;
@@ -20,6 +21,7 @@
* The list of types and type conversions that the AST interpreter knows about and can specialise
* using. Used by the DSL.
*/
@DSLOptions(useNewLayout=true)
@TypeSystem({ //
Dispatch.DispatchAction.class, //
LexicalScope.class, //
Original file line number Diff line number Diff line change
@@ -67,4 +67,9 @@ public boolean doBasicObject(RubyBasicObject object) {

public abstract boolean executeBoolean(VirtualFrame frame, Object value);

@Override
public final Object execute(VirtualFrame frame) {
return executeBoolean(frame);
}

}
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ public Object doProc(RubyProc proc) {
}

@Override
public RubyProc executeRubyProc(VirtualFrame frame) {
public final RubyProc executeRubyProc(VirtualFrame frame) {
final Object proc = execute(frame);

// The standard asRubyProc test doesn't allow for null
8 changes: 7 additions & 1 deletion core/src/main/java/org/jruby/truffle/nodes/cast/ToSNode.java
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ public ToSNode(ToSNode prev) {
}

@Override
public abstract RubyString executeString(VirtualFrame frame);
public abstract RubyString executeRubyString(VirtualFrame frame);

@Specialization
public RubyString toS(RubyString string) {
@@ -71,4 +71,10 @@ public RubyString toSFallback(VirtualFrame frame, Object object) {
return kernelToS(frame, object);
}
}

@Override
public final Object execute(VirtualFrame frame) {
return executeRubyString(frame);
}

}
Original file line number Diff line number Diff line change
@@ -27,7 +27,6 @@ public class OrNode extends RubyNode {
@Child protected RubyNode right;
private final ConditionProfile conditionProfile = ConditionProfile.createCountingProfile();


public OrNode(RubyContext context, SourceSection sourceSection, RubyNode left, RubyNode right) {
super(context, sourceSection);
this.left = left;
Original file line number Diff line number Diff line change
@@ -285,7 +285,7 @@ public PowNode(PowNode prev) {
}

@Specialization(guards = "canShiftIntoInt")
public int pow2(int a, int b) {
public int powTwo(int a, int b) {
return 1 << b;
}

Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ public Object execute(VirtualFrame frame) {
boolean tainted = false;

for (int n = 0; n < children.length; n++) {
final RubyString toInterpolate = children[n].executeString(frame);
final RubyString toInterpolate = children[n].executeRubyString(frame);
strings[n] = toInterpolate;
tainted |= taintedNode.tainted(toInterpolate);
}
12 changes: 6 additions & 6 deletions core/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
Original file line number Diff line number Diff line change
@@ -312,7 +312,7 @@ public BindingNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public abstract RubyBinding executeBinding(VirtualFrame frame);
public abstract RubyBinding executeRubyBinding(VirtualFrame frame);

@Specialization
public RubyBinding binding() {
@@ -430,7 +430,7 @@ public ClassNode(ClassNode prev) {
super(prev);
}

public abstract RubyClass executeGetClass(Object value);
public abstract RubyClass executeGetClass(VirtualFrame frame, Object value);

@Specialization
public RubyClass getClass(boolean value) {
@@ -561,7 +561,7 @@ protected RubyBinding getCallerBinding(VirtualFrame frame) {
CompilerDirectives.transferToInterpreterAndInvalidate();
bindingNode = insert(KernelNodesFactory.BindingNodeFactory.create(getContext(), getSourceSection(), new RubyNode[]{}));
}
return bindingNode.executeBinding(frame);
return bindingNode.executeRubyBinding(frame);
}

@Specialization
@@ -1198,7 +1198,7 @@ public IsANode(IsANode prev) {
super(prev);
}

public abstract boolean executeBoolean(Object self, RubyClass rubyClass);
public abstract boolean executeIsA(VirtualFrame frame, Object self, RubyClass rubyClass);

@Specialization
public boolean isA(RubyBasicObject self, RubyNilClass nil) {
@@ -1816,7 +1816,7 @@ public SingletonClassMethodNode(SingletonClassMethodNode prev) {

@Specialization
public RubyClass singletonClass(Object self) {
return singletonClassNode.executeSingletonClass(self);
return singletonClassNode.singletonClass(self);
}

}
@@ -2162,7 +2162,7 @@ public ToHexStringNode(ToHexStringNode prev) {
super(prev);
}

public abstract String executeToHexString(Object value);
public abstract String executeToHexString(VirtualFrame frame, Object value);

@Specialization
public String toHexString(int value) {
Original file line number Diff line number Diff line change
@@ -203,23 +203,4 @@ public Object dispatch(
}
}

@Fallback
public Object dispatch(
VirtualFrame frame,
LexicalScope lexicalScope,
Object receiverObject,
Object methodName,
Object blockObject,
Object argumentsObjects,
Dispatch.DispatchAction dispatchAction) {
return next.executeDispatch(
frame,
lexicalScope,
receiverObject,
methodName,
blockObject,
argumentsObjects,
dispatchAction);
}

}
}
Original file line number Diff line number Diff line change
@@ -153,25 +153,6 @@ public Object dispatch(
}
}

@Fallback
public Object dispatch(
VirtualFrame frame,
LexicalScope lexicalScope,
Object receiverObject,
Object methodName,
Object blockObject,
Object argumentsObjects,
Dispatch.DispatchAction dispatchAction) {
return next.executeDispatch(
frame,
lexicalScope,
receiverObject,
methodName,
CompilerDirectives.unsafeCast(blockObject, RubyProc.class, true, false),
argumentsObjects,
dispatchAction);
}

@Override
public String toString() {
return String.format("CachedBoxedDispatchNode(:%s, %s@%x, %s, %s)",
Original file line number Diff line number Diff line change
@@ -174,24 +174,4 @@ public Object dispatch(
}
}


@Fallback
public Object dispatch(
VirtualFrame frame,
LexicalScope lexicalScope,
Object receiverObject,
Object methodName,
Object blockObject,
Object argumentsObjects,
Dispatch.DispatchAction dispatchAction) {
return next.executeDispatch(
frame,
lexicalScope,
receiverObject,
methodName,
CompilerDirectives.unsafeCast(blockObject, RubyProc.class, true, false),
argumentsObjects, dispatchAction);
}


}
Original file line number Diff line number Diff line change
@@ -91,23 +91,4 @@ public Object dispatch(
}
}

@Fallback
public Object dispatch(
VirtualFrame frame,
LexicalScope lexicalScope,
Object receiverObject,
Object methodName,
Object blockObject,
Object argumentsObjects,
Dispatch.DispatchAction dispatchAction) {
return next.executeDispatch(
frame,
lexicalScope,
receiverObject,
methodName,
CompilerDirectives.unsafeCast(blockObject, RubyProc.class, true, false),
argumentsObjects,
dispatchAction);
}

}
Original file line number Diff line number Diff line change
@@ -123,23 +123,4 @@ public Object dispatch(
}
}

@Fallback
public Object dispatch(
VirtualFrame frame,
LexicalScope lexicalScope,
Object receiverObject,
Object methodName,
Object blockObject,
Object argumentsObjects,
Dispatch.DispatchAction dispatchAction) {
return next.executeDispatch(
frame,
lexicalScope,
receiverObject,
methodName,
CompilerDirectives.unsafeCast(blockObject, RubyProc.class, true, false),
argumentsObjects,
dispatchAction);
}

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

import com.oracle.truffle.api.dsl.Fallback;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.utilities.BranchProfile;
import org.jruby.truffle.runtime.LexicalScope;
import org.jruby.truffle.runtime.RubyContext;
@@ -77,6 +79,25 @@ protected final boolean guardName(
}
}

@Fallback
public Object dispatch(
VirtualFrame frame,
Object lexicalScope,
Object receiverObject,
Object methodName,
Object blockObject,
Object argumentsObjects,
Object dispatchAction) {
return next.executeDispatch(
frame,
(LexicalScope) lexicalScope,
receiverObject,
methodName,
blockObject,
argumentsObjects,
(Dispatch.DispatchAction) dispatchAction);
}

protected RubySymbol getCachedNameAsSymbol() {
return cachedNameAsSymbol;
}
Original file line number Diff line number Diff line change
@@ -133,25 +133,6 @@ public Object dispatch(
}
}

@Fallback
public Object dispatchFallback(
VirtualFrame frame,
LexicalScope lexicalScope,
Object receiverObject,
Object methodName,
Object blockObject,
Object argumentsObjects,
Dispatch.DispatchAction dispatchAction) {
return next.executeDispatch(
frame,
lexicalScope,
receiverObject,
methodName,
CompilerDirectives.unsafeCast(blockObject, RubyProc.class, true, false),
argumentsObjects,
dispatchAction);
}

protected static final boolean isPrimitive(
LexicalScope lexicalScope,
Object receiverObject,
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.runtime.RubyContext;
@@ -33,7 +34,7 @@ public SingletonClassNode(SingletonClassNode prev) {
super(prev);
}

public abstract RubyClass executeSingletonClass(Object value);
public abstract RubyClass executeSingletonClass(VirtualFrame frame, Object value);

@Specialization(guards = "isTrue")
protected RubyClass singletonClassTrue(boolean value) {
@@ -46,19 +47,19 @@ protected RubyClass singletonClassFalse(boolean value) {
}

@Specialization
protected Object singletonClass(int value) {
protected RubyClass singletonClass(int value) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().typeErrorCantDefineSingleton(this));
}

@Specialization
protected Object singletonClass(long value) {
protected RubyClass singletonClass(long value) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().typeErrorCantDefineSingleton(this));
}

@Specialization
protected Object singletonClass(double value) {
protected RubyClass singletonClass(double value) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().typeErrorCantDefineSingleton(this));
}