|
|
@@ -3873,7 +3873,8 @@ wasm_runtime_get_import_type(WASMModuleCommon *const module, int32 import_index,
|
|
|
import_type->kind = WASM_IMPORT_EXPORT_KIND_FUNC;
|
|
|
import_type->linked =
|
|
|
aot_import_func->func_ptr_linked ? true : false;
|
|
|
- import_type->u.func_type = aot_import_func->func_type;
|
|
|
+ import_type->u.func_type =
|
|
|
+ (WASMFuncType *)aot_import_func->func_type;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -3909,6 +3910,8 @@ wasm_runtime_get_import_type(WASMModuleCommon *const module, int32 import_index,
|
|
|
import_type->name = aot_import_memory->memory_name;
|
|
|
import_type->kind = WASM_IMPORT_EXPORT_KIND_MEMORY;
|
|
|
import_type->linked = false;
|
|
|
+ import_type->u.memory_type =
|
|
|
+ (WASMMemoryType *)&aot_import_memory->mem_type;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -3933,7 +3936,8 @@ wasm_runtime_get_import_type(WASMModuleCommon *const module, int32 import_index,
|
|
|
switch (import_type->kind) {
|
|
|
case WASM_IMPORT_EXPORT_KIND_FUNC:
|
|
|
import_type->linked = wasm_import->u.function.func_ptr_linked;
|
|
|
- import_type->u.func_type = wasm_import->u.function.func_type;
|
|
|
+ import_type->u.func_type =
|
|
|
+ (WASMFuncType *)wasm_import->u.function.func_type;
|
|
|
break;
|
|
|
case WASM_IMPORT_EXPORT_KIND_GLOBAL:
|
|
|
import_type->linked = wasm_import->u.global.is_linked;
|
|
|
@@ -3941,12 +3945,12 @@ wasm_runtime_get_import_type(WASMModuleCommon *const module, int32 import_index,
|
|
|
(WASMGlobalType *)&wasm_import->u.global.type;
|
|
|
break;
|
|
|
case WASM_IMPORT_EXPORT_KIND_TABLE:
|
|
|
- /* not supported */
|
|
|
- import_type->linked = false;
|
|
|
+ import_type->linked = false; /* not supported */
|
|
|
break;
|
|
|
case WASM_IMPORT_EXPORT_KIND_MEMORY:
|
|
|
- /* not supported */
|
|
|
- import_type->linked = false;
|
|
|
+ import_type->linked = false; /* not supported */
|
|
|
+ import_type->u.memory_type =
|
|
|
+ (WASMMemoryType *)&wasm_import->u.memory.mem_type;
|
|
|
break;
|
|
|
default:
|
|
|
bh_assert(0);
|
|
|
@@ -4026,12 +4030,11 @@ wasm_runtime_get_export_type(WASMModuleCommon *const module, int32 export_index,
|
|
|
.type;
|
|
|
break;
|
|
|
case WASM_IMPORT_EXPORT_KIND_TABLE:
|
|
|
- /* not supported */
|
|
|
- // export_type->linked = false;
|
|
|
break;
|
|
|
case WASM_IMPORT_EXPORT_KIND_MEMORY:
|
|
|
- /* not supported */
|
|
|
- // export_type->linked = false;
|
|
|
+ export_type->u.memory_type =
|
|
|
+ &aot_module->memories[aot_export->index
|
|
|
+ - aot_module->import_memory_count];
|
|
|
break;
|
|
|
default:
|
|
|
bh_assert(0);
|
|
|
@@ -4068,13 +4071,13 @@ wasm_runtime_get_export_type(WASMModuleCommon *const module, int32 export_index,
|
|
|
.type;
|
|
|
break;
|
|
|
case WASM_IMPORT_EXPORT_KIND_TABLE:
|
|
|
- /* not supported */
|
|
|
- // export_type->linked = false;
|
|
|
break;
|
|
|
case WASM_IMPORT_EXPORT_KIND_MEMORY:
|
|
|
- /* not supported */
|
|
|
- // export_type->linked = false;
|
|
|
+ export_type->u.memory_type =
|
|
|
+ &wasm_module->memories[wasm_export->index
|
|
|
+ - wasm_module->import_memory_count];
|
|
|
break;
|
|
|
+ default:
|
|
|
bh_assert(0);
|
|
|
break;
|
|
|
}
|
|
|
@@ -4185,6 +4188,30 @@ wasm_global_type_get_mutable(WASMGlobalType *const global_type)
|
|
|
return global_type->is_mutable;
|
|
|
}
|
|
|
|
|
|
+bool
|
|
|
+wasm_memory_type_get_shared(WASMMemoryType *const memory_type)
|
|
|
+{
|
|
|
+ bh_assert(memory_type);
|
|
|
+
|
|
|
+ return (memory_type->flags & SHARED_MEMORY_FLAG) ? true : false;
|
|
|
+}
|
|
|
+
|
|
|
+uint32
|
|
|
+wasm_memory_type_get_init_page_count(WASMMemoryType *const memory_type)
|
|
|
+{
|
|
|
+ bh_assert(memory_type);
|
|
|
+
|
|
|
+ return memory_type->init_page_count;
|
|
|
+}
|
|
|
+
|
|
|
+uint32
|
|
|
+wasm_memory_type_get_max_page_count(WASMMemoryType *const memory_type)
|
|
|
+{
|
|
|
+ bh_assert(memory_type);
|
|
|
+
|
|
|
+ return memory_type->max_page_count;
|
|
|
+}
|
|
|
+
|
|
|
bool
|
|
|
wasm_runtime_register_natives(const char *module_name,
|
|
|
NativeSymbol *native_symbols,
|
|
|
@@ -6519,8 +6546,8 @@ wasm_runtime_get_export_memory_type(const WASMModuleCommon *module_comm,
|
|
|
if (export->index < module->import_memory_count) {
|
|
|
WASMMemoryImport *import_memory =
|
|
|
&((module->import_memories + export->index)->u.memory);
|
|
|
- *out_min_page = import_memory->init_page_count;
|
|
|
- *out_max_page = import_memory->max_page_count;
|
|
|
+ *out_min_page = import_memory->mem_type.init_page_count;
|
|
|
+ *out_max_page = import_memory->mem_type.max_page_count;
|
|
|
}
|
|
|
else {
|
|
|
WASMMemory *memory =
|
|
|
@@ -6540,14 +6567,14 @@ wasm_runtime_get_export_memory_type(const WASMModuleCommon *module_comm,
|
|
|
if (export->index < module->import_memory_count) {
|
|
|
AOTImportMemory *import_memory =
|
|
|
module->import_memories + export->index;
|
|
|
- *out_min_page = import_memory->mem_init_page_count;
|
|
|
- *out_max_page = import_memory->mem_max_page_count;
|
|
|
+ *out_min_page = import_memory->mem_type.init_page_count;
|
|
|
+ *out_max_page = import_memory->mem_type.max_page_count;
|
|
|
}
|
|
|
else {
|
|
|
AOTMemory *memory = module->memories
|
|
|
+ (export->index - module->import_memory_count);
|
|
|
- *out_min_page = memory->mem_init_page_count;
|
|
|
- *out_max_page = memory->mem_max_page_count;
|
|
|
+ *out_min_page = memory->init_page_count;
|
|
|
+ *out_max_page = memory->max_page_count;
|
|
|
}
|
|
|
return true;
|
|
|
}
|