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

Commits on Feb 18, 2016

  1. Copy the full SHA
    1739147 View commit details
  2. Copy the full SHA
    a639003 View commit details
  3. Copy the full SHA
    e6a2a2c View commit details
  4. Copy the full SHA
    400615d View commit details
  5. Copy the full SHA
    9a89810 View commit details
  6. 3
    Copy the full SHA
    6e3f361 View commit details
Showing with 47 additions and 143 deletions.
  1. +1 −1 truffle/src/main/java/org/jruby/truffle/core/CoreLibrary.java
  2. +1 −1 truffle/src/main/java/org/jruby/truffle/core/coerce/NameToJavaStringNode.java
  3. +1 −1 truffle/src/main/java/org/jruby/truffle/core/coerce/NameToSymbolOrStringNode.java
  4. +1 −1 truffle/src/main/java/org/jruby/truffle/core/coerce/ToAryNode.java
  5. +1 −1 truffle/src/main/java/org/jruby/truffle/core/coerce/ToFNode.java
  6. +1 −1 truffle/src/main/java/org/jruby/truffle/core/coerce/ToIntNode.java
  7. +1 −1 truffle/src/main/java/org/jruby/truffle/core/coerce/ToProcNode.java
  8. +1 −1 truffle/src/main/java/org/jruby/truffle/core/coerce/ToStrNode.java
  9. +3 −3 truffle/src/main/java/org/jruby/truffle/core/fiber/FiberNodes.java
  10. +1 −1 truffle/src/main/java/org/jruby/truffle/core/kernel/AtExitManager.java
  11. +1 −1 truffle/src/main/java/org/jruby/truffle/core/string/StringNodes.java
  12. +1 −1 truffle/src/main/java/org/jruby/truffle/core/thread/ThreadManager.java
  13. +1 −1 truffle/src/main/java/org/jruby/truffle/core/thread/ThreadNodes.java
  14. +1 −1 truffle/src/main/java/org/jruby/truffle/language/constants/ReadConstantWithLexicalScopeNode.java
  15. +2 −2 truffle/src/main/java/org/jruby/truffle/language/constants/ReadLiteralConstantNode.java
  16. +0 −5 truffle/src/main/java/org/jruby/truffle/language/control/BreakException.java
  17. +1 −0 truffle/src/main/java/org/jruby/truffle/language/control/BreakID.java
  18. +7 −4 truffle/src/main/java/org/jruby/truffle/language/control/BreakNode.java
  19. +2 −17 truffle/src/main/java/org/jruby/truffle/language/control/ElidableResultNode.java
  20. +0 −3 truffle/src/main/java/org/jruby/truffle/language/control/FrameOnStackMarker.java
  21. +0 −5 truffle/src/main/java/org/jruby/truffle/language/control/NextException.java
  22. +0 −1 truffle/src/main/java/org/jruby/truffle/language/control/NextNode.java
  23. +7 −2 truffle/src/main/java/org/jruby/truffle/language/control/OnceNode.java
  24. +0 −21 truffle/src/main/java/org/jruby/truffle/language/control/QuitException.java
  25. +5 −23 truffle/src/main/java/org/jruby/truffle/language/control/RaiseException.java
  26. +0 −5 truffle/src/main/java/org/jruby/truffle/language/control/RedoException.java
  27. +0 −5 truffle/src/main/java/org/jruby/truffle/language/control/RetryException.java
  28. +0 −11 truffle/src/main/java/org/jruby/truffle/language/control/ReturnException.java
  29. +1 −3 truffle/src/main/java/org/jruby/truffle/language/control/ReturnID.java
  30. +1 −4 truffle/src/main/java/org/jruby/truffle/language/control/ReturnNode.java
  31. +0 −2 truffle/src/main/java/org/jruby/truffle/language/control/ThreadExitException.java
  32. +0 −6 truffle/src/main/java/org/jruby/truffle/language/control/ThrowException.java
  33. +0 −3 truffle/src/main/java/org/jruby/truffle/language/control/TruffleFatalException.java
  34. +1 −1 truffle/src/main/java/org/jruby/truffle/language/exceptions/EnsureNode.java
  35. +2 −2 truffle/src/main/java/org/jruby/truffle/language/exceptions/TryNode.java
  36. +1 −1 truffle/src/main/java/org/jruby/truffle/language/translator/BodyTranslator.java
  37. +1 −1 truffle/src/main/java/org/jruby/truffle/tools/SimpleShell.java
