Implement more wasm-c-apis and enable Envoy integration (#622)

Implement more wasm-c-api APIs to support Envoy integration:
- sync up with latest c-api definition
- change CMakeLists to export necessary headers and install the static library of iwasm
- enable to export tables and memories
- support memorytype and tabletype APIs
- update wasm-c-api sampels
- enable to export importtype APIs

And refine bazel scripts for sample XNNPACK workload, add license headers for sample simple.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
Wenyong Huang
2021-04-27 17:05:40 +08:00
committed by GitHub
parent a332a49a0d
commit eb29385963
36 changed files with 3190 additions and 1939 deletions

View File

@ -784,11 +784,6 @@ create_export_funcs(AOTModuleInstance *module_inst, AOTModule *module,
uint64 size;
uint32 i, func_index, ftype_index;
for (i = 0; i < module->export_count; i++) {
if (exports[i].kind == EXPORT_KIND_FUNC)
module_inst->export_func_count++;
}
if (module_inst->export_func_count > 0) {
/* Allocate memory */
size = sizeof(AOTFunctionInstance)
@ -829,6 +824,28 @@ static bool
create_exports(AOTModuleInstance *module_inst, AOTModule *module,
char *error_buf, uint32 error_buf_size)
{
AOTExport *exports = module->exports;
uint32 i;
for (i = 0; i < module->export_count; i++) {
switch (exports[i].kind) {
case EXPORT_KIND_FUNC:
module_inst->export_func_count++;
break;
case EXPORT_KIND_GLOBAL:
module_inst->export_global_count++;
break;
case EXPORT_KIND_TABLE:
module_inst->export_tab_count++;
break;
case EXPORT_KIND_MEMORY:
module_inst->export_mem_count++;
break;
default:
return false;
}
}
return create_export_funcs(module_inst, module,
error_buf, error_buf_size);
}

File diff suppressed because it is too large Load Diff

View File

@ -24,17 +24,9 @@ WASM_DECLARE_VEC(module, *)
WASM_DECLARE_VEC(instance, *)
/* Runtime Environment */
typedef enum runtime_mode_e {
INTERP_MODE = 0,
JIT_MODE,
AOT_MODE
} runtime_mode_e;
struct wasm_engine_t {
/* support one store for now */
wasm_store_vec_t *stores;
/* Interpreter by deault */
runtime_mode_e mode;
};
struct wasm_store_t {
@ -64,13 +56,13 @@ struct wasm_globaltype_t {
struct wasm_tabletype_t {
uint32 extern_kind;
/* always be WASM_FUNCREF */
wasm_valtype_t *type;
wasm_limits_t *limits;
wasm_valtype_t *val_type;
wasm_limits_t limits;
};
struct wasm_memorytype_t {
uint32 extern_kind;
wasm_limits_t *limits;
wasm_limits_t limits;
};
struct wasm_externtype_t {
@ -78,16 +70,15 @@ struct wasm_externtype_t {
uint8 data[1];
};
struct wasm_import_type_t {
uint32 extern_kind;
struct wasm_importtype_t {
wasm_name_t *module_name;
wasm_name_t *name;
wasm_externtype_t *extern_type;
};
struct wasm_export_type_t {
uint32 extern_kind;
wasm_name_t *module_name;
struct wasm_exporttype_t {
wasm_name_t *name;
wasm_externtype_t *extern_type;
};
/* Runtime Objects */
@ -104,7 +95,7 @@ struct wasm_func_t {
wasm_name_t *name;
uint16 kind;
wasm_functype_t *func_type;
wasm_functype_t *type;
bool with_env;
union {
@ -169,7 +160,7 @@ struct wasm_table_t {
struct wasm_extern_t {
wasm_name_t *module_name;
wasm_name_t *name;
uint16 kind;
wasm_externkind_t kind;
uint8 data[1];
};

View File

@ -454,14 +454,16 @@ wasm_runtime_destroy_registered_module_list()
bh_list_remove(registered_module_list, reg_module);
/* now, it is time to release every module in the runtime */
if (reg_module->module->module_type == Wasm_Module_Bytecode) {
#if WASM_ENABLE_INTERP != 0
if (reg_module->module->module_type == Wasm_Module_Bytecode)
wasm_unload((WASMModule *)reg_module->module);
#endif
}
else {
#if WASM_ENABLE_AOT != 0
if (reg_module->module->module_type == Wasm_Module_AoT)
aot_unload((AOTModule *)reg_module->module);
#endif
}
/* destroy the file buffer */
if (destroyer && reg_module->orig_file_buf) {
@ -4318,3 +4320,244 @@ wasm_runtime_dump_call_stack(WASMExecEnv *exec_env)
}
#endif /* end of WASM_ENABLE_DUMP_CALL_STACK */
bool
wasm_runtime_get_export_func_type(const WASMModuleCommon *module_comm,
const WASMExport *export,
WASMType **out)
{
#if WASM_ENABLE_INTERP != 0
if (module_comm->module_type == Wasm_Module_Bytecode) {
WASMModule *module = (WASMModule *)module_comm;
if (export->index < module->import_function_count) {
*out =
module->import_functions[export->index].u.function.func_type;
}
else {
*out =
module->functions[export->index - module->import_function_count]
->func_type;
}
return true;
}
#endif
#if WASM_ENABLE_AOT != 0
if (module_comm->module_type == Wasm_Module_AoT) {
AOTModule *module = (AOTModule *)module_comm;
if (export->index < module->import_func_count) {
*out = module->func_types[module->import_funcs[export->index]
.func_type_index];
}
else {
*out =
module->func_types[module->func_type_indexes
[export->index - module->import_func_count]];
}
return true;
}
#endif
return false;
}
bool
wasm_runtime_get_export_global_type(const WASMModuleCommon *module_comm,
const WASMExport *export,
uint8 *out_val_type,
bool *out_mutability)
{
#if WASM_ENABLE_INTERP != 0
if (module_comm->module_type == Wasm_Module_Bytecode) {
WASMModule *module = (WASMModule *)module_comm;
if (export->index < module->import_global_count) {
WASMGlobalImport *import_global =
&((module->import_globals + export->index)->u.global);
*out_val_type = import_global->type;
*out_mutability = import_global->is_mutable;
}
else {
WASMGlobal *global =
module->globals + (export->index - module->import_global_count);
*out_val_type = global->type;
*out_mutability = global->is_mutable;
}
return true;
}
#endif
#if WASM_ENABLE_AOT != 0
if (module_comm->module_type == Wasm_Module_AoT) {
AOTModule *module = (AOTModule *)module_comm;
if (export->index < module->import_global_count) {
AOTImportGlobal *import_global =
module->import_globals + export->index;
*out_val_type = import_global->type;
*out_mutability = import_global->is_mutable;
}
else {
AOTGlobal *global =
module->globals + (export->index - module->import_global_count);
*out_val_type = global->type;
*out_mutability = global->is_mutable;
}
return true;
}
#endif
return false;
}
bool
wasm_runtime_get_export_memory_type(const WASMModuleCommon *module_comm,
const WASMExport *export,
uint32 *out_min_page,
uint32 *out_max_page)
{
#if WASM_ENABLE_INTERP != 0
if (module_comm->module_type == Wasm_Module_Bytecode) {
WASMModule *module = (WASMModule *)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;
}
else {
WASMMemory *memory =
module->memories + (export->index - module->import_memory_count);
*out_min_page = memory->init_page_count;
*out_max_page = memory->max_page_count;
}
return true;
}
#endif
#if WASM_ENABLE_AOT != 0
if (module_comm->module_type == Wasm_Module_AoT) {
AOTModule *module = (AOTModule *)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;
}
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;
}
return true;
}
#endif
return false;
}
bool
wasm_runtime_get_export_table_type(const WASMModuleCommon *module_comm,
const WASMExport *export,
uint8 *out_elem_type,
uint32 *out_min_size,
uint32 *out_max_size)
{
#if WASM_ENABLE_INTERP != 0
if (module_comm->module_type == Wasm_Module_Bytecode) {
WASMModule *module = (WASMModule *)module_comm;
if (export->index < module->import_table_count) {
WASMTableImport *import_table =
&((module->import_tables + export->index)->u.table);
*out_elem_type = import_table->elem_type;
*out_min_size = import_table->init_size;
*out_max_size = import_table->max_size;
}
else {
WASMTable *table =
module->tables + (export->index - module->import_table_count);
*out_elem_type = table->elem_type;
*out_min_size = table->init_size;
*out_max_size = table->max_size;
}
return true;
}
#endif
#if WASM_ENABLE_AOT != 0
if (module_comm->module_type == Wasm_Module_AoT) {
AOTModule *module = (AOTModule *)module_comm;
if (export->index < module->import_table_count) {
AOTImportTable *import_table =
module->import_tables + export->index;
*out_elem_type = VALUE_TYPE_FUNCREF;
*out_min_size = import_table->table_init_size;
*out_max_size = import_table->table_max_size;
}
else {
AOTTable *table =
module->tables + (export->index - module->import_table_count);
*out_elem_type = table->elem_type;
*out_min_size = table->table_init_size;
*out_max_size = table->table_max_size;
}
return true;
}
#endif
return false;
}
uint8 *
wasm_runtime_get_memory_data(const WASMModuleInstanceCommon *module_inst_comm,
uint32 memory_inst_idx)
{
#if WASM_ENABLE_INTERP != 0
if (module_inst_comm->module_type == Wasm_Module_Bytecode) {
WASMModuleInstance *module_inst =
(WASMModuleInstance *)module_inst_comm;
WASMMemoryInstance *memory_inst =
module_inst->memories[memory_inst_idx];
return memory_inst->memory_data;
}
#endif
#if WASM_ENABLE_AOT != 0
if (module_inst_comm->module_type == Wasm_Module_AoT) {
AOTModuleInstance *module_inst = (AOTModuleInstance *)module_inst_comm;
AOTMemoryInstance *memory_inst =
(AOTMemoryInstance*)module_inst->memories.ptr + memory_inst_idx;
return memory_inst->memory_data.ptr;
}
#endif
return NULL;
}
uint32
wasm_runtime_get_memory_data_size(
const WASMModuleInstanceCommon *module_inst_comm,
uint32 memory_inst_idx)
{
#if WASM_ENABLE_INTERP != 0
if (module_inst_comm->module_type == Wasm_Module_Bytecode) {
WASMModuleInstance *module_inst =
(WASMModuleInstance *)module_inst_comm;
WASMMemoryInstance *memory_inst =
module_inst->memories[memory_inst_idx];
return memory_inst->cur_page_count * memory_inst->num_bytes_per_page;
}
#endif
#if WASM_ENABLE_AOT != 0
if (module_inst_comm->module_type == Wasm_Module_AoT) {
AOTModuleInstance *module_inst = (AOTModuleInstance *)module_inst_comm;
AOTMemoryInstance *memory_inst =
(AOTMemoryInstance*)module_inst->memories.ptr + memory_inst_idx;
return memory_inst->cur_page_count * memory_inst->num_bytes_per_page;
}
#endif
return 0;
}

View File

@ -744,6 +744,38 @@ wasm_runtime_finalize_call_function(WASMExecEnv *exec_env,
bool ret, uint32 *argv);
#endif
bool
wasm_runtime_get_export_func_type(const WASMModuleCommon *module_comm,
const WASMExport *export,
WASMType **out);
bool
wasm_runtime_get_export_global_type(const WASMModuleCommon *module_comm,
const WASMExport *export,
uint8 *out_val_type,
bool *out_mutability);
bool
wasm_runtime_get_export_memory_type(const WASMModuleCommon *module_comm,
const WASMExport *export,
uint32 *out_min_page,
uint32 *out_max_page);
bool
wasm_runtime_get_export_table_type(const WASMModuleCommon *module_comm,
const WASMExport *export,
uint8 *out_elem_type,
uint32 *out_min_size,
uint32 *out_max_size);
uint8 *
wasm_runtime_get_memory_data(const WASMModuleInstanceCommon *module_inst_comm,
uint32 memory_inst_idx);
uint32
wasm_runtime_get_memory_data_size(const WASMModuleInstanceCommon *module_inst_comm,
uint32 memory_inst_idx);
#ifdef __cplusplus
}
#endif

View File

@ -29,15 +29,15 @@ extern "C" {
// Auxiliaries
// Machine types
#if (__STDC_VERSION__ > 199901L)
inline void assertions() {
#if (__STDC_VERSION__) > 199901L
inline void assertions(void) {
static_assert(sizeof(float) == sizeof(uint32_t), "incompatible float type");
static_assert(sizeof(double) == sizeof(uint64_t), "incompatible double type");
static_assert(sizeof(intptr_t) == sizeof(uint32_t) ||
sizeof(intptr_t) == sizeof(uint64_t),
"incompatible pointer type");
}
#endif /* __STDC_VERSION__ > 199901L */
#endif
typedef char byte_t;
typedef float float32_t;
@ -79,7 +79,7 @@ typedef double float64_t;
// Vectors
// size: capacity
// num_elems: current number of elements
// size_of_elem: size of one element
// size_of_elem: size of one elemen
#define WASM_DECLARE_VEC(name, ptr_or_none) \
typedef struct wasm_##name##_vec_t { \
size_t size; \
@ -115,6 +115,12 @@ typedef wasm_byte_vec_t wasm_name_t;
static inline void wasm_name_new_from_string(
own wasm_name_t* out, const char* s
) {
wasm_name_new(out, strlen(s), s);
}
static inline void wasm_name_new_from_string_nt(
own wasm_name_t* out, const char* s
) {
wasm_name_new(out, strlen(s) + 1, s);
}
@ -123,11 +129,21 @@ static inline void wasm_name_new_from_string(
///////////////////////////////////////////////////////////////////////////////
// Runtime Environment
// Configuration
WASM_DECLARE_OWN(config)
WASM_API_EXTERN own wasm_config_t* wasm_config_new(void);
// Embedders may provide custom functions for manipulating configs.
// Engine
WASM_DECLARE_OWN(engine)
WASM_API_EXTERN own wasm_engine_t* wasm_engine_new();
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*);
// Store
@ -162,7 +178,7 @@ static const uint32_t wasm_limits_max_default = 0xffffffff;
WASM_DECLARE_OWN(name) \
WASM_DECLARE_VEC(name, *) \
\
WASM_API_EXTERN own wasm_##name##_t* wasm_##name##_copy(wasm_##name##_t*);
WASM_API_EXTERN own wasm_##name##_t* wasm_##name##_copy(const wasm_##name##_t*);
// Value Types
@ -334,7 +350,12 @@ WASM_DECLARE_VEC(val, )
WASM_DECLARE_OWN(name) \
\
WASM_API_EXTERN own wasm_##name##_t* wasm_##name##_copy(const wasm_##name##_t*); \
WASM_API_EXTERN bool wasm_##name##_same(const wasm_##name##_t*, const wasm_##name##_t*);
WASM_API_EXTERN bool wasm_##name##_same(const wasm_##name##_t*, const wasm_##name##_t*); \
\
WASM_API_EXTERN void* wasm_##name##_get_host_info(const wasm_##name##_t*); \
WASM_API_EXTERN void wasm_##name##_set_host_info(wasm_##name##_t*, void*); \
WASM_API_EXTERN void wasm_##name##_set_host_info_with_finalizer( \
wasm_##name##_t*, void*, void (*)(void*));
#define WASM_DECLARE_REF(name) \
WASM_DECLARE_REF_BASE(name) \
@ -354,17 +375,42 @@ WASM_DECLARE_VEC(val, )
WASM_DECLARE_REF_BASE(ref)
// Frames
WASM_DECLARE_OWN(frame)
WASM_DECLARE_VEC(frame, *)
WASM_API_EXTERN own wasm_frame_t* wasm_frame_copy(const wasm_frame_t*);
WASM_API_EXTERN struct wasm_instance_t* wasm_frame_instance(const wasm_frame_t*);
WASM_API_EXTERN uint32_t wasm_frame_func_index(const wasm_frame_t*);
WASM_API_EXTERN size_t wasm_frame_func_offset(const wasm_frame_t*);
WASM_API_EXTERN size_t wasm_frame_module_offset(const wasm_frame_t*);
// Traps
typedef wasm_name_t wasm_message_t; // null terminated
WASM_DECLARE_REF_BASE(trap)
WASM_DECLARE_REF(trap)
WASM_API_EXTERN own wasm_trap_t* wasm_trap_new(wasm_store_t* store, const wasm_message_t*);
WASM_API_EXTERN void wasm_trap_message(const wasm_trap_t*, own wasm_message_t* out);
WASM_API_EXTERN own wasm_frame_t* wasm_trap_origin(const wasm_trap_t*);
WASM_API_EXTERN void wasm_trap_trace(const wasm_trap_t*, own wasm_frame_vec_t* out);
// Foreign Objects
WASM_DECLARE_REF(foreign)
WASM_API_EXTERN own wasm_foreign_t* wasm_foreign_new(wasm_store_t*);
// Modules
// WASM_DECLARE_SHARABLE_REF(module)
#ifndef WASM_MODULE_T_DEFINED
#define WASM_MODULE_T_DEFINED
struct WASMModuleCommon;
@ -374,12 +420,9 @@ typedef struct WASMModuleCommon *wasm_module_t;
WASM_API_EXTERN own wasm_module_t* wasm_module_new(
wasm_store_t*, const wasm_byte_vec_t* binary);
WASM_API_EXTERN bool wasm_module_validate(wasm_store_t*, const wasm_byte_vec_t* binary);
WASM_API_EXTERN void wasm_module_delete(own wasm_module_t*);
WASM_API_EXTERN own wasm_module_t* wasm_module_copy(const wasm_module_t*);
WASM_API_EXTERN bool wasm_module_same(const wasm_module_t*, const wasm_module_t*);
WASM_API_EXTERN bool wasm_module_validate(wasm_store_t*, const wasm_byte_vec_t* binary);
WASM_API_EXTERN void wasm_module_imports(const wasm_module_t*, own wasm_importtype_vec_t* out);
WASM_API_EXTERN void wasm_module_exports(const wasm_module_t*, own wasm_exporttype_vec_t* out);
@ -393,7 +436,7 @@ WASM_API_EXTERN own wasm_module_t* wasm_module_deserialize(wasm_store_t*, const
WASM_DECLARE_REF(func)
typedef own wasm_trap_t* (*wasm_func_callback_t)(
const wasm_val_t args[], wasm_val_t results[]);
const wasm_val_t args[], own wasm_val_t results[]);
typedef own wasm_trap_t* (*wasm_func_callback_with_env_t)(
void* env, const wasm_val_t args[], wasm_val_t results[]);
@ -413,7 +456,7 @@ WASM_API_EXTERN own wasm_trap_t* wasm_func_call(
// Global Instances
WASM_DECLARE_REF_BASE(global)
WASM_DECLARE_REF(global)
WASM_API_EXTERN own wasm_global_t* wasm_global_new(
wasm_store_t*, const wasm_globaltype_t*, const wasm_val_t*);
@ -426,7 +469,7 @@ WASM_API_EXTERN void wasm_global_set(wasm_global_t*, const wasm_val_t*);
// Table Instances
WASM_DECLARE_REF_BASE(table)
WASM_DECLARE_REF(table)
typedef uint32_t wasm_table_size_t;
@ -444,7 +487,7 @@ WASM_API_EXTERN bool wasm_table_grow(wasm_table_t*, wasm_table_size_t delta, was
// Memory Instances
WASM_DECLARE_REF_BASE(memory)
WASM_DECLARE_REF(memory)
typedef uint32_t wasm_memory_pages_t;
@ -463,7 +506,7 @@ WASM_API_EXTERN bool wasm_memory_grow(wasm_memory_t*, wasm_memory_pages_t delta)
// Externals
WASM_DECLARE_REF_BASE(extern)
WASM_DECLARE_REF(extern)
WASM_DECLARE_VEC(extern, *)
WASM_API_EXTERN wasm_externkind_t wasm_extern_kind(const wasm_extern_t*);
@ -492,10 +535,10 @@ WASM_API_EXTERN const wasm_memory_t* wasm_extern_as_memory_const(const wasm_exte
// Module Instances
WASM_DECLARE_REF_BASE(instance)
WASM_DECLARE_REF(instance)
WASM_API_EXTERN own wasm_instance_t* wasm_instance_new(
wasm_store_t*, const wasm_module_t*, const wasm_extern_t* const imports[],
wasm_store_t*, const wasm_module_t*, const wasm_extern_t *const imports[],
own wasm_trap_t**
);
@ -505,32 +548,38 @@ WASM_API_EXTERN void wasm_instance_exports(const wasm_instance_t*, own wasm_exte
///////////////////////////////////////////////////////////////////////////////
// Convenience
// Vectors
#define WASM_EMPTY_VEC {0, NULL, 0, 0}
#define WASM_ARRAY_VEC(array) {sizeof(array)/sizeof(*(array)), array, sizeof(array)/sizeof(*(array)), sizeof(*(array))}
// Value Type construction short-hands
static inline own wasm_valtype_t* wasm_valtype_new_i32() {
static inline own wasm_valtype_t* wasm_valtype_new_i32(void) {
return wasm_valtype_new(WASM_I32);
}
static inline own wasm_valtype_t* wasm_valtype_new_i64() {
static inline own wasm_valtype_t* wasm_valtype_new_i64(void) {
return wasm_valtype_new(WASM_I64);
}
static inline own wasm_valtype_t* wasm_valtype_new_f32() {
static inline own wasm_valtype_t* wasm_valtype_new_f32(void) {
return wasm_valtype_new(WASM_F32);
}
static inline own wasm_valtype_t* wasm_valtype_new_f64() {
static inline own wasm_valtype_t* wasm_valtype_new_f64(void) {
return wasm_valtype_new(WASM_F64);
}
static inline own wasm_valtype_t* wasm_valtype_new_anyref() {
static inline own wasm_valtype_t* wasm_valtype_new_anyref(void) {
return wasm_valtype_new(WASM_ANYREF);
}
static inline own wasm_valtype_t* wasm_valtype_new_funcref() {
static inline own wasm_valtype_t* wasm_valtype_new_funcref(void) {
return wasm_valtype_new(WASM_FUNCREF);
}
// Function Types construction short-hands
static inline own wasm_functype_t* wasm_functype_new_0_0() {
static inline own wasm_functype_t* wasm_functype_new_0_0(void) {
wasm_valtype_vec_t params, results;
wasm_valtype_vec_new_empty(&params);
wasm_valtype_vec_new_empty(&results);
@ -677,6 +726,13 @@ static inline void* wasm_val_ptr(const wasm_val_t* val) {
#endif
}
#define WASM_I32_VAL(i) {.kind = WASM_I32, .of = {.i32 = i}}
#define WASM_I64_VAL(i) {.kind = WASM_I64, .of = {.i64 = i}}
#define WASM_F32_VAL(z) {.kind = WASM_F32, .of = {.f32 = z}}
#define WASM_F64_VAL(z) {.kind = WASM_F64, .of = {.f64 = z}}
#define WASM_REF_VAL(r) {.kind = WASM_ANYREF, .of = {.ref = r}}
#define WASM_INIT_VAL {.kind = WASM_ANYREF, .of = {.ref = NULL}}
///////////////////////////////////////////////////////////////////////////////

View File

@ -3417,21 +3417,18 @@ wasm_interp_call_wasm(WASMModuleInstance *module_inst,
if (function->is_import_func) {
#if WASM_ENABLE_MULTI_MODULE != 0
if (function->import_module_inst) {
LOG_DEBUG("it is a function of a sub module");
wasm_interp_call_func_import(module_inst, exec_env,
function, frame);
}
else
#endif
{
LOG_DEBUG("it is an native function");
/* it is a native function */
wasm_interp_call_func_native(module_inst, exec_env,
function, frame);
}
}
else {
LOG_DEBUG("it is a function of the module itself");
wasm_interp_call_func_bytecode(module_inst, exec_env, function, frame);
}
@ -3440,13 +3437,6 @@ wasm_interp_call_wasm(WASMModuleInstance *module_inst,
for (i = 0; i < function->ret_cell_num; i++) {
argv[i] = *(frame->sp + i - function->ret_cell_num);
}
if (function->ret_cell_num) {
LOG_DEBUG("first return value argv[0]=%d", argv[0]);
}
else {
LOG_DEBUG("no return value");
}
}
else {
#if WASM_ENABLE_DUMP_CALL_STACK != 0

View File

@ -377,7 +377,6 @@ const_str_list_insert(const uint8 *str, uint32 len, WASMModule *module,
}
if (node) {
LOG_DEBUG("reuse %s", node->str);
return node->str;
}
@ -703,7 +702,8 @@ wasm_loader_resolve_function(const char *module_name,
module_reg = wasm_runtime_find_module_registered(module_name);
if (!module_reg
|| module_reg->module_type != Wasm_Module_Bytecode) {
LOG_DEBUG("can not find a module named %s for function", module_name);
LOG_DEBUG("can not find a module named %s for function %s",
module_name, function_name);
set_error_buf(error_buf, error_buf_size, "unknown import");
return NULL;
}
@ -1722,8 +1722,6 @@ load_import_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
/* 0x00/0x01/0x02/0x03 */
kind = read_uint8(p);
LOG_DEBUG("import #%d: (%s, %s), kind: %d",
i, sub_module_name, field_name, kind);
switch (kind) {
case IMPORT_KIND_FUNC: /* import function */
bh_assert(import_functions);
@ -2947,7 +2945,6 @@ load_from_sections(WASMModule *module, WASMSection *sections,
while (section) {
buf = section->section_body;
buf_end = buf + section->section_body_size;
LOG_DEBUG("load section, type: %d", section->section_type);
switch (section->section_type) {
case SECTION_TYPE_USER:
/* unsupported user section, ignore it. */