Fix two toolchain defects found by the M checkpoint
A. Interpreter memory grew with the number of executed steps (one arena, never reclaimed): block and call arguments, frames, frame storage, value copies, place paths, channel buffers and per-step scratch now live in a collectable execution heap. Between instructions, past a threshold, the live state is copied into a fresh heap (sharing preserved) and the old one released. Long-lived state (module, world, authority, task, channel and region tables, the result) stays in the caller's arena. The guarded value of a mutex is a separate cell (no interior pointers). Nothing observable changes: fuel, schedule, PRNG, values, traps and run records are the same. - test: five loop shapes x 100k/1M/4M iterations, measured with the interpreter's own heap counters: live state after a collection does not grow with the iteration count; the heap stays under a fixed bound - conformance --collect-every-step: the second run of every run test collects before every instruction; records must be byte-identical (passes, also with --stress 20) B. A void function whose body ends in an if/if-else/match/block/void call lowered to `ret %` (malformed AIR, reported as E0001): it now lowers to `ret`. Seven fall-through tests (six failed before). Also: files_opened counts reads by relative path and file name; P6A-11 (malformed generated AIR as an internal compiler diagnostic) and Q-023 (ref of a whole array as an argument) recorded.
This commit is contained in:
1 parent
4aa9183e78
commit
222c0c884c
15 files changed
+573
-48
No files matched your search
@@ -1,6 +1,6 @@
|
||||
//! Conformance suite runner. Format: tests/conformance/README.md.
|
||||
//!
|
||||
//! usage: aji-conformance <dir> [--json] [--filter <substring>] [--stress <seeds>]
|
||||
//! usage: aji-conformance <dir> [--json] [--filter <substring>] [--stress <seeds>] [--collect-every-step]
|
||||
//!
|
||||
//! `--stress N` (P3-12): every test with a `schedules:` header runs schedule
|
||||
//! seeds 0 … N-1 under each quantum of `stress_quanta` and its own quantum,
|
||||
@@ -65,7 +65,7 @@ pub fn main(init: std.process.Init) !void {
|
||||
const args = try init.minimal.args.toSlice(arena);
|
||||
|
||||
if (args.len < 2) {
|
||||
std.debug.print("usage: aji-conformance <dir> [--json] [--filter <substring>] [--stress <seeds>]\n", .{});
|
||||
std.debug.print("usage: aji-conformance <dir> [--json] [--filter <substring>] [--stress <seeds>] [--collect-every-step]\n", .{});
|
||||
std.process.exit(2);
|
||||
}
|
||||
const root = args[1];
|
||||
@@ -78,6 +78,8 @@ pub fn main(init: std.process.Init) !void {
|
||||
} else if (std.mem.eql(u8, args[i], "--filter") and i + 1 < args.len) {
|
||||
i += 1;
|
||||
filter = args[i];
|
||||
} else if (std.mem.eql(u8, args[i], "--collect-every-step")) {
|
||||
collect_every_step = true;
|
||||
} else if (std.mem.eql(u8, args[i], "--stress") and i + 1 < args.len) {
|
||||
i += 1;
|
||||
stress_seeds = std.fmt.parseInt(u64, args[i], 10) catch {
|
||||
@@ -134,6 +136,9 @@ pub fn main(init: std.process.Init) !void {
|
||||
|
||||
/// Seeds per quantum under `--stress`; null runs each test's `schedules:`.
|
||||
var stress_seeds: ?u64 = null;
|
||||
/// The second of the two runs of every `run` test collects the execution
|
||||
/// heap before every instruction; the run records must still be identical.
|
||||
var collect_every_step = false;
|
||||
|
||||
/// Quanta of the stress mode: forced yield after every instruction, short
|
||||
/// and odd slices (spec 04 §36.3); the test's own quantum is added.
|
||||
@@ -310,7 +315,7 @@ fn runSeed(arena: std.mem.Allocator, module: aji.air.Module, want: Expect.Run, h
|
||||
var records: [2][]const u8 = undefined;
|
||||
var outcome: aji.interp.Outcome = undefined;
|
||||
var output: aji.interp.Output = undefined;
|
||||
for (&records) |*rec| {
|
||||
for (&records, 0..) |*rec, k| {
|
||||
outcome = aji.interp.run(arena, module, "main", .{
|
||||
.fuel = header.fuel,
|
||||
.grants = header.grants,
|
||||
@@ -318,6 +323,7 @@ fn runSeed(arena: std.mem.Allocator, module: aji.air.Module, want: Expect.Run, h
|
||||
.output = &output,
|
||||
.quantum = header.quantum,
|
||||
.task_limit = header.task_limit,
|
||||
.collect_every_step = collect_every_step and k == 1,
|
||||
.schedule_seed = schedule_seed,
|
||||
}) catch |err| switch (err) {
|
||||
error.EntryNotFound => return .{ .outcome = .fail, .detail = "module has no @main whose parameters are all capabilities" },
|
||||
|
||||
Reference in new issue
Block a user