From 00c41ff49d846b61997f7be7ce75793c5f677f0c Mon Sep 17 00:00:00 2001 From: zinc Date: Wed, 14 Oct 2026 16:40:41 +0330 Subject: rt: note the two definitions of a heap block's length (bnd recipe, paylen) --- src/runtime/rt.zc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/runtime/rt.zc') diff --git a/src/runtime/rt.zc b/src/runtime/rt.zc index 7089e26..f1414e4 100644 --- a/src/runtime/rt.zc +++ b/src/runtime/rt.zc @@ -87,6 +87,10 @@ enhance ishl(a, b) micro "a = shl a b"; enhance lfa(k) micro "r1 = ld 589824; k = add r1 k"; // 1 when i is outside 0..n-1 (the unsigned compare also catches negative i), else 0. enhance outside(i, n) micro "i = ltu i n; i = xor i 1"; +//: the block length has exactly two definitions, which must agree: the r7 lines of this +//: recipe (the inline check on every backend; the x86-64 and arm64 jits lower it to +//: registers, with nothing pointer-specific of their own) and paylen below (bchk's report). +//: an exact-size check or a new header layout changes those two places and nothing else. // the index check of a pointer, as one instruction: 1 when p is the start of a heap // block (its check word p[-3] is p ^ MAGIC) and the byte or word offset i * m is not // inside the block's payload (q units per word: 1 for word elements, 8 for packed -- cgit v1.2.3