Commit graph

4229 commits

Author SHA1 Message Date
Folkert
6ed899d8be
indirec inc/dec generation in mono helpers 2023-05-05 15:02:21 +02:00
Richard Feldman
df0ab01128
Merge pull request #5348 from basile-henry/basile/num-is-nan
Implement builtins for Num.isNan, Num.isInfinite, and Num.isFinite
2023-05-05 06:15:18 -04:00
Gabriel Dertoni
7d0027f428
refactor: remove needles string allocation in pretty printer
Many times, in order to create a `ven_pretty::Doc` containing a text
node, the pattern `alloc.text(format!(...))` would be used. This code
then creates a fresh string that is then used in the `Doc`. However,
many times only a small string is necessary and so the allocation could
be optimized. The `ven_pretty` crate supports this through a `SmallString`
type. Allocating a fresh string with `format!` also moves control away
from the `DocAllocator` which isn't ideal, since it could also handle
the string allocations. So, instead of creating a fresh string, one can
simply call `alloc.as_string(format_args!(...))` and delegate the
allocation to the `DocAllocator` without any loss in expressivity. So,
in order to encorage this pattern, this commit also introduces the
`text!` macro.

In order to find all instances of the code pattern, the following
tree-sitter query was used:

```scm
(call_expression
    function: (field_expression
        field: (field_identifier) @field.name
               (#eq? @field.name "text"))
    arguments: (arguments
        (macro_invocation
            macro: (identifier) @macro.name
            (#eq? @macro.name "format")))) @reference.call
```
2023-05-03 21:28:36 -03:00
Ayaz
14ac58f781
Merge pull request #5362 from jarlah/replace-panic-with-internal-error 2023-05-03 19:27:09 -05:00
Jarl André Hübenthal
e5eb5717ea
replace panic! with internal_error! in compiler modules 2023-05-03 22:11:21 +02:00
Folkert
6fe610b7fc
update mono tests 2023-05-03 18:38:20 +02:00
Folkert de Vries
27d477124d
Merge pull request #5372 from roc-lang/fix-false-debug
Determine host-exposed lambda sets once based on proc variable
2023-05-03 18:35:03 +02:00
Folkert
04081ae8b3
centralize list argument passing and dec fn pointer generation 2023-05-03 18:23:16 +02:00
Folkert
3c6c5a3e53
add windows cc implementation of new register picker 2023-05-03 17:57:54 +02:00
Ayaz
ba1f8ffe5f
Merge pull request #5272 from extemporalgenome/markdown-typos-20230410
markdown typo fixes
2023-05-03 10:24:52 -05:00
Ayaz Hafiz
0744ef946b
Determine host-exposed lambda sets once based on proc variable
Rather than calculating the HELS for each host-exposed layout (of which
there may be multiple), we only need to calculate the HELS based on the
top-level type of the host-exposed function.

Also renamed `GlueProcs.extern_names` to
`GlueProcs.legacy_layout_based_extern_names` since they are still
currently generated based on the layout, but I think we want to generate
all HELS via type variable.

Fixes false-interpreter builds in debug.
2023-05-03 10:00:50 -05:00
Folkert
e12a7f4f81
refactor nasty loops into recursive functions 2023-05-03 14:43:31 +02:00
Folkert
278e2c4604
use std.debug.print 2023-05-03 14:30:03 +02:00
Folkert
85fcd71bdb
use bitcast instead of intcast 2023-05-03 14:28:22 +02:00
Basile Henry
9a2afbb09b gen_dev: Implement builtins Num.isNan, Num.isFinite, Num.isInfinite 2023-05-03 11:12:01 +01:00
Basile Henry
d8b658da5d gen_dev: Add is_nan_freg_reg64 2023-05-03 11:12:01 +01:00
Basile Henry
1391920d0e gen_dev: Add MOVQ/MOVD to x86 backend 2023-05-03 11:12:01 +01:00
Basile Henry
b8aaaaabda Implement builtins for Num.isNan, Num.isInfinite, and Num.isFinite
Closes #5310 and closes #5309
2023-05-03 09:33:28 +01:00
Folkert
8963cc9d45
sublist tests now work 2023-05-03 01:09:28 +02:00
Folkert
47e99a226d
enable more tests after bugfix 2023-05-03 01:06:14 +02:00
Folkert
05a9b4d601
fix that inc on list was no longer recursive 2023-05-03 01:03:09 +02:00
Ayaz Hafiz
df3bd79d4a
Simplify occurs check for aliases 2023-05-02 17:00:58 -05:00
Ayaz Hafiz
8ca1e6c866
Correct occurs cycle under alias argument but not alias real var
At times we can have alias arguments that are recursive in their
position, but whose recursiveness is not immediately visible in the real
var.

