Phase 2: heap, regions and allocation budgets (RFC 0008)
- air: own<T>, own_array<T>, region, alloc_error; own.new/array/take/ free, region.create/new/array/reset/destroy; mem.alloc budget form; linear contents of owners gated by linear_aggregates - verifier: allocation types and capability kind (E1001, E3201), mem.alloc effect (E3101), ok/err counts; borrow-typed block params checked in the CFG stage with the region-allocation exception; linear owners and regions (E3002, E3001, E2001, E2002, E2101); region allocations as disjoint exclusive children of the shared region borrow; E2104 when reset/destroy would invalidate a live reference - interp: live-byte budgets charged along the narrowing chain, shared by copies, mandatory in the deterministic profile; heap cells; regions return quota only on reset/destroy - conformance: 25 heap/region tests including a 64 KiB region file copy; 4000 mutants without a crash
This commit is contained in:
1 parent
b8d4ab4d4c
commit
7f4ce71d44
38 files changed
+1341
-48
No files matched your search
@@ -105,6 +105,12 @@ pub fn printType(m: air.Module, t: air.Type, w: *Writer) Writer.Error!void {
|
||||
.cap => |k| try w.print("cap<{s}>", .{air.authority.kinds[k].name}),
|
||||
.builtin => |b| try w.writeAll(@tagName(b)),
|
||||
.resource => |r| try w.writeAll(r.text()),
|
||||
.own, .own_array => |inner| {
|
||||
try w.print("{s}<", .{@tagName(t)});
|
||||
try printType(m, inner.*, w);
|
||||
try w.writeByte('>');
|
||||
},
|
||||
.region => try w.writeAll("region"),
|
||||
.bool, .void, .never => try w.writeAll(@tagName(t)),
|
||||
}
|
||||
}
|
||||
@@ -286,6 +292,34 @@ fn printOp(m: air.Module, f: air.Function, op: air.Op, w: *Writer) Writer.Error!
|
||||
try values(f, x.args, w);
|
||||
if (x.ok) |ok| try w.print(", ok -> @{s}, err -> @{s}", .{ f.blocks[ok].name, f.blocks[x.err.?].name });
|
||||
},
|
||||
.own_new => |x| {
|
||||
try two(f, w, "own.new", x.value, x.cap);
|
||||
try okErr(f, w, x.ok, x.err);
|
||||
},
|
||||
.own_array => |x| {
|
||||
try two(f, w, "own.array", x.n, x.value);
|
||||
try w.writeAll(", ");
|
||||
try value(f, x.cap, w);
|
||||
try okErr(f, w, x.ok, x.err);
|
||||
},
|
||||
.own_take => |v| try one(f, w, "own.take", v),
|
||||
.own_free => |v| try one(f, w, "own.free", v),
|
||||
.region_create => |x| {
|
||||
try one(f, w, "region.create", x.cap);
|
||||
try okErr(f, w, x.ok, x.err);
|
||||
},
|
||||
.region_new => |x| {
|
||||
try two(f, w, "region.new", x.region, x.value);
|
||||
try okErr(f, w, x.ok, x.err);
|
||||
},
|
||||
.region_array => |x| {
|
||||
try two(f, w, "region.array", x.region, x.n);
|
||||
try w.writeAll(", ");
|
||||
try value(f, x.value, w);
|
||||
try okErr(f, w, x.ok, x.err);
|
||||
},
|
||||
.region_reset => |v| try one(f, w, "region.reset", v),
|
||||
.region_destroy => |v| try one(f, w, "region.destroy", v),
|
||||
.cap_narrow => |x| {
|
||||
try w.print("cap.narrow.{s} ", .{x.form});
|
||||
try value(f, x.cap, w);
|
||||
@@ -298,6 +332,10 @@ fn printOp(m: air.Module, f: air.Function, op: air.Op, w: *Writer) Writer.Error!
|
||||
}
|
||||
}
|
||||
|
||||
fn okErr(f: air.Function, w: *Writer, ok: u32, err: u32) Writer.Error!void {
|
||||
try w.print(", ok -> @{s}, err -> @{s}", .{ f.blocks[ok].name, f.blocks[err].name });
|
||||
}
|
||||
|
||||
fn one(f: air.Function, w: *Writer, op: []const u8, a: air.ValueId) Writer.Error!void {
|
||||
try w.print("{s} ", .{op});
|
||||
try value(f, a, w);
|
||||
|
||||
Reference in new issue
Block a user