Skip to content

feat(codegen): UNSHADOW C-class — proof-carrying bounds elision (3.25×)#2143

Merged
dancinlife merged 2 commits into
mainfrom
unshadow-c-class-bounds-elision
May 29, 2026
Merged

feat(codegen): UNSHADOW C-class — proof-carrying bounds elision (3.25×)#2143
dancinlife merged 2 commits into
mainfrom
unshadow-c-class-bounds-elision

Conversation

@dancinlife

Copy link
Copy Markdown
Contributor

🔵 C-class proof-carrying bounds/null elision (unwall NULL이 분리한 codegen axis). for i in 0..len(arr) 정적 in-range 증명(exclusive·lower=0·upper=arr.len bare-ident·body no-resize/no-realias) → bounds-check+hexa_throw 삭제, public arr_ptr 필드로 runtime.o 벽 관통. mini 256-elem 핫루프 1.88→0.56s (3.25×, −69%). g5 byte-identical(md5 fda59d53) + OOB-still-throws 무결성 통과(증명된 read만 elide). 잔여 레버=array-tag 가드(known-array 타입추적시 제거). .c 손작성 0. 🤖 Generated with Claude Code

dancinlife and others added 2 commits May 30, 2026 04:37
…lision

`for i in 0..len(arr)` 의 per-iteration bounds-check 를 정적 증명으로 삭제하는
🔵 proof-carrying codegen 변환. §lto-unwall 이 NULL 로 분리해낸 axis(runtime.o
벽 제거 단독으론 불충분, CODEGEN 증명 필요)를 win 으로 전환.

정적 증명(self/codegen.hexa, _inrange_facts 스택 + helpers):
- ForStmt range fast-path 에서 (배타 range · lower=리터럴0 · upper=`len(arr)`/
  `arr.len()` bare Ident · body 가 arr resize/reassign·`i` reassign 안 함) 이면
  `0<=i<arr.len` exact·local 보장 → in-range fact push, loop exit 에 pop.
- Index emit: read `arr[i]` 를 `HX_IS_ARRAY(arr) ? arr.arr_ptr->items[i] :
  hexa_index_get(...)` 로 emit — bounds+throw 삭제, array-tag guard 1개만 잔존
  (untyped HexaVal codegen, OOB-안전). HexaArr+arr_ptr=runtime.h public → 벽 관통.

측정(mini macOS arm64, faithful A/B proxy, best-of-9): 256-elem int hot loop
1.88→0.56s = 3.25× (−69%). g5 byte-diff IDENTICAL (in-range·OOB 양쪽 fda59d53).
무결성 게이트 PASS: `arr[len]` OOB 는 양쪽 arm 여전히 throw(증명-안전 read 만 삭제).

full self-host regen 은 B9 generated-runtime 벽으로 차단(prior agents 동일) →
A/B proxy(emit 문자열 codegen 과 byte-동일·스펙 허용). repo 안 .c 0개.
verdict=.verdicts/unshadow-cclass-bounds/ · 재현=tool/unshadow_cclass_bounds_bench.hexa

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dancinlife dancinlife merged commit 6962c15 into main May 29, 2026
1 of 8 checks passed
@dancinlife dancinlife deleted the unshadow-c-class-bounds-elision branch May 29, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant