From 815cd3760c9727d3f96a217240686d62264b4b1b Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Fri, 21 Apr 2023 16:58:20 -0500 Subject: [PATCH] fixed: function pointers in static data --- compiler/src/onyx.c | 2 +- compiler/src/wasm_type_table.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/src/onyx.c b/compiler/src/onyx.c index cf572acb..2b1b9a5b 100644 --- a/compiler/src/onyx.c +++ b/compiler/src/onyx.c @@ -885,7 +885,7 @@ static b32 onyx_run_module(bh_buffer code_buffer) { } static b32 onyx_run_wasm_file(const char *filename) { - bh_file_contents contents = bh_file_read_contents(global_heap_allocator, filename); + bh_file_contents contents = bh_file_read_contents(bh_heap_allocator(), filename); bh_buffer code_buffer; code_buffer.data = contents.data; diff --git a/compiler/src/wasm_type_table.h b/compiler/src/wasm_type_table.h index 33f4c5b8..a5ef9551 100644 --- a/compiler/src/wasm_type_table.h +++ b/compiler/src/wasm_type_table.h @@ -415,6 +415,8 @@ static u64 build_type_table(OnyxWasmModule* module) { u32 data_loc = table_buffer.length; u32 func_idx = get_element_idx(module, node); bh_buffer_write_u32(&table_buffer, func_idx); + bh_buffer_write_u32(&table_buffer, 0); + bh_buffer_write_u32(&table_buffer, 0); bh_arr_push(method_data, ((StructMethodData) { .name_loc = name_loc, @@ -843,6 +845,8 @@ static u64 build_tagged_procedures(OnyxWasmModule *module) { assert(func->entity && func->entity->package); bh_buffer_write_u32(&tag_proc_buffer, get_element_idx(module, func)); + bh_buffer_write_u32(&tag_proc_buffer, 0); + bh_buffer_write_u32(&tag_proc_buffer, 0); bh_buffer_write_u32(&tag_proc_buffer, func->type->id); WRITE_SLICE(tag_array_base, tag_count); bh_buffer_write_u32(&tag_proc_buffer, func->entity->package->id); -- 2.25.1