comptime VM: extern slice/string args (-> NUL-term char*) + float guards (Phase 4D.2)
Extract marshalExternArg: a scalar/pointer word passes verbatim (a cstring arg
already works as a pointer word via 4D.1); a string/slice {ptr,len} fat pointer is
copied into a NUL-terminated arena buffer and its char* passed -- mirrors the legacy
marshalExternArg, and is what the bundler's popen(cmd: [:0]u8, ...) needs.
Add float guards on args AND returns: floats are kindOf == .word but the host_ffi
trampolines have no float variant, so bail loudly rather than miscall through an
integer register (the legacy interp doesn't support float FFI either -> parity).
New example 0637-comptime-extern-slice-arg (#run strlen("hello, world") with a
[:0]u8 param -> 12) runs HANDLED on the VM, byte-matching legacy. 699/0 both gates.
The FFI escape now covers scalar/pointer/cstring/slice args + scalar/pointer returns.
This commit is contained in:
1
examples/expected/0637-comptime-extern-slice-arg.exit
Normal file
1
examples/expected/0637-comptime-extern-slice-arg.exit
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
1
examples/expected/0637-comptime-extern-slice-arg.stderr
Normal file
1
examples/expected/0637-comptime-extern-slice-arg.stderr
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
1
examples/expected/0637-comptime-extern-slice-arg.stdout
Normal file
1
examples/expected/0637-comptime-extern-slice-arg.stdout
Normal file
@@ -0,0 +1 @@
|
||||
len=12
|
||||
Reference in New Issue
Block a user