Skip to content

Conversation

@graalvmbot
Copy link
Collaborator

Best reviewed by commit.

This PR adds:

  • A new BytecodeFrame abstraction, which is the encouraged way to access frame data. It includes accessors for locals, local names, and arguments. Includes BytecodeFrame.getNonVirtualFrame(...) methods to obtain a non-virtual frame when it is available.
  • A new GenerateBytecode#captureFramesForTrace field. Previously, frames would be captured sometimes depending on internal interpreter correctness reasons. Now, frames will not be exposed to users unless they opt-in using this flag.
  • New BytecodeRootNode.get(FrameInstance|TruffleStackTraceElement) helper methods to obtain a BytecodeNode given a frame instance/stack trace element.

Also fixes bugs with:

  • BytecodeNode#setLocalValues and ContinuationRootNodeImpl#findBytecodeIndex not unwrapping continuation frames
  • ContinuationRootNodeImpl not delegating enough methods
  • generated interpreters unnecessarily overriding countsTowardsStackTraceLimit
  • the Bytecode DSL parser not checking for unsupported root node overrides in parent classes
The default `countsTowardsStackTraceLimit` impl invokes `isInternal`, which used to force materialization of sources in the Bytecode DSL. To prevent this eager materialization, we overrode `countsTowardsStackTraceLimit` to `true` when the user did not implement it. This is incorrect: the user could override `isInternal`, but the `countsTowardsStackTraceLimit` override would ignore it. Since eager materialization no longer occurs, we can stop generating an override for this method.
…ent classes; code generation should not delegate to super method if they are abstract.
…ace configuration option Adds a new BytecodeFrame abstraction that captures the frame and location information. This abstraction should be preferred over BytecodeNode helpers since it ensures the correct location is used. Also adds a new GenerateBytecode#captureFramesForTrace configuration option that directs the interpreter to capture frames for interpreter use. Previously, the frame would sometimes be available depending on internal interpreter correctness requirements. Now, the frame is reliably available depending on the configuration option. Lanugages should use BytecodeFrame.get(element) to obtain the frame data from a TruffleStackTraceElement (element.getFrame() may still return a non-null value, but its use by languages is not supported).
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Nov 12, 2025
@graalvmbot graalvmbot merged commit da57f0f into master Nov 13, 2025
13 checks passed
@graalvmbot graalvmbot deleted the mdsouza/GR-69861-frame-apis branch November 13, 2025 03:14
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.

2 participants