Skip to content

FIX: Record fast accessor method dependency - #14319

Open
JohnTortugo wants to merge 1 commit into
oracle:masterfrom
JohnTortugo:fix/record-fast-accessor-dependency
Open

FIX: Record fast accessor method dependency#14319
JohnTortugo wants to merge 1 commit into
oracle:masterfrom
JohnTortugo:fix/record-fast-accessor-dependency

Conversation

@JohnTortugo

Copy link
Copy Markdown
Contributor

Summary

Record accessor methods handled by BytecodeParser.tryFastInlineAccessor in the graph鈥檚 method dependency list.

Problem

The fast accessor inlining path emits a field load directly instead of creating a nested BytecodeParser. As a result, it bypasses the graph.recordMethod(method) call normally performed by BytecodeParser.build().

When JVMTI class redefinition or retransformation is enabled, HotSpot converts the recorded methods into evol_method dependencies. Without the accessor in this list, retransformation of its declaring class does not invalidate compiled
callers containing its inlined body.

This can leave stale compiled code active. The issue was reproduced using Mockito鈥檚 inline mock maker:

  1. Compile and inline a simple getter into a hot caller.
  2. Retransform the getter鈥檚 declaring class while creating a mock.
  3. Direct calls observe the transformed implementation, but the compiled caller continues executing the original inlined field read.

Fix

Call graph.recordMethod(targetMethod) when the fast accessor path successfully inlines a getter. This restores the dependency that would have been recorded by the nested parser.

Add a regression test verifying that a fast-inlined accessor is present in StructuredGraph.getMethods().

Testing

  • New regression test fails before the fix and passes afterward.
  • Full InliningTest: 37 tests passed, 2 ignored.
  • Checkstyle passed for both modified files.
  • Mockito/JUnit reproducer passed 10 consecutive runs with the rebuilt libgraal.
  • Post-fix LogCompilation output includes both:

Contributor Checklist

  • I have read the contribution guide.
  • I have the right to contribute the submitted material under the project terms.
  • I have updated tests and documentation where appropriate.
  • If I used a coding assistant, I remain responsible for the entire contribution and have reviewed it accordingly.

Fast accessor inlining bypasses the nested parser that records methods used during compilation. Record the accessor so JVMTI class redefinition invalidates callers containing its inlined body.
@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Aug 26, 2026
@JohnTortugo

Copy link
Copy Markdown
Contributor Author

/add contributor Ben Taylor (benty)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant