feat(codegen): UNSHADOW C-class — proof-carrying bounds elision (3.25×)#2143
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔵 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 삭제, publicarr_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