You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I will try to find minimal repro (or stacktraces/opcodes sequence) in few days but when working on porting Erlang to WASM I noticed that OP_IS_FUNCTION2 sometimes crashed.
After decoding it as a term, the crash disappeared:
@ -5252,37 +5251,41 @@ wait_timeout_trap_handler:
DECODE_LABEL(label, pc)
term arg1;
DECODE_COMPACT_TERM(arg1, pc)
- unsigned int arity;- DECODE_INTEGER(arity, pc)+ term arity_term;+ DECODE_COMPACT_TERM(arity_term, pc)
#ifdef IMPL_EXECUTE_LOOP
- if (term_is_function(arg1)) {- const term *boxed_value = term_to_const_term_ptr(arg1);+ if (term_is_function(arg1)) {+ const uint32_t arity = term_to_int(arity_term);+ const term *boxed_value = term_to_const_term_ptr(arg1);
Not sure if AVM does some post-processing for BEAM bytecode when compiling to .avm or something else is in play.
BEAM book suggests that the opcode should have term/register (depending on %hot/%cold modifiers) type in emulator mode but literal in JIT
The text was updated successfully, but these errors were encountered:
jakub-gonet
changed the title
is_function/3 opcode sometimes is a term, crashing VM
is_function/3 opcode doesn't handle arity as a term
Dec 2, 2024
I will try to find minimal repro (or stacktraces/opcodes sequence) in few days but when working on porting Erlang to WASM I noticed that
OP_IS_FUNCTION2
sometimes crashed.After decoding it as a term, the crash disappeared:
Not sure if AVM does some post-processing for BEAM bytecode when compiling to
.avm
or something else is in play.BEAM book suggests that the opcode should have term/register (depending on
%hot/%cold
modifiers) type in emulator mode but literal in JITThe text was updated successfully, but these errors were encountered: