stage3: unify to cleanup; MIR return-defer; docs+smokes updated; LLVM(harness): finalize_phis ownership, ret.py simplified, uses-predeclare; cleanup return override green; method-postfix cleanup return WIP (PHI head)

This commit is contained in:
Selfhosting Dev
2025-09-19 02:07:38 +09:00
parent 951a050592
commit 5e818eeb7e
205 changed files with 9671 additions and 1849 deletions

View File

@ -16,7 +16,7 @@ Statements (`StmtV0`)
- `Loop { cond, body: Stmt[] }` (Stage2; while(cond) body)
- `Break` (Stage3; exits current loop)
- `Continue` (Stage3; jumps to loop head)
- `Try { try: Stmt[], catches?: Catch[], finally?: Stmt[] }` (Stage3 skeleton; currently lowered as sequential `try` body only when runtime support is absent)
- `Try { try: Stmt[], catches?: Catch[], finally?: Stmt[] }` (Stage3 skeleton; surface syntax uses `cleanup`, but the v0 field name remains `finally` for compatibility; currently lowered as sequential `try` body only when runtime support is absent)
Expressions (`ExprV0`)
- `Int { value }` where `value` is JSON number or digit string
@ -41,6 +41,7 @@ PHI mergingPhase15 終盤の方針)
- MIR 生成層は PHI を生成しないMIR13 運用。If/Loop の合流は LLVM 層llvmlite/Resolverが PHI を合成。
- ループは既存 CFGpreheader→cond→{body|exit}; body→condの検出により、ヘッダ BB で搬送値の PHI を構築。
- 将来LoopForm= MIR18では LoopForm 占位命令から逆 Lowering で PHI を自動化予定。
- PHIoff 運用Builder 側の規約): merge 内に copy を置かず、then/else の pred へ edge_copy のみを挿入selfcopy は NoOp。usebeforedef と重複 copy を原理的に回避する。
Type meta (emitter/LLVM harness cooperation)
- `+` with any string operand → string concat pathhandle固定
@ -81,4 +82,4 @@ If with local + PHI merge
]}
```
- `Break` / `Continue` are emitted when Stage3 gate is enabled. When the bridge is compiled without Stage3 lowering, frontends may degrade them into `Expr(Int(0))` as a safety fallback.
- `Try` nodes include optional `catches` entries of the form `{ param?: string, typeHint?: string, body: Stmt[] }`. Until runtime exception semantics land, downstream lowers only the `try` body and ignores handlers/finally.
- `Try` nodes include optional `catches` entries of the form `{ param?: string, typeHint?: string, body: Stmt[] }`. Until runtime exception semantics land, downstream lowers only the `try` body and ignores handlers/`finally`.