Commit graph

10698 commits

Author SHA1 Message Date
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
Folkert
fa57ff88a5 disable list of constants in read-only section 2021-10-03 00:16:52 +02:00
Folkert
7e6a3431e2 trick morphic into updating a value that comes from the host 2021-10-03 00:07:38 +02:00
Folkert
5a8547f2d4 trick morphic into specializing closure callers 2021-10-03 00:05:17 +02:00
Brian Carroll
79a4f2bbf7 Refactor SymbolStorage local_id code, and copy_memory
SymbolStorage had some rather ad-hoc methods for extracting pieces of data.
This change makes that more intentional and organised.

Also cleaned up the API for the related function copy_memory,
as it had lots of positional arguments with the same types.
Created a struct for this just to name them and make the code clearer.
2021-10-02 22:31:48 +01:00
Folkert
2fe431f1b8 update morphic (can solve quicksort now) 2021-10-02 22:45:31 +02:00
Anton-4
c6066cc629 expr working, debugging def 2021-10-02 19:47:46 +02:00
Brendan Hansknecht
88069b679a Fix withOpen 2021-10-02 10:40:16 -07:00
Brendan Hansknecht
f412ffd2d0 Remove '*'s and make error union nice 2021-10-02 10:22:32 -07:00
Brian Carroll
6aed70978d Refactor SymbolStorage into two enums instead of one 2021-10-02 16:15:06 +01:00
Richard Feldman
7d6aca5a4e
Merge pull request #1754 from rtfeldman/www
Add 'a taste of roc' link to www
2021-10-02 09:40:19 -05:00
Brian Carroll
ffa6ff0a62 gen_wasm: Get rid of individual locals for values in stack memory
All values in stack memory can share the stack frame pointer,
with different offsets.

This avoids having to generate initialisation code for individual
pointers we used to have. It should also make things more efficient
when the runtime compiles Wasm to machine code. It can just assign
the stack frame pointer to a single CPU register and leave it there.

The original idea was to make params and local variables work the same.
(A struct param will be passed as a pointer to caller stack memory.)
But now I don't think that's worth it. Some match expressions get more
awkward this way but we might be able to refactor that to be nicer.
2021-10-02 15:12:25 +01:00
Folkert de Vries
a13ca2cb24
Merge pull request #1756 from rtfeldman/wasm_results_vs_panics
More useful stack traces for gen_wasm bugs
2021-10-02 15:37:37 +02:00
Brian Carroll
4aa2452e01 gen_wasm: Change some compiler bugs error handling from Result to panic
Result makes sense where I have something meaningful to say to the user like
"X is not implemented yet". And also for public functions that may interface
with other parts of the project like Backend.

But for private functions internal to gen_wasm, it's just unhelpful to get a stack trace
to where the Result is unwrapped! I want a stack trace to the root cause.
I always end up temporarily rewriting Err("oops") to panic!("oops") and then waiting
for it to recompile.

