Commit Graph

130 Commits

Author SHA1 Message Date
bb8ee83988 docs+config: document and catalog resolve env vars 2025-12-28 14:02:32 +09:00
2ee8718476 docs: note NYASH_STR_CP toggle for strings 2025-12-28 13:57:31 +09:00
fe3eb9f1f7 config: centralize NYASH_STR_CP and add cp smoke 2025-12-28 13:44:53 +09:00
47493b95ce docs(mir): document KeepAlive/ReleaseStrong lifecycle directives 2025-12-27 01:07:46 +09:00
55d30c9845 docs(repl): record Phase 288.1 contract and results
更新内容:
- docs/reference/language/repl.md
  - Phase 288.1 完了ステータスに更新
  - Implementation Architecture セクション追加(AST rewrite 方式説明)
  - AST Rewriter の動作フロー追加(Variable/Assignment 変換ロジック)
  - ExternCall Bridge の仕組み追加(__repl.get/set → VMValue)
  - Expression Detection ロジック追加(wrapper AST 判定)
  - 動作例を完全に更新(全機能が動作済み)

- docs/development/current/main/phases/phase-288/README.md
  - Phase 288.1 完了セクション追加
  - 変更ファイル一覧(8ファイル, +592行)記録
  - 確認コマンド 4種 記録(変数永続化/式表示/_変数/リセット)
  - 回帰テスト結果記録(154/154 PASS)

- docs/development/current/main/10-Now.md
  - "Phase 288.1 完了" に更新
  - 次の候補(REPL UX 改善 / JoinIR 設計作業)を追記

- CURRENT_TASK.md
  - 1段落サマリー更新(288.1 完了、次の方向性)

Phase 288.1 成果(SSOT記録):
 変数永続化(session → eval bridge)
 式自動表示(pure expression auto-output)
 _ 変数(last displayed value)
 Fail-Fast 未定義エラー + ヒント
 セッションリセット(.reset)
 154/154 smoke tests PASS(file mode 不変)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-25 23:05:20 +09:00
dd1b2a22e1 docs(repl): Phase 288 final documentation polish
Updated documentation for Phase 288 completion:
- docs/reference/language/repl.md: Status clarified (P0–P3 complete)
- docs/development/current/main/phases/phase-288/README.md: Added P0-P3 summaries

Changes:
- repl.md: "partial (dev tool)" → "P0–P3 complete / Phase 288.1 next"
- README.md: Each phase now has detailed description with key deliverables
- Added Box化モジュール化 (3445ef7a7) to completion record

Documentation improvements:
-  P0-P3 completion clearly marked
-  VMValue persistence approach documented
-  Box-First modularization recorded
-  Consistent with 10-Now.md, 30-Backlog.md, P1-INSTRUCTIONS.md

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-25 14:21:22 +09:00
2b86b658d8 docs(repl): Phase 288 documentation cleanup
Updated documentation to reflect actual implementation status:
- docs/reference/language/repl.md: Corrected examples (variable persistence TODO)
- docs/development/current/main/10-Now.md: Phase 288 completion noted
- docs/development/current/main/30-Backlog.md: Updated with Phase 288.1 tasks
- docs/development/current/main/phases/phase-288/: Added phase documentation

Accurate REPL behavior examples:
- x = 1 works (implicit local)
- print(x) errors (persistence in Phase 288.1)
- Expression auto-display deferred

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-25 14:01:32 +09:00
38968efa3c docs(repl): Update Phase 288 P3 completion status
Updated implementation status to reflect actual working features:
-  print() output displays
-  .reset command works
-  Implicit local binding compiles
-  Variable persistence (deferred to Phase 288.1+)

Known limitations documented:
- Variable access across lines not yet working
- _ variable stored but not accessible yet
- Expression auto-display deferred

Accurate current behavior examples added.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-25 13:48:39 +09:00
796089688a docs(repl): Phase 288 P0 - Establish REPL SSOT
Expanded docs/reference/language/repl.md (123→336 lines):
- Philosophy: "Two execution contexts, one language"
- File mode vs REPL mode: Concrete code examples
- Implementation Contract: VMValue persistence (not ValueId)
- Architecture: Box-First modularization (ReplSessionBox)
- Evaluation Pipeline: Parse→Compile→Execute→Store VMValue
- Phase 288 MVP status: P0-P3 completed, P288.1 deferred

Key design decisions documented:
- Session stores VMValue (runtime values, persist across lines)
- NOT ValueId (MIR-specific, invalidated per compilation)
- assignment_resolver.rs unchanged (file mode専用)
- 80/20 rule: Working REPL first, expression auto-display later

