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

Commits on Apr 15, 2016

  1. Copy the full SHA
    40d397c View commit details
  2. Copy the full SHA
    2f25c43 View commit details
Original file line number Diff line number Diff line change
@@ -633,6 +633,27 @@ public RoundNode(RubyContext context, SourceSection sourceSection) {
fixnumOrBignum = new FixnumOrBignumNode(context, sourceSection);
}

@Specialization(guards = "doubleInIntRange(n)")
public int roundFittingInt(double n, NotProvided ndigits,
@Cached("createBinaryProfile()") ConditionProfile positiveProfile) {
int l = (int) n;
if (positiveProfile.profile(n >= 0.0)) {
if (n - l >= 0.5) {
l++;
}
return l;
} else {
if (l - n >= 0.5) {
l--;
}
return l;
}
}

protected boolean doubleInIntRange(double n) {
return Integer.MIN_VALUE < n && n < Integer.MAX_VALUE;
}

@Specialization(guards = "doubleInLongRange(n)")
public long roundFittingLong(double n, NotProvided ndigits,
@Cached("createBinaryProfile()") ConditionProfile positiveProfile) {
Original file line number Diff line number Diff line change
@@ -90,9 +90,10 @@ public ToSNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

@TruffleBoundary
@Specialization
public DynamicObject toS(DynamicObject threadBacktraceLocation) {
final Activation activation= ThreadBacktraceLocationLayoutImpl.INSTANCE
final Activation activation = ThreadBacktraceLocationLayoutImpl.INSTANCE
.getActivation(threadBacktraceLocation);

if (activation.getCallNode() == null) {