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 4650ae5
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/04-implementation/01-design.mdx
+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
@@ -30,11 +30,11 @@ Each `Instruction` is 4 bytes. That is a 1-byte `OpCode` (`#[repr(u8)]`), a 2-by
30
30
31
31
## Dispatch shape
32
32
33
-
The hot loop reads `cache.fused_ref()[ip]`, a snapshot of the instruction stream with `LoadAttr` + `Call` sites fused into `CallMethod` + `CallMethodArgs`. Fusion happens after first dispatch when every argument is a single-push load, up to 8 arguments, never across a jump target. The arg loads shift down one slot so the pair sits adjacent at the call. Fusion runs once per chunk and is cached.
33
+
The hot loop reads `cache.fused_ref()[ip]`, a snapshot of the instruction stream with `LoadAttr` + `Call` sites fused into `CallMethod` + `CallMethodArgs`. Fusion happens after first dispatch when every argument is a single-push load, up to 8 arguments, never across a jump target. The arg loads shift down one slot so the pair sits adjacent at the call. Fusion runs once per cache, and a recursion holds one cache per depth.
34
34
35
35
A build with the `coverage` feature marks every instruction the loop dispatches, and `vm.ran(chunk, ip)` says whether `chunk.instructions[ip]` ran, still after a run that raised. Fusion stays off in that build, so each ip is the one the compiler wrote, and a chunk answers under the same pointer the caller built, an imported module under its entry in `chunk.imports`.
36
36
37
-
For arith and compare opcodes the loop checks `cache.get_fast(ip)`. A present `FastOp` runs inline without a function call.
37
+
For arith and compare opcodes `exec_arith_or_compare`checks `cache.get_fast(ip)` first. A present `FastOp` runs inside that call and skips the generic handler.
38
38
39
39
`LoadConst` reads a pre-materialised `Vec<Val>` built on first dispatch. Inline-range ints stay inline. Ints from 2⁴⁷ to 2¹²⁷ allocate a `HeapObj::LongInt` slot. Literals beyond ±2¹²⁷ are rejected at parse time.
0 commit comments