Implement wasm-c-api wasm_config related APIs (#665)

And add wasm_engine_new_with_args() declaration in wasm_c_api.h
Fix wasm-c-api frame func_offset issue in fast interp mode
Remove sanitize compiler flag in product-mini linux CMakeLists.txt
This commit is contained in:
Wenyong Huang
2021-07-15 10:47:40 +08:00
committed by GitHub
parent 0f1ce9ef3d
commit ea06c19a9d
7 changed files with 74 additions and 9 deletions

View File

@ -145,6 +145,37 @@ WASM_DECLARE_OWN(engine)
WASM_API_EXTERN own wasm_engine_t* wasm_engine_new(void);
WASM_API_EXTERN own wasm_engine_t* wasm_engine_new_with_config(own wasm_config_t*);
#ifndef MEM_ALLOC_OPTION_DEFINED
#define MEM_ALLOC_OPTION_DEFINED
/* same definition from wasm_export.h */
/* Memory allocator type */
typedef enum {
/* pool mode, allocate memory from user defined heap buffer */
Alloc_With_Pool = 0,
/* user allocator mode, allocate memory from user defined
malloc function */
Alloc_With_Allocator,
/* system allocator mode, allocate memory from system allocator,
or, platform's os_malloc function */
Alloc_With_System_Allocator,
} mem_alloc_type_t;
/* Memory allocator option */
typedef union MemAllocOption {
struct {
void *heap_buf;
uint32_t heap_size;
} pool;
struct {
void *malloc_func;
void *realloc_func;
void *free_func;
} allocator;
} MemAllocOption;
#endif
WASM_API_EXTERN own wasm_engine_t *
wasm_engine_new_with_args(mem_alloc_type_t type, const MemAllocOption *opts);
// Store

View File

@ -93,6 +93,8 @@ typedef enum {
Package_Type_Unknown = 0xFFFF
} package_type_t;
#ifndef MEM_ALLOC_OPTION_DEFINED
#define MEM_ALLOC_OPTION_DEFINED
/* Memory allocator type */
typedef enum {
/* pool mode, allocate memory from user defined heap buffer */
@ -117,6 +119,7 @@ typedef union MemAllocOption {
void *free_func;
} allocator;
} MemAllocOption;
#endif
/* WASM runtime initialize arguments */
typedef struct RuntimeInitArgs {