Commit graph

238 commits

Author SHA1 Message Date
Brian Carroll
c2a2ff2957 Create Expr::to_pretty in mono IR 2021-11-30 09:57:26 +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
f4d52f7084 Add alignment argument to Zig decref call 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
rvcas
27e77f446f feat(wasm): implement EmptyArray 2021-11-29 15:08:52 -05:00
Brian Carroll
1f747e971f Clippy & fmt 2021-11-29 01:09:31 +00:00
Brian Carroll
88bf6bf1b7 Clean up Wasm calling convention code 2021-11-29 00:17:45 +00:00
Brian Carroll
27af5897d1 Handle zero-size structs 2021-11-28 21:04:40 +00:00
Brian Carroll
44cf238a67
Merge pull request #2056 from rtfeldman/wasm-dec-add
Wasm dec add
2021-11-23 13:37:04 +00:00
Brian Carroll
8c3c01cd1f Reduce recursion for sequences of Let statements in gen_wasm 2021-11-23 09:22:41 +00:00
Folkert
f2f4f3bd72 Merge remote-tracking branch 'origin/trunk' into wasm-dec-add 2021-11-22 21:25:01 +01:00
Folkert
78c26c6096 fix returning an aggregate value with ccc 2021-11-22 10:17:17 +01:00
Folkert
f96d60a13e Merge remote-tracking branch 'origin/trunk' into layout-builtin-numbers-refactor 2021-11-21 23:19:55 +01:00
Folkert
bceebc4f8f first pass at decimal addition in the wasm backend 2021-11-21 23:00:12 +01:00
Brian Carroll
0a5b0bdb0a Merge branch 'trunk' of github.com:rtfeldman/roc into wasm-load-128bit-numbers 2021-11-21 20:53:38 +00:00
Brian Carroll
2e31350010 Logic to load 128-bit numbers 2021-11-21 20:44:16 +00:00
Folkert
fc635abe0b Revert "decimal add experiment"
This reverts commit bfd5ca623c.
2021-11-21 20:29:12 +01:00
Folkert
bfd5ca623c decimal add experiment 2021-11-21 20:02:33 +01:00
Folkert
5529841d68 Merge remote-tracking branch 'origin/trunk' into decimal-literals 2021-11-21 19:31:38 +01:00
Folkert
c4ec9aa898 working mono 2021-11-20 23:25:30 +01:00
Brian Carroll
3d124b4122 Fix builtin calls for primitives 2021-11-17 16:51:42 +00:00
Brian Carroll
03c19b727a String concatenation working in gen_wasm! 2021-11-17 13:38:50 +00:00
Brian Carroll
af896e5d33 Comments 2021-11-17 09:39:16 +00:00
Brian Carroll
e9f920827e Add support for Zig/LLVM "fast calling convention" 2021-11-15 19:20:55 +00:00
Brian Carroll
7ac1c7a72f Get long string literals working in gen_wasm 2021-11-15 15:22:07 +00:00
Brian Carroll
46636ef331 Ensure lowlevel inlining does not skip bounds checks 2021-11-15 12:56:34 +00:00
Brian Carroll
1c17797aa6 Fix de-duplication of builtin imports 2021-11-15 09:01:36 +00:00
Brian Carroll
79bd9ccf71 Symbol-to-lowlevel mapping for both dev backends 2021-11-15 00:27:04 +00:00
Brian Carroll
b9e97400d7 Inline lowlevel wrapper functions 2021-11-14 21:08:05 +00:00
Brian Carroll
29d355c4d6 Implement Expr::StructAtIndex for wasm dev backend 2021-11-14 19:06:04 +00:00
Folkert
57538c5e94 store and load decimal numbers 2021-11-12 21:38:22 +01:00
Brian Carroll
33109006c2 Fix bugs in Ret statement 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
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
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
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
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
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
09f2ce327c Change some comments after self-review 2021-11-04 21:19:23 +00:00