@@ -3873,7 +3873,8 @@ wasm_runtime_get_import_type(WASMModuleCommon *const module, int32 import_index,
38733873 import_type -> kind = WASM_IMPORT_EXPORT_KIND_FUNC ;
38743874 import_type -> linked =
38753875 aot_import_func -> func_ptr_linked ? true : false;
3876- import_type -> u .func_type = aot_import_func -> func_type ;
3876+ import_type -> u .func_type =
3877+ (WASMFuncType * )aot_import_func -> func_type ;
38773878 return ;
38783879 }
38793880
@@ -3909,6 +3910,8 @@ wasm_runtime_get_import_type(WASMModuleCommon *const module, int32 import_index,
39093910 import_type -> name = aot_import_memory -> memory_name ;
39103911 import_type -> kind = WASM_IMPORT_EXPORT_KIND_MEMORY ;
39113912 import_type -> linked = false;
3913+ import_type -> u .memory_type =
3914+ (WASMMemoryType * )& aot_import_memory -> mem_type ;
39123915 return ;
39133916 }
39143917
@@ -3933,20 +3936,21 @@ wasm_runtime_get_import_type(WASMModuleCommon *const module, int32 import_index,
39333936 switch (import_type -> kind ) {
39343937 case WASM_IMPORT_EXPORT_KIND_FUNC :
39353938 import_type -> linked = wasm_import -> u .function .func_ptr_linked ;
3936- import_type -> u .func_type = wasm_import -> u .function .func_type ;
3939+ import_type -> u .func_type =
3940+ (WASMFuncType * )wasm_import -> u .function .func_type ;
39373941 break ;
39383942 case WASM_IMPORT_EXPORT_KIND_GLOBAL :
39393943 import_type -> linked = wasm_import -> u .global .is_linked ;
39403944 import_type -> u .global_type =
39413945 (WASMGlobalType * )& wasm_import -> u .global .type ;
39423946 break ;
39433947 case WASM_IMPORT_EXPORT_KIND_TABLE :
3944- /* not supported */
3945- import_type -> linked = false;
3948+ import_type -> linked = false; /* not supported */
39463949 break ;
39473950 case WASM_IMPORT_EXPORT_KIND_MEMORY :
3948- /* not supported */
3949- import_type -> linked = false;
3951+ import_type -> linked = false; /* not supported */
3952+ import_type -> u .memory_type =
3953+ (WASMMemoryType * )& wasm_import -> u .memory .mem_type ;
39503954 break ;
39513955 default :
39523956 bh_assert (0 );
@@ -4026,12 +4030,11 @@ wasm_runtime_get_export_type(WASMModuleCommon *const module, int32 export_index,
40264030 .type ;
40274031 break ;
40284032 case WASM_IMPORT_EXPORT_KIND_TABLE :
4029- /* not supported */
4030- // export_type->linked = false;
40314033 break ;
40324034 case WASM_IMPORT_EXPORT_KIND_MEMORY :
4033- /* not supported */
4034- // export_type->linked = false;
4035+ export_type -> u .memory_type =
4036+ & aot_module -> memories [aot_export -> index
4037+ - aot_module -> import_memory_count ];
40354038 break ;
40364039 default :
40374040 bh_assert (0 );
@@ -4068,13 +4071,13 @@ wasm_runtime_get_export_type(WASMModuleCommon *const module, int32 export_index,
40684071 .type ;
40694072 break ;
40704073 case WASM_IMPORT_EXPORT_KIND_TABLE :
4071- /* not supported */
4072- // export_type->linked = false;
40734074 break ;
40744075 case WASM_IMPORT_EXPORT_KIND_MEMORY :
4075- /* not supported */
4076- // export_type->linked = false;
4076+ export_type -> u .memory_type =
4077+ & wasm_module -> memories [wasm_export -> index
4078+ - wasm_module -> import_memory_count ];
40774079 break ;
4080+ default :
40784081 bh_assert (0 );
40794082 break ;
40804083 }
@@ -4185,6 +4188,30 @@ wasm_global_type_get_mutable(WASMGlobalType *const global_type)
41854188 return global_type -> is_mutable ;
41864189}
41874190
4191+ bool
4192+ wasm_memory_type_get_shared (WASMMemoryType * const memory_type )
4193+ {
4194+ bh_assert (memory_type );
4195+
4196+ return (memory_type -> flags & SHARED_MEMORY_FLAG ) ? true : false;
4197+ }
4198+
4199+ uint32
4200+ wasm_memory_type_get_init_page_count (WASMMemoryType * const memory_type )
4201+ {
4202+ bh_assert (memory_type );
4203+
4204+ return memory_type -> init_page_count ;
4205+ }
4206+
4207+ uint32
4208+ wasm_memory_type_get_max_page_count (WASMMemoryType * const memory_type )
4209+ {
4210+ bh_assert (memory_type );
4211+
4212+ return memory_type -> max_page_count ;
4213+ }
4214+
41884215bool
41894216wasm_runtime_register_natives (const char * module_name ,
41904217 NativeSymbol * native_symbols ,
@@ -6519,8 +6546,8 @@ wasm_runtime_get_export_memory_type(const WASMModuleCommon *module_comm,
65196546 if (export -> index < module -> import_memory_count ) {
65206547 WASMMemoryImport * import_memory =
65216548 & ((module -> import_memories + export -> index )-> u .memory );
6522- * out_min_page = import_memory -> init_page_count ;
6523- * out_max_page = import_memory -> max_page_count ;
6549+ * out_min_page = import_memory -> mem_type . init_page_count ;
6550+ * out_max_page = import_memory -> mem_type . max_page_count ;
65246551 }
65256552 else {
65266553 WASMMemory * memory =
@@ -6540,14 +6567,14 @@ wasm_runtime_get_export_memory_type(const WASMModuleCommon *module_comm,
65406567 if (export -> index < module -> import_memory_count ) {
65416568 AOTImportMemory * import_memory =
65426569 module -> import_memories + export -> index ;
6543- * out_min_page = import_memory -> mem_init_page_count ;
6544- * out_max_page = import_memory -> mem_max_page_count ;
6570+ * out_min_page = import_memory -> mem_type . init_page_count ;
6571+ * out_max_page = import_memory -> mem_type . max_page_count ;
65456572 }
65466573 else {
65476574 AOTMemory * memory = module -> memories
65486575 + (export -> index - module -> import_memory_count );
6549- * out_min_page = memory -> mem_init_page_count ;
6550- * out_max_page = memory -> mem_max_page_count ;
6576+ * out_min_page = memory -> init_page_count ;
6577+ * out_max_page = memory -> max_page_count ;
65516578 }
65526579 return true;
65536580 }
0 commit comments