SSOT ensures implementation matches user expectations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-25 13:24:32 +09:00
c117a04035 fix(rewrite): toString normalization to BoxCall(slot #0) - Phase 287 P4
Root cause: toString/stringify/str were being rewritten to Global/Method calls
with class inference, causing Main.toString/0 to be called for primitives.

Fix (Box-First + Legacy Deletion):
1.  MIR Builder - toString normalization (special.rs)
   - ALWAYS emit BoxCall with method_id=0 for toString/stringify/str
   - Do NOT rewrite to Global(Class.str/0) or Method calls
   - DELETED 70+ lines of complex class inference logic
   - Primitive guard with method name filter (known.rs)

2.  JSON Serializer - method_id output (mir_json_emit.rs)
   - Include method_id field in BoxCall JSON for LLVM

3.  LLVM Backend - universal slot #0 support
   - Extract method_id from JSON (instruction_lower.py)
   - Box primitives via nyash.box.from_i64 (boxcall.py)
   - Invoke toString via plugin system with method_id=0
   - ⚠️ TODO: Add nyash.integer.tostring_h to kernel

Test Results:
 VM: local x = 1; print(x.toString()) → "1" (PASS)
 VM: array_length test (boxed Integer) → PASS
⚠️ LLVM: Compiles successfully, needs kernel function

SSOT: slot_registry - toString is ALWAYS universal slot #0

Legacy Deleted:
- special.rs: Complex class inference rewrite (~70 lines)
- special.rs: Unique suffix fallback for toString
- special.rs: Main box special handling

Files changed:
- src/mir/builder/rewrite/special.rs (try_early_str_like_to_dst)
- src/mir/builder/rewrite/known.rs (primitive guards x4)
- src/runner/mir_json_emit.rs (method_id serialization x2)
- src/llvm_py/builders/instruction_lower.py (method_id extraction)
- src/llvm_py/instructions/boxcall.py (slot #0 handler)
- docs/reference/language/quick-reference.md (toString SSOT)

🎊 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-25 11:38:05 +09:00
a40ee8dda5 refactor(plan): Phase 286C-4 Step 1 - plan_helpers module
Create helper functions to support plan_rewrites() extraction:
- build_local_block_map(): Build block ID mapping for a function
- sync_spans(): Synchronize instruction spans after rewriting

These pure functions will be used by both the current monolithic
merge_and_rewrite() and the new plan_rewrites() function.

Progress: Step 1/4 (helpers) complete

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 03:53:42 +09:00
f740e6542f feat(phase285): Complete weak reference implementation (VM + LLVM harness)
Phase 285LLVM-1.1 to 1.4 + weak reference infrastructure:

**LLVM Harness** (Phase 285LLVM-1.x):
- 285LLVM-1.1: User Box registration & debug output
- 285LLVM-1.2: WeakRef basic operations (identity deferred)
- 285LLVM-1.3: InstanceBox field access (getField/setField)
- 285LLVM-1.4: print Handle resolution (type tag propagation)

**VM Runtime** (nyash_kernel):
- FFI functions: nyrt_weak_new, nyrt_weak_to_strong, nyrt_weak_drop
  (crates/nyash_kernel/src/lib.rs: +209 lines)
- WeakRef plugin invoke support
  (crates/nyash_kernel/src/plugin/invoke.rs: +250 lines)
- weak_handles.rs: WeakRef handle registry (NEW)

**LLVM Python Backend**:
- WeakRef instruction lowering (weak.py: NEW)
- Entry point integration (entry.py: +93 lines)
- Instruction lowering (instruction_lower.py: +13 lines)
- LLVM harness runner script (tools/run_llvm_harness.sh: NEW)

**MIR & Runtime**:
- WeakRef emission & validation
- MIR JSON export for weak instructions
- Environment variable support (NYASH_WEAK_*, HAKO_WEAK_*)

**Documentation**:
- CLAUDE.md: Phase 285 completion notes
- LANGUAGE_REFERENCE_2025.md: Weak reference syntax
- 10-Now.md & 30-Backlog.md: Phase 285 status updates

Total: +864 lines, 24 files changed

SSOT: docs/reference/language/lifecycle.md
Related: Phase 285W-Syntax-0, Phase 285W-Syntax-0.1
2025-12-25 00:11:34 +09:00
cc05c37ae3 feat(phase285w): Phase 285W-Syntax-0.1 - Reject weak(...) syntax (Parser-level Fail-Fast)
- Parser guard: Reject weak(...) with LPAREN check in parse_unary()
  - Error: "Use 'weak expr', not 'weak(expr)'" (helpful message)
  - Location: src/parser/expressions.rs:248-256
- MIR builder guard: Defense-in-depth for any bypassed cases
  - Location: src/mir/builder/calls/build.rs:37-46
- Rejection test: apps/tests/phase285w_weak_call_rejected.hako
- Smoke test: phase285w_weak_call_rejected_vm.sh (PASS )
- Documentation:
  - EBNF.md: Add ~ (BitNot) to unary operators
  - lifecycle.md: Document weak(expr) as invalid syntax
  - phase-285/README.md: Add Phase 285W-Syntax-0.1 entry

Test results: 5/6 phase285 tests PASS (1 unrelated failure)
SSOT: docs/reference/language/lifecycle.md

Closes: Phase 285W-Syntax-0.1
2025-12-25 00:04:55 +09:00
af99ccab91 feat(llvm): Phase 285LLVM-0 - LLVM Conformance One-Pass
Step 0: SSOT/Reality Alignment
- Update Feature Matrix (lifecycle.md):
  - WeakRef: "285A1" → "285LLVM-1"
  - Leak Report: "partial" → "Parent process roots only (285LLVM-0)"
  - Add detailed LLVM limitation explanation
- Update SKIP reason (phase285_weak_basic_llvm.sh): "285A1" → "285LLVM-1"

Step 1: LLVM Leak Report Implementation
- Add emit_leak_report() calls to llvm.rs (success + error paths)
- Create phase285_leak_report_llvm.sh smoke test (3 test cases PASS)
- Add NYASH_LEAK_LOG documentation to environment-variables.md
- Manual test: All 3 cases PASS (no-log, LEVEL=1, LEVEL=2)
- Smoke test: 3/3 PASS

Step 2: WeakRef Design Preparation
- Create phase-285llvm-1-design.md
  - Runtime representation candidate (Option B with caveat)
  - FFI signatures definition
  - Implementation checklist
  - Test strategy
  - NO CODE IMPLEMENTATION (design-only phase)

Implementation:
- Minimal 10-20 line code change (as planned)
- Reuses existing leak_tracker.rs infrastructure
- LLVM limitation transparently documented
- Exit codes unchanged (0/1 preserved)
- Fixture SSOT: apps/tests/*.hako shared between VM/LLVM

Test Results:
-  Manual test: 3/3 cases PASS
-  Smoke test: 3/3 cases PASS
-  No regressions

Files Changed:
- src/runner/modes/llvm.rs (2 emit_leak_report() calls)
- docs/reference/language/lifecycle.md (Feature Matrix + LLVM limitation)
- docs/reference/environment-variables.md (NYASH_LEAK_LOG entry)
- tools/smokes/v2/profiles/quick/lifecycle/phase285_weak_basic_llvm.sh (SKIP reason)

Files Added:
- tools/smokes/v2/profiles/quick/lifecycle/phase285_leak_report_llvm.sh
- docs/development/current/main/phases/phase-285/phase-285llvm-1-design.md

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 09:58:00 +09:00
f9c21ea601 test(env): Phase 286A - Deprecated env warning regression test
Goal: Prevent regression where deprecated env vars warn even when unset

Changes:
- tools/smokes/v2/profiles/quick/env/phase286_deprecated_env_warnings.sh
  * Test Case 1: Unset env → No warnings (防止: 未設定で警告)
  * Test Case 2: NYASH_MACRO_TOPLEVEL_ALLOW=1 → Warning expected
  * Test Case 3: NYASH_MACRO_BOX_CHILD_RUNNER=1 → Warning expected
  * Uses env -u to truly unset variables (empty string counts as "set")

- docs/reference/environment-variables.md
  * Added "Deprecated 警告動作 (Phase 286A)" section
  * Clarified: warnings only appear when env var is explicitly set
  * Warning format: [macro][compat] <変数名> is deprecated; <推奨アクション>

Test Results:
 All 3 test cases pass
 Quick smoke: 45/46 tests pass (1 known failure unrelated)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 09:14:33 +09:00
ab76e39036 feat(parser): Phase 285A1.4 & A1.5 - Weak field sugar + Parser hang fix
A1.4: Add sugar syntax `public weak parent` ≡ `public { weak parent }`
A1.5: Fix parser hang on unsupported `param: Type` syntax

Key changes:
- A1.4: Extend visibility parser to handle weak modifier (fields.rs)
- A1.5: Shared helper `parse_param_name_list()` with progress-zero detection
- A1.5: Fix 6 vulnerable parameter parsing loops (methods, constructors, functions)
- Tests: Sugar syntax (OK/NG), parser hang (timeout-based)
- Docs: lifecycle.md, EBNF.md, phase-285a1-boxification.md

Additional changes:
- weak() builtin implementation (handlers/weak.rs)
- Leak tracking improvements (leak_tracker.rs)
- Documentation updates (lifecycle, types, memory-finalization, etc.)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 07:44:50 +09:00
cc8b27a1aa feat(weak): Phase 285A1 - Weak Field Contract (Strict Type Enforcement)
Remove automatic WeakNew conversion and enforce strict compile-time type
checking for weak field assignments. Only 3 assignment types allowed:
1. Result of weak(x) call (WeakRef type)
2. Existing WeakRef variable (e.g., me.parent = other.parent)
3. Void/null (clear operation)

**Implementation**:
- Added MirType::WeakRef to type system (src/mir/types.rs)
- Track WeakRef type in emit_weak_new() even in pure mode
- Weak field reads return WeakRef without auto-upgrade
- Removed automatic WeakNew conversion from field writes
- Implemented check_weak_field_assignment() with actionable errors
- Fixed null literal type tracking (Phase 285A1.1: Unknown → Void)

**Testing**:
- 5 test fixtures (3 OK, 2 NG cases) - all passing
- Smoke test: phase285_weak_field_vm.sh
- Error messages guide users to use weak() or null

**Documentation**:
- Updated lifecycle.md SSOT with weak field contract

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 03:17:30 +09:00
264940ef51 feat(llvm/phi): Phase 278 P0 - remove deprecated PHI debug env vars
## Changes
- debug_helper.py: Remove backward compatibility (warning → error + exit 1)
- environment-variables.md: Migrate deprecated section with migration guide
- phase278_p0_deprecated_env_fail.sh: Add smoke test for deprecated var detection

## Removed Variables (5)
- NYASH_LLVM_PHI_DEBUG
- NYASH_PHI_TYPE_DEBUG
- NYASH_PHI_ORDERING_DEBUG
- NYASH_LLVM_TRACE_PHI
- NYASH_LLVM_VMAP_TRACE

## SSOT Variables (3) - Unchanged
- NYASH_LLVM_DEBUG_PHI=1
- NYASH_LLVM_DEBUG_PHI_TRACE=1
- NYASH_LLVM_PHI_STRICT=1

## Benefits
-  Deprecated vars cause fail-fast error (not silent)
-  Error messages include replacement hints
-  Documentation reflects removal (migration guide included)
-  Smoke test verifies deprecated var rejection
-  No regressions in existing tests

## Testing
 Test 1: Deprecated NYASH_LLVM_PHI_DEBUG rejected
 Test 2: Deprecated NYASH_LLVM_TRACE_PHI rejected
 Test 3: SSOT vars work normally
 Regression tests: strict=OFF, strict=ON, debug mode - all pass

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-22 15:08:50 +09:00
757193891f feat(llvm/phi): Phase 277 P1 - fail-fast validation for PHI strict mode
## Summary
Implemented fail-fast validation for PHI ordering and value resolution in strict mode.

## Changes

### P1-1: Strict mode for "PHI after terminator"
- File: `src/llvm_py/phi_wiring/wiring.py::ensure_phi`
- Behavior: `NYASH_LLVM_PHI_STRICT=1` → RuntimeError if PHI created after terminator
- Default: Warning only (no regression)

### P1-2: Strict mode for "fallback 0"
- File: `src/llvm_py/phi_wiring/wiring.py::wire_incomings`
- Behavior: Strict mode forbids silent fallback to 0 (2 locations)
  - Location 1: Unresolvable incoming value
  - Location 2: Type coercion failure
- Error messages point to next debug file: `llvm_builder.py::_value_at_end_i64`

### P1-3: Connect verify_phi_ordering() to execution path
- File: `src/llvm_py/builders/function_lower.py`
- Behavior: Verify PHI ordering after all instructions emitted
- Debug mode: Shows " All N blocks have correct PHI ordering"
- Strict mode: Raises RuntimeError with block list if violations found

## Testing
 Test 1: strict=OFF - passes without errors
 Test 2: strict=ON - passes without errors (no violations in test fixtures)
 Test 3: debug mode - verify_phi_ordering() connected and running

## Scope
- LLVM harness (Python) changes only
- No new environment variables (uses existing 3 from Phase 277 P2)
- No JoinIR/Rust changes (root fix is Phase 279)
- Default behavior unchanged (strict mode opt-in)

## Next Steps
- Phase 278: Remove deprecated env var support
- Phase 279: Root fix - unify "2本のコンパイラ" pipelines

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-22 14:48:37 +09:00
03aa54a422 feat(phase277-p2): PHI環境変数統合 8個→3個 - ユーザビリティ向上
Phase 277 P2: PHI関連環境変数の統合・整理

【問題】
- PHI関連環境変数が8個に乱立
- ユーザーが覚える変数が多すぎる
- 保守性が低い(関連設定が分散)

【解決】
1. debug_helper.py 新規作成(SSOT)
   - is_phi_debug_enabled(): 一般デバッグ(3変数統合)
   - is_phi_trace_enabled(): 詳細トレース(2変数統合)
   - is_phi_strict_enabled(): 厳格モード(既存維持)

2. 環境変数統合(8個→3個)
   統合後:
   - NYASH_LLVM_DEBUG_PHI: 一般PHIデバッグ
   - NYASH_LLVM_DEBUG_PHI_TRACE: 詳細トレース
   - NYASH_LLVM_PHI_STRICT: 厳格モード(既存維持)

   統合前(廃止予定):
   - NYASH_LLVM_PHI_DEBUG → NYASH_LLVM_DEBUG_PHI
   - NYASH_PHI_TYPE_DEBUG → NYASH_LLVM_DEBUG_PHI
   - NYASH_PHI_ORDERING_DEBUG → NYASH_LLVM_DEBUG_PHI
   - NYASH_LLVM_TRACE_PHI → NYASH_LLVM_DEBUG_PHI_TRACE
   - NYASH_LLVM_VMAP_TRACE → NYASH_LLVM_DEBUG_PHI_TRACE

3. 後方互換性対応
   - 旧環境変数使用時に非推奨警告表示
   - Phase 278 で削除予定

【効果】
-  ユーザビリティ向上: 覚える変数 8個→3個(62%削減)
-  保守性向上: 環境変数チェック 30+箇所→1箇所(SSOT)
-  ドキュメント簡潔化: environment-variables.md 整理
-  SSOT原則適用: debug_helper.py に環境変数ロジック集約

【影響範囲】
- 新規: debug_helper.py (SSOT)
- 修正: 9ファイル(PHI関連Python)
- ドキュメント: environment-variables.md, 10-Now.md

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-22 13:57:33 +09:00
2d9c6ea3c6 feat(joinir): Phase 254-255 - Pattern 6 (ScanWithInit) + exit PHI DCE fix
## Phase 254: Pattern 6 (ScanWithInit) Detection & JoinIR Lowering

Pattern 6 detects index_of/find/contains-style loops:
- Loop condition: i < x.length()
- Loop body: if with method call condition + early return
- Step: i = i + 1
- Post-loop: return not-found value (-1)

Key features:
- Minimal lowering: main/loop_step/k_exit functions
- substring hoisted to init-time BoxCall
- Two k_exit jumps (found: i, not found: -1)
- Tests: phase254_p0_index_of_min.hako

## Phase 255 P0: Multi-param Loop CarrierInfo

Implemented CarrierInfo architecture for Pattern 6's 3-variable loop (s, ch, i):
- i: LoopState (header PHI + exit PHI)
- s, ch: ConditionOnly (header PHI only)
- Alphabetical ordering for determinism
- All 3 PHI nodes created correctly
- Eliminates "undefined ValueId" errors

## Phase 255 P1: Exit PHI DCE Fix

Prevents exit PHI from being deleted by DCE:
- PostLoopEarlyReturnStepBox emits post-loop guard
- if (i != -1) { return i } forces exit PHI usage
- Proven pattern from Pattern 2 (balanced_depth_scan)
- VM/LLVM backends working

## Test Results

 pattern254_p0_index_of_vm.sh: PASS (exit code 1)
 pattern254_p0_index_of_llvm_exe.sh: PASS (mock)
 Quick profile: json_lint_vm PASS (progresses past index_of)
 Pattern 1-5: No regressions

## Files Added

- src/mir/builder/control_flow/joinir/patterns/pattern6_scan_with_init.rs
- src/mir/join_ir/lowering/scan_with_init_minimal.rs
- apps/tests/phase254_p0_index_of_min.hako
- docs/development/current/main/phases/phase-254/README.md
- docs/development/current/main/phases/phase-255/README.md

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

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2025-12-19 23:32:25 +09:00
42f7eaa215 tools: speed up build_llvm NyRT cache + fix Phase 132 smoke counters
Improvements:
1. NyRT build cache in tools/build_llvm.sh
   - Skip [3/4] rebuild when target/release/libnyash_kernel.a exists
   - Add NYASH_LLVM_FORCE_NYRT_BUILD env var to force rebuild
   - Performance: 60-80% faster on incremental builds

2. Fix Phase 132 smoke test arithmetic bug
   - Replace ((PASS_COUNT++)) with PASS_COUNT=$((PASS_COUNT + 1))
   - Issue: ((x++)) returns 0 when x=0, causes set -e to exit
   - Locations: 8 places in phase132_exit_phi_parity.sh

3. Document NYASH_LLVM_FORCE_NYRT_BUILD in environment-variables.md

Acceptance criteria met:
- Behavior unchanged (first build creates .a, subsequent skip rebuild)
- NYASH_LLVM_FORCE_NYRT_BUILD allows forcing rebuild
- Phase 132 smoke test passes (both cases)
- Behavior-preserving optimization

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

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2025-12-15 11:06:26 +09:00
a955dd6b18 feat(llvm): Phase 131-15 - print/concat segfault 根治修正
## P1-1/P1-2: TypeFacts 優先化
- binop.py: operand facts が dst_type ヒントより優先
- mir_json_emit.rs: Unknown 時に dst_type を出さない
- function_lower.py: value_types を metadata から読み込み

## P2: handle concat 統一(根治)
- print シグネチャ修正: i64(i64) → void(i8*)
- Mixed concat を handle ベースに統一:
  - concat_si/concat_is → concat_hh
  - box.from_i64 で integer を handle 化
  - Everything is Box 哲学に統一
- legacy 関数は互換性のために保持

## 結果
-  print("Result: " + 3) → Result: 3
-  segfault 解消
-  Everything is Box 統一

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-15 01:36:34 +09:00
7dfd6ff1d9 feat(llvm): Phase 131-11-H/12 - ループキャリアPHI型修正 & vmap snapshot SSOT
## Phase 131-11-H: ループキャリアPHI型修正
- PHI生成時に初期値(entry block)の型のみ使用
- backedge の値を型推論に使わない(循環依存回避)
- NYASH_CARRIER_PHI_DEBUG=1 でトレース

## Phase 131-12-P0: def_blocks 登録 & STRICT エラー化
- safe_vmap_write() で PHI 上書き保護
- resolver miss を STRICT でエラー化(フォールバック 0 禁止)
- def_blocks 自動登録

## Phase 131-12-P1: vmap_cur スナップショット実装
- DeferredTerminator 構造体(block, term_ops, vmap_snapshot)
- Pass A で vmap_cur をスナップショット
- Pass C でスナップショット復元(try-finally)
- STRICT モード assert

## 結果
-  MIR PHI型: Integer(正しい)
-  VM: Result: 3
-  vmap snapshot 機構: 動作確認
- ⚠️ LLVM: Result: 0(別のバグ、次Phase で調査)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 21:28:41 +09:00
e912ef9134 docs(phase131): SSOT整備 - VM入口/env var/次の入口を1箇所に固定
Phase 131 SSOT 整備完了:

1) VM Box 解決の入口SSOT(phase131-2-box-resolution-map.md)
   - 📍 入口3行を先頭に追記(handle_new_box/UnifiedRegistry/BoxFactoryRegistry)
   - NYASH_VM_FAST を bench/profile-only 特例と明記

2) 環境変数のSSOTを1箇所へ(environment-variables.md)
   - ## LLVM Build Pipeline セクション新設(14変数)
   - phase87 の Environment Variables セクションを参照リンクに置き換え
   - 重複表を削除、SSOTドキュメントへの導線確立

3) 次の開発の入口を明確化(CURRENT_TASK.md)
   - P1(Loop Canonicalizer): 🔶 設計待ち(外部検討中)
   - P2(JoinIR / Selfhost depth-2):  実装可能
   - 次に触るSSOTを1行で指定:
     - Loop系: joinir-architecture-overview.md
     - VM Box系: phase131-2-box-resolution-map.md

Impact:
- 迷子防止: 各領域のSSOTが1行で分かる
- 重複削減: env var 表を environment-variables.md に集約
- 状態明確化: P1/P2 の「設計待ち/実装可能」が一目瞭然

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-14 05:27:39 +09:00
1fae4f1648 MIR: lexical scoping + builder vars modules 2025-12-13 01:30:04 +09:00
d7805e5974 feat(joinir): Phase 213-2 Step 2-2 & 2-3 Data structure extensions
Extended PatternPipelineContext and CarrierUpdateInfo for Pattern 3 AST-based generalization.

Changes:
1. PatternPipelineContext:
   - Added loop_condition: Option<ASTNode>
   - Added loop_body: Option<Vec<ASTNode>>
   - Added loop_update_summary: Option<LoopUpdateSummary>
   - Updated build_pattern_context() for Pattern 3

2. CarrierUpdateInfo:
   - Added then_expr: Option<ASTNode>
   - Added else_expr: Option<ASTNode>
   - Updated analyze_loop_updates() with None defaults

Status: Phase 213-2 Steps 2-2 & 2-3 complete
Next: Create Pattern3IfAnalyzer to extract if statement and populate update summary
2025-12-10 00:01:53 +09:00
120fbdb523 fix(mir): Receiver used_values for DCE + trace + cleanup
- Fix: Call with Callee::Method now includes receiver in used_values()
  - Prevents DCE from eliminating Copy instructions that define receivers
  - Pattern 3 (loop_if_phi.hako) now works correctly (sum=9)

- Add: NYASH_DCE_TRACE=1 for debugging eliminated instructions
  - Shows which pure instructions DCE removes and from which block

- Cleanup: Consolidate Call used_values to single source of truth
  - Early return in methods.rs handles all Call variants
  - Removed duplicate match arm (now unreachable!())
  - ChatGPT's suggestion for cleaner architecture

- Docs: Phase 166 analysis of inst_meta layer architecture
  - Identified CSE pass callee bug (to be fixed next)
  - Improvement proposals for CallLikeInst

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 23:26:55 +09:00
caf38dba19 feat(joinir): Phase 190 - LoopExitBinding boxification
Formalize exit PHI → variable_map reconnection with explicit LoopExitBinding
structure. Eliminates hardcoded variable names and prepares for Pattern 4+
multi-carrier support.

Key changes:

1. **New LoopExitBinding struct**:
   - carrier_name: String (e.g., "sum", "count")
   - join_exit_value: ValueId (JoinIR exit value)
   - host_slot: ValueId (variable_map destination)
   Makes it explicit: WHICH variable, FROM where, TO where.

2. **Updated JoinInlineBoundary**:
   - Replaced implicit host_outputs: Vec<ValueId>
   - With explicit exit_bindings: Vec<LoopExitBinding>
   - Old APIs marked #[deprecated] for backward compatibility

3. **Pattern 3 now uses explicit bindings**:
   Before: boundary.host_outputs = vec![sum_var_id]  // implicit
   After:  boundary.exit_bindings = vec![LoopExitBinding {
       carrier_name: "sum".to_string(),
       join_exit_value: ValueId(18),
       host_slot: sum_var_id,
   }]

4. **merge_joinir_mir_blocks() updated**:
   - Consumes exit_bindings instead of bare ValueIds
   - Enhanced debug output shows carrier names
   - Validates carrier name matches variable_map expectations

Benefits:
- Self-documenting code: bindings explain themselves
- Multi-carrier ready: Pattern 4+ just extend the vec![]
- Type-safe: No implicit semantics
- Debuggable: Explicit carrier name in logs

Test status:
- Build:  SUCCESS (0 errors, 47 warnings)
- Pattern 3:  PASS (no regressions)
- Backward compatibility:  Maintained via #[deprecated]

Prepare for Phase 191: Pattern Router Table and Phase 192: JoinLoopTrace

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

Co-Authored-By: ChatGPT <noreply@openai.com>
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 19:59:40 +09:00
d5b065e5c4 docs(phase173): Phase 173 Task 1-3 complete - investigation, spec, and JsonParserBox bugfix
📚 Phase 173 前半完了(Task 1-3)!

 Task 1: 名前解決経路調査
- UsingResolverBox / CalleeResolverBox 構造把握
- 3つの重大問題発見:
  1. 静的 Box が InstanceBox として扱われる
  2. JsonParserBox _parse_number 無限ループ
  3. new Alias.BoxName() 構文未サポート

 Task 2: 仕様固定(docs)
- using.md: +179行(静的 Box 使用例)
- LANGUAGE_REFERENCE_2025.md: +54行(static box ライブラリ方針)

 Task 3: JsonParserBox バグ修正
- MIR Nested-If-in-Loop Bug 発見・回避
- while → loop() 構文統一(10箇所)
- ネスト if-else のフラット化

📋 成果物:
- phase173_task1_investigation.md(220行)
- phase173_using_static_box_resolution.md
- phase173-2_using_resolver_mir_lowering.md(後半指示書)
- mir-nested-if-loop-bug.md(バグ分析)
- json_parser_min.hako(テストファイル)

🎯 次: Task 4-6(using resolver + MIR lowering 統合)

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 17:47:19 +09:00
4b6b75932c chore(phase152-b): Static method 宣言整理(箱化モジュール化)
- MainDetectionHelper で main() 検出ロジックを箱化
- Legacy "static method main" と Modern "static box Main { main() }" の両パターン対応
- stage1_run_min.hako を modern 形式に統一
- ドキュメント更新(quickstart 等で static box スタイルに統一)
- パーサ新構文追加なし(仕様統一性保持)
- 後方互換性維持(Stage-B ヘルパーで legacy もサポート)
- テスト結果: 全スモーク PASS

Phase 152-B: Static Method 宣言の整理(Stage-3 仕様統一)

実装パターン: 箱化モジュール化(Phase 133/134 継承)

修正ファイル:
- lang/src/compiler/entry/compiler_stageb.hako: MainDetectionHelper (+103 lines)
- lang/src/compiler/entry/compiler.hako: Legacy Stage-A コメント (+3 lines)
- apps/tests/stage1_run_min.hako: Modern syntax に統一 (-1 line)
- docs/development/selfhosting/quickstart.md: サンプルコード更新
- CURRENT_TASK.md: Phase 152-B 完了記録

MainDetectionHelper 設計:
- findMainBody(): Entry point
- tryLegacyPattern(): "static method main" detection
- tryModernPattern(): "static box Main { main() }" detection
- findPattern(): Pattern search helper
- extractBodyFromPosition(): Brace matching extraction

利点:
 明確な責任分離(各パターン検出が独立モジュール)
 テスタビリティ(各メソッド個別テスト可能)
 拡張性(新パターン追加時は新メソッド追加のみ)
 後方互換性(Legacy パターン削除は tryLegacyPattern 削除のみ)

テスト結果:
- stage1_run_min.hako: RC 0
- Selfhost depth-1: RC 0
- 全スモーク: 30/31 PASS (1 timeout は無関係)
2025-12-04 13:54:45 +09:00
d70329e5df feat(selfhost): Phase 151 - ConsoleBox Selfhost Support
- Identify ConsoleBox registration issue: plugins registered but PluginBoxFactory can't find them
- Root cause: timing/initialization order between BoxFactoryRegistry and UnifiedBoxRegistry
- Solution: Add ConsoleBox builtin fallback for selfhost Stage-3 pipeline
- Implementation: Plugin-preferred, builtin as fallback
- Test results: 2/2 PASS (esc_dirname_smoke.hako, string_ops_basic.hako)

Modified files:
- src/box_factory/builtin_impls/console_box.rs (new, 35 lines)
- src/box_factory/builtin_impls/mod.rs (add console_box module)
- src/box_factory/builtin.rs (add ConsoleBox creation and box_types)
- CURRENT_TASK.md (Phase 151 completion)
- docs/development/current/main/phase151_consolebox_selfhost_support.md (implementation summary)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 13:07:12 +09:00
3e3d1b369d refactor(phase124): Delete NYASH_HAKO_CHECK_JOINIR flag completely
- Remove src/config/env/hako_check.rs entirely (file deleted)
- Comment out hako_check module in src/config/env.rs with Phase 124 markers
- Mark NYASH_HAKO_CHECK_JOINIR as deleted in environment-variables.md
- Document reason: JoinIR-only consolidation makes flag unnecessary

Phase 124 Task 2/5 complete
2025-12-04 06:27:54 +09:00
adc10fdf54 Phase 123 proper完了:hako_check JoinIR実装(環境変数選択可能化)
## 実装内容

### 1. 環境変数フラグ追加
- NYASH_HAKO_CHECK_JOINIR でJoinIR/Legacy経路を切り替え可能
- src/config/env/hako_check.rs で hako_check_joinir_enabled() 実装
- デフォルト: false(レガシー経路)で後方互換性確保

### 2. MIR Builder JoinIR スイッチ
- cf_if() メソッドにフラグチェック追加
- try_cf_if_joinir() プレースホルダー実装(Phase 124で完全実装)
- JoinIR → legacy フォールバック機構を構築

### 3. テストケース作成(4個)
- phase123_simple_if.hako
- phase123_nested_if.hako
- phase123_while_loop.hako
- phase123_if_in_loop.hako

### 4. テスト結果
 Legacy path: 4/4 PASS
 JoinIR path: 4/4 PASS
(JoinIR path は現在フォールバック経由で動作)

### 5. ドキュメント更新
- environment-variables.md: NYASH_HAKO_CHECK_JOINIR 記載
- phase121_hako_check_joinir_design.md: Phase 123実装セクション追加
- hako_check_design.md: 2パス実行フロー図を追加
- CURRENT_TASK.md: Phase 123完了を記録

## 数値成果

- 新規ファイル: 2個 (config/env/hako_check.rs, test cases × 4, test script)
- 修正ファイル: 6個
- 総追加行数: 335行
- ビルド: Zero errors

## 設計・実装の特徴

 Environment variable で簡単に経路切り替え可能
 レガシー経路を完全に保持(後方互換性)
 JoinIR基盤を Phase 124 での完全実装に向けて構築
 フォールバック機構でリスク最小化

## 次のステップ

Phase 124: JoinIR 完全実装&デフォルト化
- try_cf_if_joinir() を IfSelectLowerer と統合
- Loop JoinIR 統合追加
- JoinIR をデフォルト経路に変更
- NYASH_LEGACY_PHI=1 で legacy フォールバック可能に

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 06:17:10 +09:00
a3d5bacc55 Phase 30.1 & 73: Stage-3 features env and JoinIR flag cleanup 2025-11-30 14:30:28 +09:00
35cd93a37a Phase 33-2: JoinInst::Select implementation + minimal If JoinIR lowering
Implementation:
- Add JoinInst::Select variant to JoinIR schema
- Implement Select execution in JoinIR Runner (Bool/Int cond support)
- Add Select handling in JoinIR→MIR Bridge (4-block structure)
- Create test cases (joinir_if_select_simple/local.hako)
- Add dev toggle NYASH_JOINIR_IF_SELECT=1
- Create lowering infrastructure (if_select.rs, stub for Phase 33-3)

Tests:
- 3/3 unit tests pass (test_select_true/false/int_cond)
- Integration tests pass (RC: 0)
- A/B execution verified (existing if_phi vs JoinIR Select)

Files changed:
- New: apps/tests/joinir_if_select_{simple,local}.hako
- New: src/mir/join_ir/lowering/if_select.rs
- Modified: src/mir/join_ir/{mod,json,runner,vm_bridge}.rs
- Modified: src/config/env.rs (joinir_if_select_enabled)
- Modified: docs/reference/environment-variables.md

Phase 33-3 ready: MIR pattern recognition + auto-lowering pending

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 02:58:38 +09:00
eddc4e6035 docs(joinir): L-2.2 Step-4 - Update JoinIR VM bridge documentation
Phase 32 README:
- Expand VM Bridge table with "JoinIR 利用範囲" column
- Add L-2.2 progress summary table (Step-1~5 status)
- Add developer notes for Stage-B JoinIR observation

environment-variables.md:
- Add detailed descriptions for NYASH_JOINIR_* variables
- Clarify scope and limitations (Stage-B = lowering only)
- Add Stage-B JoinIR observation example

CURRENT_TASK:
- Update L-2.2 status to Step-1~4 complete

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 11:55:04 +09:00
51ff558904 feat(phase32): L-2.1 Stage-1 UsingResolver JoinIR integration + cleanup
Phase 32 L-2.1 complete implementation:

1. Stage-1 UsingResolver main line JoinIR connection
   - CFG-based LoopForm construction for resolve_for_source/5
   - LoopToJoinLowerer integration with handwritten fallback
   - JSON snapshot tests 6/6 PASS

2. JoinIR/VM Bridge improvements
   - Simplified join_ir_vm_bridge.rs dispatch logic
   - Enhanced json.rs serialization
   - PHI core boxes cleanup (local_scope_inspector, loop_exit_liveness, loop_var_classifier)

3. Stage-1 CLI enhancements
   - Extended args.rs, groups.rs, mod.rs for new options
   - Improved stage1_bridge module (args, env, mod)
   - Updated stage1_cli.hako

4. MIR builder cleanup
   - Simplified if_form.rs control flow
   - Removed dead code from loop_builder.rs
   - Enhanced phi_merge.rs

5. Runner module updates
   - json_v0_bridge/lowering.rs improvements
   - dispatch.rs, selfhost.rs, modes/vm.rs cleanup

6. Documentation updates
   - CURRENT_TASK.md, AGENTS.md
   - Various docs/ updates

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 10:17:37 +09:00
03efa13e76 docs(phase-29): JoinIR/Stage-1 環境変数棚卸し完了
Step 1: ENV_INVENTORY.md 作成 (docs/private submodule)
Step 2: 実装統一確認 - 既にhelper経由で統一済み
Step 3: environment-variables.md に JoinIRセクション追加
Step 4: スモークテスト pass
Step 5: CURRENT_TASK.md に完了記録

発見事項:
- JoinIR: env_flag_is_1() ヘルパー経由で統一済み
- Stage-1: src/config/env/stage1.rs SSOT モジュール経由で統一済み
- NYASH_RUN_JOINIR_MINIMAL は既に削除済み

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 09:03:28 +09:00
94b2bd2799 feat(selfhost): add observation logs for Ny compiler path diagnosis
Add NYASH_CLI_VERBOSE>=2 observation logs to trace the Ny compiler
child process path (NYASH_USE_NY_COMPILER=1):
- Log when spawning child process
- Log when receiving Program(JSON v0)
- Log before/after maybe_dump_mir with dump path info
- Report whether MIR dump file was created

Key finding: apps/selfhost/compiler/compiler.hako doesn't exist,
so the preferred child process route never fires. This explains
why RUST_MIR_DUMP_PATH doesn't create files in Ny compiler path.

Also update environment-variables.md with:
- NYASH_CLI_VERBOSE=2 level documentation
- Ny compiler observation template for Phase 29

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 07:08:32 +09:00
0852a397d9 Add experimental JoinIR runner and tests 2025-11-23 08:38:15 +09:00
8750186e55 chore: Phase 26-H セッション完了 - 全ドキュメント更新
Phase 26-H 完了内容:
 JoinIR 型定義実装(src/mir/join_ir.rs)
 MIR → JoinIR 自動変換実装(lower_min_loop_to_joinir)
 自動変換テスト実装(mir_joinir_min_auto_lowering)
 PHI/Loop箱 → JoinIR 移行対応表追加(loopform_ssot.md)

ドキュメント更新:
- Phase 27 JoinIR タスク計画追加
- Phase 26-H タスク完了記録
- 各種 README 更新(進捗反映)
- CURRENT_TASK.md 更新

コミット統計: $(git status --short | wc -l) files changed

次のステップ: Phase 27 一般化 MIR → JoinIR 変換
2025-11-23 05:53:27 +09:00
c344451087 fix(mir-builder): static method arity mismatch根治 - Phase 25.x
**問題**:
- ParserStmtBox.parse_using/4 に5引数が渡される
- me.method呼び出しで instance/static 判別なし
- static method に誤って receiver 追加

**修正**:
- MeCallPolicyBox: params[0]の型で instance/static 判別
- Instance method: receiver 追加
- Static method: receiver なし
- Arity検証(NYASH_ME_CALL_ARITY_STRICT=1)

**ドキュメント**:
- docs/reference/environment-variables.md 新規作成
- docs/development/architecture/mir-logs-observability.md 更新

**テスト**:
- src/tests/mir_stage1_cli_emit_program_min.rs 追加
- 既存 stage1 テスト全てパス

Phase: 25.x
2025-11-21 11:16:38 +09:00
525e59bc8d feat(loop-phi): Add body-local variable PHI generation for Rust AST loops
Phase 25.1c/k: Fix ValueId undefined errors in loops with body-local variables

**Problem:**
- FuncScannerBox.scan_all_boxes/1 and BreakFinderBox._find_loops/2 had ValueId
  undefined errors for variables declared inside loop bodies
- LoopFormBuilder only generated PHIs for preheader variables, missing body-locals
- Example: `local ch = s.substring(i, i+1)` inside loop → undefined on next iteration

**Solution:**
1. **Rust AST path** (src/mir/loop_builder.rs):
   - Detect body-local variables by comparing body_end_vars vs current_vars
   - Generate empty PHI nodes at loop header for body-local variables
   - Seal PHIs with latch + continue snapshot inputs after seal_phis()
   - Added HAKO_LOOP_PHI_TRACE=1 logging for debugging

2. **JSON v0 path** (already fixed in previous session):
   - src/runner/json_v0_bridge/lowering/loop_.rs handles body-locals
   - Uses same strategy but for JSON v0 bridge lowering

**Results:**
-  FuncScannerBox.scan_all_boxes: 41 body-local PHIs generated
-  Main.main (demo harness): 23 body-local PHIs generated
- ⚠️ Still some ValueId undefined errors remaining (exit PHI issue)

**Files changed:**
- src/mir/loop_builder.rs: body-local PHI generation logic
- lang/src/compiler/entry/func_scanner.hako: debug logging
- /tmp/stageb_funcscan_demo.hako: test harness

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 23:12:01 +09:00
8b44c5009f fix(mir): fix else block scope bug - PHI materialization order
Root Cause:
- Else blocks were not propagating variable assignments to outer scope
- Bug 1 (if_form.rs): PHI materialization happened before variable_map reset,
  causing PHI nodes to be lost
- Bug 2 (phi.rs): Variable merge didn't check if else branch modified variables

Changes:
- src/mir/builder/if_form.rs:93-127
  - Reordered: reset variable_map BEFORE materializing PHI nodes
  - Now matches then-branch pattern (reset → materialize → execute)
  - Applied to both "else" and "no else" branches for consistency
- src/mir/builder/phi.rs:137-154
  - Added else_modified_var check to detect variable modifications
  - Use modified value from else_var_map_end_opt when available
  - Fall back to pre-if value only when truly not modified

Test Results:
 Simple block: { x=42 } → 42
 If block: if 1 { x=42 } → 42
 Else block: if 0 { x=99 } else { x=42 } → 42 (FIXED!)
 Stage-B body extraction: "return 42" correctly extracted (was null)

Impact:
- Else block variable assignments now work correctly
- Stage-B compiler body extraction restored
- Selfhost builder path can now function
- Foundation for Phase 21.x progress

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-13 20:16:20 +09:00
77d4fd72b3 phase: 20.49 COMPLETE; 20.50 Flow+String minimal reps; 20.51 selfhost v0/v1 minimal (Option A/B); hv1-inline binop/unop/copy; docs + run_all + CURRENT_TASK -> 21.0 2025-11-06 15:41:52 +09:00
30aa39f50b hv1 verify: add direct route (env JSON) and clean inline path; fix v1 phi incoming order; make test_runner use hv1 direct; add phase2037 phi canaries; load modules.workspace exports for alias; update docs (phase-20.38, source extensions) and CURRENT_TASK 2025-11-04 16:33:04 +09:00
a87ea2636c docs: clarify static box method arity (implicit self) and plan fix in Phase 20.33; expand Bridge singleton injection spec; update checklist 2025-11-01 07:07:29 +09:00
dd65cf7e4c builder+vm: unify method calls via emit_unified_call; add RouterPolicy trace; finalize LocalSSA/BlockSchedule guards; docs + selfhost quickstart
- Unify standard method calls to emit_unified_call; route via RouterPolicy and apply rewrite::{special,known} at a single entry.\n- Stabilize emit-time invariants: LocalSSA finalize + BlockSchedule PHI→Copy→Call ordering; metadata propagation on copies.\n- Known rewrite default ON (userbox only, strict guards) with opt-out flag NYASH_REWRITE_KNOWN_DEFAULT=0.\n- Expand TypeAnnotation whitelist (is_digit_char/is_hex_digit_char/is_alpha_char/Map.has).\n- Docs: unified-method-resolution design note; Quick Reference normalization note; selfhosting/quickstart.\n- Tools: add tools/selfhost_smoke.sh (dev-only).\n- Keep behavior unchanged for Unknown/core/user-instance via BoxCall fallback; all tests green (quick/integration).
2025-09-28 20:38:09 +09:00
510f4cf523 builder/vm: stabilize json_lint_vm under unified calls
- Fix condition_fn resolution: Value call path + dev safety + stub injection
- VM bridge: handle Method::birth via BoxCall; ArrayBox push/get/length/set direct bridge
- Receiver safety: pin receiver in method_call_handlers to avoid undefined use across blocks
- Local vars: materialize on declaration (use init ValueId; void for uninit)
- Prefer legacy BoxCall for Array/Map/String/user boxes in emit_box_or_plugin_call (stability-first)
- Test runner: update LLVM hint to llvmlite harness (remove LLVM_SYS_180_PREFIX guidance)
- Docs/roadmap: update CURRENT_TASK with unified default-ON + guards

Note: NYASH_DEV_BIRTH_INJECT_BUILTINS=1 can re-enable builtin birth() injection during migration.
2025-09-28 12:19:49 +09:00