mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-09 13:16:26 +00:00
Add wasm_runtime_get_module_package_type() and wasm_runtime_get_file_package_type() (#3600)
wasm_runtime_get_file_package_type() is the counterpart of get_file_package_type(). See discussion in #3595.
This commit is contained in:
parent
8aba85825c
commit
8a6379bd0a
|
@ -871,6 +871,22 @@ get_package_type(const uint8 *buf, uint32 size)
|
||||||
return Package_Type_Unknown;
|
return Package_Type_Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PackageType
|
||||||
|
wasm_runtime_get_file_package_type(const uint8 *buf, uint32 size)
|
||||||
|
{
|
||||||
|
return get_package_type(buf, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
PackageType
|
||||||
|
wasm_runtime_get_module_package_type(WASMModuleCommon *module)
|
||||||
|
{
|
||||||
|
if (!module) {
|
||||||
|
return Package_Type_Unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
return module->module_type;
|
||||||
|
}
|
||||||
|
|
||||||
#if WASM_ENABLE_AOT != 0
|
#if WASM_ENABLE_AOT != 0
|
||||||
static uint8 *
|
static uint8 *
|
||||||
align_ptr(const uint8 *p, uint32 b)
|
align_ptr(const uint8 *p, uint32 b)
|
||||||
|
|
|
@ -422,6 +422,28 @@ wasm_runtime_get_mem_alloc_info(mem_alloc_info_t *mem_alloc_info);
|
||||||
WASM_RUNTIME_API_EXTERN package_type_t
|
WASM_RUNTIME_API_EXTERN package_type_t
|
||||||
get_package_type(const uint8_t *buf, uint32_t size);
|
get_package_type(const uint8_t *buf, uint32_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the package type of a buffer (same as get_package_type).
|
||||||
|
*
|
||||||
|
* @param buf the package buffer
|
||||||
|
* @param size the package buffer size
|
||||||
|
*
|
||||||
|
* @return the package type, return Package_Type_Unknown if the type is unknown
|
||||||
|
*/
|
||||||
|
WASM_RUNTIME_API_EXTERN package_type_t
|
||||||
|
wasm_runtime_get_file_package_type(const uint8_t *buf, uint32_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the package type of a module.
|
||||||
|
*
|
||||||
|
* @param module the module
|
||||||
|
*
|
||||||
|
* @return the package type, return Package_Type_Unknown if the type is
|
||||||
|
* unknown
|
||||||
|
*/
|
||||||
|
WASM_RUNTIME_API_EXTERN package_type_t
|
||||||
|
wasm_runtime_get_module_package_type(wasm_module_t module);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether a file is an AOT XIP (Execution In Place) file
|
* Check whether a file is an AOT XIP (Execution In Place) file
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user