| ... | @@ -250,11 +250,6 @@ const PageAllocator = struct { | ... | @@ -250,11 +250,6 @@ const PageAllocator = struct { |
| 250 | } | 250 | } |
| 251 | }; | 251 | }; |
| 252 | | 252 | |
| 253 | // TODO Exposed LLVM intrinsics is a bug | | |
| 254 | // See: https://github.com/ziglang/zig/issues/2291 | | |
| 255 | extern fn @"llvm.wasm.memory.size.i32"(u32) u32; | | |
| 256 | extern fn @"llvm.wasm.memory.grow.i32"(u32, u32) i32; | | |
| 257 | | | |
| 258 | const WasmPageAllocator = struct { | 253 | const WasmPageAllocator = struct { |
| 259 | comptime { | 254 | comptime { |
| 260 | if (!std.Target.current.isWasm()) { | 255 | if (!std.Target.current.isWasm()) { |
| ... | @@ -357,7 +352,7 @@ const WasmPageAllocator = struct { | ... | @@ -357,7 +352,7 @@ const WasmPageAllocator = struct { |
| 357 | return idx + extendedOffset(); | 352 | return idx + extendedOffset(); |
| 358 | } | 353 | } |
| 359 | | 354 | |
| 360 | const prev_page_count = @"llvm.wasm.memory.grow.i32"(0, @intCast(u32, page_count)); | 355 | const prev_page_count = @wasmMemoryGrow(@intCast(u32, page_count)); |
| 361 | if (prev_page_count <= 0) { | 356 | if (prev_page_count <= 0) { |
| 362 | return error.OutOfMemory; | 357 | return error.OutOfMemory; |
| 363 | } | 358 | } |