Commit graph

205 commits

Author SHA1 Message Date
Brian Carroll
f5f34b74c0 Write serializers for much of the linking and relocation sections 2021-10-29 16:04:27 +01:00
Brian Carroll
2020e89db7 Create reserve_padded_u32, nice for readability 2021-10-28 22:44:33 +01:00
Brian Carroll
7841ef959a Serialize padded signed integers and refactor serialize module 2021-10-28 20:45:04 +01:00
Brian Carroll
3c9375af28 Start creating module_builder 2021-10-28 13:18:14 +01:00
Brian Carroll
82acf55d38 Create serializer module 2021-10-28 11:50:55 +01:00
Brian Carroll
eb47b5183c Slightly refactor code section swapping 2021-10-27 19:41:52 +01:00
Brian Carroll
f066adbe05 Adjust relocation offset to account for inserts, preamble, function offset, etc. 2021-10-27 16:50:30 +01:00
Brian Carroll
1def56ea04 Build up a vector of relocations 2021-10-26 23:31:36 +01:00
Brian Carroll
fd3d8f5227 Get rid of procedure sorting 2021-10-26 22:44:28 +01:00
Brian Carroll
a0d2b7e6e1 Unit tests for LEB-128 encoders 2021-10-26 18:08:40 +01:00
Brian Carroll
d996eee72e Pointlessly improve how we handle a crazy edge case, because my brain wouldn't let it go 2021-10-25 13:26:50 +02:00
Brian Carroll
4e098be7fe Fix a test throwing a Wasm runtime error 2021-10-25 13:04:30 +02:00
Brian Carroll
3f404dd114 clippy 2021-10-25 12:23:24 +02:00
Brian Carroll
ddf66293e9 Fix and refactor number encodings 2021-10-25 12:15:04 +02:00
Brian Carroll
b6e442c9ee Fix locals code gen 2021-10-24 23:36:00 +02:00
Brian Carroll
11f327f722 Fix function call 2021-10-24 23:35:25 +02:00
Brian Carroll
c46e73bd64 Fix test code gen 2021-10-24 23:34:14 +02:00
Brian Carroll
6534da5055 Fix LEB encoding and refactor insertions 2021-10-24 11:54:21 +02:00
Brian Carroll
13577aa9ec Combine our handmade Code section with other sections from parity_wasm (tests compile but fail) 2021-10-23 17:12:49 +02:00
Brian Carroll
7c398ba238 tweak comment 2021-10-23 13:52:45 +02:00
Brian Carroll
973626fe2d Rename FunctionBuilder back to CodeBuilder 2021-10-23 13:48:20 +02:00
Brian Carroll
dbe6d195f7 Delete CodeBuilder 2021-10-23 13:40:10 +02:00
Brian Carroll
74e3239a1c Switch over to function_builder 2021-10-23 13:39:54 +02:00
Brian Carroll
bca9f31c58 Implement insertions for byte-level code gen 2021-10-23 00:02:14 +02:00
Brian Carroll
dc1779d41d Finalisation and serialisation for byte-level function builder 2021-10-22 19:02:03 +02:00
Brian Carroll
0586f91b04 Reorder arguments of instruction methods
Having the opcode first makes it easier to see if it matches the method name
2021-10-22 13:17:18 +02:00
Brian Carroll
fbceafa8dc Get all instructon methods compiling 2021-10-22 12:59:19 +02:00
Brian Carroll
4f958e8a80 Get most common instruction patterns to compile 2021-10-22 12:01:22 +02:00
Brian Carroll
4563e2af49 Get function_builder compiling 2021-10-22 10:38:53 +02:00
Brian Carroll
dc80623d45 Sketch out methods for byte-level instructions. No macros yet. 2021-10-21 23:21:56 +02:00
Brian Carroll
e168d175c4 Start writing a byte-level function_builder 2021-10-21 21:30:51 +02:00
Brian Carroll
5ea313f256 update gen_wasm to use bumpalo::collections::Vec where possible 2021-10-21 21:14:15 +02:00
Brian Carroll
1be6fd1222 Switch to fork of parity-wasm that can support bumpalo vectors 2021-10-21 17:14:07 +02:00
Brian Carroll
401f2ececd rename some methods 2021-10-18 21:35:16 +02:00
Brian Carroll
e4db06cbdd Add a debug assertion in code builder 2021-10-18 21:16:54 +02:00
Brian Carroll
64603a480c Get rid of Option in VM stack model 2021-10-18 21:03:54 +02:00
Brian Carroll
b86849347a Write test debug output to a path in /tmp 2021-10-18 20:42:13 +02:00
Brian Carroll
f242aade86 Rename a variable & fix a bug calling functions that return via stack memory 2021-10-18 18:35:48 +02:00
Brian Carroll
1b97675f1f Refactor the optimisation for immediately-returned Let statements
The original intention was to avoid creating a local when we define
and immediately return a primitive value. But now our default path
does avoids unnecessary locals anyway!

For StackMemory values we do need an optimised path but it's nicer
to just pass a flag to Storage::allocate.
2021-10-18 13:18:10 +02:00
Brian Carroll
2daefc8b32 Name a constant 2021-10-18 13:11:05 +02:00
Brian Carroll
99468b0aac Clarify a comment 2021-10-17 11:24:25 +02:00
Brian Carroll
6206418b67 Fix clippy warnings 2021-10-14 00:13:47 +02:00
Brian Carroll
e6245c41f5 README updates 2021-10-14 00:04:17 +02:00
Brian Carroll
5c42455ca7 Rename some values & improve comments 2021-10-13 10:52:51 +02:00
Brian Carroll
472943a068 Refactoring: extract Storage out of WasmBackend 2021-10-12 10:22:38 +01:00
Brian Carroll
d2e01bd10a rename SymbolStorage -> StoredValue 2021-10-12 10:20:17 +01:00
Brian Carroll
85ca33ddd6 tweak test script 2021-10-11 08:20:33 +01:00
Brian Carroll
f6685349b3 Batch local declarations to save a few bytes and make some code a little nicer 2021-10-10 22:21:13 +01:00
Brian Carroll
58549bdf07 CodeBuilder doc comments 2021-10-10 20:56:49 +01:00
Brian Carroll
041e26e807 rename CodeBuilder methods 2021-10-10 20:56:39 +01:00