perf(core): typed calling convention for words with a known stack effect
Such a word now compiles to a fast entry (i32 x p) -> (i32 x q) carrying its stack items as WASM values, plus the usual ( -- ) wrapper that keeps the table slot, so EXECUTE / interpreter / host words / CATCH see the unchanged memory ABI. Fib(25) 1035 -> 366 us, 4.3x slower than sf64 -> 1.2x; the default guards-on config 1740 -> 361 us. WS-006.
This commit is contained in:
@@ -263,7 +263,8 @@ fn cmd_run(file: &str) -> anyhow::Result<()> {
|
||||
}
|
||||
|
||||
/// `WaferConfig` for CLI-created VMs. `WAFER_STACK_GUARDS=0|1` overrides
|
||||
/// the per-command default (REPL/file execution on, build off).
|
||||
/// the per-command default (REPL/file execution on, build off);
|
||||
/// `WAFER_TYPED_CALLS=0` falls back to the memory-stack calling convention.
|
||||
fn vm_config(default_guards: bool) -> wafer_core::config::WaferConfig {
|
||||
let mut cfg = wafer_core::config::WaferConfig::all();
|
||||
cfg.codegen.stack_guards = match std::env::var("WAFER_STACK_GUARDS").ok().as_deref() {
|
||||
@@ -271,6 +272,7 @@ fn vm_config(default_guards: bool) -> wafer_core::config::WaferConfig {
|
||||
Some(_) => true,
|
||||
None => default_guards,
|
||||
};
|
||||
cfg.codegen.typed_calls = std::env::var("WAFER_TYPED_CALLS").ok().as_deref() != Some("0");
|
||||
cfg
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user