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

Commits on Feb 15, 2015

  1. [Truffle] Switch RubyTime to use DateTime rather than Rubinius-style …

    …seconds and nanoseconds.
    chrisseaton committed Feb 15, 2015
    Copy the full SHA
    aa3d59c View commit details
  2. Copy the full SHA
    3e87b6e View commit details
  3. Copy the full SHA
    5e3bb14 View commit details
  4. Copy the full SHA
    0ab584e View commit details
  5. 3
    Copy the full SHA
    0cab173 View commit details
Showing with 558 additions and 759 deletions.
  1. +1 −0 spec/truffle/tags/core/range/each_tags.txt
  2. +1 −0 spec/truffle/tags/core/rational/abs_tags.txt
  3. +4 −0 spec/truffle/tags/core/rational/exponent_tags.txt
  4. +5 −0 spec/truffle/tags/core/time/_dump_tags.txt
  5. +6 −0 spec/truffle/tags/core/time/at_tags.txt
  6. +6 −0 spec/truffle/tags/core/time/comparison_tags.txt
  7. +1 −0 spec/truffle/tags/core/time/dup_tags.txt
  8. +6 −0 spec/truffle/tags/core/time/eql_tags.txt
  9. +1 −0 spec/truffle/tags/core/time/getgm_tags.txt
  10. +1 −0 spec/truffle/tags/core/time/getutc_tags.txt
  11. +2 −0 spec/truffle/tags/core/time/gm_tags.txt
  12. +1 −0 spec/truffle/tags/core/time/gmtime_tags.txt
  13. +2 −0 spec/truffle/tags/core/time/hash_tags.txt
  14. +2 −1 spec/truffle/tags/core/time/inspect_tags.txt
  15. +2 −1 spec/truffle/tags/core/time/local_tags.txt
  16. +2 −0 spec/truffle/tags/core/time/minus_tags.txt
  17. +2 −0 spec/truffle/tags/core/time/mktime_tags.txt
  18. +2 −0 spec/truffle/tags/core/time/new_tags.txt
  19. +4 −0 spec/truffle/tags/core/time/nsec_tags.txt
  20. +2 −0 spec/truffle/tags/core/time/plus_tags.txt
  21. +1 −0 spec/truffle/tags/core/time/sec_tags.txt
  22. +26 −4 spec/truffle/tags/core/time/strftime_tags.txt
  23. +4 −0 spec/truffle/tags/core/time/subsec_tags.txt
  24. +2 −0 spec/truffle/tags/core/time/succ_tags.txt
  25. +1 −0 spec/truffle/tags/core/time/to_f_tags.txt
  26. +1 −0 spec/truffle/tags/core/time/to_i_tags.txt
  27. +1 −0 spec/truffle/tags/core/time/to_r_tags.txt
  28. +2 −1 spec/truffle/tags/core/time/to_s_tags.txt
  29. +1 −0 spec/truffle/tags/core/time/tv_sec_tags.txt
  30. +1 −0 spec/truffle/tags/core/time/usec_tags.txt
  31. +3 −0 spec/truffle/tags/core/time/utc_tags.txt
  32. +1 −0 spec/truffle/tags/core/time/wday_tags.txt
  33. +1 −0 spec/truffle/tags/core/time/yday_tags.txt
  34. +1 −0 truffle/src/main/java/org/jruby/truffle/TruffleBridgeImpl.java
  35. +0 −12 truffle/src/main/java/org/jruby/truffle/nodes/RubyNode.java
  36. +0 −74 truffle/src/main/java/org/jruby/truffle/nodes/core/BasicObjectNodes.java
  37. +66 −63 truffle/src/main/java/org/jruby/truffle/nodes/core/BignumNodes.java
  38. +18 −0 truffle/src/main/java/org/jruby/truffle/nodes/core/EncodingNodes.java
  39. +50 −41 truffle/src/main/java/org/jruby/truffle/nodes/core/FixnumNodes.java
  40. +4 −4 truffle/src/main/java/org/jruby/truffle/nodes/core/FixnumOrBignumNode.java
  41. +12 −12 truffle/src/main/java/org/jruby/truffle/nodes/core/FloatNodes.java
  42. +4 −4 truffle/src/main/java/org/jruby/truffle/nodes/core/GeneralDivModNode.java
  43. +12 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/IntegerNodes.java
  44. +9 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
  45. +14 −14 truffle/src/main/java/org/jruby/truffle/nodes/core/MathNodes.java
  46. +3 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/NumericNodes.java
  47. +2 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/ObjectSpaceNodes.java
  48. +5 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/StringNodes.java
  49. +89 −0 truffle/src/main/java/org/jruby/truffle/nodes/core/TimeNodes.java
  50. +6 −3 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/BignumPrimitiveNodes.java
  51. +7 −4 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/FixnumPrimitiveNodes.java
  52. +0 −41 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/JodaDateTimeToRubyTimeNode.java
  53. +18 −3 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/ObjectPrimitiveNodes.java
  54. +0 −83 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/RubyTimeToJodaDateTimeNode.java
  55. +36 −99 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/TimePrimitiveNodes.java
  56. +10 −10 truffle/src/main/java/org/jruby/truffle/runtime/ObjectIDOperations.java
  57. +6 −1 truffle/src/main/java/org/jruby/truffle/runtime/core/CoreLibrary.java
  58. +4 −200 truffle/src/main/java/org/jruby/truffle/runtime/core/RubyBignum.java
  59. +11 −27 truffle/src/main/java/org/jruby/truffle/runtime/core/RubyTime.java
  60. +0 −42 truffle/src/main/java/org/jruby/truffle/runtime/core/TimeOperations.java
  61. +50 −3 truffle/src/main/java/org/jruby/truffle/translator/BodyTranslator.java
  62. +8 −3 truffle/src/main/java/org/jruby/truffle/translator/MethodTranslator.java
  63. +15 −1 truffle/src/main/ruby/core/shims.rb
