Add printingAdd print time for wamrc, fix posix mmap bug time for wamrc, fixed a posix mmap bug. (#206)

Change-Id: Ib6517b8a69cf022a1a6a74efa1f98155aec143bc
This commit is contained in:
Shi Lei
2020-03-20 16:06:40 +08:00
committed by GitHub
parent e07381c4a8
commit b6cae54b54
6 changed files with 61 additions and 1 deletions

View File

@ -727,6 +727,8 @@ aot_compile_wasm(AOTCompContext *comp_ctx)
bool ret;
uint32 i;
bh_print_time("Begin to compile WASM bytecode to LLVM IR");
for (i = 0; i < comp_ctx->func_ctx_count; i++)
if (!aot_compile_func(comp_ctx, i)) {
#if 0
@ -744,6 +746,8 @@ aot_compile_wasm(AOTCompContext *comp_ctx)
errno = 0;
#endif
bh_print_time("Begin to verify LLVM module");
ret = LLVMVerifyModule(comp_ctx->module, LLVMPrintMessageAction, &msg);
if (!ret && msg) {
if (msg[0] != '\0') {
@ -754,6 +758,8 @@ aot_compile_wasm(AOTCompContext *comp_ctx)
LLVMDisposeMessage(msg);
}
bh_print_time("Begin to run function optimization passes");
if (comp_ctx->optimize) {
LLVMInitializeFunctionPassManager(comp_ctx->pass_mgr);
for (i = 0; i < comp_ctx->func_ctx_count; i++)
@ -769,6 +775,8 @@ aot_emit_llvm_file(AOTCompContext *comp_ctx, const char *file_name)
{
char *err = NULL;
bh_print_time("Begin to emit LLVM IR file");
if (LLVMPrintModuleToFile(comp_ctx->module, file_name, &err) != 0) {
if (err) {
LLVMDisposeMessage(err);
@ -786,6 +794,8 @@ aot_emit_object_file(AOTCompContext *comp_ctx, char *file_name)
{
char *err = NULL;
bh_print_time("Begin to emit object file");
if (LLVMTargetMachineEmitToFile(comp_ctx->target_machine,
comp_ctx->module,
file_name,

View File

@ -1837,6 +1837,8 @@ aot_obj_data_create(AOTCompContext *comp_ctx)
char *err = NULL;
AOTObjectData *obj_data;
bh_print_time("Begin to emit object file to buffer");
if (!(obj_data = wasm_runtime_malloc(sizeof(AOTObjectData)))) {
aot_set_last_error("allocate memory failed.");
return false;
@ -1866,6 +1868,8 @@ aot_obj_data_create(AOTCompContext *comp_ctx)
goto fail;
}
bh_print_time("Begin to resolve object file info");
/* resolve target info/text/relocations/functions */
if (!aot_resolve_target_info(comp_ctx, obj_data)
|| !aot_resolve_text(obj_data)
@ -1894,6 +1898,8 @@ aot_emit_aot_file(AOTCompContext *comp_ctx, AOTCompData *comp_data,
if (!obj_data)
return false;
bh_print_time("Begin to emit AOT file");
aot_file_size = get_aot_file_size(comp_data, obj_data);
if (!(buf = aot_file_buf = wasm_runtime_malloc(aot_file_size))) {