Brendan Hansknecht
a2b4f64c6e
always use atomic refcounting
2025-03-26 20:46:13 -07:00
Brendan Hansknecht
c21cf9b8d6
switch roc to atomic refcounts
2025-03-26 20:38:34 -07:00
Brendan Hansknecht
ec8aeaa15a
zig fmt
2025-01-10 20:39:38 -08:00
Brendan Hansknecht
7643f89781
Merge branch 'main' into simplify-refcount
...
Signed-off-by: Brendan Hansknecht <Brendan.Hansknecht@gmail.com>
2025-01-10 20:34:52 -08:00
Norbert Hajagos
9689656845
remove unused var causing errors in debug tests.
2025-01-10 21:34:11 +01:00
Luke Boswell
37cd04c002
Merge branch 'main' into simplify-refcount
2025-01-09 10:18:00 +11:00
Brendan Hansknecht
66c1d5f425
fix perf on x86
2025-01-01 21:19:01 -05:00
Brendan Hansknecht
b9832dd6d3
remove unnecessary pub
2025-01-01 14:19:41 -08:00
Brendan Hansknecht
0d800252f3
avoid storing refcount instead load it. That optimizes beter for some reason
2025-01-01 14:03:49 -08:00
Brendan Hansknecht
78530141a1
fix tests
2025-01-01 13:35:08 -08:00
Brendan Hansknecht
26bd2d437e
if the user reserves a specific number of elements, trust them
2025-01-01 13:00:34 -08:00
Brendan Hansknecht
c6d594a758
cleanup constant refcount checking
2025-01-01 12:28:16 -08:00
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
8ad6c47211
also update is_unique for atomic isize
2024-12-31 20:52:04 -08:00
Brendan Hansknecht
f901946455
Improve roc atomic refcounting by using first bit to indicate threadlocal
...
By avoiding atomic refcounting for any threadlocal variable, this greatly improves performance.
Leads to the performance of threadlocal refcounting being only ~4% behind non-atomic refcounting.
The old atomic refcounting could be as far as ~50% behind (though normally 10-20%).
This does not enable anything atomic related.
If we enable all forms of data loading (List.get, Box.unbox, loading recursive tag) to propagate the atomic flag,
this should be a reasonable implementation for roc by default.
With propagation, a platform would just set a list to atomic. On load, individual elements would also get set to atomic.
We also should probably revert back to threadlocal if an atomic refcount drops to 1.
2024-12-31 20:52:03 -08:00
Brendan Hansknecht
0a573ca557
Merge remote-tracking branch 'origin/main' into upgrade-llvm-zig
2024-12-11 16:38:34 -08:00
Mattthew Heath
3aeab753b4
tidying
2024-12-06 18:44:10 +00:00
Mattthew Heath
8c2cdeb332
aligns at 16 finally
2024-12-06 18:35:49 +00:00
Mattthew Heath
addd826511
Revert "aligns as 8"
...
This reverts commit 82a70c79b8
.
2024-12-06 17:47:08 +00:00
Mattthew Heath
82a70c79b8
aligns as 8
2024-12-06 17:33:12 +00:00
Mattthew Heath
b33f1b0981
aligns as usize
2024-12-06 17:16:24 +00:00
Brendan Hansknecht
a8dd6244e9
fix zig build errors
2024-07-28 15:55:37 +10:00
Luke Boswell
011c13fb17
fixup the obivous zig errors
2024-07-28 15:55:37 +10:00
Brendan Hansknecht
4e8f916204
correct pointer alignment on decref
2024-07-13 10:39:57 -07:00
Brendan Hansknecht
255cc31ad9
change zig bitcode refcounting to require whether or not an element is refcounted
...
This also requires zig bitcode to have access to the dec functions for elements.
This is needed so that zig will be able to free elements in lists.
2024-07-13 10:39:51 -07:00
Brendan Hansknecht
787d7f85ac
switch dbg arg ordering to make it backwards compatible
2023-12-02 21:18:32 -08:00
Brendan Hansknecht
3966d63e2f
add src and location to dbg
2023-12-02 21:18:31 -08:00
Brendan Hansknecht
b62c9667d5
Correct typo
...
Co-authored-by: Ayaz <20735482+ayazhafiz@users.noreply.github.com>
Signed-off-by: Brendan Hansknecht <Brendan.Hansknecht@gmail.com>
2023-11-29 21:05:49 -08:00
Brendan Hansknecht
e6cc43492a
rip out old dbg and setup reasonable base debug location info
2023-11-29 21:05:49 -08:00
Brendan Hansknecht
3d6c140a30
get minimal roc_dbg
working
2023-11-29 21:05:49 -08:00
Brendan Hansknecht
ca283197b9
fix LIST_RELEASE_EXCESS_CAPACITY arg count
2023-10-23 13:50:34 -07:00
Folkert
ec0eddb8b2
fix bug in use of alignment in free for tag unions
2023-10-23 13:50:34 -07:00
Brendan Hansknecht
f1126aae75
correct type of bytes_or_null to allow it to be aligned to 1 instead of 8
2023-10-23 13:50:34 -07:00
Brendan Hansknecht
2e2e609547
update zig to 0.11 and update build script
...
Also update memcpy to avoid recursive memcpy due to optimizations.
2023-10-23 13:50:30 -07:00
Folkert
5ebd18cee0
trim some debug messages
2023-09-14 14:43:29 +02:00
Folkert
fdacfce108
all gen-dev tests work again
2023-09-14 14:43:28 +02:00
Folkert
5e4f43e1d8
checkpoint
2023-09-14 14:43:24 +02:00
Folkert
3c8dbce72e
fix alignment bug in list literals
2023-09-14 14:39:15 +02:00
Folkert
3909443ef4
fix two bugs in the dev backend
2023-09-13 20:24:17 +02:00
Luke Boswell
2e0c83ae63
fixes for zig tests Windows
2023-09-12 19:28:11 +10:00
Folkert
f04295863d
reuse free'ing logic
2023-06-27 19:37:22 +02:00
Folkert
fc3004da58
free or reuse unconditionally when value is unique
2023-06-27 17:37:45 +02:00
Brendan Hansknecht
60e70c6b1b
add workaround for wasm tests
2023-06-02 15:23:06 -07:00
Brendan Hansknecht
75a035e12d
remove all definitions of roc_memcpy
2023-06-02 15:23:05 -07:00
Folkert
f6fafdb019
nullable unwrapped for the dev backend
2023-06-01 00:02:38 +02:00
Brendan Hansknecht
90636d14c8
add extra note on security
2023-05-26 07:31:35 -07:00
Brendan Hansknecht
b4c359588e
Seed Dict and Set
...
This changes Dict and Set to have a compilation depedent seed.
The seed is not exposed to userland in anyway.
This gets a much more DOS resistant Dict and Set with no cost.
2023-05-25 09:55:48 -07:00
Folkert
317a8880c1
better debug info if dec on invalid pointer
2023-05-14 18:01:47 +02:00
Folkert
dd8739b847
better debug info if inc on invalid pointer
2023-05-14 15:20:43 +02:00
Folkert
278e2c4604
use std.debug.print
2023-05-03 14:30:03 +02:00