Implement post-MVP features and native stack overflow check (#243)

Implement native thread stack overflow check
Implement post-MVP: Non-trapping float-to-int conversions
Implement post-MVP: Sign-extension operators
Enhance WASM loader checks
This commit is contained in:
wenyongh
2020-04-30 17:52:11 +08:00
committed by GitHub
parent ab4f0c5419
commit d381b0fdec
36 changed files with 1246 additions and 232 deletions

View File

@ -20,12 +20,15 @@ struct WASMInterpFrame;
/* Execution environment */
typedef struct WASMExecEnv {
/* Next thread's exec env of a WASM module instance. */
/* Next thread's exec env of a WASM module instance. */
struct WASMExecEnv *next;
/* Previous thread's exec env of a WASM module instance. */
/* Previous thread's exec env of a WASM module instance. */
struct WASMExecEnv *prev;
/* Note: field module_inst, argv_buf and native_stack_boundary
are used by AOTed code, don't change the places of them */
/* The WASM module instance of current thread */
struct WASMModuleInstanceCommon *module_inst;
@ -33,6 +36,11 @@ typedef struct WASMExecEnv {
uint32 *argv_buf;
#endif
/* The boundary of native stack. When runtime detects that native
frame may overrun this boundary, it throws stack overflow
exception. */
uint8 *native_stack_boundary;
/* attachment for native function */
void *attachment;
@ -48,11 +56,6 @@ typedef struct WASMExecEnv {
BlockAddr block_addr_cache[BLOCK_ADDR_CACHE_SIZE][BLOCK_ADDR_CONFLICT_SIZE];
#endif
/* The boundary of native stack. When interpreter detects that native
frame may overrun this boundary, it throws a stack overflow
exception. */
void *native_stack_boundary;
/* The WASM stack size */
uint32 wasm_stack_size;
@ -61,13 +64,13 @@ typedef struct WASMExecEnv {
uint64 __make_it_8_byte_aligned_;
struct {
/* The top boundary of the stack. */
/* The top boundary of the stack. */
uint8 *top_boundary;
/* Top cell index which is free. */
/* Top cell index which is free. */
uint8 *top;
/* The Java stack. */
/* The WASM stack. */
uint8 bottom[1];
} s;
} wasm_stack;
@ -159,6 +162,9 @@ wasm_exec_env_get_cur_frame(WASMExecEnv *exec_env)
struct WASMModuleInstanceCommon *
wasm_exec_env_get_module_inst(WASMExecEnv *exec_env);
void
wasm_exec_env_set_thread_info(WASMExecEnv *exec_env);
#ifdef __cplusplus
}
#endif