Skip to content

fix(BytecodeNode): Return -1 from BytecodeNode BCI lookups when the BCI slot is unset - #14536

Open
The-Alchemist wants to merge 1 commit into
oracle:masterfrom
The-Alchemist:fix-bytecode-unset-bci-slot
Open

The-Alchemist wants to merge 1 commit into
oracle:masterfrom
The-Alchemist:fix-bytecode-unset-bci-slot

Conversation

@The-Alchemist

@The-Alchemist The-Alchemist commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • With storeBytecodeIndexInFrame = true, the bytecode index is written to the frame lazily, only before operations that need it. A frame read before the first write (for example, one materialized by the first operation in a root) still has the BCI slot marked Illegal.
  • The generated BytecodeNode.getBytecodeIndex(Frame) and both findBytecodeIndex(...) overrides read the slot unconditionally, so they threw FrameSlotTypeException instead of reporting an unknown location.
  • The root node's findBytecodeIndex(Node, Frame) already guarded against this and returned -1. The BytecodeNode variants now share that piece of code through a single helper
  • Added ReadBytecodeLocationTest#testReadBeforeStore, which reads the location through all three entry points before any BCI store.

Feedback welcome!

With storeBytecodeIndexInFrame, the BCI slot is written lazily. A frame
read before the first write still has the slot marked Illegal, so
BytecodeNode.getBytecodeIndex(Frame) and findBytecodeIndex threw
FrameSlotTypeException. They now apply the same Illegal check as the
root node's findBytecodeIndex and return -1.

Signed-off-by: The-Alchemist <kap4020@gmail.com>
@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Sep 26, 2026
@The-Alchemist
The-Alchemist marked this pull request as ready for review September 26, 2026 22:03
@The-Alchemist The-Alchemist changed the title Return -1 from BytecodeNode BCI lookups when the BCI slot is unset fix(BytecodeNode): Return -1 from BytecodeNode BCI lookups when the BCI slot is unset Sep 26, 2026

This branch has not been deployed

No deployments
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