aboutsummaryrefslogtreecommitdiff
path: root/tools/wasm_compile.h
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-10-08 19:18:43 +0200
committerWojciech Kosior <kwojtus@protonmail.com>2020-10-08 19:18:43 +0200
commit5e04a9626e2986fc40825d15cb09a274223381e9 (patch)
treea52a96fa585247145cb521b9c6f7fe7946ba7997 /tools/wasm_compile.h
parent63a2cced4238af7d171e0b8807d887c435b4656b (diff)
downloadAGH-engineering-thesis-5e04a9626e2986fc40825d15cb09a274223381e9.tar.gz
AGH-engineering-thesis-5e04a9626e2986fc40825d15cb09a274223381e9.zip
translate webasm block of instructions + put instruction names as comments in generated code
Diffstat (limited to 'tools/wasm_compile.h')
-rw-r--r--tools/wasm_compile.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/wasm_compile.h b/tools/wasm_compile.h
index 4cee1bb..c5ff49c 100644
--- a/tools/wasm_compile.h
+++ b/tools/wasm_compile.h
@@ -11,8 +11,8 @@
#define STACK_FRAME_BACKUP_ADDR 0x0FFFFC
#define STACK_TOP_ADDR 0x0FFFFC
#define CODE_BOTTOM_ADDR 0x000000
-#define CODE_TOP_ADDR 0x000200
-#define MEMORY_BOTTOM_ADDR 0x000200
+#define CODE_TOP_ADDR 0x000400
+#define MEMORY_BOTTOM_ADDR 0x000400
/* Error messages */
#define MSG_SIZE_OVERFLOW "Number overflows size_t\n"
@@ -70,6 +70,12 @@ struct module {
uint32_t exports_count;
struct export *exports;
struct target *targets;
+ struct instruction *startup;
+};
+
+struct translated_word {
+ uint16_t contents;
+ struct instruction *instr;
};
int leb_32(FILE *handle, uint32_t *result, bool with_sign);
@@ -94,7 +100,7 @@ struct module *parse_module(FILE *handle);
int translate(FILE *handle, struct function *function, struct module *module);
-int assemble(uint32_t memory_size, uint16_t memory[memory_size],
+int assemble(uint32_t memory_size, struct translated_word memory[memory_size],
struct module *module);
#endif /* WASM_COMPILE_H */