Skip to content

VM: add activation-local scratch storage for program lowering #706

Description

@chrisbbreuer

Parents: #498, #502
Related: #705, #491

Problem

Program-mode bytecode runs without a frame. Compiler lowering that must retain private intermediate state across observable calls cannot safely use synthesized global/environment bindings: nested evaluation can collide on the same hidden name, and shared-realm parallel execution can race or corrupt another invocation. Plain functions have frame slots and suspendable functions have activation environments; programs need an equivalent native per-execution facility.

Scope

  • Add bounded activation-local scratch storage for program bytecode, with explicit load/store/release operations or an equivalent verified operand-stack contract.
  • Root managed Values across GC relocation and preserve them across debugger checkpoints, exceptions, and native-tier fallback.
  • Keep scratch state private from global lexical/object reflection and separate across recursive, nested-eval, and parallel shared-realm executions.
  • Give the compiler a backend-neutral way to retain resolved references and other short-lived intermediates without heap wrappers or global names.

No-workaround rules

  • No process/global mutable scratch, hidden global properties/bindings, guessed NUL-name isolation, repeated observable evaluation, heap wrapper per reference, GIL-only serialization, or tree-walker callback presented as program lowering.

Acceptance

  • Recursive, nested direct/indirect eval, debugger, exception, GC relocation, and no-GIL parallel witnesses prove invocation isolation.
  • Interpreter, VM, baseline, optimizer, and deopt paths agree on scratch liveness and reconstruction.
  • TSan is clean and OOM/overflow fail explicitly without partial publication.
  • Compiler: lower member logical assignment references #705 top-level member logical assignments use the facility with exact one-shot reference semantics.
  • Full correctness gates and quantified overhead/code-size evidence pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions