Commit Graph

428 Commits

Author SHA1 Message Date
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
fa46ab95fc Wasm: rename some constants 2022-01-13 05:41:52 +00:00
Brian Carroll
f9fbe461d1 Wasm: Fix section parsing bug 2022-01-13 05:41:52 +00:00
Brian Carroll
3067358a33 Wasm: test for LEB-128 decoder 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
d3554b2ac0 Wasm: Create Section trait for common functionality between module sections 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
5d5e0eca96 Wasm: Convert remaining sections to store bytes, and add .size() methods 2022-01-13 05:41:52 +00:00
Brian Carroll
f4ac5bffa3 Wasm: replace builtins imports with a hashmap 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
b8ab6af203 Wasm: move WasmModule definition to mod.rs 2022-01-13 05:41:52 +00:00
Brian Carroll
d88b86e884 Wasm: change TypeSection tests to unit tests rather than integration tests 2022-01-13 05:41:52 +00:00
Brian Carroll
8e7f398e50 Wasm: Remove code to adjust function indices based on imports
With pre-linking we don't need this anymore. Pure Roc code can't add Imports.
2022-01-13 05:41:52 +00:00
Richard Feldman
d0e3c45986
Merge pull request #2328 from rtfeldman/wasm-module-refactor
Wasm module refactor
2022-01-12 11:28:12 -05:00
ayazhafiz
2c41c43aea Implement saturated add/subtract 2022-01-10 22:37:08 -05:00
Brian Carroll
c5653951a4 Wasm: improve the TypeSection preload test 2022-01-10 10:26:43 +00:00
Brian Carroll
8f73b722ff Wasm: fix release build 2022-01-10 10:26:43 +00:00
Brian Carroll
fc677e8d58 Wasm: add preloading logic for Types section 2022-01-10 10:26:43 +00:00
Brian Carroll
59278a02d6 Wasm: Create a LinkingSegment to keep string data aligned correctly 2022-01-10 10:26:43 +00:00
Brian Carroll
c89f74f7e8 Wasm: clippy fixes 2022-01-10 10:26:43 +00:00
Brian Carroll
a1f737d6d8 Wasm: Create OpaqueSection for sections that may be used in builtins but not by us 2022-01-10 10:26:43 +00:00
Brian Carroll
738434329e Wasm: refactor the model of the Linking section 2022-01-10 10:26:42 +00:00
Brian Carroll
6db7dbed1c Wasm: Store DataSection as bytes and segment count 2022-01-10 10:26:42 +00:00
Brian Carroll
265171ad17 Wasm: Make sure string constants are placed at a properly aligned offset 2022-01-10 10:26:42 +00:00
Brian Carroll
b8f51fb1bb Wasm: add preloaded_bytes and preloaded_count to Code section 2022-01-10 10:26:42 +00:00
Brian Carroll
743e14148c Wasm: Store Function section as bytes and a count 2022-01-10 10:26:42 +00:00
Brian Carroll
7a6c6b675c Wasm: Store type signatures in serialized form 2022-01-10 10:26:42 +00:00
rvcas
d2f95bde63 chore(StrToNum): layout is always a Struct, we don't need the Union case 2022-01-03 18:15:46 -05:00
Brian Carroll
aec8d1bf3d Merge branch 'trunk' of github.com:rtfeldman/roc into str_to_num 2022-01-02 12:31:59 +00:00
Brian Carroll
f767014f30
Merge pull request #2301 from rtfeldman/wasm-refcount-list
Wasm refcounting for lists
2021-12-31 13:25:38 +00:00
Brian Carroll
83d6c82e0b Wasm: avoid two memory loads for ListLen, at the cost of +1 instruction byte 2021-12-30 15:40:55 +00:00
Brian Carroll
0912f8fd45 Wasm: replace a local.set/get pair with a local.tee 2021-12-30 15:40:00 +00:00
Brian Carroll
acade33497 Wasm bugfix: allocate using the heap alignment, not the stack alignment 2021-12-30 15:37:09 +00:00
rvcas
e7825127d6 Merge branch 'trunk' into str_to_num 2021-12-29 18:17:33 -05: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
f90d9a74bd Do not inline builtin wrapper for Str.toNum 2021-12-29 21:08:16 +00:00
rvcas
0d187fb53c feat(wasm): use mono layout to figure out the correct intrinsic 2021-12-28 21:38:43 -05:00
rvcas
cd42f034b5 feat(wasm): start StrToNum 2021-12-27 19:08:21 -05:00
Folkert de Vries
249878cbd9
Merge pull request #2281 from rtfeldman/i/2149
(llvm) Generate code for tag unions less than 64 bits in size correctly
2021-12-27 22:38:08 +01:00
Brian Carroll
0d8a2c8a49 Use tail call elimination where possible in == for tag unions 2021-12-27 18:08:43 +00:00
ayazhafiz
4631ff96f5 Initialize stack pointer when it doesn't exist
I'm not sure this is right, but we have to do it somewhere.. and here
seems reasonable?
2021-12-26 17:46:06 -06:00
ayazhafiz
326bfe9aa3 Ensure WASM code gen uses proper tag ID alignment
We should use the alignment of the tag ID layout, not the alignment of
the rest of the data in the tag union. The reason is that the tag ID may
be smaller than the data.
2021-12-26 17:45:05 -06:00
Brian Carroll
e10acd59ee Debug config for Wasm backend 2021-12-26 10:45:18 +00:00
Brian Carroll
1f86ad3438 Fix Wasm function indices for generated helpers 2021-12-26 10:40:45 +00:00
Brian Carroll
da4cf721cc Fix equality on empty structures 2021-12-26 10:40:45 +00:00
Brian Carroll
ca501fdcf1 Restructure CodeGenHelp to generate IR immediately, in depth-first traversal 2021-12-26 10:40:45 +00:00
Brian Carroll
471e2c3143 Completely delete Wasm BlockType 2021-12-21 23:14:55 +00:00
Brian Carroll
1c20075d7b Change usage of Wasm if instruction now that we don't support block results anymore 2021-12-21 23:14:55 +00:00
Folkert de Vries
2f1c648602
Merge pull request #2253 from rtfeldman/wasm-no-block-results
Wasm: fix nested conditionals
2021-12-21 16:35:22 +01:00