Skip to content

Resolve variable-access names lazily from tagged bytecode (#12, for 25.6) - #14

Merged
Sam Gammon (sgammon) merged 2 commits into
elide-25.6.xfrom
sync/25.6-var-access
Nov 18, 2026
Merged

Sam Gammon (sgammon) merged 2 commits into
elide-25.6.xfrom
sync/25.6-var-access

Conversation

@sgammon

Copy link
Copy Markdown
Member

Port of #12 to elide-25.6.x. The bytecode cache version goes to 39 (25.6 was already at 38). The 25.6-only placeholder code unit in PBytecodeDSLRootNode also drops the removed argument. Builds with vm --env ni-ce --dynamicimports /graal-js,/graalpython,/wasm against elide-dev/graal sync/25.6-wave.

🤖 Generated with Claude Code

* Resolve variable-access names lazily from tagged bytecode

Drop the per-code-unit variable-access side table added in #11. It
duplicated names the code unit already holds and locations the Bytecode
DSL already records: every name occurrence was copied into the code unit,
marshaled (UTF-8 name plus five ints), re-interned on load, and kept on
the heap whether or not a tool was attached.

The ReadVariableTag/WriteVariableTag node object now resolves names on
demand from the tagged region's bytecode (TagTreeNode#getBytecodeNode and
the enter/return bytecode indices). The access is the last matching load
or store outside nested variable tags. Its operands identify the name:
frame slots map to varnames, cellvars and freevars; LocalAccessor operands
map through the locals table info; cell instructions carry an index; and
global/name instructions carry the name constant. Identifier locations
come from the tag's own source layers. Fused two-target unpacking now gets
one identifier layer per operand, so per-name ranges are preserved.

Variable tags no longer overwrite the compiler's currentLocation, which
is used for syntax error positions and loop-header trace lines.

Bump the bytecode cache version to 39 for the marshal format change (37 on elide-25.5.x; 25.6 was already at 38).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Fix JDK 21 download URLs for github jobs

Ported from elide-25.5.x; the 25.6-only placeholder code unit in PBytecodeDSLRootNode drops the argument too.

(cherry picked from commit 3fa9e56)

* Identify variable accesses by operation class, not instruction names

Instruction names are debugging aids and can change at any time. Use
InstructionDescriptor#getOperationClass() (GR-81626, backported in
elide-dev/graal#241) to recognize the custom name operations, and
recognize built-in local loads/stores by their local argument. The
access is still the last match outside nested variable tags: store values
can contain untagged local loads, such as the self/__class__ loads that
super() generates.

Pin the Graal imports to the backport commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Pin Graal imports to the merged getOperationClass() backport (elide-dev/graal#241)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep instruction locations unchanged inside variable tags

tagged variable access. Source sections exist whether or not tags are
instrumented, so exception locations, traceback carets and line tables
moved to the statement. This broke the tagged CPython tests
test_traceback (test_caret_in_type_annotation,
test_byte_offset_with_emojis_term_highlight) and
test_compile.test_lineno_procedure_call.

Open the statement and identifier layers outside the tag, and re-open the
previously innermost range inside it. The tag's own location stays at
the statement, which keeps debugger caller locations stable
(PythonDebugTest), and the tagged instructions keep their previous
location. The augmented-assignment read tag now uses the same layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci: sync ci/graal/common.json with the pinned Graal revision

JVMCI 25.5 (and mx 7.88.0), but ci/graal/common.json still pinned JVMCI
25.4. On that JDK Truffle falls back to the non-optimizing runtime
("Graal expected a JVMCI release version of 25.5, but got 25.4"), so
every junit test fails on the -Dpolyglot.engine.CompilationFailureAction
option the gate sets. This went unnoticed while the JDK 21 bootstrap
download failed before any test ran.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Apply mx 7.88 Eclipse formatting to TpSlotDescrGet

The style gate's CodeFormatCheck with mx 7.88.0 indents the sealed
class's permits continuation line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Michael Simacek <michael.simacek@oracle.com>
Ported from elide-25.5.x; the 25.6-only placeholder code unit in PBytecodeDSLRootNode drops the argument too.

(cherry picked from commit 09e64c7)

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

…#242)

The lazy variable-access resolution needs InstructionDescriptor.getOperationClass()
(elide-dev/graal#241), which reaches 25.6 with oracle#242.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sgammon
Sam Gammon (sgammon) merged commit 11344f3 into elide-25.6.x Nov 18, 2026
41 of 43 checks passed
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