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

Commits on Dec 8, 2016

  1. [Truffle] Let jt's --jexceptions print uncaught Java exceptions.

    * Caught Java exceptions are "expected" and not "exceptional".
    eregon committed Dec 8, 2016
    Copy the full SHA
    10b9ba9 View commit details
  2. Copy the full SHA
    de0a6fa View commit details
Showing with 9 additions and 55 deletions.
  1. +1 −1 tool/jt.rb
  2. +8 −54 truffle/src/main/java/org/jruby/truffle/language/dispatch/RubyCallNode.java
2 changes: 1 addition & 1 deletion tool/jt.rb
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@
JDEBUG_PORT = 51819
JDEBUG = "-J-agentlib:jdwp=transport=dt_socket,server=y,address=#{JDEBUG_PORT},suspend=y"
JDEBUG_TEST = "-Dmaven.surefire.debug=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=#{JDEBUG_PORT} -Xnoagent -Djava.compiler=NONE"
JEXCEPTION = "-Xtruffle.exceptions.print_java=true"
JEXCEPTION = "-Xtruffle.exceptions.print_uncaught_java=true"
METRICS_REPS = 10

VERBOSE = ENV.include? 'V'
Original file line number Diff line number Diff line change
@@ -10,20 +10,18 @@
package org.jruby.truffle.language.dispatch;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.profiles.ConditionProfile;
import org.jcodings.specific.UTF8Encoding;
import org.jruby.truffle.Layouts;
import org.jruby.truffle.core.array.ArrayUtils;
import org.jruby.truffle.core.array.ArrayToObjectArrayNode;
import org.jruby.truffle.core.array.ArrayToObjectArrayNodeGen;
import org.jruby.truffle.core.cast.BooleanCastNode;
import org.jruby.truffle.core.cast.BooleanCastNodeGen;
import org.jruby.truffle.core.cast.ProcOrNullNode;
import org.jruby.truffle.core.cast.ProcOrNullNodeGen;
import org.jruby.truffle.core.module.ModuleOperations;
import org.jruby.truffle.language.RubyGuards;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.arguments.RubyArguments;
import org.jruby.truffle.language.methods.InternalMethod;
@@ -43,13 +41,7 @@ public class RubyCallNode extends RubyNode {
private final boolean isAttrAssign;

@Child private CallDispatchHeadNode dispatchHead;

@CompilationFinal private boolean seenNullInUnsplat = false;
@CompilationFinal private boolean seenIntegerFixnumInUnsplat = false;
@CompilationFinal private boolean seenLongFixnumInUnsplat = false;
@CompilationFinal private boolean seenFloatInUnsplat = false;
@CompilationFinal private boolean seenObjectInUnsplat = false;

@Child private ArrayToObjectArrayNode toObjectArrayNode;
@Child private CallDispatchHeadNode respondToMissing;
@Child private BooleanCastNode respondToMissingCast;

@@ -129,58 +121,20 @@ private Object[] executeArguments(VirtualFrame frame) {
}

if (isSplatted) {
assert argumentsObjects.length == 1;
return splat(argumentsObjects[0]);
} else {
return argumentsObjects;
}
}

private Object[] splat(Object argument) {
// TODO CS 19-May-15 this is a terrible mess and needs to go

// TODO(CS): what happens if isn't just one argument, or it isn't an Array?

if (!RubyGuards.isRubyArray(argument)) {
if (toObjectArrayNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
throw new UnsupportedOperationException(argument.getClass().toString());
toObjectArrayNode = insert(ArrayToObjectArrayNodeGen.create(null));
}

final DynamicObject array = (DynamicObject) argument;
final int size = Layouts.ARRAY.getSize(array);
final Object store = Layouts.ARRAY.getStore(array);

if (seenNullInUnsplat && store == null) {
return new Object[]{};
} else if (seenIntegerFixnumInUnsplat && store instanceof int[]) {
return ArrayUtils.boxUntil((int[]) store, size);
} else if (seenLongFixnumInUnsplat && store instanceof long[]) {
return ArrayUtils.boxUntil((long[]) store, size);
} else if (seenFloatInUnsplat && store instanceof double[]) {
return ArrayUtils.boxUntil((double[]) store, size);
} else if (seenObjectInUnsplat && store != null && store.getClass() == Object[].class) {
return ArrayUtils.extractRange((Object[]) store, 0, size);
}

CompilerDirectives.transferToInterpreterAndInvalidate();

if (store == null) {
seenNullInUnsplat = true;
return new Object[]{};
} else if (store instanceof int[]) {
seenIntegerFixnumInUnsplat = true;
return ArrayUtils.boxUntil((int[]) store, size);
} else if (store instanceof long[]) {
seenLongFixnumInUnsplat = true;
return ArrayUtils.boxUntil((long[]) store, size);
} else if (store instanceof double[]) {
seenFloatInUnsplat = true;
return ArrayUtils.boxUntil((double[]) store, size);
} else if (store.getClass() == Object[].class) {
seenObjectInUnsplat = true;
return ArrayUtils.extractRange((Object[]) store, 0, size);
}

throw new UnsupportedOperationException();
// TODO(CS): what happens if it isn't an Array?
return toObjectArrayNode.executeToObjectArray((DynamicObject) argument);
}

@Override