Commit Graph

2232 Commits

Author SHA1 Message Date
aa29dc8085 feat(joinir): emit balanced depth-scan derived vars 2025-12-17 22:32:50 +09:00
bf80789757 feat(joinir): route balanced depth-scan via Pattern2 policy 2025-12-17 22:32:43 +09:00
f1a570fd45 feat(joinir): Phase 107 balanced depth-scan policy (analysis-only) 2025-12-17 22:25:34 +09:00
97c65a9e6f docs: Phase 107 plan (find_balanced_array_end) 2025-12-17 22:21:42 +09:00
af3b851984 docs: add Phase 107 prep for find_balanced 2025-12-17 22:01:23 +09:00
5f4d8ba112 refactor(joinir): Phase 106 Pattern2 step boxes 2025-12-17 22:01:19 +09:00
712e1ad755 docs: update Phase104 status and JoinIR map 2025-12-17 21:47:37 +09:00
368b363694 refactor(joinir): split Pattern2 facts from lowering orchestration 2025-12-17 21:34:11 +09:00
a05ce39a1f test: add Phase104 json_cur read_digits fixture and smokes 2025-12-17 21:25:12 +09:00
e935b2324b test(smokes): dedupe LLVM EXE scripts via llvm_exe_runner 2025-12-17 21:24:59 +09:00
ae2a1d4339 refactor(joinir): boxify Pattern2 routing and schedule facts 2025-12-17 21:24:46 +09:00
950560a3d9 test(joinir): Phase 104 read_digits loop(true) parity 2025-12-17 18:29:27 +09:00
ce501113a7 docs: Phase 103 P1 DONE (early return) 2025-12-17 17:45:16 +09:00
3fe92312a1 test: Phase 103 P1 if-only early return parity 2025-12-17 17:45:12 +09:00
a5cec824c2 docs: Phase 103 DONE (if-only parity smokes) 2025-12-17 17:41:10 +09:00
99e1d24eaf test: Phase 103 if-only merge fixture + VM/LLVM smokes 2025-12-17 17:41:07 +09:00
935d475882 docs: Phase 103 plan (if-only parity baseline) 2025-12-17 17:39:12 +09:00
733b4fa950 docs: Phase 102 entry (real-app regression smokes) 2025-12-17 16:57:15 +09:00
5b4f9c25e4 test: Phase 102 real-app read_quoted fixture + VM/LLVM smokes 2025-12-17 16:57:11 +09:00
d859e46163 fix(llvm_py): tag stringish across copy/phi for concat 2025-12-17 16:57:06 +09:00
b7a1cc4601 test(smoke): avoid Phase100 string accumulator LLVM EXE skip via plugin cache 2025-12-17 16:38:02 +09:00
dfc01f4dc5 test: Phase 100 string accumulator fixture+smokes (VM+LLVM)
- Add phase100_string_accumulator_min.hako fixture
  * out = out + ch string accumulation
  * print(out.length()) for stable numeric output
- Add VM smoke: phase100_string_accumulator_vm.sh
- Add LLVM EXE smoke: phase100_string_accumulator_llvm_exe.sh (Phase 97 gating)
- Regression: all phase100/97/94 tests pass

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 16:33:26 +09:00
27fd9720d0 feat(joinir): string accumulator emitter (JoinIR)
- Add StringAccumulatorEmitter in join_ir/lowering/common/
- Emit string concat as BinOp(Add) for polymorphic VM/LLVM handling
- Ensure VM/LLVM same semantics
- Fail-Fast: RHS must be Variable (not Literal/MethodCall)
- Pattern2 wiring: string carrier昇格 + type refinement + validation

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 16:33:18 +09:00
ad072e5e09 feat(joinir): string accumulator analyzer/spec
- Add AccumulatorKind::{Int, String} to MutableAccumulatorSpec
- Detect string accumulator pattern: out = out + ch (ch is Variable)
- Delegate string-ish type check to existing box facts
- Unit tests for Int vs String accumulator detection

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 16:33:11 +09:00
bad8ee1571 docs: Phase 100 P3 string accumulator contract
- Add P3 section to phases/phase-100/README.md
- Document allowed form: out = out + ch (Variable RHS only)
- List Fail-Fast cases (Literal RHS, MethodCall RHS, non-string-ish)
- Add example with length-based output

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 16:33:03 +09:00
1b83a92aed test(llvm_py): cover duplicate incoming per pred 2025-12-17 16:12:22 +09:00
0ea2b7d2cb fix(llvm_py): stabilize PHI incoming selection (no overwrite by failed candidate) 2025-12-17 16:12:16 +09:00
43eda13b01 fix(smoke): Phase 97 LLVM EXE filter debug logs from output
- Filter out debug log lines (starting with '[') before numeric extraction
- grep -v '^\[' excludes debug lines like [UnifiedBoxRegistry], [TRACE]
- Ensures clean numeric output extraction for test validation

