2025-09-08 11:35:30 +09:00
|
|
|
|
# Self Current Task — Now (main)
|
|
|
|
|
|
|
2025-12-07 01:45:03 +09:00
|
|
|
|
## 2025‑12‑06:現状サマリ
|
|
|
|
|
|
|
|
|
|
|
|
### JoinIR / Loop / If ライン
|
|
|
|
|
|
|
|
|
|
|
|
- LoopBuilder は Phase 186‑187 で完全削除済み。**JoinIR が唯一の loop lowering 経路**。
|
|
|
|
|
|
- LoopPattern 系は Pattern1–4 まで実装・本線化済み:
|
|
|
|
|
|
- Pattern1: Simple While
|
|
|
|
|
|
- Pattern2: Loop with Break
|
|
|
|
|
|
- Pattern3: Loop with If‑Else PHI(break/continue なし)
|
|
|
|
|
|
- Pattern4: Loop with Continue(multi‑carrier 対応)
|
|
|
|
|
|
- Exit/Carrier/Boundary ラインは次の箱で SSOT 化:
|
|
|
|
|
|
- `CarrierInfo` / `ExitMeta` / `ExitBindingBuilder`
|
|
|
|
|
|
- `JoinInlineBoundary` + `LoopExitBinding`
|
|
|
|
|
|
- If lowering は IfSelectLowerer/IfMergeLowerer を中心に整理済み。Select/PHI の扱いも Phase 189 系で橋渡し済み。
|
|
|
|
|
|
- 残課題(JoinIR ライン):
|
|
|
|
|
|
- JoinIR→MIR merge の一般化(複雑な Select/PHI パターンの統合)
|
|
|
|
|
|
- JsonParserBox など実アプリ側での長期運用テスト
|
2025-12-13 22:37:56 +09:00
|
|
|
|
|
|
|
|
|
|
### Phase 86: Carrier Init Builder + Error Tags (2025-12-13) ✅
|
|
|
|
|
|
|
|
|
|
|
|
**Status**: COMPLETE - SSOT 確立完了
|
|
|
|
|
|
|
|
|
|
|
|
**Achievements**:
|
|
|
|
|
|
- Carrier Initialization Builder: CarrierInit → ValueId 生成を単一関数化 (carrier_init_builder.rs, +8 tests)
|
|
|
|
|
|
- Error Message Centralization: JoinIR エラータグを SSOT 化 (error_tags.rs, +5 tests)
|
|
|
|
|
|
- DebugOutputBox Migration: 全 JOINIR_DEBUG 使用箇所を DebugOutputBox に統一
|
|
|
|
|
|
|
|
|
|
|
|
**Impact**:
|
|
|
|
|
|
- Tests: 987/987 PASS (+13 unit tests from Phase 86)
|
|
|
|
|
|
- SSOT modules: carrier_init_builder, error_tags (一貫性向上)
|
|
|
|
|
|
- Code quality: Single Responsibility, Testability First principles validated
|
|
|
|
|
|
|
|
|
|
|
|
**Reference**: phase78-85-boxification-feedback.md, carrier_init_builder.rs, error_tags.rs
|
2025-12-07 01:45:03 +09:00
|
|
|
|
|
feat(llvm): Phase 87 - LLVM exe line SSOT + integration smoke
Established single pipeline for .hako → executable generation.
SSOT: tools/build_llvm.sh
- Standard procedure: build_llvm.sh input.hako -o output_exe
- Prerequisites: llvm-config-18, llvmlite, LLVM features enabled
- Pipeline: .hako → MIR → LLVM IR → .o → executable
New files:
- docs: phase87-selfhost-llvm-exe-line.md (SSOT procedure doc)
* Full troubleshooting guide (llvm-config, llvmlite, linking)
* Advanced usage (custom output, debugging, performance notes)
* Anti-patterns documentation (no duplication/fragmentation)
- fixture: apps/tests/phase87_llvm_exe_min.hako (5 lines, return 42)
- smoke: integration/apps/phase87_llvm_exe_min.sh
* Exit code verification (stdout-independent testing)
* SKIP if LLVM unavailable (graceful degradation)
* Integration profile only (not in quick)
- index: 10-Now.md, 01-JoinIR-Selfhost-INDEX.md (Phase 87 entries)
- task: CURRENT_TASK.md (Phase 74-87 status update)
Integration smoke: demonstrates full pipeline
- Build: .hako → .o → exe (successful ✅)
- Runtime: Ring0 initialization issue (known limitation, out of scope)
Quick profile: unchanged (integration only, per policy)
Policy: No duplicate build paths, SSOT maintained
987/987 tests PASS (production stable)
2025-12-13 22:51:13 +09:00
|
|
|
|
### Phase 87: LLVM Exe Line SSOT (2025-12-13) ✅
|
|
|
|
|
|
|
|
|
|
|
|
**Status**: COMPLETE - Pipeline 確立完了
|
|
|
|
|
|
|
|
|
|
|
|
**Achievements**:
|
|
|
|
|
|
- SSOT established: `tools/build_llvm.sh` - Single pipeline for .hako → executable
|
|
|
|
|
|
- Integration smoke: phase87_llvm_exe_min.sh (exit code 42 verification)
|
|
|
|
|
|
- Minimal fixture: apps/tests/phase87_llvm_exe_min.hako (5 lines, return 42)
|
|
|
|
|
|
- Full documentation: phase87-selfhost-llvm-exe-line.md (troubleshooting + advanced usage)
|
|
|
|
|
|
|
|
|
|
|
|
**Policy**:
|
|
|
|
|
|
- ✅ Use build_llvm.sh SSOT (no duplication/fragmentation)
|
|
|
|
|
|
- ✅ Integration smoke only (not in quick profile)
|
|
|
|
|
|
- ✅ SKIP if LLVM unavailable (graceful degradation)
|
|
|
|
|
|
- ✅ Exit code verification (stdout-independent testing)
|
|
|
|
|
|
|
|
|
|
|
|
**Impact**:
|
|
|
|
|
|
- Standard procedure: `tools/build_llvm.sh input.hako -o output_exe`
|
|
|
|
|
|
- Prerequisites documented: llvm-config-18, llvmlite, LLVM features
|
|
|
|
|
|
- Integration test: PASS (or SKIP if no LLVM)
|
|
|
|
|
|
|
|
|
|
|
|
**Reference**: phase87-selfhost-llvm-exe-line.md
|
|
|
|
|
|
|
2025-12-14 02:31:39 +09:00
|
|
|
|
### Phase 88: Continue + 可変ステップ (2025-12-14) ✅
|
|
|
|
|
|
|
|
|
|
|
|
**Status**: COMPLETE - dev-only fixture 固定完了
|
|
|
|
|
|
|
|
|
|
|
|
**Achievements**:
|
|
|
|
|
|
- continue + 可変ステップ(i=i+const 差分加算)を dev-only fixture で固定
|
|
|
|
|
|
- continue 分岐側での acc 更新を許可
|
|
|
|
|
|
- Fail-Fast 仕様固定(非 const の i 更新を拒否)
|
|
|
|
|
|
- StepCalculator Box 抽出(+6 unit tests、再利用可能な純関数設計)
|
|
|
|
|
|
- エラーメッセージ詳細化(Expected/Found/Hint 形式)
|
|
|
|
|
|
|
|
|
|
|
|
**Impact**:
|
|
|
|
|
|
- Tests: 993 lib tests PASS, 60 normalized_dev tests PASS
|
|
|
|
|
|
- 箱化スコア: 9/10(Phase 33 Box 理論の模範実装)
|
|
|
|
|
|
- コード削減: 5%(321→305行、重複ロジック削除)
|
|
|
|
|
|
|
|
|
|
|
|
**Reference**:
|
|
|
|
|
|
- continue_pattern.rs, step_calculator.rs
|
|
|
|
|
|
- jsonparser_unescape_string_step2_min.program.json
|
|
|
|
|
|
|
|
|
|
|
|
### Phase 89 P0: Continue + Early Return Pattern Detector (2025-12-14) ✅
|
|
|
|
|
|
|
|
|
|
|
|
**Status**: COMPLETE - Dev-only detector 確立完了
|
|
|
|
|
|
|
|
|
|
|
|
**Achievements**:
|
|
|
|
|
|
- Pattern4 detector 締め(Select 必須 + conditional Jump exactly 1)
|
|
|
|
|
|
- LoopPattern::ContinueReturn enum 追加
|
|
|
|
|
|
- NormalizedDevShape::PatternContinueReturnMinimal 追加(detector: Select + conditional Jumps >= 2)
|
|
|
|
|
|
- Fail-Fast: UnimplementedPattern error(フォールバックなし)
|
|
|
|
|
|
- canonical には入れない(dev-only、誤爆防止)
|
|
|
|
|
|
|
|
|
|
|
|
**Impact**:
|
|
|
|
|
|
- Pattern4 誤爆防止(continue+return を正しく区別)
|
|
|
|
|
|
- Tests: 987 lib tests PASS
|
|
|
|
|
|
|
|
|
|
|
|
**Reference**:
|
|
|
|
|
|
- shape_guard.rs, loop_patterns/mod.rs, analysis.rs
|
|
|
|
|
|
- pattern_continue_return_min.program.json (fixture)
|
|
|
|
|
|
|
|
|
|
|
|
### Phase 89 P1: ContinueReturn Lowering Implementation (2025-12-14) ✅
|
|
|
|
|
|
|
|
|
|
|
|
**Status**: COMPLETE - 独立箱実装完了
|
|
|
|
|
|
|
|
|
|
|
|
**Achievements**:
|
|
|
|
|
|
- continue_return_pattern.rs 実装(457行、StepCalculator 再利用)
|
|
|
|
|
|
- Continue + Early Return の JoinIR lowering(loop 内 return 対応)
|
|
|
|
|
|
- Fail-Fast 原則徹底(5箇所検証)
|
|
|
|
|
|
- fixtures.rs に build_pattern_continue_return_min 追加
|
|
|
|
|
|
- normalized_dev tests +2(vm_bridge + 期待値 n=10→acc=4)
|
|
|
|
|
|
|
|
|
|
|
|
**Impact**:
|
|
|
|
|
|
- Tests: 993 lib tests PASS, 61 normalized_dev tests PASS (+2)
|
|
|
|
|
|
- 箱化原則:単一責任・境界明確・再利用性高
|
|
|
|
|
|
|
|
|
|
|
|
**Reference**:
|
|
|
|
|
|
- continue_return_pattern.rs, fixtures.rs
|
|
|
|
|
|
- tests/normalized_joinir_min/shapes.rs
|
2025-12-14 00:59:58 +09:00
|
|
|
|
|
2025-12-13 17:26:15 +09:00
|
|
|
|
### Scope / BindingId(dev-only の段階移行ライン)
|
|
|
|
|
|
|
|
|
|
|
|
- MIR builder 側で lexical scope / shadowing を実在化し、言語仕様の “local はブロック境界で分離” を SSOT に揃えた。
|
|
|
|
|
|
- JoinIR lowering 側は name-based から BindingId-based へ段階移行中:
|
|
|
|
|
|
- `ScopeManager.lookup_with_binding()` / `ConditionEnv.binding_id_map` を導入し、shadowing を壊さずに解決できる足場を作った。
|
|
|
|
|
|
- promoted carriers(DigitPos/Trim)については `BindingId(original) → BindingId(promoted) → ValueId(join)` の鎖を dev-only で整備中。
|
2025-12-14 00:05:16 +09:00
|
|
|
|
- Phase 86 で `carrier_init_builder` / `error_tags` を SSOT 化し、段階移行ラインの基盤(ValueId 生成とエラー語彙)が確立した。
|
|
|
|
|
|
- これにより、BindingId dual-path の拡張・統合時に「生成」と「表示」の責務が混ざらない構造が固定された。
|
2025-12-13 18:46:07 +09:00
|
|
|
|
- Phase 81 で Pattern2(DigitPos/Trim)の ExitLine 契約(ConditionOnly を exit PHI から除外、LoopState のみを reconnect)を E2E で固定した。
|
2025-12-13 17:26:15 +09:00
|
|
|
|
- 参照:
|
|
|
|
|
|
- `docs/development/current/main/phase73-scope-manager-design.md`
|
|
|
|
|
|
- `docs/development/current/main/phase78-bindingid-promoted-carriers.md`
|
|
|
|
|
|
- `docs/development/current/main/phase80-bindingid-p3p4-plan.md`
|
2025-12-13 18:46:07 +09:00
|
|
|
|
- `docs/development/current/main/phase81-pattern2-exitline-contract.md`
|
docs(joinir): Phase 78-85 Boxification Feedback Report
Comprehensive analysis of boxification patterns effectiveness.
Key Findings:
- Overall: Exceptional success ⭐⭐⭐⭐⭐ (24/25 avg rating)
- Net code reduction: -1,388 lines (Phase 78-79: -530L, Phase 85: -858L)
- 4 new Boxes: PromotedBindingRecorder, Detector/Recorder, BindingMapProvider, DebugOutputBox
- 28 new unit tests, 974/974 PASS maintained
Box Ratings (out of 25):
- PromotedBindingRecorder: 24/25 (67% wiring reduction)
- Detector/Recorder: 24/25 (60% code reduction, SRP)
- BindingMapProvider: 23/25 (80% cfg reduction)
- DebugOutputBox: 21/25 (centralized debug output)
Phase 86 Recommendations:
- GO: Carrier Initialization Builder (HIGH, 2-3h, -100L)
- GO: Remaining DebugOutputBox Migration (QUICK, 30m)
- GO: Error Message Centralization (LOW, 1-2h)
- NO-GO: Detector/Promoter Pipeline (over-abstraction risk)
- NO-GO: ScopeManager Lookup Variants (premature)
Lessons Learned:
- Single Responsibility principle validated
- Testability-first approach successful
- Low migration cost (1-2h per phase)
- Zero production risk (all dev-only/backward-compatible)
Report: phase78-85-boxification-feedback.md (~1,200 lines)
Updated: INDEX, Now, architecture-overview (Phase 85 links)
2025-12-13 21:32:35 +09:00
|
|
|
|
- `docs/development/current/main/phase78-85-boxification-feedback.md`
|
2025-12-13 17:26:15 +09:00
|
|
|
|
|
2025-12-07 01:45:03 +09:00
|
|
|
|
### JsonParser / Selfhost depth‑2 ライン
|
|
|
|
|
|
|
|
|
|
|
|
- `selfhost_build.sh --json` で Program JSON v0 emit は安定。
|
|
|
|
|
|
`.hako` 側から env 経由で JSON を読む最小ループ(`program_read_min.hako`)は動作確認済み。
|
|
|
|
|
|
- JsonParserBox / BundleResolver のループ 21 本のうち:
|
|
|
|
|
|
- 18 本は Pattern1–4 で JoinIR 対応済み(Phase 162–165)。
|
|
|
|
|
|
- `_trim` を含む一部の複合ループは、ValueId 境界や Box 登録など残課題あり。
|
|
|
|
|
|
- BoolExprLowerer / condition_to_joinir で OR/AND/NOT 付き条件式の lowering は実装完了(Phase 168–169)。
|
|
|
|
|
|
- 残課題(JsonParser/selfhost depth‑2):
|
|
|
|
|
|
- JoinIR→MIR ValueId boundary の完全一般化(条件用 ValueId を含める)
|
|
|
|
|
|
- JsonParserBox の using / Box 登録(Rust VM 側での認識)
|
|
|
|
|
|
- Program JSON v0 を JsonParserBox 経由でフル解析する line の仕上げ
|
|
|
|
|
|
|
|
|
|
|
|
### Ring0 / Runtime / CoreServices ライン
|
|
|
|
|
|
|
|
|
|
|
|
- Ring0Context + Ring0Registry で OS API 抽象化レイヤ完成:
|
|
|
|
|
|
- MemApi / IoApi / TimeApi / LogApi / FsApi / ThreadApi
|
|
|
|
|
|
- RuntimeProfile(Default / NoFs) で条件付き必須を制御。
|
|
|
|
|
|
- CoreServices(ring1‑core)として次を実装済み:
|
|
|
|
|
|
- StringService / IntegerService / BoolService
|
|
|
|
|
|
- ArrayService / MapService / ConsoleService
|
|
|
|
|
|
- PluginHost 統合 + UnifiedBoxRegistry からの自動初期化
|
|
|
|
|
|
- FileBox / FileHandleBox ライン:
|
|
|
|
|
|
- Ring0FsFileIo 経由で read / write / append / metadata 完全対応
|
|
|
|
|
|
- Default プロファイルでは必須、NoFs プロファイルでは disabled。
|
|
|
|
|
|
- Logging ライン:
|
|
|
|
|
|
- ConsoleService(user‑facing)
|
|
|
|
|
|
- Ring0.log(internal/dev)
|
|
|
|
|
|
- println!(test 専用)
|
|
|
|
|
|
の 3 層が `logging_policy.md` で整理済み。JoinIR/Loop trace も同ドキュメントに集約。
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## 2025‑09‑08:旧スナップショット(参考)
|
|
|
|
|
|
|
2025-09-08 11:35:30 +09:00
|
|
|
|
- LLVM 側 P0 完了(BitOps/Array/Echo/Map 緑)。VInvoke(by‑name/by‑id vector) は戻り値マッピングの暫定課題を確認中(Decisions 参照)。
|
|
|
|
|
|
- selfhosting-dev の作業を main に順次取り込み。VM/MIR 基盤は main で先に整える方針。
|
|
|
|
|
|
|
2025-12-07 01:45:03 +09:00
|
|
|
|
直近タスク(当時)
|
2025-09-08 11:35:30 +09:00
|
|
|
|
1) continue/break の lowering(Builder 修正のみで表現)
|
|
|
|
|
|
- ループ文脈スタック {head, exit} を導入。
|
|
|
|
|
|
- continue に遭遇 → head(または latch)へ br を emit し終端。
|
|
|
|
|
|
- break に遭遇 → exit へ br を emit し終端。
|
|
|
|
|
|
- post‑terminated 後に emit しない制御を徹底。
|
|
|
|
|
|
2) ループ CFG の厳密化
|
|
|
|
|
|
- 単一 exit ブロックの徹底。
|
|
|
|
|
|
- Phi はヘッダでキャリー変数を合流(SSA/支配関係が崩れない形)。
|
|
|
|
|
|
3) 検証とスモーク
|
|
|
|
|
|
- Verifier 緑(dominance/SSA)。
|
|
|
|
|
|
- VM のループ代表(単純/ネスト/早期継続・脱出)。
|
|
|
|
|
|
- LLVM/Cranelift EXE に綺麗に降りる(br/phi ベースで問題なし)。
|
|
|
|
|
|
|
|
|
|
|
|
代表コマンド(例)
|
|
|
|
|
|
- ビルド: `cargo build --release`
|
|
|
|
|
|
- LLVM smoke: `LLVM_SYS_180_PREFIX=$(llvm-config-18 --prefix) NYASH_LLVM_BITOPS_SMOKE=1 ./tools/llvm_smoke.sh release`
|
|
|
|
|
|
- VInvoke 調査: `NYASH_LLVM_VINVOKE_TRACE=1 NYASH_LLVM_VINVOKE_SMOKE=1 ./tools/llvm_smoke.sh release`
|