This feels like a more balanced approach, using each technique where it makes sense.
2021-10-02 13:40:44 +01:00
Folkert
f1ec5c30d0 make things compile 2021-10-01 20:33:34 +02:00
Richard Feldman
08a3f0fb9a Add 'a taste of roc' link to www 2021-10-01 13:06:35 -05:00
Anton-4
bc50280c0e markup to html progress 2021-10-01 19:53:51 +02:00
Anton-4
f63c276a5f docs flow working with mocked markup to html 2021-10-01 18:22:27 +02:00
Brendan Hansknecht
00c5d4d0b0 Merge branch 'trunk' into false 2021-09-30 22:08:35 -07:00
Brendan Hansknecht
e7cba9fb88 Switch to custom cksum script from old crc32. use constants to make it faster 2021-09-30 22:08:14 -07:00
Folkert de Vries
a42620ecb5
Merge pull request #1752 from rtfeldman/wasm_stack_memory
Wasm stack memory
2021-09-30 23:53:38 +02:00
Brian Carroll
304e9c904f Formatting 2021-09-30 17:28:02 +01:00
Brian Carroll
92085a0fcb README notes on reducing gets and sets 2021-09-30 17:27:56 +01:00
Brian Carroll
7ac7e16f60 Ensure stack frame is always popped when procedure returns from inside a branch 2021-09-30 17:04:16 +01:00
Brian Carroll
79ac2f04b8 Improve stack allocation code 2021-09-30 17:04:16 +01:00
Brian Carroll
f1b14c14e3 Refactor SymbolStorage to emphasise stack/non-stack params
We don't have much (any) code that cares about the difference between
heap pointers and other primitives, but we have a _lot_ of code that cares
if it's stack memory. So let's encode it that way.
2021-09-30 17:04:16 +01:00
Folkert de Vries
c4c7ecf1bc
Merge pull request #1751 from rtfeldman/str-repeat
Add Str.repeat builtin
2021-09-30 12:47:49 +02:00
Brendan Hansknecht
157a04d1ac Fix bug and comment more on the pains of recursion 2021-09-29 21:05:36 -07:00
Kofi Gumbs
2f574ea75e Remove extraneous .into() 2021-09-29 22:41:30 -04:00
Brendan Hansknecht
414f3a0438 Add info about stack overflows 2021-09-29 18:59:49 -07:00
Kofi Gumbs
b2343cb0ad Format zig 2021-09-29 21:54:14 -04:00
Kofi Gumbs
0cdafa1623 Add Str.repeat test for big strings 2021-09-29 21:54:06 -04:00
Brendan Hansknecht
0cd288f623 Add false lang interpreter example 2021-09-29 16:01:54 -07:00
Kofi Gumbs
b32a42f05a Add Str.repeat builtin 2021-09-29 17:32:42 -04:00
Brian Carroll
1fe20b0422
Merge pull request #1748 from rtfeldman/wasm_stack_memory
Wasm stack memory
2021-09-29 19:05:46 +01:00
Anton-4
28cf11a1d9 started on docs to markup to html 2021-09-29 20:05:03 +02:00
Anton-4
168c511988 Merge branch 'docs-parse-code-blocks' of github.com:rtfeldman/roc into crate-expr2-markupnode 2021-09-29 16:09:02 +02:00
Anton-4
9c2b334be7 fmt, added libasound2-dev to Earthfile 2021-09-29 15:02:23 +02:00
Anton-4
082890a8cb sound on F12 with threadpool 2021-09-29 13:48:53 +02:00
Brian Carroll
7ea59ad9d4 PR tidy-ups 2021-09-29 06:15:58 +01:00
Brian Carroll
93448182e4 Merge branch 'trunk' of github.com:rtfeldman/roc into wasm_stack_memory 2021-09-28 19:08:36 +01:00
Anton-4
f565773ca6 can now play multiple sounds in rapid succession 2021-09-28 20:07:27 +02:00
Brian Carroll
45c9dc8617 update gen_wasm README 2021-09-28 19:06:47 +01:00
Anton-4
99100be148 trying to play sound on F12 2021-09-28 19:54:05 +02:00
Brian Carroll
02bb9028ef Returning records on the stack from Wasm dev backend! 2021-09-28 08:06:59 +01:00
Anton-4
0b02929a53
Merge pull request #1746 from rtfeldman/bench_race_condition
benchmark race condition patch
2021-09-27 17:14:48 +02:00
Anton-4
4026291945 re-enjable benchmarks 2021-09-27 15:17:13 +02:00
Anton-4
e0bd644c79 single threaded file loading with env var 2021-09-27 15:16:07 +02:00
Brian Carroll
39fda3e675 Add more information to SymbolStorage
SymbolStorage is function-specific, whereas WasmLayout is function-independent.

SymbolStorage used to be a single-variant enum with a LocalId and a WasmLayout,
but now we need more variants, so we can handle stack memory allocation..

- For values in stack memory, the storage needs to include an offset within the
  stack frame, but we don't need that for primitive values.

- For function parameters, the allocated stack memory is in the caller's frame
  rather than the current frame, so we don't want size or offset.

We could have kept a WasmLayout inside of SymbolStorage but that would have made
possible a lot of invalid combinations. It seemed better to copy the fields we need.
2021-09-26 20:52:17 +01:00