You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 28b0070
Browse filesBrowse the repository at this point in the historyBrowse files
Admit methods and global-only deferred class members only when their VM state is exact. Heap activations now save, trace, relocate, and restore home-object and super scope; base constructors install private method brands before execution, while derived and field-initializing constructors retain a causal admission barrier. Unresolved source-level private names also reject eager computed-key lowering.
Verified focused Debug and TSan tier, compiler, barrier, and moving-GC witnesses; all 1,477 unit tests across four final-binary partitions plus an isolated scheduling-witness rerun; BunPress build and 89-file link check.
Test262 impact: 0 gains and 0 regressions across test/language/statements/class (4,367 cases) and test/language/expressions/object (1,170 cases), exact parent to candidate.
Copy file name to clipboardExpand all lines: docs/architecture.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ zig-js runs JavaScript through a tree-walking interpreter and a suspendable byte
23
23
Because the VM buys capability rather than speed, tiering is deliberately narrow (`plainFunctionMayUseBytecode`, `compiler.zig`):
24
24
25
25
-**Generators / async / async generators** always compile to the VM — they need suspend/resume, which the tree-walker cannot express.
26
-
- A **plain function** (non-method, non-generator, non-async, not using `arguments`) compiles to the VM only when it can actually benefit: it is strict and may contain a tail call, or it recurses by its own name (deep recursion that would otherwise overflow the native stack). Otherwise it stays on the tree-walker.
26
+
- A **plain function or method** (non-generator, non-async, not using `arguments`) compiles to the VM only when it can actually benefit: it is strict and may contain a tail call/property operation, or it recurses by its own name (deep recursion that would otherwise overflow the native stack). Method activations preserve their exact home object and `super` constructor. Otherwise the function stays on the tree-walker.
27
27
- Everything else — top-level code, and any function using a construct the compiler does not lower — tree-walks.
28
28
29
29
Because most code tree-walks, the VM path is comparatively under-exercised, so VM/tree-walker semantic divergences are a known bug surface (see the block-scoping note below).
@@ -32,7 +32,7 @@ Because most code tree-walks, the VM path is comparatively under-exercised, so V
32
32
33
33
## Lexical scoping and the slot model
34
34
35
-
The VM gives each compiled function one **flat, block-transparent slot array**: locals are frame slots indexed in O(1), and closures capture the defining frame. This is fast but does not model per-block lexical scope, so the compiler keeps functions on the tree-walker whenever correct block scoping would matter — a `let`/`const` that shadows another binding, a read in the Temporal Dead Zone (before a binding's declaration), or a `for (let …)` head captured per-iteration by a body closure. The tree-walker's `Environment` chain enforces those correctly. Proper per-block slot scoping on the VM (which would let those functions tier) is possible but unbuilt; it is only worthwhile if the VM becomes a genuine performance tier.
35
+
The VM gives each compiled function one **flat, block-transparent slot array**: locals are frame slots indexed in O(1), and closures capture the defining frame. This is fast but does not model per-block lexical scope, so the compiler keeps functions on the tree-walker whenever correct block scoping would matter — a `let`/`const` that shadows another binding, a read in the Temporal Dead Zone (before a binding's declaration), or a `for (let …)` head captured per-iteration by a body closure. Deferred class members are admitted when they use only globals, but a member that captures one of these frame slots rejects its enclosing function. Base constructors without fields can use bytecode; derived constructors and constructors with field initialization retain an explicit tree-walker barrier until bytecode activations model their initialization state. The tree-walker's `Environment` chain enforces the rejected cases correctly. Proper per-block slot scoping on the VM (which would let those functions tier) is possible but unbuilt; it is only worthwhile if the VM becomes a genuine performance tier.
36
36
37
37
Admission is observable rather than inferred from a null chunk. Every runtime
38
38
`Function` retains a stable `BytecodeAdmissionReason`, and
0 commit comments