Commit graph

11 commits

Author SHA1 Message Date
Jacob Young
a7282d0910 WasmAllocator: fix safety panic during OOM 2024-03-23 11:32:37 +01:00
mlugg
f26dda2117 all: migrate code to new cast builtin syntax
Most of this migration was performed automatically with `zig fmt`. There
were a few exceptions which I had to manually fix:

* `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten
* `@truncate`'s fixup is incorrect for vectors
* Test cases are not formatted, and their error locations change
2023-06-24 16:56:39 -07:00
Eric Joldasov
50339f595a all: zig fmt and rename "@XToY" to "@YFromX"
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-19 12:34:42 -07:00
Andrew Kelley
6261c13731 update codebase to use @memset and @memcpy 2023-04-28 13:24:43 -07:00
Andrew Kelley
7f063b2c52 WasmAllocator: simplify thanks to new Allocator interface
Now it can refuse to resize when it would disturb the metadata tracking
strategy, resulting in smaller code size, a simpler implementation, and
less fragmentation.
2022-11-29 23:46:02 -07:00
Andrew Kelley
931261752d rename a couple variables 2022-11-29 23:46:02 -07:00
Andrew Kelley
e2e60f5ff9 std.heap.WasmAllocator: redo
The previous version had a fatal flaw: it did ensureCapacity(1) on the
freelist when allocating, but I neglected to consider that you could
free() twice in a row. Silly!

This strategy allocates an intrusive freelist node with every
allocation, big or small. It also does not have the problems with resize
because in this case we can push the upper areas of freed stuff into the
corresponding freelist.
2022-11-29 23:46:02 -07:00
Andrew Kelley
3dcea95ffe std.heap.WasmAllocator: implement resizing 2022-11-29 23:46:02 -07:00
Andrew Kelley
d4a1ae474a std.heap.WasmAllocator: resize in place without force shrinking 2022-11-29 23:46:02 -07:00
Andrew Kelley
0c0c70ee82 std.heap.WasmAllocator: large allocations 2022-11-29 23:46:02 -07:00
Andrew Kelley
3ea04ed64c introduce std.heap.WasmAllocator
fast allocator for WebAssembly

eventually this is intended to be merged into
`std.heap.GeneralPurposeAllocator`
2022-11-29 23:46:02 -07:00