feat(joinir): Phase 202-A Pattern 1 uses JoinValueSpace

Migrated Pattern 1 (Simple While) to use JoinValueSpace for unified
ValueId allocation, following the same pattern as Pattern 2 (Phase 201).

Changes:
- simple_while_minimal.rs: Added join_value_space parameter, replaced
  value_counter with join_value_space.alloc_local()
- pattern1_minimal.rs: Create JoinValueSpace before calling lowerer
- loop_view_builder.rs: Create JoinValueSpace in try_pattern1()

Pattern 1 uses Local region (1000+) only, since it doesn't need
ConditionEnv (no Param region allocation required).

Tested:
- cargo build --release --lib: Success (0 errors, 4 warnings)
- cargo test --release --lib pattern: 119 passed
- E2E test apps/tests/loop_min_while.hako: Outputs "0 1 2" correctly

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-09 19:08:42 +09:00
parent 8d5ecef04f
commit 6e778948db
3 changed files with 29 additions and 15 deletions

View File

@ -28,6 +28,7 @@ pub fn lower(
impl MirBuilder {
/// Phase 179-B: Pattern 1 (Simple While Loop) minimal lowerer
/// Phase 202-A: JoinValueSpace Integration
///
/// **Refactored**: Now uses PatternPipelineContext for unified preprocessing
///
@ -60,8 +61,13 @@ impl MirBuilder {
// Phase 195: Use unified trace
trace::trace().varmap("pattern1_start", &self.variable_map);
// Phase 202-A: Create JoinValueSpace for unified ValueId allocation
// Pattern 1 uses Local region only (no Param region needed - no ConditionEnv)
use crate::mir::join_ir::lowering::join_value_space::JoinValueSpace;
let mut join_value_space = JoinValueSpace::new();
// Call Pattern 1 lowerer with preprocessed scope
let join_module = match lower_simple_while_minimal(ctx.loop_scope) {
let join_module = match lower_simple_while_minimal(ctx.loop_scope, &mut join_value_space) {
Some(module) => module,
None => {
// Phase 195: Use unified trace