From 00c2aa10a8428aa38a0197c97455a8bc3a24937d Mon Sep 17 00:00:00 2001 From: James Ring Date: Sat, 23 Nov 2024 19:30:00 -0800 Subject: [PATCH] Drop declarative elements on module instantiation (#3922) --- core/iwasm/aot/aot_runtime.c | 4 +++- core/iwasm/interpreter/wasm_runtime.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/iwasm/aot/aot_runtime.c b/core/iwasm/aot/aot_runtime.c index 5d50f255c..8a33a7271 100644 --- a/core/iwasm/aot/aot_runtime.c +++ b/core/iwasm/aot/aot_runtime.c @@ -1905,7 +1905,9 @@ aot_instantiate(AOTModule *module, AOTModuleInstance *parent, goto fail; } for (i = 0; i < module->table_init_data_count; i++) { - if (wasm_elem_is_active(module->table_init_data_list[i]->mode)) + if (wasm_elem_is_active(module->table_init_data_list[i]->mode) + || wasm_elem_is_declarative( + module->table_init_data_list[i]->mode)) bh_bitmap_set_bit(common->elem_dropped, i); } } diff --git a/core/iwasm/interpreter/wasm_runtime.c b/core/iwasm/interpreter/wasm_runtime.c index 0f1ccd937..f9378aac9 100644 --- a/core/iwasm/interpreter/wasm_runtime.c +++ b/core/iwasm/interpreter/wasm_runtime.c @@ -2467,7 +2467,8 @@ wasm_instantiate(WASMModule *module, WASMModuleInstance *parent, goto fail; } for (i = 0; i < module->table_seg_count; i++) { - if (wasm_elem_is_active(module->table_segments[i].mode)) + if (wasm_elem_is_active(module->table_segments[i].mode) + || wasm_elem_is_declarative(module->table_segments[i].mode)) bh_bitmap_set_bit(module_inst->e->common.elem_dropped, i); } }