| ... | @@ -257,6 +257,9 @@ test "" { | ... | @@ -257,6 +257,9 @@ test "" { |
| 257 | } | 257 | } |
| 258 | | 258 | |
| 259 | const WasmPageAllocator = struct { | 259 | const WasmPageAllocator = struct { |
| | 260 | // TODO: figure out why __heap_base cannot be found |
| | 261 | var heap_base_wannabe: [256]u8 = undefined; |
| | 262 | |
| 260 | const FreeBlock = struct { | 263 | const FreeBlock = struct { |
| 261 | offset: usize = 0, | 264 | offset: usize = 0, |
| 262 | packed_data: std.PackedIntSlice(u1) = std.PackedIntSlice(u1).init(&[_]u8{}, 0), | 265 | packed_data: std.PackedIntSlice(u1) = std.PackedIntSlice(u1).init(&[_]u8{}, 0), |
| ... | @@ -349,7 +352,8 @@ const WasmPageAllocator = struct { | ... | @@ -349,7 +352,8 @@ const WasmPageAllocator = struct { |
| 349 | | 352 | |
| 350 | if (free_end > free_start) { | 353 | if (free_end > free_start) { |
| 351 | if (conventional.totalPages() == 0) { | 354 | if (conventional.totalPages() == 0) { |
| 352 | conventional.initData(__heap_base[0..@intCast(usize, @"llvm.wasm.memory.size.i32"(0) * std.mem.page_size)]); | 355 | //conventional.initData(__heap_base[0..@intCast(usize, @"llvm.wasm.memory.size.i32"(0) * std.mem.page_size)]); |
| | 356 | conventional.initData(heap_base_wannabe[0..]); |
| 353 | } | 357 | } |
| 354 | | 358 | |
| 355 | if (free_start < conventional.totalPages()) { | 359 | if (free_start < conventional.totalPages()) { |