Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions core/src/main/java/org/jruby/RubyFixnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,9 @@ public static RubyFixnum newFixnum(Ruby runtime, long value) {
public static RubyFixnum newFixnum(Ruby runtime, int value) {
if (value > Short.MAX_VALUE || value < Short.MIN_VALUE) {
// integer is never in cache range
return new IntFixnum(runtime.getInteger(), value);
// disabled to avoid polymorphism and because it doesn't save size (https://github.com/jruby/jruby/pull/9379)
// return new IntFixnum(runtime.getInteger(), value);
return new LongFixnum(runtime.getInteger(), value);
}
return newFixnum(runtime, (short) value);
}
Expand All @@ -328,7 +330,9 @@ public static RubyFixnum newFixnum(Ruby runtime, byte value) {

private static RubyFixnum newFixnumForCache(RubyClass fixnum, int value) {
if (value > Short.MAX_VALUE || value < Short.MIN_VALUE) {
return new IntFixnum(fixnum, value);
// disabled to avoid polymorphism and because it doesn't save size (https://github.com/jruby/jruby/pull/9379)
//return new IntFixnum(fixnum, value);
return new LongFixnum(fixnum, value);
} else if (value > Byte.MAX_VALUE || value < Byte.MIN_VALUE) {
return new ShortFixnum(fixnum, (short) value);
}
Expand Down