Use builtins in std.heap.WasmAllocator

master
Jakub Konka 2020-06-02 13:04:02 +02:00 committed by Andrew Kelley
parent 601e831f1d
commit 146be2a8cb
1 changed files with 1 additions and 6 deletions

View File

@ -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 { const WasmPageAllocator = struct {
comptime { comptime {
if (!std.Target.current.isWasm()) { if (!std.Target.current.isWasm()) {
@ -357,7 +352,7 @@ const WasmPageAllocator = struct {
return idx + extendedOffset(); 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) { if (prev_page_count <= 0) {
return error.OutOfMemory; return error.OutOfMemory;
} }