|
|
99bdf93dfe
|
feat(joinir): Phase 47-A-LOWERING - P3 Normalized→MIR(direct)
Implement full Pattern3 (if-sum) Normalized→MIR(direct) support, completing
the P3 minimal implementation.
Key changes:
1. P3 Shape Detection (shape_guard.rs):
- Implemented is_pattern3_if_sum_minimal() with structure-based detection
- Detects P3 characteristics:
- Has Compare instruction (loop condition)
- Has Select instruction (conditional carrier update)
- Has tail call (Call with k_next: None)
- Reasonable param count (2-4 for i, sum carriers)
- Handles both JoinInst::Select and Compute(MirLikeInst::Select)
- Added unit test: test_detect_pattern3_if_sum_minimal_shape ✅
2. P3 Normalization Function (normalized.rs):
- Implemented normalize_pattern3_if_sum_minimal()
- Guards: Validates Structured JoinIR + P3 shape detection
- Phase 47-A minimal: Delegates to P2 normalization (works for simple cases)
- Updated normalized_dev_roundtrip_structured() integration
- Returns Result<NormalizedModule, String> for proper error handling
3. Bridge Integration (bridge.rs):
- Updated normalize_for_shape() to call P3 normalization
- No changes needed to direct.rs (already handles P3 instructions)
4. Integration Tests (normalized_joinir_min.rs):
- Added test_phase47a_pattern3_if_sum_minimal_normalization
- Tests Structured→Normalized transformation
- Verifies shape detection + normalization succeeds
- Validates function count and phase correctness
- Added test_phase47a_pattern3_if_sum_minimal_runner
- Basic smoke test for P3 fixture validity
- Verifies 3-function structure and entry point
Benefits:
- P3 now uses Normalized→MIR(direct) pipeline (same as P1/P2)
- Structure-based detection (no name-based heuristics)
- Minimal implementation (delegates to P2 for simplicity)
- Pure additive (no P1/P2 behavioral changes)
Tests: 938/938 PASS (lib), shape_guard P3 test PASS
- test_detect_pattern3_if_sum_minimal_shape ✅
- test_phase47a_pattern3_if_sum_minimal_normalization ✅
- test_phase47a_pattern3_if_sum_minimal_runner ✅
Next phase: Phase 47-B (proper P3-specific normalization, array_filter, multi-carrier)
Design note: This minimal implementation reuses P2 normalization for simplicity.
Proper P3-specific normalization (IfCond, ThenUpdates, ElseUpdates step sequence)
will be implemented in Phase 47-B when needed for more complex P3 patterns.
|
2025-12-12 05:53:23 +09:00 |
|
|
|
42ecd7a7e7
|
feat(joinir): Phase 47-A prep - P3 fixture and test stub
Preparation for Phase 47-A (P3 Normalized minimal implementation).
Added fixture and test stub for pattern3_if_sum_minimal.
Changes:
- fixtures.rs: Added pattern3_if_sum_minimal fixture
- Source: phase212_if_sum_min.hako
- Pattern: Single carrier (sum), simple condition (i > 0)
- Dev-only fixture for P3 Normalized development
- normalized_joinir_min.rs: Added test stub
- test_normalized_pattern3_if_sum_minimal_runner
- Currently returns early (implementation pending)
- Feature-gated: #[cfg(feature = "normalized_dev")]
- Documentation updates:
- CURRENT_TASK.md: Phase 47-A status
- PHASE_43_245B_NORMALIZED_COMPLETION.md: P3 forward reference
- joinir-architecture-overview.md: Minor formatting
- phase47-norm-p3-design.md: Implementation notes
Next steps (Phase 47-A implementation):
1. Rename pattern2_step_schedule.rs → step_schedule.rs
2. Add P3 StepKind (IfCond, ThenUpdates, ElseUpdates)
3. Implement Normalized→MIR(direct) for P3
4. Complete test implementation
Tests: 937/937 PASS (no behavioral changes yet)
|
2025-12-12 05:07:01 +09:00 |
|
|
|
d4b9ae3ba5
|
feat(joinir): Phase 46 - P2-Mid canonical Normalized promotion
Promote P2-Mid patterns (_atoi real, _parse_number real) to canonical
Normalized→MIR(direct) route, completing P2 line transition.
Canonical set expansion (Phase 41 → Phase 46):
- P2-Core: Pattern2Mini, skip_ws mini/real, atoi mini
- P2-Mid: atoi real, parse_number real (NEW)
All JsonParser P2 loops (_skip_whitespace, _atoi, _parse_number) now
canonical Normalized - Structured→MIR is legacy/comparison-only.
Key changes:
- shape_guard.rs: Expanded is_canonical_shape() (+2 patterns)
- JsonparserAtoiReal
- JsonparserParseNumberReal
- Made NormalizedDevShape enum public
- bridge.rs: Updated canonical routing comments (Phase 41 → 46)
- normalized.rs: Made shape_guard module public
- normalized_joinir_min.rs: Added Phase 46 canonical verification test
- phase46-norm-canon-p2-mid.md: Complete design documentation
Out of scope (deferred):
- P3/P4 Normalized support → NORM-P3/NORM-P4 phases
- Selfhost complex loops → separate phases
Benefits:
- Clear P2 boundary: All JsonParser P2 = Normalized canonical
- Infrastructure validation: Phase 43/245B proven production-ready
- Simplified mental model: P2 = Normalized-first, P3/P4 = future
Tests: 937/937 PASS (lib), 20/20 PASS (normalized_dev feature)
Phase 46 test: test_phase46_canonical_set_includes_p2_mid ✅
|
2025-12-12 04:40:46 +09:00 |
|
|
|
ed8e2d3142
|
feat(joinir): Phase 248 - Normalized JoinIR infrastructure
Major refactoring of JoinIR normalization pipeline:
Key changes:
- Structured→Normalized→MIR(direct) pipeline established
- ShapeGuard enhanced with Pattern2 loop validation
- dev_env.rs: New development fixtures and env control
- fixtures.rs: jsonparser_parse_number_real fixture
- normalized_bridge/direct.rs: Direct MIR generation from Normalized
- pattern2_step_schedule.rs: Extracted step scheduling logic
Files changed:
- normalized.rs: Enhanced NormalizedJoinModule with DevEnv support
- shape_guard.rs: Pattern2-specific validation (+300 lines)
- normalized_bridge.rs: Unified bridge with direct path
- loop_with_break_minimal.rs: Integrated step scheduling
- Deleted: step_schedule.rs (moved to pattern2_step_schedule.rs)
New files:
- param_guess.rs: Loop parameter inference
- pattern2_step_schedule.rs: Step scheduling for Pattern2
- phase43-norm-canon-p2-mid.md: Design doc
Tests: 937/937 PASS (+6 from baseline 931)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2025-12-12 03:15:45 +09:00 |
|
|
|
12e2f87c6f
|
Refine normalized bridge direct path and env guard
|
2025-12-11 22:50:23 +09:00 |
|
|
|
a4756f3ce1
|
Add dev normalized→MIR bridge for P1/P2 mini and JP _atoi
|
2025-12-11 22:12:46 +09:00 |
|
|
|
af6f95cd4b
|
Phase 33 NORM canon test: enforce normalized dev route for P1/P2/JP mini
|
2025-12-11 20:54:33 +09:00 |
|