Original file line number Diff line number Diff line change
@@ -764,7 +764,7 @@ public void initializeAfterBasicMethodsAdded() {

Main.printTruffleTimeMetric("after-load-core");
} catch (RaiseException e) {
final Object rubyException = e.getRubyException();
final Object rubyException = e.getException();
BacktraceFormatter.createDefaultFormatter(getContext()).printBacktrace(context, (DynamicObject) rubyException, Layouts.EXCEPTION.getBacktrace((DynamicObject) rubyException));
throw new TruffleFatalException("couldn't load the core library", e);
} finally {
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ public String coerceObject(VirtualFrame frame, Object object) {
try {
coerced = toStr.call(frame, object, "to_str", null);
} catch (RaiseException e) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getRubyException()) == getContext().getCoreLibrary().getNoMethodErrorClass()) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getException()) == getContext().getCoreLibrary().getNoMethodErrorClass()) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().typeErrorNoImplicitConversion(object, "String", this));
} else {
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ public DynamicObject coerceObject(VirtualFrame frame, Object object) {
try {
coerced = toStr.call(frame, object, "to_str", null);
} catch (RaiseException e) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getRubyException()) == getContext().getCoreLibrary().getNoMethodErrorClass()) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getException()) == getContext().getCoreLibrary().getNoMethodErrorClass()) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().typeErrorNoImplicitConversion(object, "String", this));
} else {
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ public DynamicObject coerceObject(VirtualFrame frame, Object object) {
try {
coerced = toAryNode.call(frame, object, "to_ary", null);
} catch (RaiseException e) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getRubyException()) == getContext().getCoreLibrary().getNoMethodErrorClass()) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getException()) == getContext().getCoreLibrary().getNoMethodErrorClass()) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().typeErrorNoImplicitConversion(object, "Array", this));
} else {
Original file line number Diff line number Diff line change
@@ -80,7 +80,7 @@ private double coerceObject(VirtualFrame frame, Object object) {
try {
coerced = toFNode.call(frame, object, "to_f", null);
} catch (RaiseException e) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getRubyException()) == getContext().getCoreLibrary().getNoMethodErrorClass()) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getException()) == getContext().getCoreLibrary().getNoMethodErrorClass()) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().typeErrorNoImplicitConversion(object, "Float", this));
} else {
Original file line number Diff line number Diff line change
@@ -117,7 +117,7 @@ private Object coerceObject(VirtualFrame frame, Object object) {
try {
coerced = toIntNode.call(frame, object, "to_int", null);
} catch (RaiseException e) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getRubyException()) == getContext().getCoreLibrary().getNoMethodErrorClass()) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getException()) == getContext().getCoreLibrary().getNoMethodErrorClass()) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().typeErrorNoImplicitConversion(object, "Integer", this));
} else {
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ public DynamicObject doObject(VirtualFrame frame, Object object,
try {
coerced = toProc.call(frame, object, "to_proc", null);
} catch (RaiseException e) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getRubyException()) == getContext().getCoreLibrary().getNoMethodErrorClass()) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getException()) == getContext().getCoreLibrary().getNoMethodErrorClass()) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().typeErrorNoImplicitConversion(object, "Proc", this));
} else {
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ public DynamicObject coerceObject(VirtualFrame frame, Object object) {
try {
coerced = toStrNode.call(frame, object, "to_str", null);
} catch (RaiseException e) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getRubyException()) == getContext().getCoreLibrary().getNoMethodErrorClass()) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getException()) == getContext().getCoreLibrary().getNoMethodErrorClass()) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().typeErrorNoImplicitConversion(object, "String", this));
} else {
Original file line number Diff line number Diff line change
@@ -112,7 +112,7 @@ public void run() {
} catch (ReturnException e) {
Layouts.FIBER.getMessageQueue(Layouts.FIBER.getLastResumedByFiber(fiber)).add(new FiberExceptionMessage(context.getCoreLibrary().unexpectedReturn(null)));
} catch (RaiseException e) {
Layouts.FIBER.getMessageQueue(Layouts.FIBER.getLastResumedByFiber(fiber)).add(new FiberExceptionMessage(e.getRubyException()));
Layouts.FIBER.getMessageQueue(Layouts.FIBER.getLastResumedByFiber(fiber)).add(new FiberExceptionMessage(e.getException()));
}
}
});
@@ -125,9 +125,9 @@ public static void run(RubyContext context, DynamicObject fiber, Node currentNod
try {
task.run();
} catch (RaiseException e) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getRubyException()) == context.getCoreLibrary().getSystemExitClass()) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getException()) == context.getCoreLibrary().getSystemExitClass()) {
// SystemExit: send it to the main thread if it reached here
ThreadRaisePrimitiveNode.raiseInThread(context, context.getThreadManager().getRootThread(), e.getRubyException(), currentNode);
ThreadRaisePrimitiveNode.raiseInThread(context, context.getThreadManager().getRootThread(), e.getException(), currentNode);
}
throw e;
} finally {
Original file line number Diff line number Diff line change
@@ -80,7 +80,7 @@ public List<DynamicObject> getHandlers() {
}

public static DynamicObject handleAtExitException(RubyContext context, RaiseException raiseException) {
final DynamicObject rubyException = raiseException.getRubyException();
final DynamicObject rubyException = raiseException.getException();
if (Layouts.BASIC_OBJECT.getLogicalClass(rubyException) == context.getCoreLibrary().getSystemExitClass()) {
// Do not show SystemExit errors, just track them for the exit status
} else {
Original file line number Diff line number Diff line change
@@ -397,7 +397,7 @@ public Object compare(VirtualFrame frame, DynamicObject a, Object b) {

return compare(a, coerced);
} catch (RaiseException e) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getRubyException()) == getContext().getCoreLibrary().getTypeErrorClass()) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getException()) == getContext().getCoreLibrary().getTypeErrorClass()) {
return nil();
} else {
throw e;
Original file line number Diff line number Diff line change
@@ -247,7 +247,7 @@ public synchronized Void apply(DynamicObject thread, Node currentNode) {
});
break; // Successfully executed the safepoint and sent the exceptions.
} catch (RaiseException e) {
final Object rubyException = e.getRubyException();
final Object rubyException = e.getException();
BacktraceFormatter.createDefaultFormatter(context).printBacktrace(context, (DynamicObject) rubyException, Layouts.EXCEPTION.getBacktrace((DynamicObject) rubyException));
}
}
Original file line number Diff line number Diff line change
@@ -117,7 +117,7 @@ public static void run(DynamicObject thread, final RubyContext context, Node cur
Layouts.THREAD.setValue(thread, context.getCoreLibrary().getNilObject());
return;
} catch (RaiseException e) {
Layouts.THREAD.setException(thread, e.getRubyException());
Layouts.THREAD.setException(thread, e.getException());
} catch (ReturnException e) {
Layouts.THREAD.setException(thread, context.getCoreLibrary().unexpectedReturn(currentNode));
} finally {
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ public Object isDefined(VirtualFrame frame) {
try {
constant = lookupConstantNode.executeLookupConstant(frame);
} catch (RaiseException e) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getRubyException()) == getContext().getCoreLibrary().getNameErrorClass()) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getException()) == getContext().getCoreLibrary().getNameErrorClass()) {
// private constant
return nil();
}
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ public Object isDefined(VirtualFrame frame) {
*
* We should maybe try to see if receiver.isDefined() but we also need its value if it is,
* and we do not want to execute receiver twice. */
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getRubyException()) == context.getCoreLibrary().getNameErrorClass()) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getException()) == context.getCoreLibrary().getNameErrorClass()) {
return nil();
}
throw e;
@@ -63,7 +63,7 @@ public Object isDefined(VirtualFrame frame) {
try {
constant = readConstantNode.lookupConstantNode.executeLookupConstant(frame, module, name);
} catch (RaiseException e) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getRubyException()) == context.getCoreLibrary().getNameErrorClass()) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getException()) == context.getCoreLibrary().getNameErrorClass()) {
// private constant
return nil();
}
Original file line number Diff line number Diff line change
@@ -11,9 +11,6 @@