Note: Test still fails due to functional bug (returns 0,0,0 instead of 2,-1,3)
This is a separate issue requiring investigation of LLVM backend loop handling

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

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2025-12-17 06:40:37 +09:00
61c9d7929c docs: Phase 100 P2.1 - LLVM EXE parity for mutable accumulator
- Update phases/phase-100/README.md with LLVM EXE smoke note
- Update 10-Now.md with P2.1 short report

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 06:31:21 +09:00
cca9ce398e test: Phase 100 mutable accumulator LLVM EXE smoke
- Add phase100_mutable_accumulator_llvm_exe.sh
- Plugin gating via Phase 97 pattern (dlopen cache → build-all)
- Numeric output validation (same SSOT as VM smoke)
- Regression: phase94 pass (phase97 has pre-existing issue)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 06:31:15 +09:00
536e6280c5 test: Phase 100 mutable accumulator fixture + smoke (numeric validation)
- Add apps/tests/phase100_mutable_accumulator_min.hako
  * Pattern2 with break (if i >= 3 { break })
  * Two accumulators: out = out + ch (string), count = count + 1 (integer)
  * print(count) for stable numeric output
- Add phase100_mutable_accumulator_vm.sh smoke test
  * HAKO_JOINIR_STRICT=1 validation
  * Numeric-only output extraction (expected: 3)
- Regression: all phase100/96/94 tests pass

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 06:10:59 +09:00
468977e9b3 feat(joinir): allow accumulator as LoopState carrier (Pattern2 + ScopeManager delegation)
- Integrate MutableAccumulatorAnalyzer into pattern2_with_break.rs
- Delegate read-only check to ScopeManager (SSOT search order)
- Promote valid accumulators to mutable LoopState carriers
- Accumulator updates handled by existing carrier mechanism
- Fail-Fast: mutable RHS (not supported yet)
- Allow LoopBodyLocal RHS (validated later in lowering)
- loop_body_local_init.rs: Align receiver search order with SSOT (ConditionEnv first)
- Error prefix: [joinir/mutable-acc]

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 06:10:50 +09:00
8a40b5700a feat(joinir): detect mutable accumulator pattern (AST-only, spec minimal)
- Implement MutableAccumulatorAnalyzer in loop_pattern_detection/
- Detect shape: target = target + x (Add only, x ∈ {Var, Literal})
- Does NOT check read-only (delegated to ScopeManager)
- Multiple assignments → return None (not our pattern, let other code handle it)
- 6 unit tests covering OK/NG cases
- Error prefix: [joinir/mutable-acc-spec]

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 06:10:38 +09:00
b45035597d docs: Phase 100 P2 mutable accumulator contract
- Add P2 section to phases/phase-100/README.md
- Document allowed form: s = s + x (x must be read-only)
- List Fail-Fast cases (reversed ops, complex RHS, multiple updates)
- Add example with numeric output

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 06:10:26 +09:00
682fc11f7c docs: Phase 100 P1 pinned receiver integration tests complete
- Update docs/development/current/main/phases/phase-100/README.md
  * Document P1 implementation and pinned receiver example
- Update docs/development/current/main/10-Now.md
  * Add Phase 100 P1 completion short report

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

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2025-12-17 05:43:54 +09:00
82806f8f90 test: Phase 100 pinned local receiver fixture + smoke
- Add apps/tests/phase100_pinned_local_receiver_min.hako
  * Dynamic string construction with pinned receiver usage
  * Demonstrates loop-outer local as method receiver
- Add tools/smokes/v2/profiles/integration/apps/phase100_pinned_local_receiver_vm.sh
  * HAKO_JOINIR_STRICT=1 validation
  * Numeric output extraction for log-resistant testing
- Regression: phase96 and phase94 smoke tests pass

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

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2025-12-17 05:43:44 +09:00
0661e92225 feat(joinir): phase 100 P1 - pinned local analyzer and wiring into CapturedEnv
- Implement PinnedLocalAnalyzer box to identify pinned loop-outer locals
  * Pure AST analysis (no MIR dependencies)
  * Detects locals: defined before loop, referenced in loop, NOT assigned in loop
  * 5 unit tests covering all edge cases (no assignment, assigned, empty body, etc.)
- Integrate PinnedLocalAnalyzer into pattern2_with_break.rs
  * Call analyzer with loop body AST and candidate locals from variable_map
  * Wire pinned locals into CapturedEnv with CapturedKind::Pinned
  * Fail-Fast on host_id lookup failure or analyzer errors
- Update loop_body_local_init.rs resolver to search CapturedEnv
  * New search order: LoopBodyLocalEnv → ConditionEnv → CapturedEnv
  * Access via cond_env.captured (already integrated in ConditionEnv)
  * Updated error message to show full search order
