59d620779b
fix(test): テスト調整 - 修正後用成功テストを有効化
...
- mir_stageb_string_utils_skip_ws_exec_reproduce_void_lt_zero: ignore化(修正前用)
- mir_stageb_string_utils_skip_ws_exec_success: 有効化(修正後用)
- テスト結果: 2 passed, 1 ignored, 0 failed ✅
- Phase 25.1: skip_ws Void < 0 TypeError 完全根治確認
2025-11-21 12:38:37 +09:00
c56d00b3c5
test(stageb): ParserStringUtilsBox.skip_ws Void < 0 TypeError 再現テスト追加
...
- 目的: commit 227ce61d の修正効果を検証
- テスト内容:
1. mir_stageb_string_utils_skip_ws_compile: MIRコンパイル成功確認
2. mir_stageb_string_utils_skip_ws_exec_reproduce_void_lt_zero: エラー再現(修正前用)
3. mir_stageb_string_utils_skip_ws_exec_success: 正常動作確認(修正後用・ignore)
- 検証済み:
- 修正前 (b00cc8d5 ): Type error: unsupported compare Le on Void and Integer(0)
- 修正後 (227ce61d ): RC=0 正常終了
- Phase 25.1: Stage-B scan系バグ修正完了
2025-11-21 12:35:09 +09:00
c344451087
fix(mir-builder): static method arity mismatch根治 - Phase 25.x
...
**問題**:
- ParserStmtBox.parse_using/4 に5引数が渡される
- me.method呼び出しで instance/static 判別なし
- static method に誤って receiver 追加
**修正**:
- MeCallPolicyBox: params[0]の型で instance/static 判別
- Instance method: receiver 追加
- Static method: receiver なし
- Arity検証(NYASH_ME_CALL_ARITY_STRICT=1)
**ドキュメント**:
- docs/reference/environment-variables.md 新規作成
- docs/development/architecture/mir-logs-observability.md 更新
**テスト**:
- src/tests/mir_stage1_cli_emit_program_min.rs 追加
- 既存 stage1 テスト全てパス
Phase: 25.x
2025-11-21 11:16:38 +09:00
28a312ea0d
feat(naming): Phase 25.4-A - NamingBox SSOT化完了
...
🎯 目的: static/global 呼び出しの名前決定を src/mir/naming.rs に一本化
✅ 実装完了:
- NamingBox(src/mir/naming.rs)実装
- encode_static_method(box, method, arity)
- normalize_static_global_name(func_name)
- static/global 名前の正規化ロジック統一
- MIR Builder統合(SSOT使用)
- src/mir/builder/decls.rs: build_static_main_box
- src/mir/builder/exprs.rs: 静的メソッド呼び出し
- src/mir/builder/metadata/propagate.rs: メタデータ伝播
- src/mir/builder/observe/mod.rs: Observe機能
- src/mir/builder/observe/types.rs: 型観測(新規)
- VM実行器統合(SSOT使用)
- src/backend/mir_interpreter/handlers/calls/global.rs
- normalize_static_global_name使用
- レガシーフォールバック削除済み確認
- テスト追加
- src/tests/mir_static_box_naming.rs
- encode/normalize の動作検証
📚 ドキュメント:
- docs/development/architecture/mir-naming-box.md
- NamingBoxの設計思想
- SSOT原則の説明
- 使用例
🎯 効果:
- 名前決定ロジックが1箇所に集約
- Builder/VM で同じ正規化ルールを使用
- 将来の名前空間拡張が容易
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-21 09:01:43 +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
3beddd6eb4
docs(stage1): Phase 25.1 - Stage-1 CLI ValueId(34) SSA バグ完全調査完了
...
🔍 根本原因特定:
- 問題箇所: stage1_cli.hako:111 の args null チェックパターン
local argc = 0; if args != null { argc = args.size() }
- 発生条件:
1. 深い制御フロー(BasicBlockId(12266) = 12,266ブロック)
2. using chain 複雑さ(BuildBox → ParserBox → 50+ファイル)
3. 多段階早期return(複数の支配フロンティアとPHIマージ)
- なぜShapeテストは通るか:
- スタブ実装(複雑な外部Box呼び出しなし)
- 単一ファイル(using chain なし)
- シンプルなCFG(数十ブロック vs 12,266ブロック)
✅ 解決策4案提示:
- Solution A: Fail-Fast Guard(最優先・最簡単)
if args == null { args = new ArrayBox() }
→ PHI merge を 1定義に潰す
- Solution B: デバッグロジック抽出
→ 問題パターンを小さな関数に隔離
- Solution C: Rust Bridge修正
→ stage1_bridge.rs で常に非null保証
- Solution D: MIR Builder根治(長期)
→ SSA構築ロジック・PHI配置アルゴリズム改善
📋 成果物:
- 詳細調査レポート: docs/development/current/main/stage1_cli_ssa_valueid34_analysis.md
- ValueId(34)の定義/使用ブロック解析
- 呼び出しチェーン追跡
- 制御フロー複雑度分析
- 4つの解決策の詳細実装手順
- Shapeテスト追加: src/tests/stage1_cli_entry_ssa_smoke.rs
- mir_stage1_cli_entry_like_pattern_verifies
- mir_stage1_cli_stage1_main_shape_verifies
- 構文とCFG形の正しさを検証(PASS)
🎯 技術的成果:
- MIRレベルのSSA追跡失敗メカニズムを完全解明
- 「テストは通るが実物は失敗」のギャップを構造的に特定
- 箱レベルでの実装可能な解決策を4案提示
Co-Authored-By: Claude <noreply@anthropic.com >
Co-Authored-By: Task Assistant <task@anthropic.com >
2025-11-21 07:00:05 +09:00
f9d100ce01
chore: Phase 25.1 完了 - LoopForm v2/Stage1 CLI/環境変数削減 + Phase 26-D からの変更
...
Phase 25.1 完了成果:
- ✅ LoopForm v2 テスト・ドキュメント・コメント完備
- 4ケース(A/B/C/D)完全テストカバレッジ
- 最小再現ケース作成(SSAバグ調査用)
- SSOT文書作成(loopform_ssot.md)
- 全ソースに [LoopForm] コメントタグ追加
- ✅ Stage-1 CLI デバッグ環境構築
- stage1_cli.hako 実装
- stage1_bridge.rs ブリッジ実装
- デバッグツール作成(stage1_debug.sh/stage1_minimal.sh)
- アーキテクチャ改善提案文書
- ✅ 環境変数削減計画策定
- 25変数の完全調査・分類
- 6段階削減ロードマップ(25→5、80%削減)
- 即時削除可能変数特定(NYASH_CONFIG/NYASH_DEBUG)
Phase 26-D からの累積変更:
- PHI実装改善(ExitPhiBuilder/HeaderPhiBuilder等)
- MIRビルダーリファクタリング
- 型伝播・最適化パス改善
- その他約300ファイルの累積変更
🎯 技術的成果:
- SSAバグ根本原因特定(条件分岐内loop変数変更)
- Region+next_iパターン適用完了(UsingCollectorBox等)
- LoopFormパターン文書化・テスト化完了
- セルフホスティング基盤強化
Co-Authored-By: Claude <noreply@anthropic.com >
Co-Authored-By: ChatGPT <noreply@openai.com >
Co-Authored-By: Task Assistant <task@anthropic.com >
2025-11-21 06:25:17 +09:00
6865f4acfa
feat(phi): Phase 25.1 - LoopForm v2 テスト・最小再現ケース追加
...
- ✅ 最小再現ケース作成
- apps/tests/minimal_ssa_skip_ws.hako: 確実に再現する10-30行ケース
- apps/tests/minimal_ssa_bug*.hako: 段階的簡略化版
- apps/tests/loopform_*.hako: LoopForm v2 各ケーステスト
- ✅ Rustテストスイート追加
- src/tests/mir_loopform_conditional_reassign.rs: 4ケース(Case A/B/C/D)
- src/tests/mir_loopform_complex.rs: 複雑なパターン
- 全テストPASS確認済み
- ✅ SSAバグ分析ドキュメント
- docs/development/analysis/minimal_ssa_bug_analysis.md
- エラー詳細・原因・ワークアラウンド記録
🎯 成果: SSAバグの構造を完全特定、デバッグ準備完了
2025-11-21 06:21:45 +09:00
461bdec45a
feat(phi): Step 5-5-H完了 - Phantom block検証+PHI決定性向上
...
✅ Step 5-5-H: exit_preds検証でphantom block除外
- loop_snapshot_merge.rs line 268: CFG実在チェック追加
✅ PHI生成決定性向上(4ファイル)
- HashMap/HashSet → BTreeMap/BTreeSet変換
- if_phi.rs, loop_phi.rs, loop_snapshot_merge.rs, loopform_builder.rs
✅ 根本原因分析完了(Task先生調査)
- ValueId変動の真因: HashMap非決定的イテレーション
- 詳細: docs/development/current/main/valueid-*.md
📊 テスト結果: 267/268 PASS(退行なし)
- mir_funcscanner_skip_ws: 非決定性残存(variable_map由来)
- 後続タスクで対応予定
🎉 PHI Bug Option C実装ほぼ完了!
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-20 17:10:03 +09:00
f5e8ed7f2f
feat(mir): Phase 26-A-5完了 - 統合テスト作成(ValueId型安全化完全検証)
...
## 🎯 Phase 26-A-5: 統合テスト作成完了
### ✅ 実装内容
**新規ファイル作成**:
- `src/tests/mir_value_kind.rs` - Phase 26-A統合テスト(4テスト)
- `src/tests/mod.rs` - mir_value_kindモジュール登録
**作成した統合テスト**:
1. **`test_guard_bug_prevention_full_flow()`**
- GUARD checkバグ完全再現防止テスト
- ValueId(0)がパラメータとして正しく判定されることを確認
- Phase 26-A-2/26-A-3/26-A-4の統合動作検証
2. **`test_instance_method_parameters()`**
- インスタンスメソッドの暗黙的receiver(me)を含むパラメータテスト
- 複数パラメータ(me, arg1, arg2)の型安全判定確認
3. **`test_loop_parameter_vs_local_distinction()`**
- ループ内でのパラメータ/ローカル変数/LoopCarrierの区別テスト
- loop_builder.rsの実際のユースケース検証
- new_typed_value()によるMirValueKind別ValueId生成確認
4. **`test_no_parameters_function()`**
- パラメータなし関数のテスト
- 未登録ValueIdのデフォルト動作確認
### 🏆 技術的成果
#### テスト構造
```rust
// Phase 26-A-1 ユニットテスト (src/mir/value_kind.rs)
test_mir_value_kind_parameter() // MirValueKind::Parameter
test_mir_value_kind_local() // MirValueKind::Local
test_mir_value_kind_constant() // MirValueKind::Constant
test_mir_value_kind_temporary() // MirValueKind::Temporary
test_mir_value_kind_pinned() // MirValueKind::Pinned
test_mir_value_kind_loop_carrier() // MirValueKind::LoopCarrier
test_typed_value_id_*() // TypedValueId各種機能
test_guard_check_bug_prevention() // GUARDバグ再現防止(ユニット)
test_loop_carrier_detection() // LoopCarrier検出
// Phase 26-A-5 統合テスト (src/tests/mir_value_kind.rs)
test_guard_bug_prevention_full_flow() // ✅ GUARD完全検証
test_instance_method_parameters() // ✅ 複雑パラメータ
test_loop_parameter_vs_local_distinction() // ✅ 実用ケース
test_no_parameters_function() // ✅ エッジケース
```
#### GUARDバグ再現防止の完全検証
```rust
// ❌ 旧実装で発生していたバグ
for (name, value) in ¤t_vars {
if value.0 == 0 { // ValueId(0) を未初期化と誤判定
return Ok(ValueId(0));
}
}
// ✅ Phase 26-A実装後の検証
let s = ValueId(0);
builder.register_value_kind(s, MirValueKind::Parameter(0));
assert!(builder.is_value_parameter(s)); // 正しくパラメータと判定!
```
### 📊 テスト結果
```
test result: ok. 245 passed; 1 failed; 27 ignored
```
- ✅ **245テスト合格** - Phase 26-A-4から+4テスト増加
- ✅ **10個の value_kind テスト** - 6ユニット + 4統合
- ❌ **1テスト失敗** - `mir_funcscanner_skip_ws`(既存PHIバグ、無関係)
### 🔄 修正ファイル一覧
1. `src/tests/mir_value_kind.rs` (新規) - 統合テスト実装
2. `src/tests/mod.rs` - モジュール登録
### 🎯 Phase 26-A 完全達成状況
- ✅ Phase 26-A-1: MirValueKind + TypedValueId 実装
- ✅ Phase 26-A-2: MirBuilder統合(value_kinds HashMap追加)
- ✅ Phase 26-A-3: パラメータ型自動登録(setup_function_params修正)
- ✅ Phase 26-A-4: is_parameter根本修正(名前ベース→ValueIdベース)
- ✅ **Phase 26-A-5: 統合テスト作成(完全検証) ← 今回**
### 🚀 次のステップ
- Phase 26-A: 最終確認(全テスト実行)
- ドキュメント更新
- Phase 26-Bへ移行検討
## 📚 参考
- 設計文書: docs/development/architecture/phase-26-valueid-type-safety.md
- ユニットテスト: src/mir/value_kind.rs (12テスト)
- 統合テスト: src/tests/mir_value_kind.rs (4テスト)
2025-11-20 09:56:22 +09:00
cbf852b7a4
fix(loop_builder): ValueId(0)パラメータGUARD check削除 - ループ生成バグ修正
...
## 🎯 根本原因(Task先生特定)
- `src/mir/loop_builder.rs` L203-215のGUARD checkが誤動作
- ValueId(0)を「常に未初期化」と判定していたが、実際には**最初のパラメータとして正当**
- skip_whitespace(s, idx)のsがValueId(0)で弾かれ、ループが生成されない
## ✅ 修正内容
- GUARD check完全削除(L203-215)
- 経緯説明コメント追加
## ✅ 修正効果
- ループブロック生成: 33 blocks確認
- 既存テスト: 全PASS(mir_basic_loop, mir_loopform_exit_phi)
- 回帰なし
## ❌ 別問題発見(次のタスク)
- PHI node predecessor mismatch (別バグ)
- これはExit PHI生成の問題
## 📋 調査プロセス
- Step 1-3: 最小再現ケース+Rustテスト作成
- Step 4: Task先生でMIR解析→根本原因特定
- Step 5-6: loop_builder.rs修正
- Step 7: 全確認(既存テスト全PASS)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-20 08:41:37 +09:00
471052ad8d
feat(debug): __mir__.log追加+VM実行テスト - loopバグ確定
...
## 🔍 func_scanner.hakoに__mir__.log追加
```hako
method skip_whitespace(s, idx) {
__mir__.log("skip_ws/head", i, n)
loop(1 == 1) {
__mir__.log("skip_ws/loop", i, n) ← 実行されない
...
}
__mir__.log("skip_ws/exit", i, n)
}
```
## 📊 CLI実行結果(MIRログ)
```
[MIR-LOG] skip_ws/head: %26=Integer(0) %28=Integer(6)
[MIR-LOG] skip_ws/exit: %26=Integer(0) %28=Integer(6)
```
- ✅ i=0, n=6(両方Integer, 値は正しい)
- ❌ `skip_ws/loop`が**一度も出ない**
- → **loop本体が実行されていないことがMIRレベルで確定**
## 🧪 Rustテスト更新
1. **ソースを束ねる**: func_scanner.hako + test file
- FuncScannerBox関数がmoduleに含まれるように修正
2. **VM実行追加**: execute_module()でバグ再現確認
- 期待: rc=0 (PASS), 実際: rc=1 (FAIL)
## 🎯 次のステップ
- MIRダンプでLoopForm展開を確認
- VM interpreter/LoopForm実行を調査
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-20 08:22:43 +09:00
7ed13f98d5
test(stageb): 最小再現ケース+Rustテスト追加 - using読み込み問題発見
...
## 🔍 新規ファイル
1. **funcscanner_skip_ws_min.hako**: 最小再現ケース
- FuncScannerBox.skip_whitespace直接呼び出しテスト
- 期待: idx=3(3空白スキップ)
- 実際: idx=0(loop不実行でFAIL)
2. **mir_funcscanner_skip_ws.rs**: Rustレベルテスト
- MIRコンパイル + 検証
- 関数存在確認
## 🐛 重大発見
### 問題: using経由モジュールが読み込まれない
```
[test] Module has 2 functions
[test] ALL available functions:
[test] - main
[test] - condition_fn
```
- `using lang.compiler.entry.func_scanner as FuncScannerBox`宣言済み
- でもFuncScannerBox.skip_whitespace/2が**モジュールに存在しない**
- CLI実行時は動作 → Rustテスト環境特有の問題?
### 2層の問題構造
1. **本命バグ**: loop(1==1)が実行されない(CLI実行で再現済み)
2. **新発見**: usingモジュール読み込み未実装(Rustテスト環境)
## 📊 次のステップ
- using systemのコンパイル時モジュール解決を調査
- または別アプローチでloop バグに直接アプローチ
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-20 08:16:35 +09:00
3a82633924
refactor(funcscanner): Region+next_i パターン統一 & SSA テスト追加
...
**FuncScanner .hako 側改善**:
- scan_all_boxes を Region + next_i 形式に統一(continue 多発による SSA/PHI 複雑さ削減)
- インデント修正(タブ→スペース統一)
- デバッグ print 削除
**SSA テスト追加**:
- lang/src/compiler/tests/funcscanner_scan_methods_min.hako
- src/tests/mir_funcscanner_ssa.rs (scan_methods & fib_min SSA デバッグテスト)
**Phase 25.3 ドキュメント**:
- docs/development/roadmap/phases/phase-25.3-funcscanner/ 追加
**関連**: Phase 25.3 FuncScanner 箱化準備作業
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-20 06:38:43 +09:00
9bdf2ff069
chore: Phase 25.2関連ドキュメント更新&レガシーテストアーカイブ整理
...
## ドキュメント更新
- CURRENT_TASK.md: Phase 25.2完了記録
- phase-25.1b/e/q/25.2 README更新
- json_v0_bridge/README.md新規追加
## テストファイル整理
- vtable_*テストをtests/archive/に移動(6ファイル)
- json_program_loop.rsテスト追加
## コード整理
- プラグイン(egui/python-compiler)微修正
- benchmarks.rs, instance_v2.rs更新
- MIR関連ファイル微調整
## 全体成果
Phase 25.2完了により:
- LoopSnapshotMergeBox統一管理実装
- ValueId(1283)バグ根本解決
- ~35行コード削減(目標210行の16%)
- 11テスト全部PASS、3実行テストケースPASS
2025-11-20 03:56:12 +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
75f3df2505
refactor(mir): Phase 25.1o - do_break/continue 共通化(LoopExitKind型統一)
...
【変更内容】
1. LoopExitKind enum定義
- Break / Continue の型安全な区別
2. do_loop_exit() 共通メソッド作成(47行)
- スナップショット取得(共通処理)
- kind別のスナップショット保存
- kind別のジャンプターゲット
- unreachable ブロック切り替え(共通処理)
3. do_break/continue をthin wrapperに変換
- do_break: 13行 → 4行
- do_continue: 12行 → 4行
- 合計21行削減
【効果】
- 構造改善: break/continue の共通ロジック一箇所に集約
- 保守性向上: デバッグログなどの共通処理が統一管理
- 拡張性向上: labeled break/continue等の将来拡張が容易
【検証結果】
- ビルド成功(警告なし)
- mir_stageb_loop_break_continue_verifies: PASS
- /tmp/loop_continue_fixed.hako: RC=3(期待通り)
関連: Phase 25.1m (continue PHI修正), Phase 25.1n (レガシー削除)
2025-11-19 08:56:44 +09:00
39f5256c18
📊 Phase 25.1l: Region観測レイヤー骨格 + スコープ契約設計理解
...
**Region Box統一理論の実装開始**
新規追加:
- src/mir/region/mod.rs: Region/RefSlotKind型定義
- src/mir/region/observer.rs: Region観測レイヤー
- docs/development/roadmap/phases/phase-25.1l/: 設計ドキュメント
主要概念:
- Region Box = Function/Loop/If の統一箱
- RefSlotKind = GC管理用スロット種別(Strong/Weak/Borrowed/NonRef)
- 観測専用(NYASH_REGION_TRACE=1で動作、挙動変更なし)
設計理解の深化:
- ValueId(40)問題 = LoopForm v2スコープ契約違反の症状
- 根本解決 = Region観測で無名一時値のスコープまたぎを検出
- 箱理論3原則: 境界明確化/差し替え可能/段階的移行
関連議論:
- ChatGPT提案: Region統一理論でGC/寿命管理の基盤構築
- SlotRegistry: 変数の単一真実源(SSOT)
- 階層構造: FunctionRegion → LoopRegion → IfRegion
次のステップ:
- Phase 1: Region観測(現在)- 非破壊的追加
- Phase 2: メタデータ出力(MIR JSON拡張)
- Phase 3: GC統合(retain/release挿入)
テスト追加:
- lang/src/compiler/tests/stageb_mini_driver.hako
- tools/test_loopssa_breakfinder_slot.sh
Build: ✅ 全警告は既存のもの
Tests: 既存テスト全て緑維持
2025-11-19 02:44:40 +09:00
8b37e9711d
fix(mir): conservative PHI box for If/Loop and Stage1 resolver SSA
2025-11-18 09:26:39 +09:00
f74b7d2b04
📦 Hotfix 1 & 2: Parameter ValueId Reservation + Exit PHI Validation (Box-First Theory)
...
**箱理論に基づく根治的修正**:
## 🎯 Hotfix 1: Parameter ValueId Reservation (パラメータ ValueId 予約)
### 根本原因
- MirFunction counter が params.len() を考慮していなかった
- local variables が parameter ValueIds を上書き
### 箱理論的解決
1. **LoopFormContext Box**
- パラメータ予約を明示的に管理
- 境界をはっきりさせる
2. **MirFunction::new() 改善**
- `initial_counter = param_count.max(1)` でパラメータ予約
- Parameters are %0, %1, ..., %N-1
3. **ensure_counter_after() 強化**
- パラメータ数 + 既存 ValueIds 両方を考慮
- `min_counter = param_count.max(max_id + 1)`
4. **reserve_parameter_value_ids() 追加**
- 明示的な予約メソッド(Box-First)
## 🎯 Hotfix 2: Exit PHI Predecessor Validation (Exit PHI 検証)
### 根本原因
- LoopForm builder が存在しないブロックを PHI predecessor に追加
- 「幽霊ブロック」問題
### 箱理論的解決
1. **LoopFormOps.block_exists() 追加**
- CFG 存在確認メソッド
- 境界を明確化
2. **build_exit_phis() 検証**
- 非存在ブロックをスキップ
- デバッグログ付き
### 実装ファイル
- `src/mir/function.rs`: Parameter reservation
- `src/mir/phi_core/loopform_builder.rs`: Context + validation
- `src/mir/loop_builder.rs`: LoopFormOps impl
- `src/mir/builder/stmts.rs`: Local variable allocation
### 業界標準準拠
- ✅ LLVM IR: Parameters are %0, %1, ...
- ✅ SSA Form: PHI predecessors must exist in CFG
- ✅ Cytron et al. (1991): Parameter reservation principle
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-18 06:39:45 +09:00
0f43bc6b53
fix(mir): LoopForm v2完全緑化 - ValueId(0)予約 & unreachable block許容
...
## 🎯 完了タスク
✅ Task 1: LoopForm v2 最小ユニットテスト全緑化(4/4パス)
✅ Task 2: program_v0 PHI trace スクリプト全緑化(5/5パス)
✅ Task 3: Stage-B 風ループ Rust テスト全緑化(2/2パス)
🔧 Task 4: Stage-1 using resolver (1/3パス、UsingStatement対応完了)
## 📝 主要修正
### 1. ValueId(0)を無効値として予約
- **src/mir/function.rs**: MirFunction::new() で next_value_id を1から開始
- **src/mir/builder/stmts.rs**: build_local_statement で next_value_id() 使用
- **理由**: LoopForm v2 が ValueId(0) を無効値の sentinel として使用
- **効果**: SSA 構築時の ValueId 衝突を完全に防止
### 2. Unreachable block 許容をデフォルト化
- **src/mir/verification/cfg.rs**: 到達可能性チェック削除
- **src/config/env.rs**: NYASH_VERIFY_ALLOW_UNREACHABLE 環境変数削除
- **src/tests/mir_loopform_exit_phi.rs**: 環境変数設定削除
- **理由**: break/continue/return の後の unreachable block は正当
- switch_to_unreachable_block_with_void() で意図的に作成
- LLVM IR の `unreachable` 命令と同じ標準的手法
- 削除は DCE (Dead Code Elimination) パスの仕事
- **効果**: 環境変数を減らしてシンプル化
### 3. UsingStatement の MIR Builder 対応
- **src/mir/builder/exprs.rs**: UsingStatement → void 変換を追加
- **理由**: namespace 解決は parser/runner レベルで完了済み
- **効果**: using 文を含むコードが MIR コンパイル可能に
### 4. スモークテストスクリプト修正
- **tools/smokes/v2/profiles/quick/core/phase2034/*.sh**: 5ファイル
- **修正内容**: 二重コマンド置換のシンタックスエラー修正
- 誤: `out="$(out="$(COMMAND)"; rc=$?`
- 正: `out="$(COMMAND)"; rc=$?`
## 🧪 テスト結果
- mir_loopform_exit_phi: 4/4パス ✅
- program_v0_*_phi_trace_vm: 5/5パス ✅
- mir_stageb_loop_break_continue: 2/2パス ✅
- mir_stage1_using_resolver: 1/3パス (残り2つは dominator violation)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-18 06:11:17 +09:00
f92779cfe8
fix(mir/exit_phi): Pass branch_source_block to build_exit_phis()
...
## Problem
Exit PHI generation was using header_id as predecessor, but when
build_expression(condition) creates new blocks, the actual branch
instruction is emitted from a different block, causing:
"phi pred mismatch: no input for predecessor BasicBlockId(X)"
## Solution
- Modified build_exit_phis() to accept branch_source_block parameter
- Capture actual block after condition evaluation in loop_builder.rs
- Use branch_source_block instead of header_id for PHI inputs
## Progress
- Error changed from ValueId(5941)/BasicBlockId(4674) to
ValueId(5927)/BasicBlockId(4672), showing partial fix
- Added comprehensive test suite in mir_loopform_exit_phi.rs
- Added debug logging to trace condition block creation
## Status
Partial fix - unit tests pass, but Test 2 (Stage-B compilation) still
has errors. Needs further investigation of complex nested compilation
scenarios.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-18 04:26:50 +09:00
eee3dfaa83
refactor(builder): 箱理論リファクタリング Phase 1完了
...
🎯 builder_calls.rs (982行) を箱理論で責務別にモジュール分割
## 成果
✅ builder_calls.rs: 982行 → 766行(-216行、22%削減)
✅ calls/lowering.rs: 354行(新規、箱理論6段階パターン)
✅ calls/utils.rs: 45行(新規、ユーティリティ統一)
✅ ビルド・テスト完全成功(0エラー)
## 箱理論の実装
1. 責務ごとに箱に分離:
- lowering: 関数lowering専用
- utils: ユーティリティ統一
- emit/build: Phase 2で実装予定
2. 境界を明確に:
- mod.rs で公開インターフェース定義
- pub(in crate::mir::builder) で適切な可視性制御
3. いつでも戻せる:
- 段階的移行、各ステップでビルド確認
- 既存API完全保持(互換性100%)
4. 巨大関数は分割:
- lower_static_method_as_function: 125行 → 6段階に分解
- lower_method_as_function: 80行 → 6段階に分解
## 箱理論6段階パターン
1. prepare_lowering_context - Context準備
2. create_function_skeleton - 関数スケルトン作成
3. setup_function_params - パラメータ設定
4. lower_function_body - 本体lowering
5. finalize_function - 関数finalize
6. restore_lowering_context - Context復元
## ファイル構成
src/mir/builder/
├── calls/
│ ├── mod.rs # 公開インターフェース
│ ├── lowering.rs # 関数lowering(354行)
│ └── utils.rs # ユーティリティ(45行)
└── builder_calls.rs # 削減版(766行)
## 次のステップ
Phase 2: emit.rs 作成(~500行移行)
Phase 3: build.rs 作成(~350行移行)
最終目標: builder_calls.rs を200行以内に
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
Co-Authored-By: Task先生 <task@anthropic.com >
2025-11-17 17:02:01 +09:00
c27f6466e8
fix(builder): BoxCompilationContext clear()アプローチ確立
...
🎯 箱理論: swap累積バグを修正し、clear()で完全独立化を実現
## 問題
- swap実装は ctx に変数が累積され、次のメソッドで汚染される
- StageBArgsBox.resolve_src で ValueId(21) 未定義エラー
## 解決策
- swap → clear() に変更(開始時・終了時両方)
- context_active mode: clear() のみ(完全独立)
- legacy mode: saved_var_map で従来の挙動維持
## 成果
✅ StageBArgsBox.resolve_src - 成功!
❌ StageBBodyExtractorBox.build_body_src - 次の問題箇所(進展!)
## 実装
- src/mir/builder/builder_calls.rs:
- 開始時: context_active なら clear()(swap削除)
- 終了時: context_active なら clear()(swap back削除)
- legacy mode: saved_var_map で復元
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-17 15:57:34 +09:00
757b0fcfc9
feat(mir/builder): implement BoxCompilationContext for structural metadata isolation
...
箱理論の完璧な実装!各static boxコンパイルを独立したコンテキストで実行。
設計:
- BoxCompilationContext: variable_map, value_origin_newbox, value_types を箱化
- MirBuilder: compilation_context: Option<BoxCompilationContext> フィールド追加
- context swap: lower_static_method_as_function 開始/終了時に std::mem::swap
- 自動クリーンアップ: スコープ終了でコンテキスト破棄
実装:
1. src/mir/builder/context.rs: BoxCompilationContext構造体定義(テスト付き)
2. src/mir/builder.rs: compilation_contextフィールド追加、既存フィールドにコメント追加
3. src/mir/builder/lifecycle.rs: 各static boxでコンテキスト作成・破棄
4. src/mir/builder/builder_calls.rs: lower_static_method_as_functionでcontext swap
5. src/mir/builder/decls.rs, exprs.rs: 古いmanual clear()削除
効果:
✅ グローバル状態汚染を構造的に不可能化
✅ 各static boxが完全に独立したコンテキストでコンパイル
✅ 既存コード変更なし(swap技法で完全後方互換性)
✅ StageBArgsBox ValueId(21)エラー完全解決
箱理論的評価: 🟢 95点
- 明示的な境界: 各boxのコンテキストが物理的に分離
- 汚染不可能: 前の箱の状態が構造的に残らない
- 戻せる: コンテキスト差し替えで簡単ロールバック
- 美しい設計: スコープベースのリソース管理
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-17 11:28:18 +09:00
0455307418
refactor(phase-a): remove Cranelift/JIT backend legacy code (~373 lines)
...
Phase A cleanup - Safe deletions with zero risk:
## Deleted Files (6 files, 373 lines total)
1. Cranelift/JIT Backend (321 lines):
- src/runner/modes/cranelift.rs (45 lines)
- src/runner/modes/aot.rs (55 lines)
- src/runner/jit_direct.rs (152 lines)
- src/tests/core13_smoke_jit.rs (42 lines)
- src/tests/core13_smoke_jit_map.rs (27 lines)
2. Legacy MIR Builder (52 lines):
- src/mir/builder/exprs_legacy.rs
- Functionality inlined into exprs.rs (control flow constructs)
## Module Reference Cleanup
- src/backend/mod.rs: Removed cranelift feature gate exports
- src/runner/mod.rs: Removed jit_direct module reference
- src/runner/modes/mod.rs: Removed aot module reference
- src/mir/builder.rs: Removed exprs_legacy module
## Impact Analysis
- Build: Success (cargo build --release)
- Tests: All passing
- Risk Level: None (feature already archived, code unused)
- Related: Phase 15 JIT archival (archive/jit-cranelift/)
## BID Copilot Status
- Already removed in previous cleanup
- Not part of this commit
Total Reduction: 373 lines (~0.4% of codebase)
Next: Phase B - Dead code investigation
Related: #phase-21.0-cleanup
Part of: Legacy Code Cleanup Initiative
2025-11-06 22:34:18 +09:00
96ea3892af
phase-20.45: PRIMARY no-fallback reps + MIR v0 shape fixes
...
- Fix MIR v0 shape in lowers: functions[] + name="main" + blocks.id
* lower_return_int_box.hako
* lower_return_binop_box.hako
- runner_min: adopt LowerReturnBinOpBox before ReturnInt
- Add PRIMARY no-fallback canaries (all PASS):
* return-binop / array-size / load-store / return-logical (OR)
- Fix phase2043 runner_min canary alias (Runner -> BuilderRunnerMinBox)
- Update docs: phase-20.45 README (PRIMARY reps), CURRENT_TASK progress
Ancillary: keep builder/provider/canary files in sync; no unrelated behavior changes.
2025-11-05 18:57:03 +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
510f4cf523
builder/vm: stabilize json_lint_vm under unified calls
...
- Fix condition_fn resolution: Value call path + dev safety + stub injection
- VM bridge: handle Method::birth via BoxCall; ArrayBox push/get/length/set direct bridge
- Receiver safety: pin receiver in method_call_handlers to avoid undefined use across blocks
- Local vars: materialize on declaration (use init ValueId; void for uninit)
- Prefer legacy BoxCall for Array/Map/String/user boxes in emit_box_or_plugin_call (stability-first)
- Test runner: update LLVM hint to llvmlite harness (remove LLVM_SYS_180_PREFIX guidance)
- Docs/roadmap: update CURRENT_TASK with unified default-ON + guards
Note: NYASH_DEV_BIRTH_INJECT_BUILTINS=1 can re-enable builtin birth() injection during migration.
2025-09-28 12:19:49 +09:00
85084664c2
docs+runner+parser: SSOT+AST using finalized (legacy text inlining removed); provider verify reads nyash.toml; preflight warn hook; method-body guard removed; CURRENT_TASK updated for next JSON work
2025-09-26 00:27:02 +09:00
73b90a7c28
feat: スモークテストv2実装&Phase 15.5後のプラグイン対応
...
Phase 15.5 Core Box削除後の新テストシステム構築:
## 実装内容
- スモークテストv2システム完全実装(3段階プロファイル)
- 共通ライブラリ(test_runner/plugin_manager/result_checker/preflight)
- インタープリター層完全削除(約350行)
- PyVM重要インフラ特化保持戦略(JSON v0ブリッジ専用)
- nyash.tomlパス修正(13箇所、プラグイン正常ロード確認)
## 動作確認済み
- 基本算術演算(+, -, *, /)
- 制御構文(if, loop, break, continue)
- 変数代入とスコープ
- プラグインロード(20個の.soファイル)
## 既知の問題
- StringBox/IntegerBoxメソッドが動作しない
- オブジェクト生成は成功するがメソッド呼び出しでエラー
- Phase 15.5影響でプラグイン実装が不完全な可能性
## ドキュメント
- docs/development/testing/smoke-tests-v2.md 作成
- docs/reference/pyvm-usage-guidelines.md 作成
- CODEX_QUESTION.md(Codex相談用)作成
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-24 09:30:42 +09:00
fc4c866151
Step 2完了: peek→match完全統一 + 重大PHI命令バグ発見
...
## 🎉 Step 2: peek→match完全統一アーキテクチャクリーンアップ完了
- ✅ 15ファイルで PeekExpr → MatchExpr 一括置換完了
- ✅ lowering/peek.rs → match_expr.rs 完全移行
- ✅ AI理解性・コードベース一貫性・保守性大幅向上
## 🔍 Step 3: 複数行パース問題調査完了
- ✅ Task先生による根本原因特定完了
- 原因: オブジェクトリテラルパーサーの改行スキップ不足
- 修正: src/parser/expr/primary.rs の skip_newlines() 追加
## 🚨 重大発見: PHI命令処理バグ
- 問題: gemini_test_case.nyash で期待値2→実際0
- 原因: フェーズM+M.2のPHI統一作業でループ後変数マージに回帰バグ
- 詳細: PHI命令は正常だが、print時に間違ったPHI参照
- 影響: Phase 15セルフホスティング基盤の重大バグ
## 📝 CLAUDE.md更新
- 全進捗状況の詳細記録
- 次のアクション: ChatGPT相談でMIRビルダー修正戦略立案
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-23 09:00:07 +09:00
da78fc174b
selfhost/runtime: Stage 0-1 runner + MIR JSON loader (summary) with trace; compiler: scopebox/loopform prepass wiring (flags, child args); libs: add P1 standard boxes (console/string/array/map) as thin wrappers; runner: pass --box-pref via env; ops_calls dispatcher skeleton; docs: selfhost executor roadmap + scopebox/loopform notes; smokes: selfhost runner + identity prepasses; CURRENT_TASK: update plan and box lib schedule
2025-09-22 21:52:39 +09:00
c8063c9e41
pyvm: split op handlers into ops_core/ops_box/ops_ctrl; add ops_flow + intrinsic; delegate vm.py without behavior change
...
net-plugin: modularize constants (consts.rs) and sockets (sockets.rs); remove legacy commented socket code; fix unused imports
mir: move instruction unit tests to tests/mir_instruction_unit.rs (file lean-up); no semantic changes
runner/pyvm: ensure using pre-strip; misc docs updates
Build: cargo build ok; legacy cfg warnings remain as before
2025-09-21 08:53:00 +09:00
da32455afc
freeze: macro platform complete; default ON with profiles; env consolidation; docs + smokes\n\n- Profiles: --profile {lite|dev|ci|strict} (dev-like default for macros)\n- Macro paths: prefer NYASH_MACRO_PATHS (legacy envs deprecated with warnings)\n- Selfhost pre-expand: auto mode, PyVM-only, add smokes (array/map)\n- Docs: user-macros updated; new macro-profiles guide; AGENTS freeze note; CURRENT_TASK freeze\n- Compat: non-breaking; legacy envs print deprecation notices\n
2025-09-19 22:27:59 +09:00
a6f28a8980
parser(match): introduce expression (replaces syntax); keep AST PeekExpr lowering
...
- Tokenizer: add MATCH keyword; remove PEEK
- Parser: parse (MVP: literal patterns, block/expr arms); build PeekExpr AST for existing lowering
- Tests/Smokes: update peek samples to match; skip one return-value case pending richer arm parsing
Notes: MIR unchanged; existing PeekExpr lowerers continue to work.
2025-09-19 07:58:01 +09:00
5e818eeb7e
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)
2025-09-19 02:07:38 +09:00
5d51086530
python-plugin: RAII (PyOwned/PyBorrowed) + autodecode enum; crate: ny-llvmc --emit exe with NyRT link; tools: build_llvm.sh crate-exe path + crate_exe_smoke; CURRENT_TASK update
2025-09-18 03:57:25 +09:00
a5054a271b
llvm(py): introduce BuildCtx + trace hub; refactor if-merge prepass + PHI wiring into module; unify logs; ctx-enable compare/ret/call/boxcall/externcall/typeop/newbox/safepoint; curated smoke option for if-merge; README updates; keep behavior stable
2025-09-17 16:11:01 +09:00
adbb0201a9
chore(fmt): add legacy stubs and strip trailing whitespace to unblock cargo fmt
2025-09-17 07:43:07 +09:00
94d95dfbcd
🚀 Break/Continue/Try-Catch構文のサポート追加とMIRループ制御強化
...
## 主な変更点
### 🎯 MIRループ制御の実装(根治対応)
- src/mir/loop_builder.rs: Break/Continue対応のループコンテキスト管理
- ループのbreak/continueターゲットブロック追跡
- ネストループの適切な処理
- src/mir/builder.rs: Break/Continue文のMIR生成実装
- src/tokenizer.rs: Break/Continue/Tryトークン認識追加
### 📝 セルフホストパーサーの拡張
- apps/selfhost-compiler/boxes/parser_box.nyash:
- Stage-3: break/continue構文受理(no-op実装)
- Stage-3: try-catch-finally構文受理(構文解析のみ)
- エラー処理構文の将来対応準備
### 📚 ドキュメント更新
- 論文K(爆速事件簿): 45事例に更新(4件追加)
- PyVM迂回路の混乱事件
- Break/Continue無限ループ事件
- EXE-first戦略の再発見
- 論文I(開発秘話): Day 38の重要決定追加
### 🧪 テストケース追加
- apps/tests/: ループ制御とPHIのテストケース
- nested_loop_inner_break_isolated.nyash
- nested_loop_inner_continue_isolated.nyash
- loop_phi_one_sided.nyash
- shortcircuit関連テスト
## 技術的詳細
- Break/ContinueをMIRレベルで適切に処理
- 無限ループ問題(CPU 99.9%暴走)の根本解決
- 将来の例外処理機能への準備
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-15 22:14:42 +09:00
658a0d46da
feat(llvm-py): Major breakthrough in Python LLVM backend! 🎉
...
✅ Print and FileBox paths now working correctly
✅ Resolver simplified by removing overly aggressive fast-path optimization
✅ Both OFF/ON in compare_harness_on_off.sh now use Python version
✅ String handle propagation issues resolved
Key changes:
- Removed instruction reordering in llvm_builder.py (respecting MIR order)
- Resolver now more conservative but reliable
- compare_harness_on_off.sh updated to use Python backend for both paths
This marks a major milestone towards Phase 15 self-hosting with Python/llvmlite!
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-14 00:44:28 +09:00
c6a8d0b686
🧹 Major warning cleanup: 200+ → 102 warnings (50% reduction)
...
- Fix TokenType enum naming convention (SNAKE_CASE → CamelCase)
- Remove 60+ unused imports across multiple modules
- Clean up interpreter, backend, and box modules
- LLVM build now passes with significantly fewer warnings
2025-09-11 16:24:18 +09:00
da5fa600d2
merge: selfhosting-dev <- origin/main; prefer main updates in cranelift builder (ARROW removal/SHR adoption)
2025-09-08 04:33:50 +09:00
17225c29f7
tests: add parser/vm bitops tests; docs: update cheatsheet and language guide for bitwise ops and shift; note Arrow(>>) removal
...
- Add src/tests/parser_bitops_test.rs and vm_bitops_test.rs
- Update tokenizer unit test to expect SHIFT_RIGHT
- Update quick-reference and language guide to document &,|,^,<<,>> and Arrow deprecation
Known: one unrelated test failing (consolebox println TLV vs typebox) pre-existing.
2025-09-08 04:04:19 +09:00
10d6b3059a
llvm: inline env.box.new_i64x arg conversion; add bitops tests/smoke; update CURRENT_TASK
...
- Inline-coerce env.box.new_i64x args to i64 handles (int passthrough, f64 via nyash.box.from_f64, i8* via nyash.box.from_i8_string). Removes closure that caused builder lifetime/borrow issues.
- Add unit test for bitwise/shift ops (VM=48; LLVM emit ok; compile_and_execute returns 48).
- Extend tools/llvm_smoke.sh with optional NYASH_LLVM_BITOPS_SMOKE gate; add apps/tests/ny-llvm-bitops (parser currently lacks &|^<<>> so E2E gated).
- Update CURRENT_TASK.md to reflect P1 progress and test strategy.
Build/test:
- LLVM build: LLVM_SYS_180_PREFIX=/usr/lib/llvm-18 cargo build --release --features llvm
- Unit: cargo test --no-run (env-dependent to run)
- Smoke (optional): NYASH_LLVM_BITOPS_SMOKE=1 ./tools/llvm_smoke.sh
2025-09-08 03:27:52 +09:00
864473336e
merge: resolve conflicts (prefer cranelift-dev for Core-13 defaults; drop modules/using, add env.local/env.box shims)
2025-09-08 01:28:39 +09:00
1aad0479e7
merge: bring cranelift-dev into selfhosting-dev (VM stable, AOT/JIT smokes passing)
2025-09-08 01:24:13 +09:00
b8bdb867d8
Merge selfhosting-dev into main (Core-13 pure CI/tests + LLVM bridge) ( #126 )
...
* WIP: sync before merging origin/main
* fix: unify using/module + build CLI; add missing helper in runner; build passes; core smokes green; jit any.len string now returns 3
* Apply local changes after merging main; keep docs/phase-15 removed per main; add phase-15.1 docs and tests
* Remove legacy docs/phase-15/README.md to align with main
* integration: add Core-13 pure CI, tests, and minimal LLVM execute bridge (no docs) (#125 )
Co-authored-by: Tomoaki <tomoaki@example.com >
---------
Co-authored-by: Selfhosting Dev <selfhost@example.invalid >
Co-authored-by: Tomoaki <tomoaki@example.com >
2025-09-07 07:36:15 +09:00
d62114c705
Core-13 pure: add CI workflows, VM e2e tests, LLVM parity bridge (minimal); do not touch private docs
2025-09-07 07:28:53 +09:00