Skip to content

Commit

Permalink
Merge branch 'dev/checkpoint_and_restore' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
victoryang00 committed May 27, 2024
1 parent 7cc3839 commit 80afb01
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 40 deletions.
3 changes: 2 additions & 1 deletion core/iwasm/aot/aot_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,8 @@ memories_instantiate(AOTModuleInstance *module_inst, AOTModuleInstance *parent,

#if WASM_ENABLE_SHARED_MEMORY != 0
/* Currently we have only one memory instance */
bool is_shared_memory = module->memories[0].memory_flags & 0x02 ? true : false;
bool is_shared_memory =
module->memories[0].memory_flags & 0x02 ? true : false;
if (is_shared_memory && parent != NULL) {
/* Ignore setting memory init data if the memory has been initialized */
return true;
Expand Down
6 changes: 6 additions & 0 deletions core/iwasm/common/wasm_runtime_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,12 @@ wasm_runtime_checkpoint(wasm_module_inst_t module_inst, char *file);
bool
wasm_runtime_restore(wasm_module_inst_t module_inst, char *file, char *file1);
#endif
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_detect_native_stack_overflow(WASMExecEnv *exec_env);

WASM_RUNTIME_API_EXTERN bool
wasm_runtime_detect_native_stack_overflow_size(WASMExecEnv *exec_env,
uint32 requested_size);

#if WASM_ENABLE_LINUX_PERF != 0
bool
Expand Down
4 changes: 0 additions & 4 deletions core/iwasm/compilation/aot_compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,6 @@ fake_aot_gen_commit_value(AOTCompFrame *frame, bool reset_dirty_bit,
case VALUE_TYPE_FUNCREF:
case VALUE_TYPE_EXTERNREF:
break;
break;

break;

case VALUE_TYPE_I64:
if (reset_dirty_bit)
((*p) + 1)->dirty = 0;
Expand Down
40 changes: 7 additions & 33 deletions core/iwasm/include/wasm_export.h
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,6 @@ wasm_runtime_set_wasi_ns_lookup_pool(wasm_module_t module,
*/
WASM_RUNTIME_API_EXTERN wasm_module_inst_t
wasm_runtime_instantiate(const wasm_module_t module,
<<<<<<< HEAD
uint32_t default_stack_size,
uint32_t host_managed_heap_size, char *error_buf,
uint32_t error_buf_size);
Expand All @@ -626,14 +625,6 @@ WASM_RUNTIME_API_EXTERN wasm_module_inst_t
wasm_runtime_instantiate_ex(const wasm_module_t module,
const InstantiationArgs *args, char *error_buf,
uint32_t error_buf_size);
||||||| parent of d8948a72 (Update version number to 2.0.0 and update release notes (#3327))
uint32_t default_stack_size, uint32_t host_managed_heap_size,
char *error_buf, uint32_t error_buf_size);
=======
uint32_t default_stack_size,
uint32_t host_managed_heap_size, char *error_buf,
uint32_t error_buf_size);
>>>>>>> d8948a72 (Update version number to 2.0.0 and update release notes (#3327))

/**
* Instantiate a WASM module, with specified instantiation arguments
Expand All @@ -649,12 +640,13 @@ wasm_runtime_instantiate_ex(const wasm_module_t module,
/**
* Instantiate a WASM module, with specified instantiation arguments
*
* Same as wasm_runtime_instantiate, but it also allows overwriting maximum memory
* Same as wasm_runtime_instantiate, but it also allows overwriting maximum
* memory
*/
WASM_RUNTIME_API_EXTERN wasm_module_inst_t
wasm_runtime_instantiate_ex(const wasm_module_t module,
const InstantiationArgs *args,
char *error_buf, uint32_t error_buf_size);
const InstantiationArgs *args, char *error_buf,
uint32_t error_buf_size);

/**
* Set the running mode of a WASM module instance, override the
Expand Down Expand Up @@ -1531,16 +1523,8 @@ WASM_RUNTIME_API_EXTERN double
wasm_runtime_sum_wasm_exec_time(wasm_module_inst_t module_inst);

/**
<<<<<<< HEAD
* Return execution time in ms of a given wasm function with
* func_name. If the function is not found, return 0.
||||||| parent of d8948a72 (Update version number to 2.0.0 and update release notes (#3327))
* Return execution time in ms of a given wasm funciton with
* func_name. If the function is not found, return 0.
=======
* Return execution time in ms of a given wasm funciton with
* func_name. If the function is not found, return 0.
>>>>>>> d8948a72 (Update version number to 2.0.0 and update release notes (#3327))
*
* @param module_inst the WASM module instance to profile
* @param func_name could be an export name or a name in the
Expand Down Expand Up @@ -1762,16 +1746,8 @@ wasm_runtime_is_import_func_linked(const char *module_name,
const char *func_name);

/**
<<<<<<< HEAD
* Check whether an import global `(import <module_name> <global_name>
* (global ...))` is linked or not with runtime registered native globals
||||||| parent of d8948a72 (Update version number to 2.0.0 and update release notes (#3327))
* Check whether an import global `(import <module_name> <global_name> (global ...))`
* is linked or not with runtime registered natvie globals
=======
* Check whether an import global `(import <module_name> <global_name>
* (global ...))` is linked or not with runtime registered natvie globals
>>>>>>> d8948a72 (Update version number to 2.0.0 and update release notes (#3327))
*/
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_is_import_global_linked(const char *module_name,
Expand Down Expand Up @@ -1980,7 +1956,7 @@ wasm_runtime_is_underlying_binary_freeable(const wasm_module_t module);
/*
* wasm_runtime_checkpoint/wasm_runtime_restore
*
* These APIs are intended to be used by the host to register the current
* These APIs are intended to be used by the host to register the current
* state of the WASM module instance to a file and restore the state from
* file
* eg.
Expand All @@ -1993,11 +1969,9 @@ wasm_runtime_is_underlying_binary_freeable(const wasm_module_t module);
* }
*/
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_checkpoint(wasm_module_inst_t module_inst,
char *file);
wasm_runtime_checkpoint(wasm_module_inst_t module_inst, char *file);
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_restore(wasm_module_inst_t module_inst,
char *file, char *file1);
wasm_runtime_restore(wasm_module_inst_t module_inst, char *file, char *file1);
#endif

WASM_RUNTIME_API_EXTERN bool
Expand Down
2 changes: 1 addition & 1 deletion core/iwasm/interpreter/wasm_mini_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -4269,7 +4269,7 @@ wasm_loader_pop_frame_ref(WASMLoaderContext *ctx, uint8 type, char *error_buf,
ctx->frame_ref--;
ctx->stack_cell_num--;

if (is_32bit_type(type) || *ctx->frame_ref == VALUE_TYPE_ANY)
if (is_32bit_type(type))
return true;

ctx->frame_ref--;
Expand Down
2 changes: 1 addition & 1 deletion core/iwasm/libraries/libc-wasi/libc_wasi_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -2595,7 +2595,7 @@ wasi_sock_recv(wasm_exec_env_t exec_env, wasi_fd_t sock, iovec_app_t *ri_data,
ro_flags);
set_tcp();
#endif
if (!validate_native_addr(ro_flags, (uint32)sizeof(wasi_roflags_t)))
if (!validate_native_addr(ro_flags, (uint64)sizeof(wasi_roflags_t)))
return __WASI_EINVAL;

error = wasi_sock_recv_from(exec_env, sock, ri_data, ri_data_len, ri_flags,
Expand Down

0 comments on commit 80afb01

Please sign in to comment.