phase: 20.49 COMPLETE; 20.50 Flow+String minimal reps; 20.51 selfhost v0/v1 minimal (Option A/B); hv1-inline binop/unop/copy; docs + run_all + CURRENT_TASK -> 21.0
This commit is contained in:
31
examples/jit_plugin_invoke_param_array.hako
Normal file
31
examples/jit_plugin_invoke_param_array.hako
Normal file
@ -0,0 +1,31 @@
|
||||
// @jit-strict
|
||||
// @jit-debug
|
||||
// @plugin-builtins
|
||||
|
||||
// JIT plugin_invoke smoke: no NewBox in JITed function
|
||||
// Requires: array plugin built + nyash.toml configured
|
||||
// Build plugins:
|
||||
// (cd plugins/nyash-array-plugin && cargo build --release)
|
||||
// Run (JIT helper only):
|
||||
// NYASH_USE_PLUGIN_BUILTINS=1 NYASH_JIT_EXEC=1 NYASH_JIT_THRESHOLD=1 \
|
||||
// NYASH_JIT_SHIM_TRACE=1 NYASH_CLI_VERBOSE=1 \
|
||||
// ./target/release/nyash --backend vm examples/jit_plugin_invoke_param_array.hako
|
||||
|
||||
static box Main {
|
||||
main() {
|
||||
local a
|
||||
// Create ArrayBox in VM (this function stays in VM)
|
||||
a = new ArrayBox()
|
||||
a.push(1)
|
||||
a.push(2)
|
||||
a.push(3)
|
||||
// Call helper (this function should JIT) — only BoxCall on parameter
|
||||
return me.helper(a)
|
||||
}
|
||||
|
||||
helper(arr) {
|
||||
// No allocations/new here; only plugin call on parameter
|
||||
return arr.length()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user