Commit 8c1c67bdd0

Andrew Kelley <andrew@ziglang.org>
2022-11-12 06:59:39
stage2: take advantage of the new WasmAllocator
1 parent 3dcdd55
Changed files (1)
src/main.zig
@@ -152,8 +152,14 @@ var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{
 pub fn main() anyerror!void {
     crash_report.initialize();
 
-    const use_gpa = build_options.force_gpa or !builtin.link_libc;
+    const use_gpa = (build_options.force_gpa or !builtin.link_libc) and builtin.os.tag != .wasi;
     const gpa = gpa: {
+        if (builtin.os.tag == .wasi) {
+            break :gpa Allocator{
+                .ptr = undefined,
+                .vtable = &std.heap.WasmAllocator.vtable,
+            };
+        }
         if (use_gpa) {
             break :gpa general_purpose_allocator.allocator();
         }