vm: stabilize plugin-first VM output + TLV decode\n\n- runtime(plugin_loader_v2): decode plugin TLV generically (tag 1/2/3/5/6/7/8/9)\n- vm(print): coerce plugin-backed results via semantics (i64/string) for consistent output\n- vm(plugin_invoke): add decode debug; align return handling\n- bin/lib: expose runner_plugin_init in bin; fix call sites to init plugin host\n- tools(build_aot.sh): disable legacy-forbid diag and toml env for object emit\n- add VM/JIT smoke scripts (counter, filebox, jit-compare)\n\nResult: VM plugin smokes PASS; jit-direct compare PASS. AOT emit still needs CLIF block init tweak.

This commit is contained in:
nyash-dev
2025-09-08 01:08:59 +09:00
parent 1bb2d2db5b
commit 5ab3cc6688
18 changed files with 565 additions and 119 deletions

View File

@ -0,0 +1,14 @@
// mir-compare-multi - exercise Compare ops under JIT-direct
static box Main {
main() {
local c = 0
if 1 < 2 { c = c + 1 } // true
if 2 < 1 { c = c + 10 } // false (unchanged)
if 5 == 5 { c = c + 100 } // true
if 7 != 7 { c = c + 1000 } // false
// Expect 1 + 100 = 101
return c
}
}

View File

@ -0,0 +1,12 @@
// vm-plugin-smoke-counter
// Purpose: Verify VM uses plugin boxes deterministically (CounterBox)
// Expected: returns 1 after a single inc()
// Note: VM runner in this branch initializes plugin host and prefers
// plugin implementations for core boxes. CounterBox is provided by
// libnyash_counter_plugin per nyash.toml.
local c = new CounterBox()
c.inc()
return c.get()

View File

@ -0,0 +1,12 @@
// vm-plugin-smoke-filebox
// Purpose: Verify VM uses FileBox plugin to open/read a file.
// Script expects the test file to be created by the runner script.
local path = "tmp/vm_filebox_smoke.txt"
local f = new FileBox()
f.open(path, "r")
local s = f.read()
f.close()
// Return the length of read content to avoid printing large buffers
return s.length()