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

Commits on Jun 4, 2015

  1. Copy the full SHA
    8156e58 View commit details
  2. Copy the full SHA
    c3cc29e View commit details
  3. Copy the full SHA
    0398913 View commit details
  4. Copy the full SHA
    87ac2e4 View commit details
  5. Copy the full SHA
    87a43f2 View commit details
  6. Copy the full SHA
    cfa7caf View commit details
  7. Copy the full SHA
    8dc3582 View commit details
  8. Copy the full SHA
    f267801 View commit details
  9. Copy the full SHA
    b2f6b33 View commit details
  10. [Truffle] jt: add --jexception[s] to print java exceptions

    * both test and run
    * --jdebug has now alias --debug
    pitr-ch committed Jun 4, 2015
    Copy the full SHA
    19590ae View commit details
  11. [Truffle] jt: print cmd being called

    useful for copying to `jt run ...` and tweaking
    pitr-ch committed Jun 4, 2015
    Copy the full SHA
    5b04676 View commit details
  12. Copy the full SHA
    a24087b View commit details
  13. Copy the full SHA
    6b7d2b4 View commit details
  14. Copy the full SHA
    40cc598 View commit details
  15. Copy the full SHA
    7379991 View commit details
  16. Copy the full SHA
    d40f7b0 View commit details
  17. [Truffle] fix typo

    pitr-ch committed Jun 4, 2015
    Copy the full SHA
    dd87239 View commit details
  18. [Truffle] BigDecimal: safe cast to int in :split method

    * add IntegerCastNode for safe int casting
    pitr-ch committed Jun 4, 2015
    Copy the full SHA
    b628851 View commit details
Showing with 552 additions and 217 deletions.
  1. +1 −0 lib/ruby/truffle/truffle/bigdecimal.rb
  2. +0 −2 spec/truffle/tags/library/bigdecimal/abs_tags.txt
  3. +0 −6 spec/truffle/tags/library/bigdecimal/case_compare_tags.txt
  4. +0 −5 spec/truffle/tags/library/bigdecimal/divide_tags.txt
  5. +0 −5 spec/truffle/tags/library/bigdecimal/equal_value_tags.txt
  6. +0 −3 spec/truffle/tags/library/bigdecimal/exponent_tags.txt
  7. +0 −3 spec/truffle/tags/library/bigdecimal/gte_tags.txt
  8. +0 −3 spec/truffle/tags/library/bigdecimal/lt_tags.txt
  9. +0 −3 spec/truffle/tags/library/bigdecimal/lte_tags.txt
  10. +0 −7 spec/truffle/tags/library/bigdecimal/quo_tags.txt
  11. +0 −7 spec/truffle/tags/library/bigdecimal/split_tags.txt
  12. +0 −2 spec/truffle/tags/library/bigdecimal/to_i_tags.txt
  13. +0 −2 spec/truffle/tags/library/bigdecimal/to_int_tags.txt
  14. +33 −10 tool/jt.rb
  15. +0 −4 truffle/src/main/java/org/jruby/truffle/nodes/cast/BooleanCastNode.java
  16. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/cast/HashCastNode.java
  17. +56 −0 truffle/src/main/java/org/jruby/truffle/nodes/cast/IntegerCastNode.java
  18. +348 −50 truffle/src/main/java/org/jruby/truffle/nodes/core/BigDecimalNodes.java
  19. +29 −7 truffle/src/main/java/org/jruby/truffle/nodes/core/BignumNodes.java
  20. +29 −15 truffle/src/main/java/org/jruby/truffle/nodes/core/FloatNodes.java
  21. +10 −42 truffle/src/main/java/org/jruby/truffle/nodes/core/MathNodes.java
  22. +29 −8 truffle/src/main/java/org/jruby/truffle/nodes/core/fixnum/FixnumNodes.java
  23. +16 −14 truffle/src/main/java/org/jruby/truffle/nodes/dispatch/CallDispatchHeadNode.java
  24. +0 −18 truffle/src/main/java/org/jruby/truffle/nodes/dispatch/UseMethodMissingException.java
1 change: 1 addition & 0 deletions lib/ruby/truffle/truffle/bigdecimal.rb
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ def ==(o)
end

alias_method :eql?, :==
alias_method :===, :==

def coerce(other)
[BigDecimal(other), self]
2 changes: 0 additions & 2 deletions spec/truffle/tags/library/bigdecimal/abs_tags.txt

This file was deleted.

6 changes: 0 additions & 6 deletions spec/truffle/tags/library/bigdecimal/case_compare_tags.txt

This file was deleted.

5 changes: 0 additions & 5 deletions spec/truffle/tags/library/bigdecimal/divide_tags.txt

This file was deleted.

5 changes: 0 additions & 5 deletions spec/truffle/tags/library/bigdecimal/equal_value_tags.txt

This file was deleted.

3 changes: 0 additions & 3 deletions spec/truffle/tags/library/bigdecimal/exponent_tags.txt
Original file line number Diff line number Diff line change
@@ -6,6 +6,3 @@ fails:BigDecimal#** other powers of 0 are 0
fails:BigDecimal#** returns NaN if self is NaN
fails:BigDecimal#** returns 0.0 if self is infinite and argument is negative
fails:BigDecimal#** returns infinite if self is infinite and argument is positive
fails:BigDecimal#exponent returns an Integer
fails:BigDecimal#exponent is n if number can be represented as 0.xxx*10**n
fails:BigDecimal#exponent returns 0 if self is 0
3 changes: 0 additions & 3 deletions spec/truffle/tags/library/bigdecimal/gte_tags.txt

This file was deleted.