Closes #5330
2023-05-02 17:00:58 -05:00
Ayaz Hafiz
8dc86a81b8
Rename ROC_VERIFY_OCCURS_RECURSION flag 2023-05-02 17:00:58 -05:00
Ayaz Hafiz
5815807927
seen_recursion_pair is immutable 2023-05-02 17:00:58 -05:00
Ayaz
4824de5192
Merge pull request #5363 from roc-lang/i5344
Correctly include flex vars in generalization group of rec defs
2023-05-02 16:44:29 -05:00
Folkert
dc77c702c5
enable more tests 2023-05-02 23:39:00 +02:00
Folkert
d6885ec17a
implement List.dropAt 2023-05-02 23:30:06 +02:00
Folkert
a48618e34a
List.releaseExcessCapacity 2023-05-02 23:00:07 +02:00
Ayaz
7897495ee2
Update gen_primitives.rs
Signed-off-by: Ayaz <20735482+ayazhafiz@users.noreply.github.com>
2023-05-02 15:40:45 -05:00
Folkert
4e29652f0d
enable many more tests 2023-05-02 22:31:58 +02:00
Folkert
cb4b726c7e
don't refcount the empty tag union 2023-05-02 22:31:57 +02:00
Folkert
fb123b8990
lambda set unwrapping 2023-05-02 22:31:57 +02:00
Folkert
0fa85fe91d
don't copy zero-sized types to the stack 2023-05-02 22:31:57 +02:00
Folkert
35c507a33f
array literal arg loading was moved 2023-05-02 22:31:56 +02:00
Folkert
4ec99764cb
an implementation of sublist that segfaults (sometimes) 2023-05-02 22:31:56 +02:00
Folkert
f383ff14f8
helper for generating dec functions 2023-05-02 22:31:56 +02:00
Folkert
13e52844c7
implement ForeignCall function calls 2023-05-02 22:31:55 +02:00
Folkert
ac64e4ab87
fix for re-used DEV_TMP symbol 2023-05-02 22:31:55 +02:00
Folkert
ce36069d57
thread layout_ids through for future inc/dec function codegen 2023-05-02 22:31:55 +02:00
Folkert
9e8854614a
fix reading float from a pointer 2023-05-02 22:31:54 +02:00
Folkert
e4b0d77f2e
pass floats independently of general registers 2023-05-02 22:31:54 +02:00
Folkert
cd8c865a66
List.reverse 2023-05-02 22:31:54 +02:00
Folkert
1b5d88b002
literal helpers 2023-05-02 22:31:53 +02:00
Folkert
668e3e3151
add List.subList 2023-05-02 22:31:52 +02:00
Folkert
29bc9a2e85
short-circuit loading field from size 0 struct 2023-05-02 22:31:52 +02:00
Folkert
37eec2b7c2
allow configure of whether roc_alloc is generated 2023-05-02 22:31:49 +02:00
Ayaz Hafiz
d4fcd83ba9
Correctly include flex vars in generalization group of rec defs
Rather than resetting the list here, we should append to it!

Closes #5344
2023-05-02 13:18:50 -05:00
Ayaz Hafiz
d13e221678
Print variables if asked to 2023-05-02 13:08:58 -05:00
Ayaz Hafiz
155375062a
Fmt 2023-05-02 10:52:49 -05:00