Commit Graph

13 Commits

Author SHA1 Message Date
Feoramund
b056b9e130 Rewrite the heap allocator
This is a total rewrite after having experimented with a variety of
techniques including a dual-allocator strategy for small and large size
classes where the large class allocator had a coalescing mechanism.

This allocator design is much closer to `mimalloc` in spirit and
performs almost twice as fast as the original bitmap-based design.

Additionally, several bugs have been fixed. The most important one being
the lock-free synchronization method used for remote frees. This design
uses a single atomic pointer that is doubly-tagged to pass remote frees
either to the heap or to the slab, depending on the ownership status.
2025-05-09 17:56:36 -04:00
Feoramund
c52c29856c Unify heap allocators
- Simplify the malloc-based allocator
- Correct the type signatures on malloc/calloc/realloc
- Make `heap_alloc/heap_free/heap_resize` API consistent across platforms
2025-05-08 11:06:02 -04:00
Feoramund
541443fe33 Don't build feoramalloc on web platforms
Their allocation pathways are already tuned for their respective
platforms.
2025-05-08 11:06:01 -04:00
Feoramund
e9bf350cca Add heap allocator exception for Orca
This is a copy of the libc malloc-based allocator that we previously
had. It's preferable to use the Orca runtime allocator over our own.
2025-05-08 11:06:01 -04:00
Feoramund
6d99d9571c Fix indentation 2025-05-08 11:06:01 -04:00
Feoramund
a4a776634c Add native heap allocator
- Add the test bench for the allocator
- Move old allocator code to the test bench
- Fix `heap_resize` usage in `os2/env_linux.odin` to fit new API
  requiring `old_size`
2025-05-08 11:06:00 -04:00
flysand7
bec09d82df Fix vet errors 2024-09-19 21:07:08 +11:00
flysand7
e0bb07728d Fix resize OOB when copying old data that's bigger than new data 2024-09-19 20:55:52 +11:00
gingerBill
bed18a17e6 Bodge: Improve aligned_resize logic 2024-08-06 11:22:34 +01:00
gingerBill
93441a043a Make runtime.heap_alloc contextless 2024-06-25 09:38:49 +01:00
gingerBill
0428f508d8 Fix typo of _heap_resize 2024-01-28 23:21:59 +00:00
gingerBill
038086d1d9 Alias heap calls from base:runtime is core:os 2024-01-28 22:47:55 +00:00
gingerBill
9a16bc5fc5 Remove core:os dependency for base:runtime 2024-01-28 22:40:46 +00:00