3 changes: 0 additions & 3 deletions spec/truffle/tags/library/bigdecimal/lt_tags.txt

This file was deleted.

3 changes: 0 additions & 3 deletions spec/truffle/tags/library/bigdecimal/lte_tags.txt

This file was deleted.

7 changes: 0 additions & 7 deletions spec/truffle/tags/library/bigdecimal/quo_tags.txt

This file was deleted.

7 changes: 0 additions & 7 deletions spec/truffle/tags/library/bigdecimal/split_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/truffle/tags/library/bigdecimal/to_i_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/truffle/tags/library/bigdecimal/to_int_tags.txt

This file was deleted.

43 changes: 33 additions & 10 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
# 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
@@ -18,6 +18,7 @@

JDEBUG_PORT = 51819
JDEBUG = "-J-agentlib:jdwp=transport=dt_socket,server=y,address=#{JDEBUG_PORT},suspend=y"
JEXCEPTION = "-Xtruffle.exceptions.print_java=true"

# wait for sub-processes to handle the interrupt
trap(:INT) {}
@@ -111,13 +112,26 @@ module ShellUtils
private

def raw_sh(*args)
puts "$ #{printable_cmd(args) * ' '}"
result = system(*args)
unless result
$stderr.puts "FAILED (#{$?}): #{args * ' '}"
$stderr.puts "FAILED (#{$?}): #{printable_cmd(args) * ' '}"
exit $?.exitstatus
end
end

def printable_cmd(args)
if Hash === args[0]
if args[0].empty?
args[1..-1]
else
[args[0].map { |k, v| "#{k}=#{v}" }.join(' '), *args[1..-1]]
end
else
args
end
end

def sh(*args)
Dir.chdir(JRUBY_DIR) do
raw_sh(*args)
@@ -148,11 +162,12 @@ def help
puts 'jt irb irb'
puts 'jt rebuild clean and build'
puts 'jt run [options] args... run JRuby with -X+T and args'
puts ' --graal use Graal (set GRAAL_BIN or it will try to automagically find it)'
puts ' --asm show assembly (implies --graal)'
puts ' --server run an instrumentation server on port 8080'
puts ' --igv make sure IGV is running and dump Graal graphs after partial escape (implies --graal)'
puts ' --jdebug run a JDWP debug server on 8000'
puts ' --graal use Graal (set GRAAL_BIN or it will try to automagically find it)'
puts ' --asm show assembly (implies --graal)'
puts ' --server run an instrumentation server on port 8080'
puts ' --igv make sure IGV is running and dump Graal graphs after partial escape (implies --graal)'
puts ' --[j]debug run a JDWP debug server on 8000'
puts ' --jexception[s] print java exceptions'
puts 'jt e 14 + 2 evaluate an expression'
puts 'jt puts 14 + 2 evaluate and print an expression'
puts 'jt test run all mri tests and specs'
@@ -228,10 +243,14 @@ def run(*args)
jruby_args += %w[-J-XX:+UnlockDiagnosticVMOptions -J-XX:CompileCommand=print,*::callRoot]
end

if args.delete('--jdebug')
if args.delete('--jdebug') || args.delete('--debug')
jruby_args << JDEBUG
end

if args.delete('--jexception') || args.delete('--jexceptions')
jruby_args << JEXCEPTION
end

if args.delete('--server')
jruby_args += %w[-Xtruffle.instrumentation_server_port=8080 -Xtruffle.passalot=1]
end
@@ -301,7 +320,7 @@ def test_specs(*args)
env_vars = {}

options = %w[--excl-tag fails]

if args.first == 'fast'
args.shift
options += %w[--excl-tag slow]
@@ -312,10 +331,14 @@ def test_specs(*args)
options << '-T-J-server'
end

if args.delete('--jdebug')
if args.delete('--jdebug') || args.delete('--debug')
options << "-T#{JDEBUG}"
end

if args.delete('--jexception') || args.delete('--jexceptions')
options << "-T#{JEXCEPTION}"
end

mspec_env env_vars, 'run', *options, *args
end
private :test_specs
Original file line number Diff line number Diff line change
@@ -27,10 +27,6 @@ public BooleanCastNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public BooleanCastNode(BooleanCastNode copy) {
super(copy.getContext(), copy.getSourceSection());
}

public abstract boolean executeBoolean(VirtualFrame frame, Object value);

@Specialization(guards = "isNil(nil)")
Original file line number Diff line number Diff line change
@@ -83,7 +83,7 @@ public Object cast(VirtualFrame frame, RubyBasicObject object) {

if (!RubyGuards.isRubyHash(result)) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().typeErrorShouldReturn(object.toString(), "to_hash", "HAsh", this));
throw new RaiseException(getContext().getCoreLibrary().typeErrorShouldReturn(object.toString(), "to_hash", "Hash", this));
}

return result;
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright (c) 2013, 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.cast;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.dsl.Fallback;
import com.oracle.truffle.api.dsl.ImportStatic;
import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.control.RaiseException;

/**
* Casts a value into an int.
*/
@ImportStatic(Integer.class)
@NodeChild(value = "value", type = RubyNode.class)
public abstract class IntegerCastNode extends RubyNode {

public IntegerCastNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public abstract int executeInteger(VirtualFrame frame, Object value);

@Override
public abstract int executeInteger(VirtualFrame frame);

@Specialization
public int doIntegerFixnum(int value) {
return value;
}

@Specialization(guards = {"value >= MIN_VALUE", "value <= MAX_VALUE"})
public int doLongFixnum(long value) {
return (int) value;
}

@Fallback
public int doBasicObject(Object object) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().
typeErrorIsNotA(object.toString(), "Fixnum (fitting in int)", this));
}

}
Loading