Skip to content

Commit 23c8be1

Browse files
authored
[instantiation linking] refactor wasm_table_inst_t (bytecodealliance#3901)
- refactor wasm_table_inst_t and add functions to retrieve export type by name
1 parent ee2d60b commit 23c8be1

File tree

5 files changed

+218
-211
lines changed

5 files changed

+218
-211
lines changed

core/iwasm/aot/aot_runtime.c

+10-3
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,7 @@ tables_instantiate(AOTModuleInstance *module_inst, AOTModule *module,
725725
#if WASM_ENABLE_GC != 0
726726
table->elem_ref_type.elem_ref_type = table_type->elem_ref_type;
727727
#endif
728+
table->is_table64 = table_type->flags & TABLE64_FLAG;
728729

729730
#if WASM_ENABLE_MULTI_MODULE != 0
730731
/* Set all elements to -1 or NULL_REF to mark them as uninitialized
@@ -788,6 +789,7 @@ tables_instantiate(AOTModuleInstance *module_inst, AOTModule *module,
788789
#if WASM_ENABLE_GC != 0
789790
table->elem_ref_type.elem_ref_type = table_type->elem_ref_type;
790791
#endif
792+
table->is_table64 = table_type->flags & TABLE64_FLAG;
791793

792794
/* Set all elements to -1 or NULL_REF to mark them as uninitialized
793795
* elements */
@@ -951,15 +953,20 @@ memories_deinstantiate(AOTModuleInstance *module_inst)
951953

952954
memory_deinstantiate(memory);
953955

954-
#if WASM_ENABLE_MULTI_MODULE == 0 && WASM_ENABLE_SHARED_MEMORY != 0
956+
#if WASM_ENABLE_MULTI_MODULE == 0
957+
#if WASM_ENABLE_SHARED_MEMORY != 0
955958
/* for spawned only */
956959
if (!shared_memory_is_shared(memory)) {
960+
wasm_runtime_free(memory);
957961
continue;
958962
}
959963

960964
if (shared_memory_get_reference(memory) == 0) {
961965
wasm_runtime_free(memory);
962966
}
967+
#else
968+
wasm_runtime_free(memory);
969+
#endif
963970
#endif
964971
}
965972

@@ -1290,8 +1297,8 @@ memories_instantiate(const AOTModule *module, AOTModuleInstance *module_inst,
12901297
#endif
12911298
/*
12921299
*TODO:
1293-
* - either memories[x] points to an external AOTMemoryInstance.
1294-
* - or memories[x] points to an internal AOTMemoryInstance in
1300+
* - either memories[x] points to an external WASM/AOTMemoryInstance.
1301+
* - or memories[x] points to an internal WASM/AOTMemoryInstance in
12951302
* global_table_data
12961303
*
12971304
* the first case is simple for maintaining resource management

0 commit comments

Comments
 (0)