authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-11-11 22:59:39-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-12-06 12:15:04-07:00
log8c1c67bdd0a636006e7ddbc14da8c2484b131df7
treedbbc0bed26a1ae47764bc632e7d801e680e03e43
parent3dcdd5544faf9891e2e20391f4da2b42381f79ba

stage2: take advantage of the new WasmAllocator


1 files changed, 7 insertions(+), 1 deletions(-)

src/main.zig+7-1
......@@ -152,8 +152,14 @@ var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{
152152pub fn main() anyerror!void {
153153 crash_report.initialize();
154154
155 const use_gpa = build_options.force_gpa or !builtin.link_libc;
155 const use_gpa = (build_options.force_gpa or !builtin.link_libc) and builtin.os.tag != .wasi;
156156 const gpa = gpa: {
157 if (builtin.os.tag == .wasi) {
158 break :gpa Allocator{
159 .ptr = undefined,
160 .vtable = &std.heap.WasmAllocator.vtable,
161 };
162 }
157163 if (use_gpa) {
158164 break :gpa general_purpose_allocator.allocator();
159165 }