Commit graph

59 commits

Author SHA1 Message Date
Mats Sigge
71f359fbdc Move macros from roc_reporting to new roc_error_macros module
The `internal_error!` and `user_error!´ macros can't be used everywhere
when they live in `roc_reporting` due to circular dependencies.
2022-01-23 18:40:04 +01:00
Brian Carroll
f354b4842b Wasm: Move Eq/NotEq into LowLevelCall 2022-01-17 09:35:08 +00:00
Brian Carroll
f635dd8776 Wasm: Refactor lowlevels to get more flexibility without increasing boilerplate. 2022-01-17 09:33:06 +00:00
Brian Carroll
88b779c3ff Wasm: Create CodeGenNumber 2022-01-17 09:33:06 +00:00
Brian Carroll
05a6a9c7ce Wasm: update comments on lowlevels 2022-01-17 09:33:06 +00:00
ayazhafiz
2c41c43aea Implement saturated add/subtract 2022-01-10 22:37:08 -05:00
rvcas
d2f95bde63 chore(StrToNum): layout is always a Struct, we don't need the Union case 2022-01-03 18:15:46 -05:00
Brian Carroll
aec8d1bf3d Merge branch 'trunk' of github.com:rtfeldman/roc into str_to_num 2022-01-02 12:31:59 +00:00
Brian Carroll
83d6c82e0b Wasm: avoid two memory loads for ListLen, at the cost of +1 instruction byte 2021-12-30 15:40:55 +00:00
Brian Carroll
f90d9a74bd Do not inline builtin wrapper for Str.toNum 2021-12-29 21:08:16 +00:00
rvcas
0d187fb53c feat(wasm): use mono layout to figure out the correct intrinsic 2021-12-28 21:38:43 -05:00
rvcas
cd42f034b5 feat(wasm): start StrToNum 2021-12-27 19:08:21 -05:00
Folkert de Vries
18187bc43f
Merge pull request #2245 from rtfeldman/wasm-tag-eq
Wasm tag equality
2021-12-21 16:24:14 +01:00
rvcas
c6eaf3abd3 feat(wasm): enable more Str LowLevels 2021-12-20 17:47:39 -05:00
Brian Carroll
c510226c15 Reorganise Wasm lowlevels to get pointer equality working correctly 2021-12-19 21:20:06 +00:00
Brian Carroll
e847c924dd Lowlevels: replace RefCountGetPtr with the more general GetPtrAsInt. 2021-12-19 08:29:17 +00:00
Brian Carroll
a1d883600c Equality operator for records 2021-12-18 17:25:00 +00:00
rvcas
b9bd75d643 Merge branch 'trunk' into wasm_arrays 2021-12-17 11:54:23 -05:00
rvcas
787900d291 fix(wasm): ListLen does not need to match ret_layout 2021-12-17 11:38:09 -05:00
rvcas
40da207859 feat(wasm): LowLevel::ListLen 2021-12-16 21:50:12 -05:00
Brian Carroll
86d8e2789e Implement Wasm string equality 2021-12-16 16:56:56 +00:00
Brian Carroll
3adaacc66e Add some comments 2021-12-16 16:56:53 +00:00
Brian Carroll
cd91be678f Setup for specializing equality checks 2021-12-16 16:52:47 +00:00
Brian Carroll
cca4acf728 Remove f128 equality implementation 2021-12-13 22:23:20 +00:00
Brian Carroll
594fe9124d Wasm support for 128-bit number literals, isFinite, ==, and != 2021-12-13 09:05:07 +00:00
Richard Feldman
1ce648ac27
Merge pull request #2116 from rtfeldman/str_to_num
Str.toNum
2021-12-09 09:48:38 -05:00
Brian Carroll
1dda8859c4 Update gen_wasm's error handling to remove Result and use macros consistently 2021-12-09 00:11:44 +00:00
Brian Carroll
72fa6217fb Refactor wasm lowlevels to make it easier to add more 128-bit ops 2021-12-01 15:09:23 +00:00
Folkert
69fc1ad7e7 sketch of StrToNum 2021-12-01 15:33:16 +01:00
Brian Carroll
a3827d6636
Merge pull request #2071 from rtfeldman/refcount-mono-ir
Start generating refcounting code as mono IR
2021-12-01 12:59:16 +00:00
rvcas
f995a07029 feat: Num.toStr
* add type for Num.toStr
  * create new lowlevel
  * delete types and Symbol for fromInt and fromFloat
  * leave LowLevel::{StrFromFloat,StrFromInt}
  * match on LowLevel::NumToStr and figure out the layout to decide
    which build function to delegate to
2021-11-30 14:52:06 -05:00
Brian Carroll
079a8311ec Delete HeapMemory variant of WasmLayout, just treat pointers as Primitive
When I created this (at the very beginning of the Wasm backend),
I didn't really have a clear reason for it. I just thought it might end up
making sense treat heap pointers differently from numbers, somehow.

But the semantic differences between pointers and other numbers is not relevant
to WasmLayout. The semantics are clear from where the Symbol appears in the IR.

Also we were storing heap pointers in locals, for no real reason.
And the fact that it's *different* meant a lot of new cases in match expressions,
to do the exact same thing as Primitives but with a pointless difference.

Until now, we haven't really used this variant in any of our tests.
But the refcount pointer needed it... and everything broke!
2021-11-30 09:57:00 +00:00
Brian Carroll
264927fb85 Wasm code gen for new refcount lowlevels 2021-11-30 09:57:00 +00:00
Brian Carroll
6e5acadfea Create new lowlevels for refcounting 2021-11-30 09:57:00 +00:00
Brian Carroll
88bf6bf1b7 Clean up Wasm calling convention code 2021-11-29 00:17:45 +00:00
Folkert
bceebc4f8f first pass at decimal addition in the wasm backend 2021-11-21 23:00:12 +01:00
Michael Downey
d11bb93539
Merge branch 'trunk' into add_list_all 2021-11-18 16:09:24 -05:00
Michael Downey
12f7d4b458 fixing format 2021-11-18 16:04:38 -05:00
Michael Downey
9d587d37b4
Merge branch 'trunk' into add_list_all 2021-11-18 06:41:08 -05:00
Brian Carroll
be55582290 Enable some more gen_wasm string builtins 2021-11-18 09:59:52 +00:00
Brian Carroll
e75a9ec281 Merge branch 'trunk' of github.com:rtfeldman/roc into wasm-str-builtins 2021-11-17 13:51:11 +00:00
Brian Carroll
a3bfee5cd8 Leave other string builtins for later 2021-11-17 13:48:29 +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
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
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
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