Commit graph

5620 commits

Author SHA1 Message Date
Folkert
15a2ac7410 update more List.walk uses 2021-10-10 12:35:52 +02:00
Folkert
ebcee4021c flip list.walk passed function arguments 2021-10-10 12:35:03 +02:00
Brian Carroll
14f7f0f3b4 Improved test setup for size comparison 2021-10-10 10:42:02 +01:00
Brian Carroll
47f93bddea Fix & refactor create_storage 2021-10-10 10:36:23 +01:00
Brian Carroll
32b9f4fb07 Generate a .wasm file for every test, for size benchmarking 2021-10-09 18:47:37 +01:00
Brian Carroll
d166f65a31 Fix bug: Forgot to generate a local for the stack frame pointer 2021-10-09 18:16:24 +01:00
Brian Carroll
476c1664ec Add debug logging to CodeBuilder and fix a minor bug 2021-10-09 17:24:37 +01:00
Brian Carroll
3aaafdefe1 Get Join/Jump working with VM storage 2021-10-09 16:46:59 +01:00
Anton-4
03d9d41a7a debugging closure -> MarkupNode 2021-10-08 20:19:52 +02:00
Brian Carroll
d81999045a Get Switch statements working with VM storage 2021-10-07 09:14:35 +01:00
Folkert
94e8c62613 make things compile, base64 has a memory leak 2021-10-06 22:57:11 +02:00
Brian Carroll
af823fe5a8 Get rid of unneeded local.set/get in common cases 2021-10-06 20:07:20 +01:00
Richard Feldman
c6a8bdfdbe Swap closure indices in alias analysis 2021-10-06 08:59:38 -04:00
Richard Feldman
90401477c9 Fix List.walkUntil arg order 2021-10-06 07:32:56 -04:00
Richard Feldman
54a1a33ddf Improve unreachable error message 2021-10-05 21:19:08 -04:00
Richard Feldman
8391c337ab Merge remote-tracking branch 'origin/trunk' into list-walk-flip 2021-10-05 20:50:50 -04:00
Brian Carroll
d6bba482ee Treat the Virtual Machine stack as a form of SymbolStorage
Simulate the behaviour of the stack machine, mark where Symbol values
are created, and track where they are in the stack as we emit instructions.

This will allow us to be smarter with setting and getting locals.
However that's not actually implemented yet! At the moment,
we're still generating the same code as before but in a fancier way.

What's happening:

Let's say we have a function call that takes two arguments [A,B]
and that we are lucky and just happen to have a VM stack of [A,B]
That's great, we _should_ not have to do anything, just emit 'Call'

BUT what we are doing is "load A to the top" and then "load B to the top".
This sounds good but it's actually stupid
We are saying we want A at the top of the stack when we don't!!
We want it right where it is, just beneath the top!

So we are emitting code to bring it from 2nd position to the top.
How do we do that? By inserting a local.set instruction to save it,
and a local.get instruction to load it to the top!

What should be happening:

Check the entire VM stack at once for all the symbols we are trying to load.
If they happen to be there (which is likely given the IR structure) do nothing.
If it's not quite perfect... then emit lots of local.set and local.get. Whatever.

What would be the way to solve this properly?

