Skip to content

Permute indy invoke paths to reduce uncached stack#8446

Open
headius wants to merge 1 commit intojruby:masterfrom
headius:permute_indy_invokes
Open

Permute indy invoke paths to reduce uncached stack#8446
headius wants to merge 1 commit intojruby:masterfrom
headius:permute_indy_invokes

Conversation

@headius
Copy link
Member

@headius headius commented Nov 22, 2024

Passing all uncached calls through the varargs form simplifies maintenance, but requires an indirect dispatch for the first invocation. This adds several frames to the stack for such uncached calls. The patch here permutes the InvokeSite.invoke methods so they can directly dispatch to the to-be-cached handle, reducing the number of stack frames in a backtrace.

This is unlikely to reduce actual stack consumption due to the unoptimized MethodHandle and LambdaForm between the invokeExact call and the target method.

See #8410 for original PR closed by 9.4-dev branch deletion.

Passing all uncached calls through the varargs form simplifies
maintenance, but requires an indirect dispatch for the first
invocation. This adds several frames to the stack for such uncached
calls. The patch here permutes the InvokeSite.invoke methods so
they can directly dispatch to the to-be-cached handle, reducing the
number of stack frames in a backtrace.

This is unlikely to reduce actual stack consumption due to the
unoptimized MethodHandle and LambdaForm between the invokeExact
call and the target method.
@headius headius added this to the JRuby 10.0.0.0 milestone Nov 22, 2024
@headius headius changed the base branch from 10-dev to master March 10, 2025 22:10
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