Use logger for runtime error/debug prints (#3097)
Change runtime internal error/debug prints from using `os_printf()` to using `LOG_ERROR()`/`LOG_DEBUG()`.
This commit is contained in:
@ -3335,7 +3335,7 @@ load(const uint8 *buf, uint32 size, AOTModule *module, char *error_buf,
|
||||
{
|
||||
uint32 i;
|
||||
for (i = 0; i < module->func_count; i++) {
|
||||
os_printf("AOT func %u, addr: %p\n", i, module->func_ptrs[i]);
|
||||
LOG_VERBOSE("AOT func %u, addr: %p\n", i, module->func_ptrs[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -376,7 +376,7 @@ runtime_exception_handler(EXCEPTION_POINTERS *exce_info)
|
||||
#endif
|
||||
}
|
||||
|
||||
os_printf("Unhandled exception thrown: exception code: 0x%lx, "
|
||||
LOG_ERROR("Unhandled exception thrown: exception code: 0x%lx, "
|
||||
"exception address: %p, exception information: %p\n",
|
||||
ExceptionRecord->ExceptionCode, ExceptionRecord->ExceptionAddress,
|
||||
sig_addr);
|
||||
|
||||
@ -160,10 +160,10 @@ jit_compiler_compile(WASMModule *module, uint32 func_idx)
|
||||
|
||||
#if WASM_ENABLE_CUSTOM_NAME_SECTION != 0
|
||||
char *function_name = cc->cur_wasm_func->field_name;
|
||||
os_printf("fast jit compilation failed: %s (function_name=%s)\n",
|
||||
LOG_ERROR("fast jit compilation failed: %s (function_name=%s)\n",
|
||||
last_error ? last_error : "unknown error", function_name);
|
||||
#else
|
||||
os_printf("fast jit compilation failed: %s\n",
|
||||
LOG_ERROR("fast jit compilation failed: %s\n",
|
||||
last_error ? last_error : "unknown error");
|
||||
#endif
|
||||
|
||||
|
||||
@ -1093,7 +1093,7 @@ init_func_translation(JitCompContext *cc)
|
||||
|| !(jit_frame = jit_calloc(offsetof(JitFrame, lp)
|
||||
+ sizeof(*jit_frame->lp)
|
||||
* (max_locals + max_stacks)))) {
|
||||
os_printf("allocate jit frame failed\n");
|
||||
LOG_ERROR("allocate jit frame failed\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -3300,7 +3300,7 @@ orcjit_thread_callback(void *arg)
|
||||
/* Compile fast jit funcitons of this group */
|
||||
for (i = group_idx; i < func_count; i += group_stride) {
|
||||
if (!jit_compiler_compile(module, i + module->import_function_count)) {
|
||||
os_printf("failed to compile fast jit function %u\n", i);
|
||||
LOG_ERROR("failed to compile fast jit function %u\n", i);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3327,7 +3327,7 @@ orcjit_thread_callback(void *arg)
|
||||
if (!jit_compiler_set_call_to_fast_jit(
|
||||
module,
|
||||
i + j * group_stride + module->import_function_count)) {
|
||||
os_printf(
|
||||
LOG_ERROR(
|
||||
"failed to compile call_to_fast_jit for func %u\n",
|
||||
i + j * group_stride + module->import_function_count);
|
||||
module->orcjit_stop_compiling = true;
|
||||
@ -3377,7 +3377,7 @@ orcjit_thread_callback(void *arg)
|
||||
LLVMOrcLLLazyJITLookup(comp_ctx->orc_jit, &func_addr, func_name);
|
||||
if (error != LLVMErrorSuccess) {
|
||||
char *err_msg = LLVMGetErrorMessage(error);
|
||||
os_printf("failed to compile llvm jit function %u: %s", i, err_msg);
|
||||
LOG_ERROR("failed to compile llvm jit function %u: %s", i, err_msg);
|
||||
LLVMDisposeErrorMessage(err_msg);
|
||||
break;
|
||||
}
|
||||
@ -3398,7 +3398,7 @@ orcjit_thread_callback(void *arg)
|
||||
func_name);
|
||||
if (error != LLVMErrorSuccess) {
|
||||
char *err_msg = LLVMGetErrorMessage(error);
|
||||
os_printf("failed to compile llvm jit function %u: %s", i,
|
||||
LOG_ERROR("failed to compile llvm jit function %u: %s", i,
|
||||
err_msg);
|
||||
LLVMDisposeErrorMessage(err_msg);
|
||||
/* Ignore current llvm jit func, as its func ptr is
|
||||
|
||||
@ -2024,7 +2024,7 @@ orcjit_thread_callback(void *arg)
|
||||
/* Compile fast jit funcitons of this group */
|
||||
for (i = group_idx; i < func_count; i += group_stride) {
|
||||
if (!jit_compiler_compile(module, i + module->import_function_count)) {
|
||||
os_printf("failed to compile fast jit function %u\n", i);
|
||||
LOG_ERROR("failed to compile fast jit function %u\n", i);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2051,7 +2051,7 @@ orcjit_thread_callback(void *arg)
|
||||
if (!jit_compiler_set_call_to_fast_jit(
|
||||
module,
|
||||
i + j * group_stride + module->import_function_count)) {
|
||||
os_printf(
|
||||
LOG_ERROR(
|
||||
"failed to compile call_to_fast_jit for func %u\n",
|
||||
i + j * group_stride + module->import_function_count);
|
||||
module->orcjit_stop_compiling = true;
|
||||
@ -2101,7 +2101,7 @@ orcjit_thread_callback(void *arg)
|
||||
LLVMOrcLLLazyJITLookup(comp_ctx->orc_jit, &func_addr, func_name);
|
||||
if (error != LLVMErrorSuccess) {
|
||||
char *err_msg = LLVMGetErrorMessage(error);
|
||||
os_printf("failed to compile llvm jit function %u: %s", i, err_msg);
|
||||
LOG_ERROR("failed to compile llvm jit function %u: %s", i, err_msg);
|
||||
LLVMDisposeErrorMessage(err_msg);
|
||||
break;
|
||||
}
|
||||
@ -2122,7 +2122,7 @@ orcjit_thread_callback(void *arg)
|
||||
func_name);
|
||||
if (error != LLVMErrorSuccess) {
|
||||
char *err_msg = LLVMGetErrorMessage(error);
|
||||
os_printf("failed to compile llvm jit function %u: %s", i,
|
||||
LOG_ERROR("failed to compile llvm jit function %u: %s", i,
|
||||
err_msg);
|
||||
LLVMDisposeErrorMessage(err_msg);
|
||||
/* Ignore current llvm jit func, as its func ptr is
|
||||
|
||||
@ -269,14 +269,14 @@ getentropy_wrapper(wasm_exec_env_t exec_env, void *buffer, uint32 length)
|
||||
static int
|
||||
setjmp_wrapper(wasm_exec_env_t exec_env, void *jmp_buf)
|
||||
{
|
||||
os_printf("setjmp() called\n");
|
||||
LOG_DEBUG("setjmp() called\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
longjmp_wrapper(wasm_exec_env_t exec_env, void *jmp_buf, int val)
|
||||
{
|
||||
os_printf("longjmp() called\n");
|
||||
LOG_DEBUG("longjmp() called\n");
|
||||
}
|
||||
|
||||
#if !defined(BH_PLATFORM_LINUX_SGX)
|
||||
|
||||
Reference in New Issue
Block a user