mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-07-15 08:48:33 +00:00
Merge pull request #1254 from bytecodealliance/main
Merge main into dev/upgrade_llvm_wasi_sdk_emsdk
This commit is contained in:
commit
e440734084
|
@ -25,9 +25,11 @@ if (NOT DEFINED WAMR_BUILD_TARGET)
|
|||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
else ()
|
||||
message(SEND_ERROR "Unsupported build target platform!")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -41,9 +41,11 @@ if (NOT DEFINED WAMR_BUILD_TARGET)
|
|||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
else ()
|
||||
message(SEND_ERROR "Unsupported build target platform!")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -1511,7 +1511,9 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
|
|||
|
||||
#if WASM_ENABLE_DUMP_CALL_STACK != 0
|
||||
if (!ret) {
|
||||
aot_dump_call_stack(exec_env);
|
||||
if (aot_create_call_stack(exec_env)) {
|
||||
aot_dump_call_stack(exec_env, true, NULL, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1568,7 +1570,9 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
|
|||
|
||||
#if WASM_ENABLE_DUMP_CALL_STACK != 0
|
||||
if (aot_get_exception(module_inst)) {
|
||||
aot_dump_call_stack(exec_env);
|
||||
if (aot_create_call_stack(exec_env)) {
|
||||
aot_dump_call_stack(exec_env, true, NULL, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -3018,38 +3022,24 @@ aot_free_frame(WASMExecEnv *exec_env)
|
|||
|| (WASM_ENABLE_PERF_PROFILING != 0) */
|
||||
|
||||
#if WASM_ENABLE_DUMP_CALL_STACK != 0
|
||||
void
|
||||
aot_dump_call_stack(WASMExecEnv *exec_env)
|
||||
bool
|
||||
aot_create_call_stack(struct WASMExecEnv *exec_env)
|
||||
{
|
||||
AOTFrame *cur_frame = (AOTFrame *)exec_env->cur_frame,
|
||||
*first_frame = cur_frame;
|
||||
AOTModuleInstance *module_inst = (AOTModuleInstance *)exec_env->module_inst;
|
||||
const char *func_name;
|
||||
uint32 n = 0;
|
||||
|
||||
os_printf("\n");
|
||||
while (cur_frame) {
|
||||
func_name =
|
||||
get_func_name_from_index(module_inst, cur_frame->func_index);
|
||||
|
||||
/* function name not exported, print number instead */
|
||||
if (func_name == NULL) {
|
||||
os_printf("#%02d $f%d \n", n, cur_frame->func_index);
|
||||
}
|
||||
else {
|
||||
os_printf("#%02d %s \n", n, func_name);
|
||||
}
|
||||
|
||||
cur_frame = cur_frame->prev_frame;
|
||||
n++;
|
||||
}
|
||||
os_printf("\n");
|
||||
|
||||
/* release previous stack frames and create new ones */
|
||||
if (!bh_vector_destroy(module_inst->frames.ptr)
|
||||
|| !bh_vector_init(module_inst->frames.ptr, n, sizeof(WASMCApiFrame),
|
||||
false)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
cur_frame = first_frame;
|
||||
|
@ -3059,14 +3049,85 @@ aot_dump_call_stack(WASMExecEnv *exec_env)
|
|||
frame.module_offset = 0;
|
||||
frame.func_index = cur_frame->func_index;
|
||||
frame.func_offset = 0;
|
||||
frame.func_name_wp =
|
||||
get_func_name_from_index(module_inst, cur_frame->func_index);
|
||||
|
||||
if (!bh_vector_append(module_inst->frames.ptr, &frame)) {
|
||||
bh_vector_destroy(module_inst->frames.ptr);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
cur_frame = cur_frame->prev_frame;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#define PRINT_OR_DUMP() \
|
||||
do { \
|
||||
total_len += \
|
||||
wasm_runtime_dump_line_buf_impl(line_buf, print, &buf, &len); \
|
||||
if ((!print) && buf && (len == 0)) { \
|
||||
return total_len; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
uint32
|
||||
aot_dump_call_stack(WASMExecEnv *exec_env, bool print, char *buf, uint32 len)
|
||||
{
|
||||
AOTModuleInstance *module_inst = (AOTModuleInstance *)exec_env->module_inst;
|
||||
uint32 n = 0, total_len = 0, total_frames;
|
||||
/* reserve 256 bytes for line buffer, any line longer than 256 bytes
|
||||
* will be truncated */
|
||||
char line_buf[256];
|
||||
|
||||
if (!module_inst->frames.ptr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
total_frames = bh_vector_size(module_inst->frames.ptr);
|
||||
if (total_frames == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
snprintf(line_buf, sizeof(line_buf), "\n");
|
||||
PRINT_OR_DUMP();
|
||||
|
||||
while (n < total_frames) {
|
||||
WASMCApiFrame frame = { 0 };
|
||||
uint32 line_length, i;
|
||||
|
||||
if (!bh_vector_get(module_inst->frames.ptr, n, &frame)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* function name not exported, print number instead */
|
||||
if (frame.func_name_wp == NULL) {
|
||||
line_length = snprintf(line_buf, sizeof(line_buf), "#%02d $f%d\n",
|
||||
n, frame.func_index);
|
||||
}
|
||||
else {
|
||||
line_length = snprintf(line_buf, sizeof(line_buf), "#%02d %s\n", n,
|
||||
frame.func_name_wp);
|
||||
}
|
||||
|
||||
if (line_length >= sizeof(line_buf)) {
|
||||
uint32 line_buffer_len = sizeof(line_buf);
|
||||
/* If line too long, ensure the last character is '\n' */
|
||||
for (i = line_buffer_len - 5; i < line_buffer_len - 2; i++) {
|
||||
line_buf[i] = '.';
|
||||
}
|
||||
line_buf[line_buffer_len - 2] = '\n';
|
||||
}
|
||||
|
||||
PRINT_OR_DUMP();
|
||||
|
||||
n++;
|
||||
}
|
||||
snprintf(line_buf, sizeof(line_buf), "\n");
|
||||
PRINT_OR_DUMP();
|
||||
|
||||
return total_len + 1;
|
||||
}
|
||||
#endif /* end of WASM_ENABLE_DUMP_CALL_STACK */
|
||||
|
||||
|
|
|
@ -731,8 +731,24 @@ aot_alloc_frame(WASMExecEnv *exec_env, uint32 func_index);
|
|||
void
|
||||
aot_free_frame(WASMExecEnv *exec_env);
|
||||
|
||||
void
|
||||
aot_dump_call_stack(WASMExecEnv *exec_env);
|
||||
bool
|
||||
aot_create_call_stack(struct WASMExecEnv *exec_env);
|
||||
|
||||
/**
|
||||
* @brief Dump wasm call stack or get the size
|
||||
*
|
||||
* @param exec_env the execution environment
|
||||
* @param print whether to print to stdout or not
|
||||
* @param buf buffer to store the dumped content
|
||||
* @param len length of the buffer
|
||||
*
|
||||
* @return when print is true, return the bytes printed out to stdout; when
|
||||
* print is false and buf is NULL, return the size required to store the
|
||||
* callstack content; when print is false and buf is not NULL, return the size
|
||||
* dumped to the buffer, 0 means error and data in buf may be invalid
|
||||
*/
|
||||
uint32
|
||||
aot_dump_call_stack(WASMExecEnv *exec_env, bool print, char *buf, uint32 len);
|
||||
|
||||
void
|
||||
aot_dump_perf_profiling(const AOTModuleInstance *module_inst);
|
||||
|
|
|
@ -3049,7 +3049,7 @@ fail:
|
|||
|| defined(BUILD_TARGET_RISCV32_ILP32D) \
|
||||
|| defined(BUILD_TARGET_RISCV32_ILP32) || defined(BUILD_TARGET_ARC)
|
||||
typedef void (*GenericFunctionPointer)();
|
||||
int64
|
||||
void
|
||||
invokeNative(GenericFunctionPointer f, uint32 *args, uint32 n_stacks);
|
||||
|
||||
typedef float64 (*Float64FuncPtr)(GenericFunctionPointer, uint32 *, uint32);
|
||||
|
@ -3058,13 +3058,16 @@ typedef int64 (*Int64FuncPtr)(GenericFunctionPointer, uint32 *, uint32);
|
|||
typedef int32 (*Int32FuncPtr)(GenericFunctionPointer, uint32 *, uint32);
|
||||
typedef void (*VoidFuncPtr)(GenericFunctionPointer, uint32 *, uint32);
|
||||
|
||||
static Float64FuncPtr invokeNative_Float64 =
|
||||
static volatile Float64FuncPtr invokeNative_Float64 =
|
||||
(Float64FuncPtr)(uintptr_t)invokeNative;
|
||||
static Float32FuncPtr invokeNative_Float32 =
|
||||
static volatile Float32FuncPtr invokeNative_Float32 =
|
||||
(Float32FuncPtr)(uintptr_t)invokeNative;
|
||||
static Int64FuncPtr invokeNative_Int64 = (Int64FuncPtr)(uintptr_t)invokeNative;
|
||||
static Int32FuncPtr invokeNative_Int32 = (Int32FuncPtr)(uintptr_t)invokeNative;
|
||||
static VoidFuncPtr invokeNative_Void = (VoidFuncPtr)(uintptr_t)invokeNative;
|
||||
static volatile Int64FuncPtr invokeNative_Int64 =
|
||||
(Int64FuncPtr)(uintptr_t)invokeNative;
|
||||
static volatile Int32FuncPtr invokeNative_Int32 =
|
||||
(Int32FuncPtr)(uintptr_t)invokeNative;
|
||||
static volatile VoidFuncPtr invokeNative_Void =
|
||||
(VoidFuncPtr)(uintptr_t)invokeNative;
|
||||
|
||||
#if defined(BUILD_TARGET_ARM_VFP) || defined(BUILD_TARGET_THUMB_VFP)
|
||||
#define MAX_REG_INTS 4
|
||||
|
@ -3520,7 +3523,7 @@ fail:
|
|||
|| defined(BUILD_TARGET_THUMB) || defined(BUILD_TARGET_MIPS) \
|
||||
|| defined(BUILD_TARGET_XTENSA)
|
||||
typedef void (*GenericFunctionPointer)();
|
||||
int64
|
||||
void
|
||||
invokeNative(GenericFunctionPointer f, uint32 *args, uint32 sz);
|
||||
|
||||
typedef float64 (*Float64FuncPtr)(GenericFunctionPointer f, uint32 *, uint32);
|
||||
|
@ -3529,13 +3532,16 @@ typedef int64 (*Int64FuncPtr)(GenericFunctionPointer f, uint32 *, uint32);
|
|||
typedef int32 (*Int32FuncPtr)(GenericFunctionPointer f, uint32 *, uint32);
|
||||
typedef void (*VoidFuncPtr)(GenericFunctionPointer f, uint32 *, uint32);
|
||||
|
||||
static Int64FuncPtr invokeNative_Int64 = (Int64FuncPtr)invokeNative;
|
||||
static Int32FuncPtr invokeNative_Int32 = (Int32FuncPtr)(uintptr_t)invokeNative;
|
||||
static Float64FuncPtr invokeNative_Float64 =
|
||||
static volatile Int64FuncPtr invokeNative_Int64 =
|
||||
(Int64FuncPtr)(uintptr_t)invokeNative;
|
||||
static volatile Int32FuncPtr invokeNative_Int32 =
|
||||
(Int32FuncPtr)(uintptr_t)invokeNative;
|
||||
static volatile Float64FuncPtr invokeNative_Float64 =
|
||||
(Float64FuncPtr)(uintptr_t)invokeNative;
|
||||
static Float32FuncPtr invokeNative_Float32 =
|
||||
static volatile Float32FuncPtr invokeNative_Float32 =
|
||||
(Float32FuncPtr)(uintptr_t)invokeNative;
|
||||
static VoidFuncPtr invokeNative_Void = (VoidFuncPtr)(uintptr_t)invokeNative;
|
||||
static volatile VoidFuncPtr invokeNative_Void =
|
||||
(VoidFuncPtr)(uintptr_t)invokeNative;
|
||||
|
||||
static inline void
|
||||
word_copy(uint32 *dest, uint32 *src, unsigned num)
|
||||
|
@ -3762,19 +3768,8 @@ typedef uint32x4_t __m128i;
|
|||
#endif /* end of WASM_ENABLE_SIMD != 0 */
|
||||
|
||||
typedef void (*GenericFunctionPointer)();
|
||||
#if defined(__APPLE__) || defined(__MACH__)
|
||||
/**
|
||||
* Define the return type as 'void' in MacOS, since after converting
|
||||
* 'int64 invokeNative' into 'float64 invokeNative_Float64', the
|
||||
* return value passing might be invalid, the caller reads the return
|
||||
* value from register rax but not xmm0.
|
||||
*/
|
||||
void
|
||||
invokeNative(GenericFunctionPointer f, uint64 *args, uint64 n_stacks);
|
||||
#else
|
||||
int64
|
||||
invokeNative(GenericFunctionPointer f, uint64 *args, uint64 n_stacks);
|
||||
#endif
|
||||
|
||||
typedef float64 (*Float64FuncPtr)(GenericFunctionPointer, uint64 *, uint64);
|
||||
typedef float32 (*Float32FuncPtr)(GenericFunctionPointer, uint64 *, uint64);
|
||||
|
@ -3782,13 +3777,16 @@ typedef int64 (*Int64FuncPtr)(GenericFunctionPointer, uint64 *, uint64);
|
|||
typedef int32 (*Int32FuncPtr)(GenericFunctionPointer, uint64 *, uint64);
|
||||
typedef void (*VoidFuncPtr)(GenericFunctionPointer, uint64 *, uint64);
|
||||
|
||||
static Float64FuncPtr invokeNative_Float64 =
|
||||
static volatile Float64FuncPtr invokeNative_Float64 =
|
||||
(Float64FuncPtr)(uintptr_t)invokeNative;
|
||||
static Float32FuncPtr invokeNative_Float32 =
|
||||
static volatile Float32FuncPtr invokeNative_Float32 =
|
||||
(Float32FuncPtr)(uintptr_t)invokeNative;
|
||||
static Int64FuncPtr invokeNative_Int64 = (Int64FuncPtr)(uintptr_t)invokeNative;
|
||||
static Int32FuncPtr invokeNative_Int32 = (Int32FuncPtr)(uintptr_t)invokeNative;
|
||||
static VoidFuncPtr invokeNative_Void = (VoidFuncPtr)(uintptr_t)invokeNative;
|
||||
static volatile Int64FuncPtr invokeNative_Int64 =
|
||||
(Int64FuncPtr)(uintptr_t)invokeNative;
|
||||
static volatile Int32FuncPtr invokeNative_Int32 =
|
||||
(Int32FuncPtr)(uintptr_t)invokeNative;
|
||||
static volatile VoidFuncPtr invokeNative_Void =
|
||||
(VoidFuncPtr)(uintptr_t)invokeNative;
|
||||
|
||||
#if WASM_ENABLE_SIMD != 0
|
||||
typedef v128 (*V128FuncPtr)(GenericFunctionPointer, uint64 *, uint64);
|
||||
|
@ -4527,6 +4525,30 @@ wasm_externref_retain(uint32 externref_idx)
|
|||
#endif /* end of WASM_ENABLE_REF_TYPES */
|
||||
|
||||
#if WASM_ENABLE_DUMP_CALL_STACK != 0
|
||||
uint32
|
||||
wasm_runtime_dump_line_buf_impl(const char *line_buf, bool dump_or_print,
|
||||
char **buf, uint32 *len)
|
||||
{
|
||||
if (dump_or_print) {
|
||||
return (uint32)os_printf("%s", line_buf);
|
||||
}
|
||||
else if (*buf) {
|
||||
uint32 dump_len;
|
||||
|
||||
dump_len = snprintf(*buf, *len, "%s", line_buf);
|
||||
if (dump_len >= *len) {
|
||||
dump_len = *len;
|
||||
}
|
||||
|
||||
*len = *len - dump_len;
|
||||
*buf = *buf + dump_len;
|
||||
return dump_len;
|
||||
}
|
||||
else {
|
||||
return strlen(line_buf);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
wasm_runtime_dump_call_stack(WASMExecEnv *exec_env)
|
||||
{
|
||||
|
@ -4534,15 +4556,56 @@ wasm_runtime_dump_call_stack(WASMExecEnv *exec_env)
|
|||
wasm_exec_env_get_module_inst(exec_env);
|
||||
#if WASM_ENABLE_INTERP != 0
|
||||
if (module_inst->module_type == Wasm_Module_Bytecode) {
|
||||
wasm_interp_dump_call_stack(exec_env);
|
||||
wasm_interp_dump_call_stack(exec_env, true, NULL, 0);
|
||||
}
|
||||
#endif
|
||||
#if WASM_ENABLE_AOT != 0
|
||||
if (module_inst->module_type == Wasm_Module_AoT) {
|
||||
aot_dump_call_stack(exec_env);
|
||||
aot_dump_call_stack(exec_env, true, NULL, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32
|
||||
wasm_runtime_get_call_stack_buf_size(wasm_exec_env_t exec_env)
|
||||
{
|
||||
WASMModuleInstanceCommon *module_inst =
|
||||
wasm_exec_env_get_module_inst(exec_env);
|
||||
|
||||
#if WASM_ENABLE_INTERP != 0
|
||||
if (module_inst->module_type == Wasm_Module_Bytecode) {
|
||||
return wasm_interp_dump_call_stack(exec_env, false, NULL, 0);
|
||||
}
|
||||
#endif
|
||||
#if WASM_ENABLE_AOT != 0
|
||||
if (module_inst->module_type == Wasm_Module_AoT) {
|
||||
return aot_dump_call_stack(exec_env, false, NULL, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32
|
||||
wasm_runtime_dump_call_stack_to_buf(wasm_exec_env_t exec_env, char *buf,
|
||||
uint32 len)
|
||||
{
|
||||
WASMModuleInstanceCommon *module_inst =
|
||||
wasm_exec_env_get_module_inst(exec_env);
|
||||
|
||||
#if WASM_ENABLE_INTERP != 0
|
||||
if (module_inst->module_type == Wasm_Module_Bytecode) {
|
||||
return wasm_interp_dump_call_stack(exec_env, false, buf, len);
|
||||
}
|
||||
#endif
|
||||
#if WASM_ENABLE_AOT != 0
|
||||
if (module_inst->module_type == Wasm_Module_AoT) {
|
||||
return aot_dump_call_stack(exec_env, false, buf, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* end of WASM_ENABLE_DUMP_CALL_STACK */
|
||||
|
||||
bool
|
||||
|
|
|
@ -404,6 +404,7 @@ typedef struct wasm_frame_t {
|
|||
uint32 module_offset;
|
||||
uint32 func_index;
|
||||
uint32 func_offset;
|
||||
const char *func_name_wp;
|
||||
} WASMCApiFrame;
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
|
@ -803,6 +804,28 @@ void
|
|||
wasm_externref_cleanup(WASMModuleInstanceCommon *module_inst);
|
||||
#endif /* end of WASM_ENABLE_REF_TYPES */
|
||||
|
||||
#if WASM_ENABLE_DUMP_CALL_STACK != 0
|
||||
/**
|
||||
* @brief Internal implementation for dumping or printing callstack line
|
||||
*
|
||||
* @note if dump_or_print is true, then print to stdout directly;
|
||||
* if dump_or_print is false, but *buf is NULL, then return the length of the
|
||||
* line;
|
||||
* if dump_or_print is false, and *buf is not NULL, then dump content to
|
||||
* the memory pointed by *buf, and adjust *buf and *len according to actual
|
||||
* bytes dumped, and return the actual dumped length
|
||||
*
|
||||
* @param line_buf current line to dump or print
|
||||
* @param dump_or_print whether to print to stdout or dump to buf
|
||||
* @param buf [INOUT] pointer to the buffer
|
||||
* @param len [INOUT] pointer to remaining length
|
||||
* @return bytes printed to stdout or dumped to buf
|
||||
*/
|
||||
uint32
|
||||
wasm_runtime_dump_line_buf_impl(const char *line_buf, bool dump_or_print,
|
||||
char **buf, uint32 *len);
|
||||
#endif /* end of WASM_ENABLE_DUMP_CALL_STACK != 0 */
|
||||
|
||||
/* Get module of the current exec_env */
|
||||
WASMModuleCommon *
|
||||
wasm_exec_env_get_module(WASMExecEnv *exec_env);
|
||||
|
|
|
@ -2699,8 +2699,10 @@ apply_lto_passes(AOTCompContext *comp_ctx)
|
|||
LLVMPassManagerBuilderSetOptLevel(pass_mgr_builder, comp_ctx->opt_level);
|
||||
LLVMPassManagerBuilderPopulateModulePassManager(pass_mgr_builder,
|
||||
common_pass_mgr);
|
||||
#if LLVM_VERSION_MAJOR < 15
|
||||
LLVMPassManagerBuilderPopulateLTOPassManager(pass_mgr_builder,
|
||||
common_pass_mgr, true, true);
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_LAZY_JIT == 0
|
||||
LLVMRunPassManager(common_pass_mgr, comp_ctx->module);
|
||||
|
|
|
@ -919,6 +919,7 @@ wasm_runtime_get_function_attachment(wasm_exec_env_t exec_env);
|
|||
*/
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_set_user_data(wasm_exec_env_t exec_env, void *user_data);
|
||||
|
||||
/**
|
||||
* Get the user data within execution environment.
|
||||
*
|
||||
|
@ -963,7 +964,7 @@ WASM_RUNTIME_API_EXTERN void
|
|||
wasm_runtime_set_max_thread_num(uint32_t num);
|
||||
|
||||
/**
|
||||
* spawn a new exec_env, the spawned exec_env
|
||||
* Spawn a new exec_env, the spawned exec_env
|
||||
* can be used in other threads
|
||||
*
|
||||
* @param num the original exec_env
|
||||
|
@ -982,7 +983,7 @@ WASM_RUNTIME_API_EXTERN void
|
|||
wasm_runtime_destroy_spawned_exec_env(wasm_exec_env_t exec_env);
|
||||
|
||||
/**
|
||||
* spawn a thread from the given exec_env
|
||||
* Spawn a thread from the given exec_env
|
||||
*
|
||||
* @param exec_env the original exec_env
|
||||
* @param tid thread id to be returned to the caller
|
||||
|
@ -996,7 +997,7 @@ wasm_runtime_spawn_thread(wasm_exec_env_t exec_env, wasm_thread_t *tid,
|
|||
wasm_thread_callback_t callback, void *arg);
|
||||
|
||||
/**
|
||||
* waits a spawned thread to terminate
|
||||
* Waits a spawned thread to terminate
|
||||
*
|
||||
* @param tid thread id
|
||||
* @param retval if not NULL, output the return value of the thread
|
||||
|
@ -1046,13 +1047,41 @@ WASM_RUNTIME_API_EXTERN bool
|
|||
wasm_externref_retain(uint32_t externref_idx);
|
||||
|
||||
/**
|
||||
* dump the call stack
|
||||
* Dump the call stack to stdout
|
||||
*
|
||||
* @param exec_env the execution environment
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_dump_call_stack(wasm_exec_env_t exec_env);
|
||||
|
||||
/**
|
||||
* Get the size required to store the call stack contents, including
|
||||
* the space for terminating null byte ('\0')
|
||||
*
|
||||
* @param exec_env the execution environment
|
||||
*
|
||||
* @return size required to store the contents, 0 means error
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN uint32_t
|
||||
wasm_runtime_get_call_stack_buf_size(wasm_exec_env_t exec_env);
|
||||
|
||||
/**
|
||||
* Dump the call stack to buffer.
|
||||
*
|
||||
* @note this function is not thread-safe, please only use this API
|
||||
* when the exec_env is not executing
|
||||
*
|
||||
* @param exec_env the execution environment
|
||||
* @param buf buffer to store the dumped content
|
||||
* @param len length of the buffer
|
||||
*
|
||||
* @return bytes dumped to the buffer, including the terminating null
|
||||
* byte ('\0'), 0 means error and data in buf may be invalid
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN uint32_t
|
||||
wasm_runtime_dump_call_stack_to_buf(wasm_exec_env_t exec_env, char *buf,
|
||||
uint32_t len);
|
||||
|
||||
/**
|
||||
* Get a custom section by name
|
||||
*
|
||||
|
|
|
@ -3834,7 +3834,9 @@ wasm_interp_call_wasm(WASMModuleInstance *module_inst, WASMExecEnv *exec_env,
|
|||
}
|
||||
else {
|
||||
#if WASM_ENABLE_DUMP_CALL_STACK != 0
|
||||
wasm_interp_dump_call_stack(exec_env);
|
||||
if (wasm_interp_create_call_stack(exec_env)) {
|
||||
wasm_interp_dump_call_stack(exec_env, true, NULL, 0);
|
||||
}
|
||||
#endif
|
||||
LOG_DEBUG("meet an exception %s", wasm_get_exception(module_inst));
|
||||
}
|
||||
|
|
|
@ -3847,7 +3847,9 @@ wasm_interp_call_wasm(WASMModuleInstance *module_inst, WASMExecEnv *exec_env,
|
|||
}
|
||||
else {
|
||||
#if WASM_ENABLE_DUMP_CALL_STACK != 0
|
||||
wasm_interp_dump_call_stack(exec_env);
|
||||
if (wasm_interp_create_call_stack(exec_env)) {
|
||||
wasm_interp_dump_call_stack(exec_env, true, NULL, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -2171,6 +2171,15 @@ load_export_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
|
|||
|
||||
export = module->exports;
|
||||
for (i = 0; i < export_count; i++, export ++) {
|
||||
#if WASM_ENABLE_THREAD_MGR == 0
|
||||
if (p == p_end) {
|
||||
/* export section with inconsistent count:
|
||||
n export declared, but less than n given */
|
||||
set_error_buf(error_buf, error_buf_size,
|
||||
"length out of bounds");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
read_leb_uint32(p, p_end, str_len);
|
||||
CHECK_BUF(p, p_end, str_len);
|
||||
|
||||
|
@ -9319,8 +9328,15 @@ re_scan:
|
|||
}
|
||||
|
||||
if (loader_ctx->csp_num > 0) {
|
||||
set_error_buf(error_buf, error_buf_size,
|
||||
"function body must end with END opcode");
|
||||
if (cur_func_idx < module->function_count - 1)
|
||||
/* Function with missing end marker (between two functions) */
|
||||
set_error_buf(error_buf, error_buf_size, "END opcode expected");
|
||||
else
|
||||
/* Function with missing end marker
|
||||
(at EOF or end of code sections) */
|
||||
set_error_buf(error_buf, error_buf_size,
|
||||
"unexpected end of section or function, "
|
||||
"or section size mismatch");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
|
@ -1491,8 +1491,8 @@ wasm_instantiate(WASMModule *module, bool is_sub_inst, uint32 stack_size,
|
|||
if (stack_size == 0)
|
||||
stack_size = DEFAULT_WASM_STACK_SIZE;
|
||||
#if WASM_ENABLE_SPEC_TEST != 0
|
||||
if (stack_size < 48 * 1024)
|
||||
stack_size = 48 * 1024;
|
||||
if (stack_size < 128 * 1024)
|
||||
stack_size = 128 * 1024;
|
||||
#endif
|
||||
module_inst->default_wasm_stack_size = stack_size;
|
||||
|
||||
|
@ -2485,8 +2485,8 @@ wasm_get_module_inst_mem_consumption(const WASMModuleInstance *module_inst,
|
|||
|| (WASM_ENABLE_MEMORY_TRACING != 0) */
|
||||
|
||||
#if WASM_ENABLE_DUMP_CALL_STACK != 0
|
||||
void
|
||||
wasm_interp_dump_call_stack(struct WASMExecEnv *exec_env)
|
||||
bool
|
||||
wasm_interp_create_call_stack(struct WASMExecEnv *exec_env)
|
||||
{
|
||||
WASMModuleInstance *module_inst =
|
||||
(WASMModuleInstance *)wasm_exec_env_get_module_inst(exec_env);
|
||||
|
@ -2507,12 +2507,12 @@ wasm_interp_dump_call_stack(struct WASMExecEnv *exec_env)
|
|||
if (!bh_vector_destroy(module_inst->frames)
|
||||
|| !bh_vector_init(module_inst->frames, n, sizeof(WASMCApiFrame),
|
||||
false)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
cur_frame = first_frame;
|
||||
n = 0;
|
||||
os_printf("\n");
|
||||
|
||||
while (cur_frame) {
|
||||
WASMCApiFrame frame = { 0 };
|
||||
WASMFunctionInstance *func_inst = cur_frame->function;
|
||||
|
@ -2560,20 +2560,86 @@ wasm_interp_dump_call_stack(struct WASMExecEnv *exec_env)
|
|||
}
|
||||
}
|
||||
|
||||
/* function name not exported, print number instead */
|
||||
if (func_name == NULL) {
|
||||
os_printf("#%02d $f%d \n", n, func_inst - module_inst->functions);
|
||||
}
|
||||
else {
|
||||
os_printf("#%02d %s \n", n, func_name);
|
||||
}
|
||||
frame.func_name_wp = func_name;
|
||||
|
||||
/* keep print */
|
||||
bh_vector_append(module_inst->frames, &frame);
|
||||
if (!bh_vector_append(module_inst->frames, &frame)) {
|
||||
bh_vector_destroy(module_inst->frames);
|
||||
return false;
|
||||
}
|
||||
|
||||
cur_frame = cur_frame->prev_frame;
|
||||
n++;
|
||||
}
|
||||
os_printf("\n");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#define PRINT_OR_DUMP() \
|
||||
do { \
|
||||
total_len += \
|
||||
wasm_runtime_dump_line_buf_impl(line_buf, print, &buf, &len); \
|
||||
if ((!print) && buf && (len == 0)) { \
|
||||
return total_len; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
uint32
|
||||
wasm_interp_dump_call_stack(struct WASMExecEnv *exec_env, bool print, char *buf,
|
||||
uint32 len)
|
||||
{
|
||||
WASMModuleInstance *module_inst =
|
||||
(WASMModuleInstance *)wasm_exec_env_get_module_inst(exec_env);
|
||||
uint32 n = 0, total_len = 0, total_frames;
|
||||
/* reserve 256 bytes for line buffer, any line longer than 256 bytes
|
||||
* will be truncated */
|
||||
char line_buf[256];
|
||||
|
||||
if (!module_inst->frames) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
total_frames = bh_vector_size(module_inst->frames);
|
||||
if (total_frames == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
snprintf(line_buf, sizeof(line_buf), "\n");
|
||||
PRINT_OR_DUMP();
|
||||
|
||||
while (n < total_frames) {
|
||||
WASMCApiFrame frame = { 0 };
|
||||
uint32 line_length, i;
|
||||
|
||||
if (!bh_vector_get(module_inst->frames, n, &frame)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* function name not exported, print number instead */
|
||||
if (frame.func_name_wp == NULL) {
|
||||
line_length = snprintf(line_buf, sizeof(line_buf), "#%02d $f%d\n",
|
||||
n, frame.func_index);
|
||||
}
|
||||
else {
|
||||
line_length = snprintf(line_buf, sizeof(line_buf), "#%02d %s\n", n,
|
||||
frame.func_name_wp);
|
||||
}
|
||||
|
||||
if (line_length >= sizeof(line_buf)) {
|
||||
uint32 line_buffer_len = sizeof(line_buf);
|
||||
/* If line too long, ensure the last character is '\n' */
|
||||
for (i = line_buffer_len - 5; i < line_buffer_len - 2; i++) {
|
||||
line_buf[i] = '.';
|
||||
}
|
||||
line_buf[line_buffer_len - 2] = '\n';
|
||||
}
|
||||
|
||||
PRINT_OR_DUMP();
|
||||
|
||||
n++;
|
||||
}
|
||||
snprintf(line_buf, sizeof(line_buf), "\n");
|
||||
PRINT_OR_DUMP();
|
||||
|
||||
return total_len + 1;
|
||||
}
|
||||
#endif /* end of WASM_ENABLE_DUMP_CALL_STACK */
|
||||
|
|
|
@ -432,8 +432,25 @@ wasm_get_table_inst(const WASMModuleInstance *module_inst, const uint32 tbl_idx)
|
|||
}
|
||||
|
||||
#if WASM_ENABLE_DUMP_CALL_STACK != 0
|
||||
void
|
||||
wasm_interp_dump_call_stack(struct WASMExecEnv *exec_env);
|
||||
bool
|
||||
wasm_interp_create_call_stack(struct WASMExecEnv *exec_env);
|
||||
|
||||
/**
|
||||
* @brief Dump wasm call stack or get the size
|
||||
*
|
||||
* @param exec_env the execution environment
|
||||
* @param print whether to print to stdout or not
|
||||
* @param buf buffer to store the dumped content
|
||||
* @param len length of the buffer
|
||||
*
|
||||
* @return when print is true, return the bytes printed out to stdout; when
|
||||
* print is false and buf is NULL, return the size required to store the
|
||||
* callstack content; when print is false and buf is not NULL, return the size
|
||||
* dumped to the buffer, 0 means error and data in buf may be invalid
|
||||
*/
|
||||
uint32
|
||||
wasm_interp_dump_call_stack(struct WASMExecEnv *exec_env, bool print, char *buf,
|
||||
uint32 len);
|
||||
#endif
|
||||
|
||||
const uint8 *
|
||||
|
|
|
@ -51,11 +51,17 @@
|
|||
#define CONFIG_HAS_FDATASYNC 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* For NuttX, CONFIG_HAS_ISATTY is provided by its platform header.
|
||||
* (platform_internal.h)
|
||||
*/
|
||||
#ifndef __NuttX__
|
||||
#ifndef __CloudABI__
|
||||
#define CONFIG_HAS_ISATTY 1
|
||||
#else
|
||||
#define CONFIG_HAS_ISATTY 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __APPLE__
|
||||
#define CONFIG_HAS_POSIX_FALLOCATE 1
|
||||
|
|
|
@ -35,9 +35,11 @@ if (NOT DEFINED WAMR_BUILD_TARGET)
|
|||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
else ()
|
||||
message(SEND_ERROR "Unsupported build target platform!")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -22,9 +22,11 @@ if (NOT DEFINED WAMR_BUILD_TARGET)
|
|||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
else ()
|
||||
message(SEND_ERROR "Unsupported build target platform!")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -16,9 +16,11 @@ if (NOT DEFINED WAMR_BUILD_TARGET)
|
|||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
else ()
|
||||
message(SEND_ERROR "Unsupported build target platform!")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -16,9 +16,11 @@ if (NOT DEFINED WAMR_BUILD_TARGET)
|
|||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
else ()
|
||||
message(SEND_ERROR "Unsupported build target platform!")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -25,9 +25,11 @@ if (NOT DEFINED WAMR_BUILD_TARGET)
|
|||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
else ()
|
||||
message(SEND_ERROR "Unsupported build target platform!")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -24,9 +24,11 @@ if (NOT DEFINED WAMR_BUILD_TARGET)
|
|||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
else ()
|
||||
message(SEND_ERROR "Unsupported build target platform!")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -23,9 +23,11 @@ if (NOT DEFINED WAMR_BUILD_TARGET)
|
|||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
else ()
|
||||
message(FATAL_ERROR "Unsupported build target platform!")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -33,9 +33,11 @@ if (NOT DEFINED WAMR_BUILD_TARGET)
|
|||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
else ()
|
||||
message(SEND_ERROR "Unsupported build target platform!")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -27,9 +27,11 @@ if (NOT DEFINED WAMR_BUILD_TARGET)
|
|||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
else ()
|
||||
message(SEND_ERROR "Unsupported build target platform!")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -27,9 +27,11 @@ if (NOT DEFINED WAMR_BUILD_TARGET)
|
|||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
else ()
|
||||
message(SEND_ERROR "Unsupported build target platform!")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -27,9 +27,11 @@ if (NOT DEFINED WAMR_BUILD_TARGET)
|
|||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
else ()
|
||||
message(SEND_ERROR "Unsupported build target platform!")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -33,9 +33,11 @@ if (NOT DEFINED WAMR_BUILD_TARGET)
|
|||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
else ()
|
||||
message(SEND_ERROR "Unsupported build target platform!")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -125,9 +125,11 @@ if (NOT DEFINED WAMR_BUILD_TARGET)
|
|||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
else ()
|
||||
message(SEND_ERROR "Unsupported build target platform!")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -27,9 +27,11 @@ if (NOT DEFINED WAMR_BUILD_TARGET)
|
|||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
else ()
|
||||
message(SEND_ERROR "Unsupported build target platform!")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -39,9 +39,11 @@ if (NOT DEFINED WAMR_BUILD_TARGET)
|
|||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
else ()
|
||||
message(SEND_ERROR "Unsupported build target platform!")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
diff --git a/test/core/binary.wast b/test/core/binary.wast
|
||||
index c6f9755..a479212 100644
|
||||
index 891aad3..07356a3 100644
|
||||
--- a/test/core/binary.wast
|
||||
+++ b/test/core/binary.wast
|
||||
@@ -161,7 +161,7 @@
|
||||
@@ -206,7 +206,7 @@
|
||||
)
|
||||
|
||||
;; Type section with signed LEB128 encoded type
|
||||
|
@ -11,7 +11,7 @@ index c6f9755..a479212 100644
|
|||
(module binary
|
||||
"\00asm" "\01\00\00\00"
|
||||
"\01" ;; Type section id
|
||||
@@ -171,7 +171,7 @@
|
||||
@@ -216,7 +216,7 @@
|
||||
"\00\00"
|
||||
)
|
||||
"integer representation too long"
|
||||
|
@ -20,7 +20,7 @@ index c6f9755..a479212 100644
|
|||
|
||||
;; Unsigned LEB128 must not be overlong
|
||||
(assert_malformed
|
||||
@@ -1582,7 +1582,7 @@
|
||||
@@ -1683,7 +1683,7 @@
|
||||
)
|
||||
|
||||
;; 2 elem segment declared, 1 given
|
||||
|
@ -29,7 +29,7 @@ index c6f9755..a479212 100644
|
|||
(module binary
|
||||
"\00asm" "\01\00\00\00"
|
||||
"\01\04\01" ;; type section
|
||||
@@ -1595,7 +1595,7 @@
|
||||
@@ -1696,7 +1696,7 @@
|
||||
;; "\00\41\00\0b\01\00" ;; elem 1 (missed)
|
||||
)
|
||||
"unexpected end"
|
||||
|
@ -38,6 +38,24 @@ index c6f9755..a479212 100644
|
|||
|
||||
;; 2 elem segment declared, 1.5 given
|
||||
(assert_malformed
|
||||
@@ -1813,7 +1813,7 @@
|
||||
)
|
||||
|
||||
;; 1 br_table target declared, 2 given
|
||||
-(assert_malformed
|
||||
+(;assert_malformed
|
||||
(module binary
|
||||
"\00asm" "\01\00\00\00"
|
||||
"\01\04\01" ;; type section
|
||||
@@ -1832,7 +1832,7 @@
|
||||
"\0b\0b\0b" ;; end
|
||||
)
|
||||
"unexpected end"
|
||||
-)
|
||||
+;)
|
||||
|
||||
;; Start section
|
||||
(module binary
|
||||
diff --git a/test/core/data.wast b/test/core/data.wast
|
||||
index 4f339be..0b5b3e6 100644
|
||||
--- a/test/core/data.wast
|
||||
|
@ -93,26 +111,10 @@ index 4f339be..0b5b3e6 100644
|
|||
|
||||
;; Invalid offsets
|
||||
diff --git a/test/core/elem.wast b/test/core/elem.wast
|
||||
index 575ecef..204b748 100644
|
||||
index 575ecef..6eecab9 100644
|
||||
--- a/test/core/elem.wast
|
||||
+++ b/test/core/elem.wast
|
||||
@@ -467,6 +467,7 @@
|
||||
"type mismatch"
|
||||
)
|
||||
|
||||
+(; not supported by wat2wasm
|
||||
(assert_invalid
|
||||
(module
|
||||
(table 1 funcref)
|
||||
@@ -507,6 +508,7 @@
|
||||
)
|
||||
"constant expression required"
|
||||
)
|
||||
+;)
|
||||
|
||||
;; Two elements target the same slot
|
||||
|
||||
@@ -571,9 +573,11 @@
|
||||
@@ -571,9 +571,11 @@
|
||||
(func $const-i32-d (type $out-i32) (i32.const 68))
|
||||
)
|
||||
|
||||
|
@ -124,7 +126,7 @@ index 575ecef..204b748 100644
|
|||
|
||||
(module $module3
|
||||
(type $out-i32 (func (result i32)))
|
||||
@@ -584,6 +588,8 @@
|
||||
@@ -584,6 +586,8 @@
|
||||
(func $const-i32-f (type $out-i32) (i32.const 70))
|
||||
)
|
||||
|
||||
|
@ -785,7 +787,7 @@ index 0b2d26f..bdab6a0 100644
|
|||
(table $t1 30 30 funcref)
|
||||
(elem (table $t1) (i32.const 2) func 3 1 4 1)
|
||||
diff --git a/test/core/unreached-valid.wast b/test/core/unreached-valid.wast
|
||||
index 0025217..07d2788 100644
|
||||
index b7ebabf..4f2abfb 100644
|
||||
--- a/test/core/unreached-valid.wast
|
||||
+++ b/test/core/unreached-valid.wast
|
||||
@@ -46,6 +46,7 @@
|
||||
|
@ -796,9 +798,8 @@ index 0025217..07d2788 100644
|
|||
(module
|
||||
(func (export "meet-bottom")
|
||||
(block (result f64)
|
||||
@@ -59,4 +60,5 @@
|
||||
(drop)
|
||||
)
|
||||
@@ -61,3 +62,4 @@
|
||||
)
|
||||
+;)
|
||||
|
||||
(assert_trap (invoke "meet-bottom") "unreachable")
|
||||
+;)
|
||||
|
|
|
@ -275,12 +275,12 @@ function spec_test()
|
|||
|
||||
# update basic test cases
|
||||
echo "update spec test cases"
|
||||
git fetch origin master
|
||||
git fetch origin main
|
||||
# restore from XX_ignore_cases.patch
|
||||
# resotre branch
|
||||
git checkout -B master
|
||||
# [spec] Fix instruction table (#1402) Thu Dec 2 17:21:54 2021 +0100
|
||||
git reset --hard 2460ad02b51fb5ed5824f44de287a8638b19a5f8
|
||||
git checkout -B main
|
||||
# [spec] Update note on module initialization trapping (#1493)
|
||||
git reset --hard 044d0d2e77bdcbe891f7e0b9dd2ac01d56435f0b
|
||||
git apply ../../spec-test-script/ignore_cases.patch
|
||||
if [[ ${ENABLE_SIMD} == 1 ]]; then
|
||||
git apply ../../spec-test-script/simd_ignore_cases.patch
|
||||
|
@ -295,8 +295,8 @@ function spec_test()
|
|||
|
||||
# fetch spec for threads proposal
|
||||
git fetch threads
|
||||
# [interpreter] Threading (#179) Fri Aug 6 18:02:59 2021 +0200
|
||||
git reset --hard 0d115b494d640eb0c1c352941fd14ca0bad926d3
|
||||
# Fix error in Web embedding desc for atomic.notify (#185)
|
||||
git reset --hard 85b562cd6805947876ec5e8b975ab0127c55a0a2
|
||||
git checkout threads/main
|
||||
|
||||
git apply ../../spec-test-script/thread_proposal_ignore_cases.patch
|
||||
|
@ -321,16 +321,16 @@ function spec_test()
|
|||
exit 1
|
||||
;;
|
||||
esac
|
||||
if [ ! -f /tmp/wabt-1.0.24-${WABT_PLATFORM}.tar.gz ]; then
|
||||
if [ ! -f /tmp/wabt-1.0.29-${WABT_PLATFORM}.tar.gz ]; then
|
||||
wget \
|
||||
https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-${WABT_PLATFORM}.tar.gz \
|
||||
https://github.com/WebAssembly/wabt/releases/download/1.0.29/wabt-1.0.29-${WABT_PLATFORM}.tar.gz \
|
||||
-P /tmp
|
||||
fi
|
||||
|
||||
cd /tmp \
|
||||
&& tar zxf wabt-1.0.24-${WABT_PLATFORM}.tar.gz \
|
||||
&& tar zxf wabt-1.0.29-${WABT_PLATFORM}.tar.gz \
|
||||
&& mkdir -p ${WORK_DIR}/wabt/out/gcc/Release/ \
|
||||
&& install wabt-1.0.24/bin/wa* ${WORK_DIR}/wabt/out/gcc/Release/ \
|
||||
&& install wabt-1.0.29/bin/wa* ${WORK_DIR}/wabt/out/gcc/Release/ \
|
||||
&& cd -
|
||||
fi
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue
Block a user