Files
hakorune/docs/development/current/main/investigations
tomoaki edc7355937 refactor(joinir): unify boundary join_inputs SSOT (pattern4/6/7)
Apply Phase 256.8 SSOT fix to Pattern4/6/7:
- Use join_module.entry.params.clone() instead of hardcoded ValueIds
- Add fail-fast validation for params count mismatch
- Remove ValueId(0), ValueId(PARAM_MIN + k) patterns
- Clean up unused PARAM_MIN imports

This prevents entry_param_mismatch errors structurally and maintains
consistency with Pattern2/3.

Changes:
- pattern4_with_continue.rs: Lines 442-476 (SSOT extraction + validation)
- pattern6_scan_with_init.rs: Lines 447-471 (SSOT extraction + validation)
- pattern7_split_scan.rs: Lines 495-526 (SSOT extraction + validation)

All patterns now use the same SSOT principle:
1. Extract entry function (priority: join_module.entry → fallback "main")
2. Use params as SSOT: join_inputs = entry_func.params.clone()
3. Build host_inputs in expected order (pattern-specific)
4. Fail-fast validation: join_inputs.len() == host_inputs.len()

Verification:
- cargo build --release:  PASS (no PARAM_MIN warnings)
- Quick profile:  First FAIL still json_lint_vm (baseline maintained)
- Pattern6 smoke:  PASS (index_of test)
- Pattern7 smoke: Pre-existing phi pred mismatch (not introduced by SSOT)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-20 20:05:11 +09:00
..

Investigations Folder

This folder contains investigation notes and analysis for debugging sessions.

Active Investigations

Phase 131-12: LLVM Wrong Result (Case C)

Status: Root cause identified Problem: LLVM backend returns wrong results for loop exit values Root Cause: vmap object identity mismatch between Pass A and Pass C

Key Documents:

  1. phase131-12-case-c-llvm-wrong-result.md - Initial investigation scope
  2. phase131-12-p1-vmap-identity-analysis.md - Detailed trace analysis
  3. phase131-12-p1-trace-summary.md - Executive summary with fix recommendations

Quick Summary:

  • Bug: Pass A deletes _current_vmap before Pass C runs
  • Impact: Terminators use wrong vmap object, missing all Pass A writes
  • Fix: Store vmap_cur in deferred_terminators tuple (Option 3)

Next Steps:

  1. Implement Option 3 fix in block_lower.py
  2. Add Fail-Fast check in instruction_lower.py
  3. Verify with NYASH_LLVM_VMAP_TRACE=1
  4. Run full test suite

Trace Environment Variables

Phase 131-12-P1 Traces

NYASH_LLVM_VMAP_TRACE=1    # Object identity and vmap keys tracing
NYASH_LLVM_USE_HARNESS=1   # Enable llvmlite harness
NYASH_LLVM_DUMP_IR=<path>  # Save LLVM IR to file

Investigation Workflow

  1. Scope - Define problem and test case (phase131-12-case-c-*.md)
  2. Trace - Add instrumentation and collect data (phase131-12-p1-vmap-identity-*.md)
  3. Analysis - Identify root cause with evidence (phase131-12-p1-trace-summary.md)
  4. Fix - Implement solution with validation
  5. Document - Update investigation notes with results

Archive

Completed investigations are kept for reference and pattern recognition.

JoinIR Generalization Study (Historical)

  • joinir-generalization-study.mdPhase 131138 の状況と一般化案の相談用コンテキスト。SSOT は design/ を参照)