Skip to content

fix(core): Don't inline invokedynamic bootstrap methods in alias analysis - #309

Draft
misonijnik wants to merge 3 commits into
mainfrom
misonijnik/fix-nested-call-arg-idx
Draft

fix(core): Don't inline invokedynamic bootstrap methods in alias analysis#309
misonijnik wants to merge 3 commits into
mainfrom
misonijnik/fix-nested-call-arg-idx

Conversation

@misonijnik

Copy link
Copy Markdown
Member

No description provided.

@misonijnik misonijnik changed the title fix(dataflow): Don't abort analysis when a nested call references an out-of-range arg fix(core): Don't abort analysis when a nested call references an out-of-range arg Jul 24, 2026
@misonijnik
misonijnik marked this pull request as draft July 24, 2026 12:31
@misonijnik
misonijnik force-pushed the misonijnik/fix-nested-call-arg-idx branch from 447ade2 to ba57918 Compare July 24, 2026 15:27
@misonijnik misonijnik changed the title fix(core): Don't abort analysis when a nested call references an out-of-range arg fix(core): Don't inline invokedynamic bootstrap methods in alias analysis Jul 24, 2026
…analysis

Alias analysis crashed with IllegalStateException("Incorrect argument
idx: 4")
while analyzing record-bearing code (e.g. Netflix Conductor's openai.api
package). A record's auto-generated equals/hashCode/toString lowers to
an
invokedynamic bootstrapped by java.lang.runtime.ObjectMethods.bootstrap,
which
declares six parameters while the dynamic call site supplies one.
resolveCallNoCache resolved that call to the six-parameter bootstrap and
inlined
it; NestedCallInstEvalCtx then mapped the callee's parameters onto the
one-element call.args and indexed past the end, aborting the whole
package
unit's alias analysis (on Conductor this silently suppressed ~60% of
findings).

Guard at the resolution boundary: never inline a callee that declares
more
parameters than the call site provides, since its parameters cannot be
soundly
mapped onto the arguments. The call becomes opaque for alias analysis --
the
conservative default for an unanalyzable callee -- and createArg's
out-of-range
check stays a genuine invariant assertion rather than a silent fallback
that
fabricates alias facts.

Baked by test: AliasSampleTest.`record invokedynamic bootstrap does not
overflow
alias arg mapping` inlines Payload.hashCode() at depth 2 and asserts the
analysis
does not throw; it fails with "Incorrect argument idx" when the guard is
removed.
The alias samples module moves to Java 17 so record samples compile --
existing
samples use no invokedynamic constructs and their behaviour is unchanged
(full
AliasSampleTest green).
@misonijnik
misonijnik force-pushed the misonijnik/fix-nested-call-arg-idx branch from ba57918 to 1244158 Compare August 3, 2026 06:02
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