From 61a2ee522164c03bf4eb560b071f7a257e53bb8a Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Thu, 13 Aug 2026 08:35:48 +0900 Subject: [PATCH] ww: preserve fallible graph allocation in self-host --- selfhost/cmd/ww/main.ww | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/selfhost/cmd/ww/main.ww b/selfhost/cmd/ww/main.ww index e5ce4c9c..6822b77f 100644 --- a/selfhost/cmd/ww/main.ww +++ b/selfhost/cmd/ww/main.ww @@ -993,6 +993,18 @@ fn sepallocptrs(cap: i32) ([]*u8 | nomem) = { return value; }; +fn sepallocgraph(pkg: []seppkg, context: []sepcontext) (*sepgraph | nomem) = { + let value: *sepgraph = alloc(sepgraph{ + pkg = pkg, + n = 0, + context = context, + ncontext = 0, + supportcontext = -1, + identityfailed = false, + })?; + return value; +}; + fn sepmakeints(count: i32, out: *[]i32) bool = { if (count < 0) { sepfailsize(); @@ -3613,14 +3625,8 @@ fn buildonesepimpl(selfdir: *u8, src: *u8, entryisdir: i32, let pkgslot: []seppkg; let contextslot: []sepcontext; - let graphallocation: (*sepgraph | nomem) = alloc(sepgraph{ - pkg = pkgslot, - n = 0, - context = contextslot, - ncontext = 0, - supportcontext = -1, - identityfailed = false, - }); + let graphallocation: (*sepgraph | nomem) = sepallocgraph(pkgslot, + contextslot); let g: *sepgraph; match (graphallocation) { case let value: *sepgraph => g = value;