Brian Carroll
8a01c3f98a
Wasm: implement dead code elimination
2022-01-14 18:20:52 +00:00
Brian Carroll
dd79a9b35a
Clippy fixes
2022-01-13 05:41:52 +00:00
Brian Carroll
c8181c3a19
Wasm: use parsed data from object file in the backend
2022-01-13 05:41:52 +00:00
Brian Carroll
9f8f31b2b6
Wasm: adjust function indices for preloading
2022-01-13 05:41:52 +00:00
Brian Carroll
9f0e0d5099
Wasm: create a hashmap of exported functions
2022-01-13 05:41:52 +00:00
Brian Carroll
9c0abcd0da
Wasm: Preload WasmModule from object file bytes
2022-01-13 05:41:52 +00:00
Brian Carroll
fd79613f0d
Wasm: load platform object file in tests and pass the bytes to the backend
2022-01-13 05:41:52 +00:00
Brian Carroll
5a39002e8b
Wasm: Serialize WasmModule without linking info
2022-01-13 05:41:52 +00:00
Brian Carroll
738434329e
Wasm: refactor the model of the Linking section
2022-01-10 10:26:42 +00:00
Brian Carroll
6b932f9743
Clarify some lowlevel code to make it clearer what to do when adding new ones
2021-12-29 22:11:33 +00:00
Brian Carroll
e10acd59ee
Debug config for Wasm backend
2021-12-26 10:45:18 +00:00
Brian Carroll
efef2be958
Rename mono IR code gen helpers
2021-12-16 16:52:47 +00:00
Brian Carroll
71de2289ae
Rename helper proc generator struct
2021-12-16 16:52:47 +00:00
Brian Carroll
0547647341
Rename code gen helper file in mono
2021-12-16 16:52:47 +00:00
Brian Carroll
f54f96281f
Fix roc_alloc linking. Test passes for recursive Tag
2021-12-11 20:33:11 +00:00
Brian Carroll
3f7b3bef87
Merge branch 'trunk' of github.com:rtfeldman/roc into wasm-tags
2021-12-09 09:28:11 +00:00
Brian Carroll
1dda8859c4
Update gen_wasm's error handling to remove Result and use macros consistently
2021-12-09 00:11:44 +00:00
Brian Carroll
1ba654c5b2
Change round_up_to_alignment to a macro to work on more Rust types
2021-12-08 21:11:10 +00:00
Brian Carroll
ea64b6488c
Add some disabled debugging statements
2021-11-30 12:59:03 +00:00
Brian Carroll
a08633fd36
Debugging improvements
2021-11-30 10:58:03 +00:00
Brian Carroll
3581c7f5be
Use readable debug names throughout refcount proc generator
2021-11-30 09:57:00 +00:00
Brian Carroll
820d9e0ab4
Register debug names for new Symbols, and refactor to avoid borrow-checker issues
2021-11-30 09:57:00 +00:00
Brian Carroll
e7d8c7c895
Make gen_wasm's Env mutable
2021-11-30 09:57:00 +00:00
Brian Carroll
38e3386b80
Formatting & comments
2021-11-30 09:57:00 +00:00
Brian Carroll
ebc1fd6880
Get rid of special ModuleId for refcounting code
2021-11-30 09:57:00 +00:00
Brian Carroll
2ad032f894
Integrate refcount proc generator with Wasm backend
2021-11-30 09:57:00 +00:00
Brian Carroll
61575cea7e
Generate calls to refcount procs from Wasm backend
2021-11-30 09:57:00 +00:00
Brian Carroll
88bf6bf1b7
Clean up Wasm calling convention code
2021-11-29 00:17:45 +00:00
Brian Carroll
1134b6f45c
Fix test_wrapper linking bug
2021-11-17 16:45:38 +00:00
Brian Carroll
e9f920827e
Add support for Zig/LLVM "fast calling convention"
2021-11-15 19:20:55 +00:00
Brian Carroll
7c95189e4a
Get lots of Num lowlevel ops working
2021-11-10 14:21:32 +00:00
Brian Carroll
ec03b7b12a
Move lowlevel calls to their own module of gen_wasm
2021-11-10 10:44:17 +00:00
Brian Carroll
e2b95662a8
Fix wasm linking bugs
2021-11-09 21:22:12 +00:00
Brian Carroll
d0ffaabe83
Re-index all internal functions to make room for imported external functions
...
Linked external functions must be declared in the Import section,
and they must come first in the function index space.
In other words, internal function numbers start at the number of imports.
However we don't know in advance how many builtins the code may call,
and we don't want to add more passes over the full IR. Instead we re-index
function references at the end of code generation.
2021-11-09 14:50:53 +00:00
Brian Carroll
ce9658684a
Move wasmer dependency from gen_wasm to test_wasm
2021-11-07 22:56:28 +00:00
Brian Carroll
34b57cf315
Refactor after creating constant linking data
2021-11-07 11:23:20 +00:00
Brian Carroll
38d9fc5bbd
Add linker data for strings, and deduplicate them
...
For references to addresses of constant strings, we make an entry in
reloc.CODE and configure the relocation type to say it points at a
memory address. (At least I think this is right, I can't test it yet!)
The same info can also be used for de-duplication.
It turns out we don't need reloc.DATA. I had misunderstood it.
The use case for that would be constant nested data structures,
where constant data would contain pointers to other constant data.
I don't think we're doing this in Roc at all, but not sure.
2021-11-07 11:20:32 +00:00
Brian Carroll
414c9e6f86
Move WasmModule initialisation into WasmBackend
...
It helps to coordinate different sections with related values,
based on knowledge of Roc rather than Wasm.
2021-11-04 20:41:23 +00:00
Brian Carroll
c57d99c1ac
Create types for DataSection
2021-11-04 18:58:17 +00:00
Brian Carroll
ad9b761fce
Move wasm file format code into a submodule
2021-11-03 11:20:16 +00:00
Brian Carroll
87f6246851
Remove parity-wasm!
2021-11-03 10:36:08 +00:00
Brian Carroll
59757d638a
Migrate the last sections: Type and Function
2021-11-03 10:24:03 +00:00
Brian Carroll
b0aeafc066
Refactor code section to get rid of a copy
2021-11-02 20:34:57 +00:00
Brian Carroll
d8c1017aec
refactor stack pointer initialisation
2021-11-02 14:00:22 +00:00
Brian Carroll
baf896f6f9
Migrate linking and relocation sections
2021-11-02 13:56:47 +00:00
Brian Carroll
e720873c05
Migrate to own Global and Memory sections
2021-11-02 13:32:54 +00:00
Brian Carroll
edadd4ce13
Temporary setup to gradually migrate sections from parity_wasm to our own module_builder
...
Previously we just had our own code section.
Now we also have export section, and a way of switching them over one by one,
running tests in between.
2021-11-02 12:46:15 +00:00
Brian Carroll
6ab00d164c
Create WasmModule struct
2021-11-01 00:06:25 +00:00
Brian Carroll
63f65947bc
Remove excessive calls to LayoutIds::default()
2021-11-01 00:02:28 +00:00
Brian Carroll
b0e0c14dd8
clippy
2021-10-30 17:52:38 +01:00