Files
hakorune/tools/mir-refactoring-targets.md
Moe Charm fb2d8e37d5 🎉 Phase 11.8/12.7: MIR Core-13 完全実装 + 糖衣構文ドキュメント更新
主要な変更:
- MIR Core-13命令セット確定(Load/Store削除の革命的設計)
  - Const, BinOp, Compare(値・計算)
  - Jump, Branch, Return, Phi(制御)
  - Call, BoxCall, ExternCall(呼び出し)
  - TypeOp, Safepoint, Barrier(メタ)
- Phase 12.7糖衣構文ドキュメント整理(超圧縮重視、可逆変換保証)
- MIRビルダーのモジュール分割完了
- vtableテストスイート拡充
- AI協調開発ツール追加(並列リファクタリング支援)

詳細:
- src/mir/instruction_introspection.rs: core13_instruction_names()追加
- MIRビルダー分割: decls.rs, exprs_*.rs, fields.rs
- plugin_loader_v2: errors.rs, host_bridge.rs分離
- 論文用データ: mir13-final.md作成

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-04 11:34:15 +09:00

79 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# MIRリファクタリング対象ファイル
## 🚨 緊急度高大きなファイル900行以上
### 1. mir/verification.rs (965行)
**分割案**
- `mir/verification/basic.rs` - 基本検証
- `mir/verification/types.rs` - 型検証
- `mir/verification/control_flow.rs` - 制御フロー検証
- `mir/verification/ownership.rs` - 所有権検証
### 2. mir/builder.rs (930行)
**状態**: ChatGPT5が作業中
**分割案**
- `mir/builder/exprs.rs` - 式のビルド(一部完了)
- `mir/builder/stmts.rs` - 文のビルド(一部完了)
- `mir/builder/decls.rs` - 宣言のビルド(一部完了)
- `mir/builder/control_flow.rs` - 制御構造
### 3. mir/instruction.rs (896行)
**状態**: MIR13固定化で大幅変更予定
**現在**: 20命令ChatGPT5設計→ 目標: 13命令
**作業内容**:
- 不要な命令の削除
- BoxCall統一ArrayGet/Set, RefNew/Get/Set等
- TypeOp統一TypeCheck, Cast
### 4. mir/optimizer.rs (875行)
**分割案**
- `mir/optimizer/constant_folding.rs`
- `mir/optimizer/dead_code.rs`
- `mir/optimizer/inline.rs`
- `mir/optimizer/type_inference.rs`
## 📊 MIR命令削減マッピング20→13
### 削除予定の命令
```
ArrayGet, ArraySet → BoxCall
RefNew, RefGet, RefSet → BoxCall
WeakNew, WeakGet → BoxCall
MapGetProperty, MapSetProperty → BoxCall
TypeCheck, Cast → TypeOp
PluginInvoke → BoxCallプラグイン統合
Copy → Load + Store
Debug, Print → ExternCall
Nop → 削除
Throw, Catch → ExternCall
Safepoint → 削除VMレベルで処理
```
### 最終的な13-14命令
1. Const - 定数
2. Load - 読み込み
3. Store - 書き込み
4. BinOp - 二項演算
5. UnaryOp - 単項演算
6. Compare - 比較
7. Branch - 条件分岐
8. Jump - 無条件ジャンプ
9. Return - 戻り値
10. Call - 関数呼び出し
11. BoxCall - Box操作統一
12. TypeOp - 型操作統一
13. Phi - SSA合流
14. ExternCall - 外部呼び出し(オプション)
## 🚀 実行コマンド例
```bash
# 非同期でverification.rsのリファクタリング
./tools/codex-async-notify.sh "Refactor src/mir/verification.rs into smaller modules (basic, types, control_flow, ownership)"
# optimizer.rsの分割
./tools/codex-async-notify.sh "Split src/mir/optimizer.rs into separate optimization pass modules"
# MIR命令削減の実装
./tools/codex-async-notify.sh "Reduce MIR instructions from 57 to 13-14 by unifying with BoxCall and TypeOp"
```