Refactor JoinIR lowerers and boundary

This commit is contained in:
2025-12-28 03:52:52 +09:00
parent 3e2086cc78
commit ca91be349d
26 changed files with 2228 additions and 2375 deletions

View File

@ -49,9 +49,8 @@ use super::{
/// # Returns
///
/// Returns `Ok(Some(exit_phi_id))` if the merged JoinIR functions have return values
/// that were collected into an exit block PHI. さらに、`boundary` に
/// host_outputs が指定されている場合は、exit PHI の結果をホスト側の
/// SSA スロットへ再接続するvariable_map 内の ValueId を更新する)。
/// that were collected into an exit block PHI. Exit reconnection is driven by
/// explicit exit_bindings on the boundary (no legacy host_outputs).
pub(in crate::mir::builder) fn merge_joinir_mir_blocks(
builder: &mut crate::mir::builder::MirBuilder,
mir_module: &MirModule,

View File

@ -234,15 +234,6 @@ impl ExitLineReconnector {
}
}
// Backward compatibility warning for deprecated host_outputs
#[allow(deprecated)]
if !boundary.host_outputs.is_empty() && debug {
trace.stderr_if(
"[joinir/exit-line] WARNING: Using deprecated host_outputs. Migrate to exit_bindings.",
true,
);
}
// Phase 190-impl-D-3: Contract verification (debug build only)
// Ensures all exit_bindings have corresponding entries in carrier_phis and variable_ctx.variable_map
#[cfg(debug_assertions)]

View File

@ -95,7 +95,7 @@ impl<'a> ExitBindingBuilder<'a> {
///
/// Phase 222.5-C: Delegates to applicator module.
///
/// Sets exit_bindings (and join_outputs for legacy) based on loop_var + carriers.
/// Sets exit_bindings based on loop_var + carriers.
/// Must be called after build_loop_exit_bindings().
///
/// # Arguments
@ -374,11 +374,6 @@ mod tests {
host_inputs: vec![],
join_inputs: vec![],
exit_bindings: vec![], // Phase 171: Add missing field
#[allow(deprecated)]
host_outputs: vec![], // legacy, unused in new assertions
join_outputs: vec![],
#[allow(deprecated)]
condition_inputs: vec![], // Phase 171: Add missing field
condition_bindings: vec![], // Phase 171-fix: Add missing field
expr_result: None, // Phase 33-14: Add missing field
jump_args_layout: crate::mir::join_ir::lowering::inline_boundary::JumpArgsLayout::CarriersOnly,

View File

@ -10,7 +10,7 @@ use std::collections::BTreeMap; // Phase 222.5-D: HashMap → BTreeMap for deter
/// Apply bindings to JoinInlineBoundary
///
/// Sets exit_bindings (and join_outputs for legacy) based on loop_var + carriers.
/// Sets exit_bindings based on loop_var + carriers.
/// Must be called after build_loop_exit_bindings().
///
/// Phase 222.5-C: Extracted from ExitBindingBuilder to separate application concerns.
@ -35,8 +35,6 @@ pub(crate) fn apply_exit_bindings_to_boundary(
let mut bindings = Vec::new();
bindings.push(create_loop_var_exit_binding(carrier_info));
let mut join_outputs = vec![carrier_info.loop_var_id]; // legacy field for compatibility
for carrier in &carrier_info.carriers {
let post_loop_id = variable_map
.get(&carrier.name)
@ -53,18 +51,9 @@ pub(crate) fn apply_exit_bindings_to_boundary(
join_exit_value: join_exit_id,
role: carrier.role, // Phase 227: Propagate role from CarrierInfo
});
join_outputs.push(join_exit_id);
}
boundary.exit_bindings = bindings;
// Deprecated fields kept in sync for legacy consumers
let join_outputs_clone = join_outputs.clone();
boundary.join_outputs = join_outputs;
#[allow(deprecated)]
{
boundary.host_outputs = join_outputs_clone;
}
Ok(())
}
@ -128,11 +117,6 @@ mod tests {
host_inputs: vec![],
join_inputs: vec![],
exit_bindings: vec![], // Phase 171: Add missing field
#[allow(deprecated)]
host_outputs: vec![], // legacy, unused in new assertions
join_outputs: vec![],
#[allow(deprecated)]
condition_inputs: vec![], // Phase 171: Add missing field
condition_bindings: vec![], // Phase 171-fix: Add missing field
expr_result: None, // Phase 33-14: Add missing field
jump_args_layout: crate::mir::join_ir::lowering::inline_boundary::JumpArgsLayout::CarriersOnly,