1 change: 1 addition & 0 deletions spec/truffle/tags/core/range/each_tags.txt
Original file line number Diff line number Diff line change
@@ -2,3 +2,4 @@ fails:Range#each passes each element to the given block by using #succ
fails:Range#each raises a TypeError if the first element does not respond to #succ
fails:Range#each returns an enumerator when no block given
fails:Range#each passes each Symbol element by using #succ
fails:Range#each raises a TypeError if the first element is a Time object
1 change: 1 addition & 0 deletions spec/truffle/tags/core/rational/abs_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Rational#abs returns self's absolute value
4 changes: 4 additions & 0 deletions spec/truffle/tags/core/rational/exponent_tags.txt
Original file line number Diff line number Diff line change
@@ -2,3 +2,7 @@ fails:Rational#** when passed Rational returns self raised to the argument as a
fails:Rational#** when passed Rational returns a complex number when self is negative and the passed argument is not 0
fails:Rational#** when passed Float returns a complex number if self is negative and the passed argument is not 0
fails:Rational#** when passed Float returns Complex(1.0) when the passed argument is 0.0
fails:Rational#** when passed Bignum returns 0.0 when self is > 1 and the exponent is negative
fails:Rational#** when passed Bignum returns 0.0 when self is < -1 and the exponent is negative
fails:Rational#** when passed Bignum returns 0.0 when self is > 1
fails:Rational#** when passed Bignum returns 0.0 when self is < -1 and the exponent is negative
5 changes: 5 additions & 0 deletions spec/truffle/tags/core/time/_dump_tags.txt
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
fails:Time#_dump dumps like MRI's marshaled time format
fails:Time#_dump is a private method
fails:Time#_dump preserves the GMT flag
fails:Time#_dump dumps a Time object to a bytestring
fails:Time#_dump dumps an array with a date as first element
fails:Time#_dump dumps an array with a time as second element
6 changes: 6 additions & 0 deletions spec/truffle/tags/core/time/at_tags.txt
Original file line number Diff line number Diff line change
@@ -4,3 +4,9 @@ fails:Time.at passed Time returns a non-UTC time if the argument is non-UTC
fails:Time.at passed Time returns a subclass instance
fails:Time.at passed non-Time, non-Numeric with an argument that responds to #to_r coerces using #to_r
fails:Time.at passed [Integer, Numeric] returns a Time object representing the given number of seconds and Integer microseconds since 1970-01-01 00:00:00 UTC
fails:Time.at passed Numeric returns a Time object representing the given number of Integer seconds since 1970-01-01 00:00:00 UTC
fails:Time.at passed Numeric returns a non-UTC Time
fails:Time.at passed non-Time, non-Numeric with an argument that responds to #to_int coerces using #to_int
fails:Time.at passed [Integer, Numeric] returns a Time object representing the given number of seconds and Float microseconds since 1970-01-01 00:00:00 UTC
fails:Time.at with a second argument that responds to #to_int coerces using #to_int
fails:Time.at with a second argument that responds to #to_r coerces using #to_r
6 changes: 6 additions & 0 deletions spec/truffle/tags/core/time/comparison_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fails:Time#<=> returns 1 if the first argument is a point in time after the second argument
fails:Time#<=> returns 0 if time is the same as other
fails:Time#<=> returns -1 if the first argument is a point in time before the second argument
fails:Time#<=> returns 1 if the first argument is a fraction of a microsecond after the second argument
fails:Time#<=> returns 0 if time is the same as other, including fractional microseconds
fails:Time#<=> returns -1 if the first argument is a fraction of a microsecond before the second argument
1 change: 1 addition & 0 deletions spec/truffle/tags/core/time/dup_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
fails:Time#dup returns an independent Time object
fails:Time#dup returns a subclass instance
fails:Time#dup returns a Time object that represents the same time
6 changes: 6 additions & 0 deletions spec/truffle/tags/core/time/eql_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fails:Time#eql? returns true if self and other have the same whole number of seconds
fails:Time#eql? returns false if self and other have differing whole numbers of seconds
fails:Time#eql? returns true if self and other have the same number of microseconds
fails:Time#eql? returns false if self and other have differing numbers of microseconds
fails:Time#eql? returns false if self and other have differing fractional microseconds
fails:Time#eql? returns false when given a non-time value
1 change: 1 addition & 0 deletions spec/truffle/tags/core/time/getgm_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Time#getgm returns a new time which is the utc representation of time
1 change: 1 addition & 0 deletions spec/truffle/tags/core/time/getutc_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Time#getutc returns a new time which is the utc representation of time
2 changes: 2 additions & 0 deletions spec/truffle/tags/core/time/gm_tags.txt
Original file line number Diff line number Diff line change
@@ -40,3 +40,5 @@ fails:Time.gm handles fractional microseconds as a Float
fails:Time.gm handles fractional microseconds as a Rational
fails:Time.gm ignores fractional seconds if a passed whole number of microseconds
fails:Time.gm ignores fractional seconds if a passed fractional number of microseconds
fails:Time.gm creates a time based on given values, interpreted as UTC (GMT)
fails:Time.gm accepts various year ranges
1 change: 1 addition & 0 deletions spec/truffle/tags/core/time/gmtime_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Time#gmtime returns the utc representation of time
2 changes: 2 additions & 0 deletions spec/truffle/tags/core/time/hash_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fails:Time#hash returns a Fixnum
fails:Time#hash is stable
3 changes: 2 additions & 1 deletion spec/truffle/tags/core/time/inspect_tags.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
fails:Time#inspect formats the fixed offset time following the pattern 'yyyy-MM-dd HH:mm:ss +/-HHMM'
fails:Time#inspect formats the local time following the pattern 'yyyy-MM-dd HH:mm:ss Z'
fails:Time#inspect formats the UTC time following the pattern 'yyyy-MM-dd HH:mm:ss UTC'
3 changes: 2 additions & 1 deletion spec/truffle/tags/core/time/local_tags.txt
Original file line number Diff line number Diff line change
@@ -42,4 +42,5 @@ fails:Time.local ignores fractional seconds if a passed whole number of microsec
fails:Time.local ignores fractional seconds if a passed fractional number of microseconds
fails:Time.local raises ArgumentError when given 9 arguments
fails:Time.local raises ArgumentError when given 11 arguments

