Commit graph

151 commits

Author SHA1 Message Date
Brendan Hansknecht
4b8693537a
Simplify Refcounting
Instead of -max_size to -1 for regular refcounts, use 1 to max_size.
0 still means constant refcount.
The highest bit is used to signify atomic refcounting required.
This does not turn on any sort of atomic refcounting.
2025-01-01 11:00:18 -08:00
Brendan Hansknecht
a7e4a55e1e
add refcount constants 2024-12-28 15:01:00 -08:00
Brendan Hansknecht
ad41b509cf
avoid writing to readonly refcounts 2024-12-28 14:43:17 -08:00
shua
b5ce935d89
RocDec::from_str accept 'e' exponent notation
The intent of this change is to allow roc dec values to be parsed from
strings using the 'e' exponent notation, eg '1e3' as a notation for '1000'.

Fixes #7351
2024-12-27 22:44:20 -05:00
Brendan Hansknecht
5d0947960c
fix small string handling 2024-12-10 20:29:46 -08:00
Brendan Hansknecht
5fbf8f5b1c
fmt and clippy 2024-12-10 20:11:28 -08:00
Brendan Hansknecht
98cde41439
add readonly roc list and roc str to roc_std 2024-12-10 20:03:08 -08:00
Brendan Hansknecht
0e162a767d
add RocRefcounted to SendSafe types 2024-12-10 19:34:54 -08:00
Luke Boswell
89ce3d61d8
add Safety section to roc_box as_refcount_ptr() 2024-12-02 14:31:19 +11:00
Dan Knutson
346014d55c
fix rename 2024-11-30 13:33:37 -06:00
Dan Gieschen Knutson
1036695b77
Update crates/roc_std/src/roc_box.rs 2024-11-30 13:08:54 -06:00
Dan Knutson
dccc0f68da
add RoxBox::as_ptr 2024-11-30 13:08:50 -06:00
Luke Boswell
d0ee040421
make clippy happy 2024-10-24 11:31:15 +11:00
svcxc
b7ec1f143b
Implemented Default, PartialOrd, and Ord for RocDec 2024-10-14 14:50:53 +02:00
Luke Boswell
45cca34c12
add impl RocRefcounted for RocResult 2024-07-15 14:33:19 +10:00
Brendan Hansknecht
2cd0d51409
add RocRefcounted to RocBox 2024-07-13 10:39:58 -07:00
Brendan Hansknecht
c79febb52d
Change RocRefcounted to have argumentless inc function
Just inc by 1. No need for inc by n.
2024-07-13 10:39:52 -07:00
Brendan Hansknecht
f87c32ca7d
clippy 2024-07-13 10:39:52 -07:00
Brendan Hansknecht
442ba0b49a
Manually implement RocRefcounted in Glue
I needed to update RustGlue.roc to generate this.
That said, I want to see and measure results.
As such, I am just manually implementing this for now!
2024-07-13 10:39:52 -07:00
Brendan Hansknecht
44cd1ee9c4
Avoid accessing unallocated bytes in list.incref 2024-07-13 10:39:52 -07:00
Brendan Hansknecht
9b6798ead1
Correct refcounting check to be recursive through aggregate types 2024-07-13 10:39:52 -07:00
Brendan Hansknecht
e2dc112f86
Correct sizes when allocating lists from rust 2024-07-13 10:39:51 -07:00
Brendan Hansknecht
a1d08702a4
Update roc_std List to handle size on the heap
This increased the number of failing tests for some reason (more segfaults).
That said, I think it is correct.

Probably just exposing errors from elsewher that haven't been addressed (maybe causing a double free).
2024-07-13 10:39:51 -07:00
Brendan Hansknecht
93fab26c01
Add a RocRefcounted trait in roc_std
This is required to properly handle refcounting of RocList.
Without it, we can't tell if we need to get the length from the heap.
That said, it isn't a pretty solution.

I think dealing with generating bespoke type in glue would feel nicer than this but be much more work.
It also would deal with the issue of implementations in the bitcode not matching external libraries.
That said, it would require exposing way more symbols from roc for each monomophorphized list variant.
2024-07-13 10:39:51 -07:00
Anton-4
c1d0c24194
fix expected type
Rust's u128 and Roc's U128 have different alignment. They can not be used interchangebly, that leads to segmentation faults. See also 434410692
2024-04-20 19:57:47 +02:00
Anton-4
8502a37b3c
fmt 2024-04-15 16:51:07 +02:00
Anton-4
e4b814ce1c
clippy 2024-04-15 16:50:44 +02:00
Folkert
164319a07d
pi is not 3 2024-01-30 15:51:49 -08:00
Brendan Hansknecht
260b94b36d
Merge branch 'main' into rust-1-72-upgrade 2024-01-17 14:36:16 -08:00
Brian Teague
60c639b60e
Consolidate gitignore
Keep certain files with no file extension

Keep specific files with no file extension

Delete all gitignore files
2024-01-10 22:16:04 -05:00
Anton-4
2ac6243e72
partial clippy fixes 2023-12-27 17:46:56 +01:00
Anton-4
a4fd42b8de
rustfmt 2023-12-25 17:19:30 +01:00
Anton-4
cd632fe549
Merge branch 'main' of github.com:roc-lang/roc into clippy-1.74 2023-12-25 17:05:37 +01:00
Folkert
f570444901
always slice a big string as a slice (not as a small string) 2023-12-12 10:49:21 +01:00
Folkert
37ef3549c8
rename field name 2023-12-12 10:45:53 +01:00
Folkert
f742d50379
changes after review 2023-12-12 10:45:53 +01:00
Folkert
9865096c24
expose list/string slices to rust users 2023-12-12 10:45:53 +01:00
Brendan Hansknecht
787d7f85ac
switch dbg arg ordering to make it backwards compatible 2023-12-02 21:18:32 -08:00
Brendan Hansknecht
13d2238536
update roc_dbg in platforms 2023-12-02 21:18:31 -08:00
Ayaz
aaba3f4d82
Merge branch 'main' into clippy-1.74 2023-12-02 20:09:06 -06:00
Brendan Hansknecht
f5fb01fd53
Get tests passing
Add roc_dbg to some platforms.
Also start updating some roc_panic impls.
2023-11-29 21:05:49 -08:00
Folkert
6d55acc5cf
cleanups in roc_std 2023-11-18 22:43:11 +01:00
Brendan Hansknecht
d01fc9156c
add missing traits to RocResult 2023-11-14 18:16:04 -08:00
Folkert
f717cb75a9
clippy 2023-10-15 21:06:23 +02:00
Folkert
72d5b64c6f
clippy 2023-10-15 20:26:02 +02:00
Folkert
d4e77856fe
roc_std: fixes found by running miri 2023-10-15 20:12:06 +02:00
Folkert
be81651299
fix valgrind issue in roc_std 2023-10-09 15:24:44 +02:00
Sekerez
a5b65cad03 Add whole number dec test 2023-09-17 11:25:56 -04:00
Isak
c5f93e3c54 Simplify Dec to_str implementation 2023-09-16 18:07:50 -04:00
Isak
426582906c Remove dbg statement 2023-09-16 17:52:32 -04:00