From 7ff224faa88725fe59441e73c70dfa4eedd76345 Mon Sep 17 00:00:00 2001 From: zinc Date: Thu, 15 Oct 2026 02:39:49 +0330 Subject: o3: break and continue out of an o3 { } block call rt.o3_leave for each block they leave (the loop records the o3 depth it began at), so the depth returns to 0 and pending collections and drops run; spec 4.10.3, o3_break_continue_leave.zc --- docs/SPEC.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/SPEC.md') diff --git a/docs/SPEC.md b/docs/SPEC.md index bb0f44f..c80b220 100644 --- a/docs/SPEC.md +++ b/docs/SPEC.md @@ -624,7 +624,7 @@ switch (s) { case circle(r): pn(r); case rect(w, h): pn(w * h); case dot: ps("do o3 int sum(fixed int[?] a) { int s = 0; for (int i = 0; i < len(a); i++) s += a[i]; return s; } ``` -4.10.3 no collection runs inside an o3 region, from any code path. an allocation that would collect grows the heap instead and leaves a collection pending; an explicit `rt.gc()` inside the region is pending too. when the outermost region is left (the end of an `o3 { }` block, a `return` out of it, or the return of an o3 function called from normal code), the pending collection runs once. if the heap can't grow, the allocation is a runtime trap (out of heap memory, exit status 2). +4.10.3 no collection runs inside an o3 region, from any code path. an allocation that would collect grows the heap instead and leaves a collection pending; an explicit `rt.gc()` inside the region is pending too. when the outermost region is left (the end of an `o3 { }` block, a `return`, `break` or `continue` out of it, or the return of an o3 function called from normal code), the pending collection runs once. if the heap can't grow, the allocation is a runtime trap (out of heap memory, exit status 2). 4.10.4 drops (6.15) don't run inside o3: setting a drop inside an o3 region is error: a drop can't be set inside an o3 region, and ending the lifetime of a value with a drop inside an o3 region, by `rt.free`, at a scope end, or as a temporary, is error: x: has drop and can't end inside an o3 region. a drop the compiler can't see (unchecked code) that comes to run inside o3 stops the program: zy: a drop can't run inside an o3 region. ### 4.11 memdebug -- cgit v1.2.3