Commit graph

250 commits

Author SHA1 Message Date
Brian Carroll
29d355c4d6 Implement Expr::StructAtIndex for wasm dev backend 2021-11-14 19:06:04 +00:00
Brian Carroll
d34f5050cb formatting 2021-11-14 13:35:25 +00:00
Brian Carroll
21a53ea044 Merge branch 'trunk' of github.com:rtfeldman/roc into wasm-control-stack 2021-11-14 13:22:02 +00:00
Brian Carroll
f121d6f599 Fix formatting 2021-11-14 13:21:56 +00:00
Brian Carroll
a2abf9c3d2 More accurate model of the Wasm VM's stack machine, with control flow blocks 2021-11-14 12:29:54 +00:00
Brian Carroll
39263b0ab1 Shorter name: VmSymbolState 2021-11-14 10:57:19 +00:00
Theo Felippe
277681fd06 fixed formatting 2021-11-13 18:12:14 +00:00
Theo Felippe
8d7c252fce implemented Str.trimRight 2021-11-13 18:02:58 +00:00
satotake
9ec2bc7946 Remove takeFirst and takeLast from backend 2021-11-13 06:03:18 +00:00
satotake
98d2c57edf move List.sublist to backend 2021-11-13 04:57:28 +00:00
Brian Carroll
33109006c2 Fix bugs in Ret statement 2021-11-12 17:51:50 +00:00
Brian Carroll
daf6771bf5 Shorten the name of the Symbol for temporary Wasm values 2021-11-12 17:51:50 +00:00
Brian Carroll
4b3538dc58 Simplify CodeBuilder::call 2021-11-12 17:51:50 +00:00
Brian Carroll
3a751aa3e8 Cheap optimisation for boolean conditions in Switch statements 2021-11-12 17:51:50 +00:00
Brian Carroll
78a7e45b8f Fix a type error in Switch statement condition 2021-11-12 17:51:45 +00:00
Brian Carroll
7f633c107f Fix a bug in our model of the Wasm VM stack 2021-11-12 17:44:31 +00:00
Brian Carroll
830003c9a3 Change wasm opcodes to an enum 2021-11-10 20:18:55 +00:00
Brian Carroll
86de39e7f8 Add missing lowlevel from match 2021-11-10 20:11:27 +00:00
Brian Carroll
06a6e8545b FIXME for wasm NumRound 2021-11-10 15:32:45 +00:00
Brian Carroll
7c95189e4a Get lots of Num lowlevel ops working 2021-11-10 14:21:32 +00:00
Brian Carroll
6421ff07a5 Use shorter notation for enums in lowlevel module 2021-11-10 10:47:01 +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
51b6076322 stack pointer: use constants & add a comment 2021-11-10 09:20:31 +00:00
Brian Carroll
e2b95662a8 Fix wasm linking bugs 2021-11-09 21:22:12 +00:00
Folkert
a9ce02799c WIP 2021-11-09 21:37:56 +01:00
Brian Carroll
4948cee360 Fix clippy warnings 2021-11-09 15:49:08 +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
9e6147a9de Add Debug implementations for sections 2021-11-09 14:28:15 +00:00
Brian Carroll
a61987e032 Rename CodeBuilder::finalize -> CodeBuilder::build_fn_header
We actually have a few more steps to go after this one!
2021-11-09 14:28:15 +00:00
Brian Carroll
c7baaceae9 Fix dependencies 2021-11-09 14:28:15 +00:00
Brian Carroll
1b5740cd5d Tidy up lowlevel calls and implement a few more 2021-11-09 14:28:15 +00:00
Brian Carroll
5bfc0093ec Intitialise CodeSection with just the right capacity 2021-11-08 14:59:49 +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
7dd5197953
Merge branch 'trunk' into wasm_serialization_refactor 2021-11-07 09:58:57 +00:00
Brendan Hansknecht
74a55f53f3 Switch back to cranelift due to versioning and aarch64 issues 2021-11-06 14:24:58 -07:00
Brendan Hansknecht
40f0271ccf Fix M1 mac build
I changed wasmer to use the llvm backend because it compiles the fastest and supports aarch64.
If we later run into llvm versioning issues of some sort, we should switch this to cranelift.
Also re-adds serde-json which is used on macos.
2021-11-06 14:08:19 -07:00
Brendan Hansknecht
73e2cbcb1e Make versions numbers consistent and matching the lock files 2021-11-06 13:24:45 -07:00
Anton-4
69f6ffadab
Merge branch 'trunk' into deps 2021-11-06 18:07:34 +01:00
Kevin Sjöberg
f6d055dc62 Correct minor spelling mistakes 2021-11-06 15:29:08 +01:00
Brendan Hansknecht
c595668b37 Remove dependency on cranelift 2021-11-05 19:59:42 -07:00
Brendan Hansknecht
bddc08c977 Remove unused dependencies 2021-11-05 16:58:11 -07:00
Brian Carroll
5f998f3707 Minor refactor in CodeBuilder 2021-11-05 12:26:05 +00:00
Brian Carroll
e5a0738681 Rename CodeSection serializer, since it doesn't actually mutate 2021-11-05 12:25:27 +00:00
Brian Carroll
01b47a2ec7 Add inline directives to ensure unit placeholders are optimised away 2021-11-05 12:11:37 +00:00
Brian Carroll
d220ed7a23 Refactor module section serialization 2021-11-05 12:11:33 +00:00
Brian Carroll
4dcb65cc46 Fix data count section for the case where data section is empty 2021-11-05 08:36:18 +00:00
Brian Carroll
c5d99433f7 Fix build error
And slightly improve efficiency by exiting early from an iteration
2021-11-04 23:21:48 +00:00
Brian Carroll
09f2ce327c Change some comments after self-review 2021-11-04 21:19:23 +00:00