fails:Time.local creates a time based on given values, interpreted in the local time zone
fails:Time.local accepts various year ranges
2 changes: 2 additions & 0 deletions spec/truffle/tags/core/time/minus_tags.txt
Original file line number Diff line number Diff line change
@@ -10,3 +10,5 @@ fails:Time#- returns a non-UTC time if self is non-UTC
fails:Time#- returns a time with the same fixed offset as self
fails:Time#- returns a time with nanoseconds precision between two time objects
fails:Time#- maintains precision
fails:Time#- decrements the time by the specified amount
fails:Time#- does not return a subclass instance
2 changes: 2 additions & 0 deletions spec/truffle/tags/core/time/mktime_tags.txt
Original file line number Diff line number Diff line change
@@ -42,3 +42,5 @@ fails:Time.mktime handles fractional microseconds as a Float
fails:Time.mktime handles fractional microseconds as a Rational
fails:Time.mktime ignores fractional seconds if a passed whole number of microseconds
fails:Time.mktime ignores fractional seconds if a passed fractional number of microseconds
fails:Time.mktime creates a time based on given values, interpreted in the local time zone
fails:Time.mktime accepts various year ranges
2 changes: 2 additions & 0 deletions spec/truffle/tags/core/time/new_tags.txt
Original file line number Diff line number Diff line change
@@ -46,3 +46,5 @@ fails:Time.new with a utc_offset argument raises ArgumentError if the argument r
fails:Time.new with a utc_offset argument with an argument that responds to #to_int coerces using #to_int
fails:Time.new with a utc_offset argument with an argument that responds to #to_r coerces using #to_r
fails:Time.new with a utc_offset argument with an argument that responds to #to_str coerces using #to_str
fails:Time.new creates a time based on given values, interpreted in the local time zone
fails:Time.new accepts various year ranges
4 changes: 4 additions & 0 deletions spec/truffle/tags/core/time/nsec_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
fails:Time#nsec returns the nanoseconds part of a Time constructed with a Float number of seconds
fails:Time#nsec returns the nanoseconds part of a Time constructed with a Rational number of seconds
fails:Time#nsec returns 0 for a Time constructed with a whole number of seconds
fails:Time#nsec returns the nanoseconds part of a Time constructed with an Integer number of microseconds
fails:Time#nsec returns the nanoseconds part of a Time constructed with an Float number of microseconds
fails:Time#nsec returns the nanoseconds part of a Time constructed with an Rational number of microseconds
2 changes: 2 additions & 0 deletions spec/truffle/tags/core/time/plus_tags.txt
Original file line number Diff line number Diff line change
@@ -11,3 +11,5 @@ fails:Time#+ maintains nanoseconds precision
fails:Time#+ maintains subseconds precision
fails:Time#+ maintains precision
fails:Time#+ increments the time by the specified amount as rational numbers
fails:Time#+ increments the time by the specified amount
fails:Time#+ does not return a subclass instance
1 change: 1 addition & 0 deletions spec/truffle/tags/core/time/sec_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Time#sec returns the second of the minute(0..60) for time
30 changes: 26 additions & 4 deletions spec/truffle/tags/core/time/strftime_tags.txt
Original file line number Diff line number Diff line change
@@ -9,7 +9,29 @@ fails:Time#strftime with %z formats a UTC time offset as '+0000'
fails:Time#strftime with %z formats a local time with positive UTC offset as '+HHMM'
fails:Time#strftime with %z formats a local time with negative UTC offset as '-HHMM'
fails:Time#strftime with %z rounds fixed offset to the nearest second
fails:Time#strftime with %z formats a time with fixed positive offset as '+HHMM'
fails:Time#strftime with %z formats a time with fixed negative offset as '-HHMM'
fails:Time#strftime with %z formats a time with fixed offset as '+/-HH:MM' with ':' specifier
fails:Time#strftime with %z formats a time with fixed offset as '+/-HH:MM:SS' with '::' specifier
fails:Time#strftime formats time according to the directives in the given format string
fails:Time#strftime supports week of year format with %U and %W
fails:Time#strftime supports 12-hr formatting with %l
fails:Time#strftime supports AM/PM formatting with %p
fails:Time#strftime returns the abbreviated weekday with %a
fails:Time#strftime returns the full weekday with %A
fails:Time#strftime returns the abbreviated month with %b
fails:Time#strftime returns the full month with %B
fails:Time#strftime returns the day of the month with %d
fails:Time#strftime returns the 24-based hour with %H
fails:Time#strftime returns the 12-based hour with %I
fails:Time#strftime returns the Julian date with %j
fails:Time#strftime returns the month with %m
fails:Time#strftime returns the minute with %M
fails:Time#strftime returns the second with %S
fails:Time#strftime returns the enumerated day of the week with %w
fails:Time#strftime returns the date alone with %x
fails:Time#strftime returns the time alone with %X
fails:Time#strftime returns the year wihout a century with %y
fails:Time#strftime returns the year with %Y
fails:Time#strftime returns the timezone with %Z
fails:Time#strftime supports am/pm formatting with %P
fails:Time#strftime supports GNU modificators
fails:Time#strftime supports the '-' modifier to drop leading zeros
fails:Time#strftime supports the '-' modifier for padded format directives
fails:Time#strftime passes the format string's encoding to the result string
4 changes: 4 additions & 0 deletions spec/truffle/tags/core/time/subsec_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
fails:Time#subsec returns the fractional seconds as a Rational for a Time constructed with a Rational number of seconds
fails:Time#subsec returns the fractional seconds as a Rational for a Time constructed with a Float number of seconds
fails:Time#subsec returns 0 as a Fixnum for a Time with a whole number of seconds
fails:Time#subsec returns the fractional seconds as a Rational for a Time constructed with an Integer number of microseconds
fails:Time#subsec returns the fractional seconds as a Rational for a Time constructed with an Rational number of microseconds
fails:Time#subsec returns the fractional seconds as a Rational for a Time constructed with an Float number of microseconds
2 changes: 2 additions & 0 deletions spec/truffle/tags/core/time/succ_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fails:Time#succ returns a new time one second later than time
fails:Time#succ returns a new instance
1 change: 1 addition & 0 deletions spec/truffle/tags/core/time/to_f_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Time#to_f returns the float number of seconds + usecs since the epoch
1 change: 1 addition & 0 deletions spec/truffle/tags/core/time/to_i_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Time#to_i returns the value of time as an integer number of seconds since epoch
1 change: 1 addition & 0 deletions spec/truffle/tags/core/time/to_r_tags.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
fails:Time#to_r returns the a Rational representing seconds and subseconds since the epoch
fails:Time#to_r returns a Rational even for a whole number of seconds
3 changes: 2 additions & 1 deletion spec/truffle/tags/core/time/to_s_tags.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
fails:Time#to_s formats the fixed offset time following the pattern 'yyyy-MM-dd HH:mm:ss +/-HHMM'
fails:Time#to_s formats the local time following the pattern 'yyyy-MM-dd HH:mm:ss Z'
fails:Time#to_s formats the UTC time following the pattern 'yyyy-MM-dd HH:mm:ss UTC'
1 change: 1 addition & 0 deletions spec/truffle/tags/core/time/tv_sec_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Time#tv_sec returns the value of time as an integer number of seconds since epoch
1 change: 1 addition & 0 deletions spec/truffle/tags/core/time/usec_tags.txt
Original file line number Diff line number Diff line change
@@ -6,3 +6,4 @@ fails:Time#usec returns the microseconds part of a Time constructed with a Ratio
fails:Time#usec returns the microseconds part of a Time constructed with an Rational number of microseconds > 1
fails:Time#usec returns 0 for a Time constructed with an Rational number of microseconds < 1
fails:Time#usec returns the microseconds for time created by Time#local
fails:Time#usec returns 0 for a Time constructed with a whole number of seconds
3 changes: 3 additions & 0 deletions spec/truffle/tags/core/time/utc_tags.txt
Original file line number Diff line number Diff line change
@@ -43,3 +43,6 @@ fails:Time.utc handles fractional microseconds as a Float
fails:Time.utc handles fractional microseconds as a Rational
fails:Time.utc ignores fractional seconds if a passed whole number of microseconds
fails:Time.utc ignores fractional seconds if a passed fractional number of microseconds
fails:Time.utc creates a time based on given values, interpreted as UTC (GMT)
fails:Time.utc accepts various year ranges
fails:Time#utc returns the utc representation of time
1 change: 1 addition & 0 deletions spec/truffle/tags/core/time/wday_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Time#wday returns an integer representing the day of the week, 0..6, with Sunday being 0
1 change: 1 addition & 0 deletions spec/truffle/tags/core/time/yday_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Time#yday returns an integer representing the day of the year, 1..366
Original file line number Diff line number Diff line change
@@ -97,6 +97,7 @@ public void init() {
CoreMethodNodeManager.addCoreMethodNodes(rubyObjectClass, UnboundMethodNodesFactory.getFactories());
CoreMethodNodeManager.addCoreMethodNodes(rubyObjectClass, ByteArrayNodesFactory.getFactories());
CoreMethodNodeManager.addCoreMethodNodes(rubyObjectClass, TruffleNodesFactory.getFactories());
CoreMethodNodeManager.addCoreMethodNodes(rubyObjectClass, TimeNodesFactory.getFactories());

// Give the core library manager a chance to tweak some of those methods

12 changes: 0 additions & 12 deletions truffle/src/main/java/org/jruby/truffle/nodes/RubyNode.java
Original file line number Diff line number Diff line change
@@ -220,18 +220,6 @@ public boolean isTrue(boolean value) {
return value;
}

public RubyBignum bignum(int value) {
return bignum((long) value);
}

public RubyBignum bignum(long value) {
return bignum(BigInteger.valueOf(value));
}

public RubyBignum bignum(BigInteger value) {
return new RubyBignum(getContext().getCoreLibrary().getBignumClass(), value);
}

public RubyNode getNonWrapperNode() {
return this;
}
Original file line number Diff line number Diff line change
@@ -125,80 +125,6 @@ public boolean equal(VirtualFrame frame, Object a, Object b) {

}

@CoreMethod(names = "__id__")
public abstract static class IDNode extends CoreMethodNode {

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

public IDNode(IDNode prev) {
super(prev);
}

public abstract Object executeObjectID(VirtualFrame frame, Object value);

@Specialization
public int objectID(RubyNilClass nil) {
return ObjectIDOperations.NIL;
}

@Specialization(guards = "isTrue")
public int objectIDTrue(boolean value) {
return ObjectIDOperations.TRUE;
}

@Specialization(guards = "!isTrue")
public int objectIDFalse(boolean value) {
return ObjectIDOperations.FALSE;
}

@Specialization
public long objectID(int value) {
return ObjectIDOperations.smallFixnumToID(value);
}

@Specialization(rewriteOn = ArithmeticException.class)
public long objectIDSmallFixnumOverflow(long value) {
return ObjectIDOperations.smallFixnumToIDOverflow(value);
}

/* TODO: Ideally we would have this instead of the code below to speculate better. [GRAAL-903]
@Specialization(guards = "isSmallFixnum")
public long objectIDSmallFixnum(long value) {
return ObjectIDOperations.smallFixnumToID(value);
}
@Specialization(guards = "!isSmallFixnum")
public Object objectIDLargeFixnum(long value) {
return ObjectIDOperations.largeFixnumToID(getContext(), value);
} */

@Specialization
public Object objectID(long value) {
if (isSmallFixnum(value)) {
return ObjectIDOperations.smallFixnumToID(value);
} else {
return ObjectIDOperations.largeFixnumToID(getContext(), value);
}
}

@Specialization
public RubyBignum objectID(double value) {
return ObjectIDOperations.floatToID(getContext(), value);
}

@Specialization
public long objectID(RubyBasicObject object) {
return object.getObjectID();
}

protected boolean isSmallFixnum(long fixnum) {
return ObjectIDOperations.isSmallFixnum(fixnum);
}

}

@CoreMethod(names = "equal?", required = 1)
public abstract static class ReferenceEqualNode extends BinaryCoreMethodNode {

Loading