Skip to content

Commit afdc016

Browse files
committed
Restore call site check in optimized plus site
1 parent 163906e commit afdc016

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

core/src/main/java/org/jruby/runtime/callsite/PlusCallSite.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,15 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
3232
@Override
3333
public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg1) {
3434
if (self instanceof RubyFixnum && Builtins.checkIntegerPlus(context)) {
35-
return ((RubyFixnum) self).op_plus(context, arg1);
35+
CacheEntry cache = this.cache;
36+
if (cache instanceof FixnumEntry && cache.typeOk(getMetaClass(self))) {
37+
return ((RubyFixnum) self).op_plus(context, arg1);
38+
}
3639
} else if (self instanceof RubyFloat && Builtins.checkFloatPlus(context)) {
37-
return ((RubyFloat) self).op_plus(context, arg1);
40+
CacheEntry cache = this.secondaryCache;
41+
if (cache instanceof FloatEntry && cache.typeOk(getMetaClass(self))) {
42+
return ((RubyFloat) self).op_plus(context, arg1);
43+
}
3844
}
3945
return super.call(context, caller, self, arg1);
4046
}

0 commit comments

Comments
 (0)