mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-09 13:16:26 +00:00
fast-interp: Fix GC opcode ref.as_non_null (#3156)
The issue was found in https://github.com/bytecodealliance/wasm-micro-runtime/issues/3151.
This commit is contained in:
parent
b0c54c8a86
commit
3a0e86454e
|
@ -686,10 +686,12 @@ aot_add_llvm_func(AOTCompContext *comp_ctx, LLVMModuleRef module,
|
||||||
|
|
||||||
bh_assert(func_index < comp_ctx->func_ctx_count);
|
bh_assert(func_index < comp_ctx->func_ctx_count);
|
||||||
bh_assert(LLVMGetReturnType(func_type) == ret_type);
|
bh_assert(LLVMGetReturnType(func_type) == ret_type);
|
||||||
|
|
||||||
const char *prefix = AOT_FUNC_PREFIX;
|
const char *prefix = AOT_FUNC_PREFIX;
|
||||||
const bool need_precheck =
|
const bool need_precheck =
|
||||||
comp_ctx->enable_stack_bound_check || comp_ctx->enable_stack_estimation;
|
comp_ctx->enable_stack_bound_check || comp_ctx->enable_stack_estimation;
|
||||||
LLVMValueRef precheck_func;
|
LLVMValueRef precheck_func = NULL;
|
||||||
|
|
||||||
if (need_precheck) {
|
if (need_precheck) {
|
||||||
precheck_func = aot_add_llvm_func1(comp_ctx, module, func_index,
|
precheck_func = aot_add_llvm_func1(comp_ctx, module, func_index,
|
||||||
aot_func_type->param_count,
|
aot_func_type->param_count,
|
||||||
|
|
|
@ -2437,11 +2437,12 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
|
|
||||||
HANDLE_OP(WASM_OP_REF_AS_NON_NULL)
|
HANDLE_OP(WASM_OP_REF_AS_NON_NULL)
|
||||||
{
|
{
|
||||||
gc_obj = GET_REF_FROM_ADDR(frame_sp - REF_CELL_NUM);
|
gc_obj = POP_REF();
|
||||||
if (gc_obj == NULL_REF) {
|
if (gc_obj == NULL_REF) {
|
||||||
wasm_set_exception(module, "null reference");
|
wasm_set_exception(module, "null reference");
|
||||||
goto got_exception;
|
goto got_exception;
|
||||||
}
|
}
|
||||||
|
PUSH_REF(gc_obj);
|
||||||
HANDLE_OP_END();
|
HANDLE_OP_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1967,12 +1967,12 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
}
|
}
|
||||||
HANDLE_OP(WASM_OP_REF_AS_NON_NULL)
|
HANDLE_OP(WASM_OP_REF_AS_NON_NULL)
|
||||||
{
|
{
|
||||||
opnd_off = GET_OFFSET();
|
gc_obj = POP_REF();
|
||||||
gc_obj = GET_REF_FROM_ADDR(frame_lp + opnd_off);
|
|
||||||
if (gc_obj == NULL_REF) {
|
if (gc_obj == NULL_REF) {
|
||||||
wasm_set_exception(module, "null reference");
|
wasm_set_exception(module, "null reference");
|
||||||
goto got_exception;
|
goto got_exception;
|
||||||
}
|
}
|
||||||
|
PUSH_REF(gc_obj);
|
||||||
HANDLE_OP_END();
|
HANDLE_OP_END();
|
||||||
}
|
}
|
||||||
HANDLE_OP(WASM_OP_REF_EQ)
|
HANDLE_OP(WASM_OP_REF_EQ)
|
||||||
|
|
|
@ -12253,11 +12253,10 @@ re_scan:
|
||||||
error_buf, error_buf_size))) {
|
error_buf, error_buf_size))) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#if WASM_ENABLE_FAST_INTERP != 0
|
#if WASM_ENABLE_FAST_INTERP != 0
|
||||||
disable_emit = true;
|
disable_emit = true;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* PUSH the converted (ref ht) */
|
/* PUSH the converted (ref ht) */
|
||||||
if (type != VALUE_TYPE_ANY) {
|
if (type != VALUE_TYPE_ANY) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user