mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
Use builtins in std.heap.WasmAllocator
This commit is contained in:
parent
601e831f1d
commit
146be2a8cb
@ -250,11 +250,6 @@ const PageAllocator = struct {
|
||||
}
|
||||
};
|
||||
|
||||
// TODO Exposed LLVM intrinsics is a bug
|
||||
// See: https://github.com/ziglang/zig/issues/2291
|
||||
extern fn @"llvm.wasm.memory.size.i32"(u32) u32;
|
||||
extern fn @"llvm.wasm.memory.grow.i32"(u32, u32) i32;
|
||||
|
||||
const WasmPageAllocator = struct {
|
||||
comptime {
|
||||
if (!std.Target.current.isWasm()) {
|
||||
@ -357,7 +352,7 @@ const WasmPageAllocator = struct {
|
||||
return idx + extendedOffset();
|
||||
}
|
||||
|
||||
const prev_page_count = @"llvm.wasm.memory.grow.i32"(0, @intCast(u32, page_count));
|
||||
const prev_page_count = @wasmMemoryGrow(@intCast(u32, page_count));
|
||||
if (prev_page_count <= 0) {
|
||||
return error.OutOfMemory;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user