diff options
-rwxr-xr-x | main.py | 4 | ||||
-rw-r--r-- | resources/wasm.xml | 6 | ||||
-rw-r--r-- | test/autowasm.c | 17 |
3 files changed, 23 insertions, 4 deletions
@@ -358,10 +358,10 @@ class CodeGen(object): ref_node_name = pointer_remover(ref_node.attrib["name"]) if child_count == 1: for_read = text.c_read_elem_sig_2.replace("XXX", ref_node_name).replace("YYY", "dummy->" + child.attrib["name"]) + ";\n" - read_source.write(for_read) + read_source.write("dummy->" + child.attrib["name"] + "=" + for_read) elif child_count > 1: for_read = text.c_read_elem_sig_2.replace("XXX", ref_node_name).replace("YYY", "dummy->" + child.attrib["name"] + "[i]") + ";\n" - read_source.write(for_read) + read_source.write("dummy->" + child.attrib["name"] + "=" + for_read) else: # child_count == -1 count_name_str = child.attrib["count"][6:] read_source.write("if (" + "dummy->" + get_node_name(count_name_str, elem) + ")\n") diff --git a/resources/wasm.xml b/resources/wasm.xml index 6a9dfe9..6925cdb 100644 --- a/resources/wasm.xml +++ b/resources/wasm.xml @@ -40,8 +40,10 @@ <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/> <NameLength name="namelength" type="uint32" encoding="leb128u"/> <Name name="name" type="string" size="self::NameLength"/> + <!-- <Count name="count" encoding="leb128u" type="uint32" count="1"/> - <Entries name="entries" type="self::Memory_Type" count="self::Count"/> + --> + <Entries name="entries" type="self::Memory_Type" count="1"/> </Memory_Section> <Global_Section name="W_Global_Section" count="1" type="" isaggregate="true"> <ID name="id" type="uint8" encoding="leb128u"/> @@ -106,7 +108,7 @@ <Mutability name="mutability" encoding="leb128u" type="uint8" count="1"></Mutability> </Global_Type> <Table_Type name="table_type_t" isaggregate="true"> - <Element_Type name="element_type" encoding="leb128s" type="int8" count="1"></Element_Type> + <Element_Type name="element_type" encoding="leb128u" type="uint8" count="1"></Element_Type> <Resizable_Limit name="resizable_limit" count="1" type="self::Resizable_Limit"></Resizable_Limit> </Table_Type> <Memory_Type name="memory_type_t" isaggregate="true"> diff --git a/test/autowasm.c b/test/autowasm.c index fe3fece..2e978ce 100644 --- a/test/autowasm.c +++ b/test/autowasm.c @@ -16,6 +16,7 @@ int main (int argc, char** argv) { printf("magic_number:%x\n", magic_number_container->magic_number); printf("version:%x\n", version_container->version); + printf("type section id:%d\n", W_Type_Section_container->id); printf("type section payloadlength:%d\n", W_Type_Section_container->payloadlength); printf("type_section entry count:%d\n", W_Type_Section_container->count); @@ -46,6 +47,22 @@ int main (int argc, char** argv) { for (int i = 0; i < W_Function_Section_container->count; ++i) printf("type:%d\n", W_Function_Section_container->types[i]); + printf("table_section_id:%d\n", W_Table_Section_container->id); + printf("table_section_payloadlength:%d\n", W_Table_Section_container->payloadlength); + printf("table_section_count:%d\n", W_Table_Section_container->count); + for (int i = 0; i < W_Table_Section_container->count; ++i) { + printf("element_type:%d\n", W_Table_Section_container->entries[i]->element_type); + printf("rl_flags:%d\n", W_Table_Section_container->entries[i]->resizable_limit->flags); + printf("rl_initial:%d\n", W_Table_Section_container->entries[i]->resizable_limit->initial); + printf("rl_maximum:%d\n", W_Table_Section_container->entries[i]->resizable_limit->maximum); + } + + printf("memory_section_id:%d\n", W_Memory_Section_container->id); + printf("memory_section_payload_length:%d\n", W_Memory_Section_container->payloadlength); + printf("rl_flags:%d\n", W_Memory_Section_container->entries->resizable_limit->flags); + printf("rl_initial:%d\n", W_Memory_Section_container->entries->resizable_limit->initial); + printf("rl_maximum:%d\n", W_Memory_Section_container->entries->resizable_limit->maximum); + release_all(); return 0; } |