kpreisser opened issue #5257:
Hi!
As far as I understand the trap redesign with #5149, host traps/errors created with
wasmtime_trap_new
, as well as traps caused by setting the WASI exit code (by calling WASI'sproc_exit
), are now returned aswasmtime_error_t*
instead ofwasm_trap_t*
(e.g. withwasmtime_func_call
andwasmtime_linker_instantiate
); whereas only actual WASM traps that have a corresponding trap code (wasmtime_trap_code_t
) are still returned aswasm_trap_t*
.With #5215, the WASI exit code can now be retrieved from the
wasmtime_error_t*
.However, the unchecked variant
wasmtime_func_call_unchecked
only returns awasm_trap_t*
, but nowasmtime_error_t*
. Therefore, it doesn't seem possible e.g. to extract the WASI exit code from it:
https://github.com/bytecodealliance/wasmtime/blob/95ca72a37ae17d33d6fa727150dab5a49011b555/crates/c-api/include/wasmtime/func.h#L244-L248Would this require an adjustment of the C API? E.g., should
wasmtime_func_call_unchecked
additionally return awasmtime_error_t*
, for consistency withwasmtime_func_call
, so that it would return host traps and WASI exit traps aswasmtime_error_t*
, instead ofwasm_trap_t*
?Thanks!
kpreisser edited issue #5257:
Hi!
As far as I understand the trap redesign with #5149 regarding the C API, host traps/errors created with
wasmtime_trap_new
, as well as traps caused by setting the WASI exit code (by calling WASI'sproc_exit
), are now returned aswasmtime_error_t*
instead ofwasm_trap_t*
(e.g. withwasmtime_func_call
andwasmtime_linker_instantiate
); whereas only actual WASM traps that have a corresponding trap code (wasmtime_trap_code_t
) are still returned aswasm_trap_t*
.With #5215, the WASI exit code can now be retrieved from the
wasmtime_error_t*
.However, the unchecked variant
wasmtime_func_call_unchecked
only returns awasm_trap_t*
, but nowasmtime_error_t*
. Therefore, it doesn't seem possible e.g. to extract the WASI exit code from it:
https://github.com/bytecodealliance/wasmtime/blob/95ca72a37ae17d33d6fa727150dab5a49011b555/crates/c-api/include/wasmtime/func.h#L244-L248Would this require an adjustment of the C API? E.g., should
wasmtime_func_call_unchecked
additionally return awasmtime_error_t*
, for consistency withwasmtime_func_call
, so that it would return host traps and WASI exit traps aswasmtime_error_t*
, instead ofwasm_trap_t*
?Thanks!
kpreisser edited issue #5257:
Hi!
As far as I understand the trap redesign with #5149 regarding the C API, host traps/errors created with
wasmtime_trap_new
, as well as traps caused by setting the WASI exit code (by calling WASI'sproc_exit
), are now returned aswasmtime_error_t*
instead ofwasm_trap_t*
(e.g. withwasmtime_func_call
andwasmtime_linker_instantiate
); whereas normally only actual WASM traps that have a corresponding trap code (wasmtime_trap_code_t
) are still returned aswasm_trap_t*
.With #5215, the WASI exit code can now be retrieved from the
wasmtime_error_t*
.However, the unchecked variant
wasmtime_func_call_unchecked
only returns awasm_trap_t*
, but nowasmtime_error_t*
. Therefore, it doesn't seem possible e.g. to extract the WASI exit code from it:
https://github.com/bytecodealliance/wasmtime/blob/95ca72a37ae17d33d6fa727150dab5a49011b555/crates/c-api/include/wasmtime/func.h#L244-L248Would this require an adjustment of the C API? E.g., should
wasmtime_func_call_unchecked
additionally return awasmtime_error_t*
, for consistency withwasmtime_func_call
, so that it would return host traps and WASI exit traps aswasmtime_error_t*
, instead ofwasm_trap_t*
?Thanks!
alexcrichton commented on issue #5257:
Oh dear you are right, thanks for the report! I'll work on updating this API today to return the error/trap combo. I think the error/trap combo probably needs to be redone in the future since it makes less sense than it did before, but in the meantime no functionality should be lost with this prior refactoring.
alexcrichton closed issue #5257:
Hi!
As far as I understand the trap redesign with #5149 regarding the C API, host traps/errors created with
wasmtime_trap_new
, as well as traps caused by setting the WASI exit code (by calling WASI'sproc_exit
), are now returned aswasmtime_error_t*
instead ofwasm_trap_t*
(e.g. withwasmtime_func_call
andwasmtime_linker_instantiate
); whereas normally only actual WASM traps that have a corresponding trap code (wasmtime_trap_code_t
) are still returned aswasm_trap_t*
.With #5215, the WASI exit code can now be retrieved from the
wasmtime_error_t*
.However, the unchecked variant
wasmtime_func_call_unchecked
only returns awasm_trap_t*
, but nowasmtime_error_t*
. Therefore, it doesn't seem possible e.g. to extract the WASI exit code from it:
https://github.com/bytecodealliance/wasmtime/blob/95ca72a37ae17d33d6fa727150dab5a49011b555/crates/c-api/include/wasmtime/func.h#L244-L248Would this require an adjustment of the C API? E.g., should
wasmtime_func_call_unchecked
additionally return awasmtime_error_t*
, for consistency withwasmtime_func_call
, so that it would return host traps and WASI exit traps aswasmtime_error_t*
, instead ofwasm_trap_t*
?Thanks!
Last updated: Dec 23 2024 at 12:05 UTC