wasm_data := #file_contents "data/test.wasm";
wasm_binary := wasm.load(wasm_data);
- println("Loaded sections");
-
- for ^entry: wasm_binary.section_locations.entries {
- printf("Section number: {}\nOffset: {}\n", entry.key, entry.value);
+ for ^entry: wasm_binary.sections.entries {
+ printf("Section: {}\nOffset: {}\n", entry.key, entry.value);
}
+
+ wasm_sections := wasm.parse_sections(^wasm_binary, context.allocator);
+ printf("Types:\n{p}\n", wasm_sections.type_section);
+ printf("Imports:\n{p}\n", wasm_sections.import_section);
+ printf("Exports:\n{p}\n", wasm_sections.export_section);
+ printf("Code:\n{}\n", wasm_sections.code_section);
+
+ // type_section := wasm.parse_type_section(^wasm_binary);
+ // printf("Types:\n{}\n", type_section);
+
+ // import_section := wasm.parse_import_section(^wasm_binary);
+ // printf("Imports:\n{p}\n", import_section);
+
+ // export_section := wasm.parse_export_section(^wasm_binary);
+ // printf("Exports:\n{p}\n", export_section);
+
+ // function_section := wasm.parse_function_section(^wasm_binary);
+ // printf("Functions:\n{p}\n", function_section);
+
+ // start_function := wasm.parse_start_section(^wasm_binary);
+ // printf("Start function: {}\n", start_function);
+
+ // memory_section := wasm.parse_memory_section(^wasm_binary);
+ // printf("Memories:\n{p}\n", memory_section);
+
+ // table_section := wasm.parse_table_section(^wasm_binary);
+ // printf("Tables:\n{p}\n", table_section);
+
+ // global_section := wasm.parse_global_section(^wasm_binary);
+ // printf("Globals:\n{p}\n", global_section);
+
+ // element_section := wasm.parse_element_section(^wasm_binary);
+ // printf("Elements:\n{p}\n", element_section);
+
+ // data_section := wasm.parse_data_section(^wasm_binary);
+ // for e: data_section do printf("Data: {} {} {}\n", e.memory_index, e.offset, e.data.count);
+
+ // code_section := wasm.parse_code_section(^wasm_binary);
+ // printf("Code:\n{p}\n", code_section.count);
}