import com.oracle.truffle.api.nodes.ControlFlowException;

/**
* Controls a break from a control structure or method.
*/
public final class BreakException extends ControlFlowException {

private final BreakID breakID;
@@ -32,6 +29,4 @@ public Object getResult() {
return result;
}

private static final long serialVersionUID = -8650123232850256133L;

}
Original file line number Diff line number Diff line change
@@ -10,4 +10,5 @@
package org.jruby.truffle.language.control;

public class BreakID {

}
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.profiles.BranchProfile;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.language.RubyNode;
@@ -19,15 +20,17 @@
public class BreakNode extends RubyNode {

private final BreakID breakID;
private final boolean ignoreMarker;

@Child private RubyNode child;
private final boolean ignoreMarker;

public BreakNode(RubyContext context, SourceSection sourceSection, BreakID breakID, RubyNode child, boolean ignoreMarker) {
private final BranchProfile breakFromProcClosureProfile = BranchProfile.create();

public BreakNode(RubyContext context, SourceSection sourceSection, BreakID breakID, boolean ignoreMarker, RubyNode child) {
super(context, sourceSection);
this.breakID = breakID;
this.child = child;
this.ignoreMarker = ignoreMarker;
this.child = child;
}

@Override
@@ -36,7 +39,7 @@ public Object execute(VirtualFrame frame) {
final FrameOnStackMarker marker = RubyArguments.getFrameOnStackMarker(frame.getArguments());

if (marker != null && !marker.isOnStack()) {
CompilerDirectives.transferToInterpreter();
breakFromProcClosureProfile.enter();
throw new RaiseException(getContext().getCoreLibrary().localJumpError("break from proc-closure", this));
}
}
Original file line number Diff line number Diff line change
@@ -18,11 +18,8 @@
import org.jruby.truffle.language.RubyNode;

/**
* This node has a pair of children - one required and one elidable result. The required node is
* always executed, but its result is discarded. Therefore it should perform some useful side
* effects. The elidable node is executed, and its result value returned, if an execute method with
* a non-void type is used. It is not executed at all if a void typed execute method is used.
* Therefore it should not perform any observable side effects.
* This node has a pair of children. One has side effects and the other returns the
* result. If the result isn't needed all we execute is the side effects.
*/
@NodeInfo(cost = NodeCost.NONE)
public class ElidableResultNode extends RubyNode {
@@ -36,18 +33,6 @@ public ElidableResultNode(RubyContext context, SourceSection sourceSection, Ruby
this.elidableResult = elidableResult;
}

@Override
public int executeInteger(VirtualFrame frame) throws UnexpectedResultException {
required.executeVoid(frame);
return elidableResult.executeInteger(frame);
}

@Override
public double executeDouble(VirtualFrame frame) throws UnexpectedResultException {
required.executeVoid(frame);
return elidableResult.executeDouble(frame);
}

@Override
public Object execute(VirtualFrame frame) {
required.executeVoid(frame);
Original file line number Diff line number Diff line change
@@ -13,9 +13,6 @@ public final class FrameOnStackMarker {

private boolean onStack = true;

public FrameOnStackMarker() {
}

public boolean isOnStack() {
return onStack;
}
Original file line number Diff line number Diff line change
@@ -11,9 +11,6 @@

import com.oracle.truffle.api.nodes.ControlFlowException;

/**
* Controls moving to the next iteration in a control structure or method.
*/
public final class NextException extends ControlFlowException {

private final Object result;
@@ -26,6 +23,4 @@ public Object getResult() {
return result;
}

private static final long serialVersionUID = -302759969186731457L;

}
Original file line number Diff line number Diff line change
@@ -20,7 +20,6 @@ public class NextNode extends RubyNode {

public NextNode(RubyContext context, SourceSection sourceSection, RubyNode child) {
super(context, sourceSection);

this.child = child;
}

Original file line number Diff line number Diff line change
@@ -9,18 +9,21 @@
*/
package org.jruby.truffle.language.control;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import com.oracle.truffle.api.utilities.AssumedValue;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.language.RubyNode;

/**
* Executes a child node just once, and uses the same value each subsequent time the node is exeuted.
*/
public class OnceNode extends RubyNode {

@Child private RubyNode child;

// TODO(CS): need to always copy this with cloned nodes
private final AssumedValue<Object> valueMemo = new AssumedValue<>("OnceNode", null);
private final AssumedValue<Object> valueMemo = new AssumedValue<>(OnceNode.class.getName(), null);

public OnceNode(RubyContext context, SourceSection sourceSection, RubyNode child) {
super(context, sourceSection);
@@ -32,10 +35,12 @@ public Object execute(VirtualFrame frame) {
Object value = valueMemo.get();

if (value == null) {
CompilerDirectives.transferToInterpreter();
value = child.execute(frame);
valueMemo.set(value);
}

return value;
}

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -12,34 +12,16 @@
import com.oracle.truffle.api.nodes.ControlFlowException;
import com.oracle.truffle.api.object.DynamicObject;

/**
* Ruby exceptions are just Ruby objects, so they cannot also be exceptions unless we made all Ruby
* objects exceptions. A simpler approach is to wrap Ruby exceptions in Java exceptions when we want
* to throw them. The error messages match MRI. Note that throwing is different to raising in Ruby,
* which is the reason we have both {@link ThrowException} and {@link RaiseException}.
*/
public class RaiseException extends ControlFlowException {

private final DynamicObject rubyException;

public RaiseException(DynamicObject rubyException) {
this.rubyException = rubyException;
}

@Override
public String toString() {
return rubyException.toString();
}
private final DynamicObject exception;

@Override
public String getMessage() {
return rubyException.toString();
public RaiseException(DynamicObject exception) {
this.exception = exception;
}

public DynamicObject getRubyException() {
return rubyException;
public DynamicObject getException() {
return exception;
}

private static final long serialVersionUID = 7501185855599094740L;

}
Original file line number Diff line number Diff line change
@@ -11,11 +11,6 @@

import com.oracle.truffle.api.nodes.ControlFlowException;

/**
* Controls re-doing an iteration in a control structure or method.
*/
public final class RedoException extends ControlFlowException {

private static final long serialVersionUID = -4717868827111714052L;

}
Loading