- All existing tests pass (1101 passed, 1 unrelated failure)
- Smoke tests verified: phase96_json_loader_next_non_ws_vm, phase94_p5b_escape_e2e

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

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2025-12-17 05:32:35 +09:00
0c7ea21cac refactor(joinir): phase 100 P1 - add CapturedKind (Explicit/Pinned) to CapturedVar
- Add CapturedKind enum to types.rs (Explicit for traditional, Pinned for Phase 100)
- Update CapturedVar struct to include kind field
- Add insert() and insert_pinned() helper methods to CapturedEnv
- Update analyzers.rs to specify kind field in all CapturedVar instantiations
- Export CapturedKind from function_scope_capture module
- Update scope_manager.rs test to include kind field

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

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2025-12-17 05:32:17 +09:00
692d44da62 docs: Phase 100 rollout plan (Pinned then mutable carrier) 2025-12-17 05:18:09 +09:00
8ab95666c8 docs: Phase 100 pinned read-only captures plan 2025-12-17 05:03:07 +09:00
90a8f1650d docs: Phase 99 notes and indices
Trim/escape実コード寄り強化の記録:
- phase-96: 3ケース追記
- phase-95: 末尾バックスラッシュ扱い追記
- phase-99: 新規README作成
- 10-Now.md: Phase 99短報追加

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 04:26:23 +09:00
708d01d1f8 test: Phase 99 add trailing backslash escape best-effort (VM+LLVM)
末尾バックスラッシュ処理:
- 現行仕様: best-effort(そのまま出力)として固定
- fixture: "hello\\" → "hello\" を出力
- VM+LLVM EXE parity完全対応

Integration smokeで検証済み

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 04:26:05 +09:00
b23d23f11f test: Phase 99 extend next_non_ws to 3 cases (VM+LLVM)
3ケース固定:
- 既存: "  hi" → 2, " \t" → -1
- 新規: "\n\r\tX" → 3 (mixed newline/CR/tab)

VM+LLVM EXE parity完全対応

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 04:25:57 +09:00
6d73fc3404 feat(llvm): Phase 97 Box/Policy refactoring complete
Box化完了:
- CallRoutePolicyBox: Call routing SSoT
- PrintArgMarshallerBox: Print marshalling SSoT
- TypeFactsBox: Type propagation SSoT
- PhiSnapshotPolicyBox: PHI contract SSoT
- PluginErrorContext: Structured error reporting

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 04:14:26 +09:00
65763c1ed6 feat(llvm): Phase 97 - Call/PHI/Plugin強化 + リファクタリング準備
## 概要
LLVM backend のCall処理、PHI wiring、Plugin loader を強化。
次のリファクタリング(箱化モジュール化)のための準備も含む。

## 変更内容

### LLVM Call処理強化
- `mir_call/__init__.py`: Call ルーティングロジック改善
- `mir_call/global_call.py`: print処理の marshal強化
- `mir_call/method_call.py`: メソッド呼び出し処理改善
- `boxcall.py`: BoxCall処理改善

### PHI処理強化
- `phi_manager.py`: PHI管理改善
- `phi_wiring/wiring.py`: PHI配線ロジック強化(+17行)
- `phi_wiring/tagging.py`: Type tagging改善
- `resolver.py`: Value解決ロジック強化(+34行)

### Copy伝播
- `copy.py`: Copy命令のType tag伝播追加(+10行)

### Plugin loader強化
- `library.rs`: エラー出力改善、[plugin/missing]ログ追加(+34行)
- fail-fast強化

### テスト
- `phase97_json_loader_escape_llvm_exe.sh`: Phase 97 E2Eテスト追加
- `phase97_next_non_ws_llvm_exe.sh`: Phase 97 E2Eテスト追加

### その他
- `nyash_kernel/lib.rs`: Kernel側の改善(+23行)

## 統計
- 14ファイル変更
- +256行 / -53行 = +203 net

## 次のリファクタリング準備
以下の箇所がリファクタリング対象として識別済み:
1. Call ルーティング箱の明文化
2. print の marshal 箱
3. TypeFacts/Tagging 箱の一本化
4. PHI Snapshot 契約のSSOT
5. Plugin loader のエラー出力統合

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 03:51:03 +09:00
1a0d9ce8a0 docs: add Phase 97 LLVM EXE parity entry 2025-12-17 02:26:42 +09:00
bc55c50d70 test: add Phase 97 LLVM EXE smokes for MiniJsonLoader 2025-12-17 02:26:24 +09:00
af8c00dedb test(joinir): add break condition extraction SSOT tests 2025-12-17 02:12:34 +09:00
bc1a09f2c3 fix(joinir): Phase 96 next_non_ws break condition SSOT 2025-12-17 01:59:21 +09:00
db4453eb3c test: strengthen phase96 next_non_ws fixture 2025-12-17 01:35:43 +09:00