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

Commits on Apr 30, 2015

  1. [Truffle] ToIntNode was never guaranteed to return an int - but provi…

    …de that utility for people using it like that.
    chrisseaton committed Apr 30, 2015
    2
    Copy the full SHA
    39fbeaf View commit details
  2. Copy the full SHA
    85cbf9c View commit details
  3. Copy the full SHA
    e478127 View commit details
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/util/cli/Options.java
Original file line number Diff line number Diff line change
@@ -144,7 +144,7 @@ public class Options {
public static final Option<String> TRUFFLE_TRANSLATOR_PRINT_FULL_AST = string(TRUFFLE, "truffle.translator.print_full_asts", "", "Comma delimited list of method names to print the full AST of after translation.");
public static final Option<String> TRUFFLE_TRANSLATOR_PRINT_PARSE_TREE = string(TRUFFLE, "truffle.translator.print_parse_trees", "", "Comma delimited list of method names to print the JRuby parse tree of before translation.");
public static final Option<Boolean> TRUFFLE_PANIC_ON_JAVA_ASSERT = bool(TRUFFLE, "truffle.debug.panic_on_java_assert", false, "Panic as soon as a Java assertion failure is found.");
public static final Option<Boolean> TRUFFLE_EXCEPTIONS_PRINT_JAVA = bool(TRUFFLE, "truffle.exceptions.print_java", false, "Print Java exceptions at the point of translating them to Ruby exceptions.");
public static final Option<Boolean> TRUFFLE_EXCEPTIONS_PRINT_JAVA = bool(TRUFFLE, "truffle.exceptions.print_java", true, "Print Java exceptions at the point of translating them to Ruby exceptions.");
public static final Option<Boolean> TRUFFLE_EXCEPTIONS_PRINT_UNCAUGHT_JAVA = bool(TRUFFLE, "truffle.exceptions.print_uncaught_java", false, "Print uncaught Java exceptions at the point of translating them to Ruby exceptions.");
public static final Option<Boolean> TRUFFLE_COVERAGE = bool(TRUFFLE, "truffle.coverage", false, "Enable coverage (will be enabled by default in the future - currently has some bugs");

2 changes: 2 additions & 0 deletions test/mri/excludes_truffle/TestString.rb
Original file line number Diff line number Diff line change
@@ -56,3 +56,5 @@
exclude :test_split , "needs investigation"
exclude :test_sum , "needs investigation"
exclude :test_clone, "needs investigation"
exclude :test_clone, "needs investigation"
exclude :test_strip, "needs investigation"
1 change: 1 addition & 0 deletions test/mri/excludes_truffle/TestString2.rb
Original file line number Diff line number Diff line change
@@ -53,3 +53,4 @@
exclude :test_split , "needs investigation"
exclude :test_sum , "needs investigation"
exclude :test_clone, "needs investigation"
exclude :test_strip, "needs investigation"
2 changes: 1 addition & 1 deletion tool/jt.rb
Original file line number Diff line number Diff line change
@@ -244,7 +244,7 @@ def test_mri(*args)
env_vars = {
"EXCLUDES" => "test/mri/excludes_truffle"
}
jruby_args = %w[-X+T -Xtruffle.exceptions.print_java]
jruby_args = %w[-J-Xmx4G -X+T -Xtruffle.exceptions.print_java]

if args.empty?
args = File.readlines("#{JRUBY_DIR}/test/mri_truffle.index").grep(/^[^#]\w+/).map(&:chomp)
Original file line number Diff line number Diff line change
@@ -36,7 +36,18 @@ public ToIntNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public abstract int executeInt(VirtualFrame frame, Object object);
public int doInt(VirtualFrame frame, Object object) {
final Object integerObject = executeIntOrLong(frame, object);

if (integerObject instanceof Integer) {
return (int) integerObject;
}

CompilerDirectives.transferToInterpreter();
throw new UnsupportedOperationException();
}

public abstract Object executeIntOrLong(VirtualFrame frame, Object object);

@Specialization
public int coerceInt(int value) {
58 changes: 29 additions & 29 deletions truffle/src/main/java/org/jruby/truffle/nodes/core/ArrayNodes.java
Original file line number Diff line number Diff line change
@@ -287,7 +287,7 @@ public Object mulObjectCount(VirtualFrame frame, RubyArray array, Object object)
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
final int count = toIntNode.executeInt(frame, object);
final int count = toIntNode.doInt(frame, object);
if (count < 0) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("negative argument", this));
@@ -413,7 +413,7 @@ public Object set(VirtualFrame frame, RubyArray array, Object indexObject, Objec
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
final int index = toIntNode.executeInt(frame, indexObject);
final int index = toIntNode.doInt(frame, indexObject);
return set(frame, array, index, value, unused);
}

@@ -438,7 +438,7 @@ public Object setObject(VirtualFrame frame, RubyArray array, int start, Object l
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
int length = toIntNode.executeInt(frame, lengthObject);
int length = toIntNode.doInt(frame, lengthObject);
return setObject(frame, array, start, length, value);
}

@@ -448,7 +448,7 @@ public Object setObject(VirtualFrame frame, RubyArray array, Object startObject,
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
int start = toIntNode.executeInt(frame, startObject);
int start = toIntNode.doInt(frame, startObject);
return setObject(frame, array, start, length, value);
}

@@ -458,8 +458,8 @@ public Object setObject(VirtualFrame frame, RubyArray array, Object startObject,
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
int length = toIntNode.executeInt(frame, lengthObject);
int start = toIntNode.executeInt(frame, startObject);
int length = toIntNode.doInt(frame, lengthObject);
int start = toIntNode.doInt(frame, startObject);
return setObject(frame, array, start, length, value);
}

@@ -529,7 +529,7 @@ public Object setOtherArray(VirtualFrame frame, RubyArray array, Object startObj
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
int start = toIntNode.executeInt(frame, startObject);
int start = toIntNode.doInt(frame, startObject);
return setOtherArray(frame, array, start, length, value);
}

@@ -539,7 +539,7 @@ public Object setOtherArray(VirtualFrame frame, RubyArray array, int start, Obje
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
int length = toIntNode.executeInt(frame, lengthObject);
int length = toIntNode.doInt(frame, lengthObject);
return setOtherArray(frame, array, start, length, value);
}

@@ -549,8 +549,8 @@ public Object setOtherArray(VirtualFrame frame, RubyArray array, Object startObj
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
int start = toIntNode.executeInt(frame, startObject);
int length = toIntNode.executeInt(frame, lengthObject);
int start = toIntNode.doInt(frame, startObject);
int length = toIntNode.doInt(frame, lengthObject);
return setOtherArray(frame, array, start, length, value);
}

@@ -1685,7 +1685,7 @@ public RubyArray initialize(VirtualFrame frame, RubyArray array, Object object,
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
int size = toIntNode.executeInt(frame, object);
int size = toIntNode.doInt(frame, object);
if (size < 0) {
return initializeNegative(array, size, UndefinedPlaceholder.INSTANCE, UndefinedPlaceholder.INSTANCE);
} else {
@@ -1794,7 +1794,7 @@ public RubyArray initialize(VirtualFrame frame, RubyArray array, Object sizeObje
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
int size = toIntNode.executeInt(frame, sizeObject);
int size = toIntNode.doInt(frame, sizeObject);
if (size < 0) {
return initializeNegative(array, size, defaultValue, UndefinedPlaceholder.INSTANCE);
} else {
@@ -2117,7 +2117,7 @@ public Object insertBoxed(VirtualFrame frame, RubyArray array, Object[] values)
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
index = toIntNode.executeInt(frame, values[0]);
index = toIntNode.doInt(frame, values[0]);
}

final int valuesLength = values.length - 1;
@@ -2868,7 +2868,7 @@ public Object popNilWithNum(VirtualFrame frame, RubyArray array, Object object)
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
final int n = toIntNode.executeInt(frame, object);
final int n = toIntNode.doInt(frame, object);
if (n < 0) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("negative array size", this));
@@ -3013,7 +3013,7 @@ public RubyArray popIntegerFixnumInBoundsWithNumObj(VirtualFrame frame, RubyArra
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
final int num = toIntNode.executeInt(frame, object);
final int num = toIntNode.doInt(frame, object);
if (num < 0) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("negative array size", this));
@@ -3037,7 +3037,7 @@ public Object popIntegerFixnumWithNumObj(VirtualFrame frame, RubyArray array, Ob
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
final int num = toIntNode.executeInt(frame, object);
final int num = toIntNode.doInt(frame, object);
if (num < 0) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("negative array size", this));
@@ -3061,7 +3061,7 @@ public RubyArray popLongFixnumInBoundsWithNumObj(VirtualFrame frame, RubyArray a
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
final int num = toIntNode.executeInt(frame, object);
final int num = toIntNode.doInt(frame, object);
if (num < 0) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("negative array size", this));
@@ -3085,7 +3085,7 @@ public Object popLongFixnumWithNumObj(VirtualFrame frame, RubyArray array, Objec
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
final int num = toIntNode.executeInt(frame, object);
final int num = toIntNode.doInt(frame, object);
if (num < 0) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("negative array size", this));
@@ -3108,7 +3108,7 @@ public RubyArray popFloatInBoundsWithNumObj(VirtualFrame frame, RubyArray array,
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
final int num = toIntNode.executeInt(frame, object);
final int num = toIntNode.doInt(frame, object);
if (num < 0) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("negative array size", this));
@@ -3131,7 +3131,7 @@ public Object popFloatWithNumObj(VirtualFrame frame, RubyArray array, Object obj
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
final int num = toIntNode.executeInt(frame, object);
final int num = toIntNode.doInt(frame, object);
if (num < 0) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("negative array size", this));
@@ -3154,7 +3154,7 @@ public Object popObjectWithNumObj(VirtualFrame frame, RubyArray array, Object ob
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
final int num = toIntNode.executeInt(frame, object);
final int num = toIntNode.doInt(frame, object);
if (num < 0) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("negative array size", this));
@@ -3993,7 +3993,7 @@ public Object shiftNilWithNum(VirtualFrame frame, RubyArray array, Object object
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
final int n = toIntNode.executeInt(frame, object);
final int n = toIntNode.doInt(frame, object);
if (n < 0) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("negative array size", this));
@@ -4148,7 +4148,7 @@ public RubyArray shiftIntegerFixnumInBoundsWithNumObj(VirtualFrame frame, RubyAr
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
final int num = toIntNode.executeInt(frame, object);
final int num = toIntNode.doInt(frame, object);
if (num < 0) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("negative array size", this));
@@ -4173,7 +4173,7 @@ public Object shiftIntegerFixnumWithNumObj(VirtualFrame frame, RubyArray array,
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
final int num = toIntNode.executeInt(frame, object);
final int num = toIntNode.doInt(frame, object);
if (num < 0) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("negative array size", this));
@@ -4198,7 +4198,7 @@ public RubyArray shiftLongFixnumInBoundsWithNumObj(VirtualFrame frame, RubyArray
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
final int num = toIntNode.executeInt(frame, object);
final int num = toIntNode.doInt(frame, object);
if (num < 0) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("negative array size", this));
@@ -4223,7 +4223,7 @@ public Object shiftLongFixnumWithNumObj(VirtualFrame frame, RubyArray array, Obj
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
final int num = toIntNode.executeInt(frame, object);
final int num = toIntNode.doInt(frame, object);
if (num < 0) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("negative array size", this));
@@ -4247,7 +4247,7 @@ public RubyArray shiftFloatInBoundsWithNumObj(VirtualFrame frame, RubyArray arra
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
final int num = toIntNode.executeInt(frame, object);
final int num = toIntNode.doInt(frame, object);
if (num < 0) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("negative array size", this));
@@ -4272,7 +4272,7 @@ public Object shiftFloatWithNumObj(VirtualFrame frame, RubyArray array, Object o
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
final int num = toIntNode.executeInt(frame, object);
final int num = toIntNode.doInt(frame, object);
if (num < 0) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("negative array size", this));
@@ -4297,7 +4297,7 @@ public Object shiftObjectWithNumObj(VirtualFrame frame, RubyArray array, Object
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}
final int num = toIntNode.executeInt(frame, object);
final int num = toIntNode.doInt(frame, object);
if (num < 0) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("negative array size", this));
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@ public Object getIndex(VirtualFrame frame, RubyMatchData matchData, Object index
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}

return getIndex(matchData, toIntNode.executeInt(frame, index));
return getIndex(matchData, toIntNode.doInt(frame, index));
}

@Specialization(guards = {"!isRubySymbol(range)", "!isRubyString(range)"})
Loading