Sync HERE to WASM memory, replace HERE host function with Forth (Phase 4)
HERE is now defined in boot.fth as `: HERE 12 @ ;` (reads SYSVAR_HERE from WASM linear memory). The Rust side syncs user_here to memory[12]: - At the start of each evaluate() call (sync_here_to_wasm) - In each host function that modifies HERE (ALLOT, comma, C-comma, ALIGN) This avoids per-token sync overhead — only 2 sync points per evaluate() call plus host-function writes. Removed the HERE host function closure (~30 lines). All 426 tests pass.
This commit is contained in:
@@ -137,3 +137,14 @@
|
||||
|
||||
\ */MOD ( n1 n2 n3 -- rem quot )
|
||||
: */MOD >R M* R> FM/MOD ;
|
||||
|
||||
\ ---------------------------------------------------------------
|
||||
\ Phase 4: HERE and ALIGNED
|
||||
\ ---------------------------------------------------------------
|
||||
|
||||
\ HERE reads from SYSVAR_HERE (offset 12 in WASM memory).
|
||||
\ The Rust side syncs user_here to memory[12] before each evaluate call
|
||||
\ and whenever host ALLOT/comma modifies it.
|
||||
: HERE 12 @ ;
|
||||
|
||||
\ ALIGNED is already an IR primitive in the compiler.
|
||||
|
||||
Reference in New Issue
Block a user