ResultBox migration (stage 0): suppress legacy deprecation warnings in box_trait impls; keep dual handling in VM. Fix verifier Display for SuspiciousBarrierContext. Expose VM stats fields to vm_stats module. CLI core_ci guide and script in place.

This commit is contained in:
Moe Charm
2025-08-26 01:42:18 +09:00
parent 7705508b99
commit 9c94e88b86
13 changed files with 408 additions and 36 deletions

View File

@ -82,11 +82,14 @@ impl<'a> LoopBuilder<'a> {
// 7. ループボディの構築
self.set_current_block(body_id)?;
self.emit_safepoint()?;
// ボディをビルド
for stmt in body {
self.build_statement(stmt)?;
}
// latchブロックのスナップショットを保存phi入力解決用
let latch_snapshot = self.get_current_variable_map();
self.block_var_maps.insert(body_id, latch_snapshot);
// 8. Latchブロックボディの最後からHeaderへ戻る
let latch_id = self.current_block()?;
@ -114,6 +117,8 @@ impl<'a> LoopBuilder<'a> {
) -> Result<(), String> {
// 現在の変数マップから、ループで使用される可能性のある変数を取得
let current_vars = self.get_current_variable_map();
// preheader時点のスナップショット後でphi入力の解析に使う
self.block_var_maps.insert(preheader_id, current_vars.clone());
// 各変数に対して不完全なPhi nodeを作成
let mut incomplete_phis = Vec::new();
@ -271,9 +276,12 @@ impl<'a> LoopBuilder<'a> {
self.parent_builder.variable_map.insert(name, value);
}
fn get_variable_at_block(&self, name: &str, _block_id: BasicBlockId) -> Option<ValueId> {
// 簡易実装:現在の変数マップから取得
// TODO: 本来はブロックごとの変数マップを管理すべき
fn get_variable_at_block(&self, name: &str, block_id: BasicBlockId) -> Option<ValueId> {
// まずブロックごとのスナップショットを優先
if let Some(map) = self.block_var_maps.get(&block_id) {
if let Some(v) = map.get(name) { return Some(*v); }
}
// フォールバック:現在の変数マップ(単純ケース用)
self.parent_builder.variable_map.get(name).copied()
}
@ -285,4 +293,4 @@ impl<'a> LoopBuilder<'a> {
fn build_statement(&mut self, stmt: ASTNode) -> Result<ValueId, String> {
self.parent_builder.build_expression(stmt)
}
}
}