Skip to content

Fallback primitive numeric ops to object dispatch#6370

Merged
headius merged 1 commit intojruby:masterfrom
headius:better_fixnum_math_fallback
Sep 1, 2020
Merged

Fallback primitive numeric ops to object dispatch#6370
headius merged 1 commit intojruby:masterfrom
headius:better_fixnum_math_fallback

Conversation

@headius
Copy link
Member

@headius headius commented Aug 29, 2020

Numeric operators with a literal long-ranged integer or double-ranged float on the RHS attempt to dispatch directly without an object, to avoid type-checking an incoming boxed Fixnum or Float object. However when the primitive type does not match the type of the LHS, we fell back to slow-path uncached invocation at indy call sites.

This patch instead falls back on "normal" invocation, currying the boxed number as the sole argument to a second call site's invoker. This allows these primitive numeric ops to fall back to fully optimizable object-based dispatch.

Numeric operators with a literal long-ranged integer or double-
ranged float on the RHS attempt to dispatch directly without an
object, to avoid type-checking an incoming boxed Fixnum or Float
object. However when the primitive type does not match the type
of the LHS, we fell back to slow-path uncached invocation at indy
call sites.

This patch instead falls back on "normal" invocation, currying the
boxed number as the sole argument to a second call site's invoker.
This allows these primitive numeric ops to fall back to fully
optimizable object-based dispatch.
@headius headius added this to the JRuby 9.3.0.0 milestone Aug 29, 2020
@headius headius merged commit 129e3d7 into jruby:master Sep 1, 2020
@headius headius deleted the better_fixnum_math_fallback branch September 30, 2020 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant