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

Commits on May 26, 2015

  1. Copy the full SHA
    206295b View commit details
  2. Copy the full SHA
    4c787c1 View commit details
4 changes: 4 additions & 0 deletions truffle/src/main/java/org/jruby/truffle/nodes/RubyNode.java
Original file line number Diff line number Diff line change
@@ -12,21 +12,25 @@
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.Truffle;
import com.oracle.truffle.api.dsl.ImportStatic;
import com.oracle.truffle.api.dsl.TypeSystemReference;
import com.oracle.truffle.api.frame.MaterializedFrame;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.instrument.ProbeNode;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.UnexpectedResultException;
import com.oracle.truffle.api.source.SourceSection;

import jnr.ffi.provider.MemoryManager;
import jnr.posix.POSIX;

import org.jruby.truffle.nodes.instrument.RubyWrapperNode;
import org.jruby.truffle.runtime.RubyArguments;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.core.*;
import org.jruby.truffle.runtime.sockets.NativeSockets;

@TypeSystemReference(RubyTypes.class)
@ImportStatic(RubyGuards.class)
public abstract class RubyNode extends Node {

23 changes: 23 additions & 0 deletions truffle/src/main/java/org/jruby/truffle/nodes/RubyTypes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.nodes;

import com.oracle.truffle.api.dsl.ImplicitCast;
import com.oracle.truffle.api.dsl.TypeSystem;

@TypeSystem({})
public abstract class RubyTypes {

@ImplicitCast
public static long int2long(int value) {
return value;
}

}
Original file line number Diff line number Diff line change
@@ -97,16 +97,6 @@ public double add(int a, double b) {
return a + b;
}

@Specialization(rewriteOn = ArithmeticException.class)
public long add(int a, long b) {
return ExactMath.addExact(a, b);
}

@Specialization
public Object addWithOverflow(int a, long b) {
return fixnumOrBignum(BigInteger.valueOf(a).add(BigInteger.valueOf(b)));
}

@Specialization(guards = "isRubyBignum(b)")
public Object add(int a, RubyBasicObject b) {
return fixnumOrBignum(BigInteger.valueOf(a).add(BignumNodes.getBigIntegerValue(b)));
@@ -117,16 +107,6 @@ public Object addCoerced(VirtualFrame frame, int a, RubyBasicObject b) {
return ruby(frame, "redo_coerced :+, b", "b", b);
}

@Specialization(rewriteOn = ArithmeticException.class)
public long add(long a, int b) {
return ExactMath.addExact(a, b);
}

@Specialization
public Object addWithOverflow(long a, int b) {
return fixnumOrBignum(BigInteger.valueOf(a).add(BigInteger.valueOf(b)));
}

@Specialization(rewriteOn = ArithmeticException.class)
public long add(long a, long b) {
return ExactMath.addExact(a, b);