feat(hako_check): Phase 155 MIR CFG data bridge (MVP)
🌉 CFG データブリッジ MVP 完成! 🔗 実装内容: - MIR JSON 出力時に CFG を自動抽出 (mir_json_emit.rs) - Analysis IR に CFG フィールド追加 (analysis_consumer.hako) - DeadBlockAnalyzerBox が ir.get("cfg") でアクセス可能 📊 技術詳細: - extract_cfg_info() を MIR JSON 出力に統合 - v0/v1 両 JSON フォーマット対応 - CFG: functions[].blocks[]{id, successors, terminator, reachable} ⚠️ MVP 制限事項: - CFG は MIR JSON に含まれるが、hako_check は未読み込み - Analysis IR の CFG は空構造体(ブロック情報なし) - HC020 は実行されるが検出結果 0 件(期待通り) 🎯 Phase 154 + 155 で HC020 基盤完成! 🔧 次のステップ (Phase 156 or 155.5): - Option A: hako_check に MIR パイプライン統合 - Option B: extract_mir_cfg() builtin 関数実装 - 推奨: Option A (既存の hakorune_emit_mir.sh 活用) 📝 Modified files: - src/runner/mir_json_emit.rs (+15 lines) - tools/hako_check/analysis_consumer.hako (+7 lines) - docs/development/current/main/phase155_mir_cfg_bridge.md (+130 lines) - CURRENT_TASK.md (Phase 155 section added) Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -591,10 +591,19 @@ pub fn emit_mir_json_for_harness(
|
||||
_ => true,
|
||||
};
|
||||
|
||||
// Phase 155: Extract CFG information for hako_check
|
||||
let cfg_info = nyash_rust::mir::extract_cfg_info(module);
|
||||
|
||||
let root = if use_v1_schema {
|
||||
create_json_v1_root(json!(funs))
|
||||
let mut root = create_json_v1_root(json!(funs));
|
||||
// Add CFG data to v1 schema
|
||||
if let Some(obj) = root.as_object_mut() {
|
||||
obj.insert("cfg".to_string(), cfg_info);
|
||||
}
|
||||
root
|
||||
} else {
|
||||
json!({"functions": funs}) // v0 legacy format
|
||||
// v0 legacy format - also add CFG
|
||||
json!({"functions": funs, "cfg": cfg_info})
|
||||
};
|
||||
|
||||
// NOTE: numeric_core strict validation is applied on the AotPrep output
|
||||
@ -935,7 +944,11 @@ pub fn emit_mir_json_for_harness_bin(
|
||||
let params: Vec<_> = f.params.iter().map(|v| v.as_u32()).collect();
|
||||
funs.push(json!({"name": name, "params": params, "blocks": blocks}));
|
||||
}
|
||||
let root = json!({"functions": funs});
|
||||
|
||||
// Phase 155: Extract CFG information for hako_check
|
||||
let cfg_info = crate::mir::extract_cfg_info(module);
|
||||
|
||||
let root = json!({"functions": funs, "cfg": cfg_info});
|
||||
|
||||
// NOTE: numeric_core strict validation is applied on the AotPrep output
|
||||
// (tools/hakorune_emit_mir.sh) rather than at raw MIR emit time. This keeps
|
||||
|
||||
Reference in New Issue
Block a user