Commit graph

467 commits

Author SHA1 Message Date
Brian Carroll
4aaa6d92a1 For now, commit a binary archive of Wasm libc 2021-11-17 12:52:48 +00:00
Brian Carroll
af896e5d33 Comments 2021-11-17 09:39:16 +00:00
Michael Downey
51ad326d11 fmt 2021-11-16 17:30:04 -05:00
Michael Downey
d946b84e63 adding initial List.all 2021-11-16 16:34:36 -05:00
Brian Carroll
b8f40011b9 Generate a test "platform" with libc allocator functions 2021-11-16 11:59:46 +00:00
Brian Carroll
e9f920827e Add support for Zig/LLVM "fast calling convention" 2021-11-15 19:20:55 +00:00
Brian Carroll
8ad2f13ba9 Map some Str lowlevels to builtin calls 2021-11-15 19:17:27 +00:00
Folkert de Vries
1a3f2aed4f
Merge branch 'trunk' into refactor-builtin-list-drop 2021-11-15 19:51:17 +01:00
Brian Carroll
7ac1c7a72f Get long string literals working in gen_wasm 2021-11-15 15:22:07 +00:00
Brian Carroll
a5c3809290 Delete DataCountSection. Not well-supported and only needed for instructions we don't use
https://webassembly.github.io/spec/core/binary/modules.html#binary-datacountsec

Tools like wasm2wat and wasm-validate reject the module when this section is included!
Its purpose is to enable single-pass validation for two specific instructions that were
not in the original Wasm MVP: memory.init and data.drop.
We don't use them in our Roc backend. It seems to make sense just to drop the section.
2021-11-15 12:59:28 +00:00
Brian Carroll
46636ef331 Ensure lowlevel inlining does not skip bounds checks 2021-11-15 12:56:34 +00:00
satotake
c253273490 Merge branch 'trunk' into refactor-builtin-list-drop 2021-11-15 11:37:32 +00:00
satotake
8e29daa160 remove low-level List.drop codes 2021-11-15 11:28:38 +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
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
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
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