| ... | ... | @@ -252,6 +252,12 @@ extern fn @"llvm.wasm.memory.size.i32"(u32) u32; |
| 252 | 252 | extern fn @"llvm.wasm.memory.grow.i32"(u32, u32) i32; |
| 253 | 253 | |
| 254 | 254 | const WasmPageAllocator = struct { |
| 255 | comptime { |
| 256 | if (!std.Target.current.isWasm()) { |
| 257 | @compileError("WasmPageAllocator is only available for wasm32 arch"); |
| 258 | } |
| 259 | } |
| 260 | |
| 255 | 261 | const PageStatus = enum(u1) { |
| 256 | 262 | used = 0, |
| 257 | 263 | free = 1, |
| ... | ... | @@ -797,7 +803,7 @@ test "c_allocator" { |
| 797 | 803 | } |
| 798 | 804 | |
| 799 | 805 | test "WasmPageAllocator internals" { |
| 800 | | if (std.Target.current.isWasm()) { |
| 806 | if (comptime std.Target.current.isWasm()) { |
| 801 | 807 | const none_free = WasmPageAllocator.PageStatus.none_free; |
| 802 | 808 | std.debug.assert(none_free == WasmPageAllocator.conventional.data[0]); // Passes if this test runs first |
| 803 | 809 | std.debug.assert(!WasmPageAllocator.extended.isInitialized()); // Passes if this test runs first |