|
|
4a48d6afa3
|
refactor(stage1): Phase 25.4-B準備 - Stage-1 CLI env処理改善
🎯 目的: Stage-1 CLI の env/トグル処理を整理・改善
✅ 改善内容:
- stage1_cli.hako: 関数名修正・簡略化
- パラメータ名を cli_args_raw に統一
- __mir__.log マーカー整備(デバッグ用)
- env処理のコメント改善
- string_helpers.hako: to_i64 改善
- null/Void ガード追加
- NYASH_TO_I64_DEBUG 対応
- NYASH_TO_I64_FORCE_ZERO トグル準備
- tools/stage1_debug.sh: デバッグ改善
- NYASH_TO_I64_DEBUG フラグ追加
- NYASH_TO_I64_FORCE_ZERO フラグ追加
- ログ観測の改善
- apps/tests/minimal_to_i64_void.hako: テストケース追加
- Void値の to_i64 処理確認用
📋 Phase 25.4-B への準備:
- 次フェーズで Stage1CliConfigBox を導入予定
- env.get() を Config 箱に集約する基盤完成
- 既存動作は維持(Fail-Fast + テスト緑キープ)
🎯 効果:
- デバッグ観測性向上
- Void/null 処理の安全性向上
- 将来の Config 箱化への準備完了
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-21 09:02:02 +09:00 |
|
|
|
380a724b9c
|
debug(stage1): Phase 25.1 - MIR Builder 型混乱バグ完全特定
🚨 重大発見: .hakoレベルでは修正不可能なMIR Builderバグ
🔍 根本原因特定:
- MIR Builder の型レジストリシステムが型情報を正しく追跡できていない
- new ArrayBox() で生成したValueIdが、誤った型として認識される
- PHIマージポイントで型情報が失われる/上書きされる
📊 系統的な型混乱パターン:
1. args.size() → ParserBox.size() (本来: ArrayBox.size())
2. cli_args.length() → ParserBox.length() (本来: ArrayBox.length())
3. new ArrayBox().size() → LoopOptsBox.size() (本来: ArrayBox.size())
❌ すべての.hako回避策が失敗:
- パラメータ名変更: args → cli_args → cli_args_raw
- 新しいArrayBox作成: local x = new ArrayBox()
- Fail-Fast Guard追加
→ すべて同じ型混乱エラー
✅ 決定的証拠:
- __mir__.log が一度も実行されなかった
→ エラーは MIR生成時に発生(実行時ではない)
→ .hakoコードの問題ではない
📋 成果物:
- __mir__.log マーカー追加 (lang/src/runner/stage1_cli.hako)
- stage1_main 入口ログ
- env toggles ログ
- args.size() 前後ログ
- StringHelpers.to_i64 改善 (lang/src/shared/common/string_helpers.hako)
- null/Void ガード追加
- デバッグログ追加
- 完全調査レポート:
- stage1_mir_builder_type_confusion_bug.md (最終レポート)
- stage1_mir_log_investigation.md (詳細調査ログ)
🔧 必要な修正 (推定6-10時間):
Phase 1: デバッグトレース追加 (30分)
- src/mir/builder/types/mod.rs に NYASH_MIR_TYPE_TRACE
Phase 2: トレース実行 (1時間)
- 型情報がどこで失われるか特定
Phase 3: 根本修正 (4-8時間)
- NewBox生成時の型登録修正
- PHI型伝播ロジック修正
- 型レジストリ整合性チェック追加
Phase 4: 検証 (1時間)
- stage1_cli 正常動作確認
🎯 結論:
MIR Builder の根本的インフラバグ。SSA変換とPHIノード経由での
型情報追跡に失敗している。.hakoレベルでは回避不可能。
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Task Assistant <task@anthropic.com>
|
2025-11-21 08:03:03 +09:00 |
|
|
|
525e59bc8d
|
feat(loop-phi): Add body-local variable PHI generation for Rust AST loops
Phase 25.1c/k: Fix ValueId undefined errors in loops with body-local variables
**Problem:**
- FuncScannerBox.scan_all_boxes/1 and BreakFinderBox._find_loops/2 had ValueId
undefined errors for variables declared inside loop bodies
- LoopFormBuilder only generated PHIs for preheader variables, missing body-locals
- Example: `local ch = s.substring(i, i+1)` inside loop → undefined on next iteration
**Solution:**
1. **Rust AST path** (src/mir/loop_builder.rs):
- Detect body-local variables by comparing body_end_vars vs current_vars
- Generate empty PHI nodes at loop header for body-local variables
- Seal PHIs with latch + continue snapshot inputs after seal_phis()
- Added HAKO_LOOP_PHI_TRACE=1 logging for debugging
2. **JSON v0 path** (already fixed in previous session):
- src/runner/json_v0_bridge/lowering/loop_.rs handles body-locals
- Uses same strategy but for JSON v0 bridge lowering
**Results:**
- ✅ FuncScannerBox.scan_all_boxes: 41 body-local PHIs generated
- ✅ Main.main (demo harness): 23 body-local PHIs generated
- ⚠️ Still some ValueId undefined errors remaining (exit PHI issue)
**Files changed:**
- src/mir/loop_builder.rs: body-local PHI generation logic
- lang/src/compiler/entry/func_scanner.hako: debug logging
- /tmp/stageb_funcscan_demo.hako: test harness
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-19 23:12:01 +09:00 |
|
|
|
772149c86d
|
Analyzer安定化完了: NYASH_DISABLE_PLUGINS=1復元 + plugin無効化根治
## 修正内容
1. **hako_check.sh/run_tests.sh**: NYASH_DISABLE_PLUGINS=1 + NYASH_BOX_FACTORY_POLICY=builtin_first追加
2. **src/box_factory/plugin.rs**: NYASH_DISABLE_PLUGINS=1チェック追加
3. **src/box_factory/mod.rs**: plugin shortcut pathでNYASH_DISABLE_PLUGINS尊重
4. **tools/hako_check/render/graphviz.hako**: smart quotes修正(parse error解消)
## 根本原因
- NYASH_USE_PLUGIN_BUILTINS=1が自動設定され、ArrayBox/MapBoxがplugin経由で生成を試行
- bid/registry.rsで"Plugin loading temporarily disabled"の状態でも試行されエラー
- mod.rs:272のshortcut pathがNYASH_DISABLE_PLUGINSを無視していた
## テスト結果
- 10/11 PASS(HC011,13-18,21-22,31)
- HC012: 既存issue(JSON安定化未完)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-08 15:49:25 +09:00 |
|
|
|
58a6471883
|
Phase 21.3 WIP: Hako Source Checker improvements - HC011/HC016/HC017 実装完了
主な変更:
- ✅ HC011 (dead methods) 実装・テスト緑
- ✅ HC016 (unused alias) 実装・テスト緑
- ✅ HC017 (non-ascii quotes) 実装完了
- 🔧 tokenizer/parser_core 強化(AST優先ルート)
- 🛡️ plugin_guard.rs 追加(stderr専用出力)
- 📋 テストインフラ整備(run_tests.sh改善)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-08 00:46:34 +09:00 |
|
|
|
6a452b2dca
|
fix(mir): PHI検証panic修正 - update_cfg()を検証前に呼び出し
A案実装: debug_verify_phi_inputs呼び出し前にCFG predecessorを更新
修正箇所(7箇所):
- src/mir/builder/phi.rs:50, 73, 132, 143
- src/mir/builder/ops.rs:273, 328, 351
根本原因:
- Branch/Jump命令でsuccessorは即座に更新
- predecessorはupdate_cfg()で遅延再構築
- PHI検証が先に実行されてpredecessor未更新でpanic
解決策:
- 各debug_verify_phi_inputs呼び出し前に
if let Some(func) = self.current_function.as_mut() {
func.update_cfg();
}
を挿入してCFGを同期
影響: if/else文、論理演算子(&&/||)のPHI生成が正常動作
|
2025-11-01 13:28:56 +09:00 |
|
|
|
e5f697eb22
|
restore(lang): full lang tree from ff3ef452 (306 files) — compiler, vm, shared, runner, c-abi, etc.\n\n- Restores lang/ directory (files≈306, dirs≈64) as per historical branch with selfhost sources\n- Keeps our recent parser index changes in compiler/* (merged clean by checkout)\n- Unblocks selfhost development and documentation references
|
2025-10-31 20:45:46 +09:00 |
|