re-org bh_definition.c && introduce wamr fast interpreter (#189)
Co-authored-by: Xu Jun
This commit is contained in:
@ -11,6 +11,7 @@
|
||||
#include "bh_thread.h"
|
||||
#include "wasm_exec_env.h"
|
||||
#include "wasm_native.h"
|
||||
#include "../include/wasm_export.h"
|
||||
#include "../interpreter/wasm.h"
|
||||
#if WASM_ENABLE_LIBC_WASI != 0
|
||||
#include "wasmtime_ssp.h"
|
||||
@ -24,13 +25,6 @@ extern "C" {
|
||||
#define wasm_malloc bh_malloc
|
||||
#define wasm_free bh_free
|
||||
|
||||
/* Package Type */
|
||||
typedef enum {
|
||||
Wasm_Module_Bytecode = 0,
|
||||
Wasm_Module_AoT,
|
||||
Package_Type_Unknown = 0xFFFF
|
||||
} PackageType;
|
||||
|
||||
typedef struct WASMModuleCommon {
|
||||
/* Module type, for module loaded from WASM bytecode binary,
|
||||
this field is Wasm_Module_Bytecode, and this structure should
|
||||
@ -53,19 +47,6 @@ typedef struct WASMModuleInstanceCommon {
|
||||
uint8 module_inst_data[1];
|
||||
} WASMModuleInstanceCommon;
|
||||
|
||||
typedef void WASMFunctionInstanceCommon;
|
||||
|
||||
/* WASM section */
|
||||
typedef struct WASMSection {
|
||||
struct WASMSection *next;
|
||||
/* section type */
|
||||
int section_type;
|
||||
/* section body, not include type and size */
|
||||
const uint8 *section_body;
|
||||
/* section body size */
|
||||
uint32 section_body_size;
|
||||
} WASMSection, AOTSection;
|
||||
|
||||
#if WASM_ENABLE_LIBC_WASI != 0
|
||||
typedef struct WASIContext {
|
||||
struct fd_table *curfds;
|
||||
@ -74,6 +55,9 @@ typedef struct WASIContext {
|
||||
} WASIContext;
|
||||
#endif
|
||||
|
||||
typedef package_type_t PackageType;
|
||||
typedef wasm_section_t WASMSection, AOTSection;
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
bool
|
||||
wasm_runtime_init();
|
||||
@ -82,6 +66,14 @@ wasm_runtime_init();
|
||||
void
|
||||
wasm_runtime_destroy();
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
bool
|
||||
wasm_runtime_full_init(RuntimeInitArgs *init_args);
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
void
|
||||
wasm_runtime_full_destroy();
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
PackageType
|
||||
get_package_type(const uint8 *buf, uint32 size);
|
||||
@ -112,7 +104,7 @@ wasm_runtime_deinstantiate(WASMModuleInstanceCommon *module_inst);
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
WASMFunctionInstanceCommon *
|
||||
wasm_runtime_lookup_function(const WASMModuleInstanceCommon *module_inst,
|
||||
wasm_runtime_lookup_function(WASMModuleInstanceCommon * const module_inst,
|
||||
const char *name, const char *signature);
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
@ -245,7 +237,7 @@ wasm_runtime_set_wasi_args(WASMModuleCommon *module,
|
||||
const char *dir_list[], uint32 dir_count,
|
||||
const char *map_dir_list[], uint32 map_dir_count,
|
||||
const char *env_list[], uint32 env_count,
|
||||
const char *argv[], uint32 argc);
|
||||
char *argv[], int argc);
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
bool
|
||||
@ -260,7 +252,7 @@ wasm_runtime_init_wasi(WASMModuleInstanceCommon *module_inst,
|
||||
const char *dir_list[], uint32 dir_count,
|
||||
const char *map_dir_list[], uint32 map_dir_count,
|
||||
const char *env[], uint32 env_count,
|
||||
const char *argv[], uint32 argc,
|
||||
char *argv[], uint32 argc,
|
||||
char *error_buf, uint32 error_buf_size);
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user