Build the Wasm instructions as a tree, then serialise it depth-first.
The tree encodes all of the information about what needs to be on the
stack at what point in the program. If a tree node has two children,
it consumes two items from the stack. If you do it this way, all
of the instructions get executed just at the right time.
2021-10-05 21:39:19 +01:00
Brian Carroll
d796bbcc68 add a couple of assertions 2021-10-05 21:19:08 +01:00
Anton-4
ab665b7380 Merge branch 'trunk' of github.com:rtfeldman/roc into docs_markup 2021-10-05 11:58:45 +02:00
Anton-4
4324b08a30 cleanup+fmt+clippy 2021-10-05 11:58:11 +02:00
Richard Feldman
894e295b85
Merge pull request #1764 from rtfeldman/list
Some List docs changes
2021-10-04 18:08:32 -05:00
Anton-4
548d806a88 def->MarkupNode working 2021-10-04 19:26:31 +02:00
Folkert de Vries
fa4875da83
Merge pull request #1761 from rtfeldman/giesch
Add List.dropAt
2021-10-04 15:01:17 +02:00
Richard Feldman
cfe7d5afbb Document List.map2 and List.map3 2021-10-04 08:42:52 -04:00
Richard Feldman
e6ec1ded22 Add mapJoin and mapOrDrop to List 2021-10-04 08:26:23 -04:00
Richard Feldman
696a8273ee
Merge pull request #1742 from rtfeldman/test-linker
Test linker
2021-10-03 23:26:15 -04:00
Richard Feldman
c7e20e0ccc
Merge pull request #1741 from rtfeldman/nested-rigid-introduced-twice
only introduce rigid once!
2021-10-03 22:23:39 -04:00
Brian Carroll
d9c595a6c2
Merge pull request #1757 from rtfeldman/wasm_shared_stack_pointer
Wasm shared stack pointer
2021-10-03 22:57:12 +01:00
Folkert de Vries
3d82369bcd
Merge branch 'trunk' into nested-rigid-introduced-twice 2021-10-03 23:55:23 +02:00
Brian Carroll
32f79b5ee2 Create CodeBuilder to track Wasm VM stack as we accumulate instructions 2021-10-03 22:50:11 +01:00
Brian Carroll
cc6f83f284 Clearer variant names for StackMemoryLocation 2021-10-03 21:53:18 +01:00
Brian Carroll
2756425eb9 Assert storage matches when copying 2021-10-03 21:52:27 +01:00
Richard Feldman
47c52b0220
Merge pull request #1737 from rtfeldman/fix-repl-sum-crash
repl cannot handle some functions
2021-10-03 15:52:26 -05:00
Richard Feldman
1054095e1a
Merge pull request #1744 from rtfeldman/call-with-closure
Call with closure
2021-10-03 15:49:34 -05:00
Richard Feldman
e3a8d436cf
Merge pull request #1607 from rtfeldman/editor-let-value
file loading/saving/running, headers, top level defs
2021-10-03 15:45:08 -05:00
Dan Knutson
b83336d3c3 remove outdated uniqueness doc 2021-10-03 14:39:35 -05:00
Dan Knutson
25215cb3e3 cleanup mutable case, split test 2021-10-03 14:09:07 -05:00
Dan Knutson
2a72439117 WIP adding unique mutable case 2021-10-03 13:55:11 -05:00
Dan Knutson
d1ee9c90b2 fix copy/paste error in test 2021-10-03 13:55:11 -05:00
Dan Knutson
65821d6a9f remove giesch/todo tags, add List.drop doc 2021-10-03 13:55:11 -05:00
Dan Knutson
700ab20a8c add tests for List.dropAt 2021-10-03 13:55:11 -05:00
Dan Knutson
3baff93a97 add first version of List.dropAt
* adds an implementation with no uniqueness/mutability
2021-10-03 13:55:11 -05:00
Folkert
f8ac85195b fix zig test 2021-10-03 14:18:48 +02:00
Folkert
0690633116 spec for List.reverse 2021-10-03 13:34:09 +02:00
Folkert
13d480d5f3 spec for list append 2021-10-03 13:27:47 +02:00
Folkert
486f1d540f add specifications for fromUtf8 and toUtf8 2021-10-03 13:22:03 +02:00
Folkert
018348bd83 make Str.fromUtf8 in-place 2021-10-03 12:13:17 +02:00
Folkert
9e97a09a87 check if exposed function is defined already 2021-10-03 00:57:54 +02:00
Folkert
dbb8acbe67 add in-place List.swap 2021-10-03 00:25:35 +02:00
Folkert
3d7b42deba better error message for when morphic did not specialize 2021-10-03 00:17:15 +02:00