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

Commits on Dec 20, 2014

  1. 1
    Copy the full SHA
    9d4fdcb View commit details
  2. 3
    Copy the full SHA
    891cc12 View commit details
  3. 1
    Copy the full SHA
    284cb13 View commit details
  4. 1
    Copy the full SHA
    3f2c760 View commit details
  5. Copy the full SHA
    54a3ef7 View commit details
  6. Copy the full SHA
    b7b9019 View commit details
  7. Copy the full SHA
    78bd3c6 View commit details
  8. Copy the full SHA
    b3b4f24 View commit details
  9. Copy the full SHA
    1aee72a View commit details
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ public static abstract class BignumCoreMethodNode extends CoreMethodNode {

public BignumCoreMethodNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
fixnumOrBignum = new FixnumOrBignumNode();
fixnumOrBignum = new FixnumOrBignumNode(context);
}

public BignumCoreMethodNode(BignumCoreMethodNode prev) {
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
*/
package org.jruby.truffle.nodes.core;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.utilities.BranchProfile;
import org.jruby.truffle.runtime.RubyContext;
@@ -19,9 +20,18 @@

public class FixnumOrBignumNode extends Node {

public FixnumOrBignumNode(RubyContext context) {
this.context = context;
}

private final RubyContext context;

private final BranchProfile lowerProfile = BranchProfile.create();
private final BranchProfile integerProfile = BranchProfile.create();
private final BranchProfile longProfile = BranchProfile.create();
private final BranchProfile integerFromBignumProfile = BranchProfile.create();
private final BranchProfile longFromBignumProfile = BranchProfile.create();

private final BranchProfile integerFromDoubleProfile = BranchProfile.create();
private final BranchProfile longFromDoubleProfile = BranchProfile.create();

private final BranchProfile bignumProfile = BranchProfile.create();
private final BranchProfile checkLongProfile = BranchProfile.create();
@@ -33,37 +43,38 @@ public Object fixnumOrBignum(RubyBignum value) {
final long longValue = value.longValue();

if (longValue >= Integer.MIN_VALUE && longValue <= Integer.MAX_VALUE) {
integerProfile.enter();
integerFromBignumProfile.enter();
return (int) longValue;
} else {
longProfile.enter();
longFromBignumProfile.enter();
return longValue;
}
} else {
return value;
}
}

public Object fixnumOrBignum(RubyContext context, double value) {
public Object fixnumOrBignum(double value) {
if (value > Integer.MIN_VALUE && value < Integer.MAX_VALUE) {
// TODO(CS): reusing profiles might not be a good idea
integerProfile.enter();

integerFromDoubleProfile.enter();
return (int) value;
}

checkLongProfile.enter();

if (value > Long.MIN_VALUE && value < Long.MAX_VALUE) {
// TODO(CS): reusing profiles might not be a good idea
longProfile.enter();

longFromDoubleProfile.enter();
return (long) value;
}

bignumProfile.enter();

return new RubyBignum(context.getCoreLibrary().getBignumClass(), new BigDecimal(value).toBigInteger());
return new RubyBignum(context.getCoreLibrary().getBignumClass(), doubleToBigInteger(value));
}

@CompilerDirectives.TruffleBoundary
private static BigInteger doubleToBigInteger(double value) {
return new BigDecimal(value).toBigInteger();
}

}
10 changes: 6 additions & 4 deletions core/src/main/java/org/jruby/truffle/nodes/core/FloatNodes.java
Original file line number Diff line number Diff line change
@@ -563,7 +563,7 @@ public abstract static class RoundNode extends CoreMethodNode {

public RoundNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
fixnumOrBignum = new FixnumOrBignumNode();
fixnumOrBignum = new FixnumOrBignumNode(context);
}

public RoundNode(RoundNode prev) {
@@ -576,10 +576,12 @@ public Object round(double n) {
// Algorithm copied from JRuby - not shared as we want to branch profile it

if (Double.isInfinite(n)) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().floatDomainError("Infinity", this));
}

if (Double.isNaN(n)) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().floatDomainError("NaN", this));
}

@@ -603,7 +605,7 @@ public Object round(double n) {
}
}

return fixnumOrBignum.fixnumOrBignum(getContext(), f);
return fixnumOrBignum.fixnumOrBignum(f);
}

}
@@ -615,7 +617,7 @@ public abstract static class ToINode extends CoreMethodNode {

public ToINode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
fixnumOrBignum = new FixnumOrBignumNode();
fixnumOrBignum = new FixnumOrBignumNode(context);
}

public ToINode(ToINode prev) {
@@ -633,7 +635,7 @@ public Object toI(double value) {
throw new RaiseException(getContext().getCoreLibrary().floatDomainError("NaN", this));
}

return fixnumOrBignum.fixnumOrBignum(getContext(), value);
return fixnumOrBignum.fixnumOrBignum(value);
}

}
Original file line number Diff line number Diff line change
@@ -34,8 +34,8 @@ public class GeneralDivModNode extends Node {
public GeneralDivModNode(RubyContext context) {
assert context != null;
this.context = context;
fixnumOrBignumQuotient = new FixnumOrBignumNode();
fixnumOrBignumRemainder = new FixnumOrBignumNode();
fixnumOrBignumQuotient = new FixnumOrBignumNode(context);
fixnumOrBignumRemainder = new FixnumOrBignumNode(context);
}

public RubyArray execute(int a, int b) {
Original file line number Diff line number Diff line change
@@ -705,7 +705,7 @@ private void logScriptResolutionFailure(String path) {
public static void checkGraalVersion() {
if (Options.TRUFFLE_RUNTIME_VERSION_CHECK.load()) {
final String graalVersion = System.getProperty("graal.version", "unknown");
final String expectedGraalVersion = "0.6";
final String expectedGraalVersion = "0.7-dev";

if (graalVersion.equals("unknown")) {
return;
8 changes: 6 additions & 2 deletions tool/build-graal-bundles.sh
Original file line number Diff line number Diff line change
@@ -52,16 +52,20 @@ function pack {

tar -zxf $buildname || exit $?
chmod -R +w graalvm-jdk1.8.0

cp -r graalvm-jdk1.8.0 jruby-$version || exit $?
rm -rf jruby-$version/graalvm-jdk1.8.0/src.zip jruby-$version/graalvm-jdk1.8.0/demo jruby-$version/graalvm-jdk1.8.0/include jruby-$version/graalvm-jdk1.8.0/sample || exit $?
targetname=jruby-dist-$version+graal-$1-x86_64-bin.tar.gz
tar -zcf $targetname jruby-$version || exit $?
shasum -a 1 $targetname > $targetname.sha1 || exit $?

rm -rf jruby-master || exit $?

cp -r jruby-$version jruby-master || exit $?
targetname=jruby-dist-master+graal-$1-x86_64-bin.tar.gz
tar -zcf $targetname jruby-master || exit $?
shasum -a 1 $targetname > $targetname.sha1 || exit $?
}

pack "linux" "b132" "0.5"
pack "macosx" "b132" "0.5"
pack "linux" "b132" "0.6"
pack "macosx" "b132" "0.6"