Parcourir la source

Fix drop opcode not clear frame ref issue (#2360)

Xu Jun il y a 2 ans
Parent
commit
f906585b56

+ 12 - 0
core/iwasm/interpreter/wasm_interp_classic.c

@@ -1763,12 +1763,24 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
             HANDLE_OP(WASM_OP_DROP)
             {
                 frame_sp--;
+
+#if WASM_ENABLE_GC != 0
+                frame_ref_tmp = FRAME_REF(frame_sp);
+                *frame_ref_tmp = 0;
+#endif
                 HANDLE_OP_END();
             }
 
             HANDLE_OP(WASM_OP_DROP_64)
             {
                 frame_sp -= 2;
+
+#if WASM_ENABLE_GC != 0
+                frame_ref_tmp = FRAME_REF(frame_sp);
+                *frame_ref_tmp = 0;
+                *(frame_ref_tmp + 1) = 0;
+#endif
+
                 HANDLE_OP_END();
             }
 

+ 0 - 1
core/shared/mem-alloc/ems/ems_alloc.c

@@ -480,7 +480,6 @@ alloc_hmu_ex(gc_heap_t *heap, gc_size_t size)
 #if GC_IN_EVERY_ALLOCATION != 0
     if (GC_SUCCESS != do_gc_heap(heap))
         return NULL;
-    return alloc_hmu(heap, size);
 #else
     if (heap->total_free_size < heap->gc_threshold) {
         if (GC_SUCCESS != do_gc_heap(heap))