6856922374
Phase 25.1a: selfhost builder hotfix (fn rename, docs)
2025-11-15 05:42:32 +09:00
864a94d013
feat(phase-21.8+25): Complete imports resolution + Ring0/Ring1 numeric ABI design
...
Phase 21.8 完了 (imports resolution):
- ✅ using nyash.core.numeric.matrix_i64 as MatI64 完全対応
- ✅ hakorune_emit_mir.sh で imports 抽出・MirBuilder に配線
- ✅ MatI64/IntArrayCore の静的参照解決が安定動作
- ✅ matmul_core ベンチ MIR 生成成功 (VM/LLVM 両対応)
Phase 25 設計完了 (Ring0/Ring1 + numeric ABI):
- 🎯 Ring0/Ring1 責務分離を明文化 (Rust Freeze Policy 具体化)
- 🎯 Call/ExternCall 明確な分離設計
- Call: Ring1 Hako 関数 (numeric core 等)
- ExternCall: Ring0 intrinsic (rt_mem_* 等の FFI のみ)
- 🎯 BoxCall → Call 変換方針確定 (AotPrep で実施)
- 🎯 MatI64.mul_naive を NyNumericMatI64.mul_naive に分離
(System Hakorune subset で完全実装済み)
実装:
- ✅ AotPrepNumericCoreBox 診断パス実装 (NYASH_AOT_NUMERIC_CORE=1)
- ✅ numeric ABI ドキュメント整備 (NUMERIC_ABI.md)
- ✅ System Hakorune subset 定義 (system-hakorune-subset.md)
- ✅ IntArrayCore/MatI64 仕様固定 (lang/src/runtime/numeric/README.md)
- ✅ ENV_VARS.md に NYASH_AOT_NUMERIC_CORE トグル追記
今後のタスク:
- BoxCall(MatI64) → Call(NyNumericMatI64) 変換実装 (opt-in)
- IntArrayCore の numeric core 整備
- matmul_core スモークテスト (NYASH_AOT_NUMERIC_CORE=0/1 両対応)
🎉 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-14 20:19:00 +09:00
29dae149ea
feat(phase-21.8): wire imports through extern_provider (Step 7 part 1)
...
**Step 7 進行中**: extern_provider 側の実装完了
Changes:
- Modified extern_provider.rs to read HAKO_MIRBUILDER_IMPORTS env var
- Both routes now call program_json_to_mir_json_with_imports():
- Direct extern call (env.mirbuilder.emit)
- hostbridge.extern_invoke route
- Deserializes JSON imports map and passes to MirBuilder
- Build succeeds ✅
Next: Wire collection side - set HAKO_MIRBUILDER_IMPORTS from runner
Related: #phase-21.8 MatI64/IntArrayCore integration
2025-11-14 16:34:41 +09:00
8214176814
feat(perf): add Phase 21.8 foundation for IntArrayCore/MatI64 numeric boxes
...
Prepare infrastructure for specialized numeric array benchmarking:
- Add IntArrayCore plugin stub (crates/nyash_kernel/src/plugin/intarray.rs)
- Add IntArrayCore/MatI64 box definitions (lang/src/runtime/numeric/)
- Add Phase 21.8 documentation and task tracking
- Update nyash.toml/hako.toml with numeric library configuration
- Extend microbench.sh for matmul_core benchmark case
Next: Resolve Stage-B MirBuilder to recognize MatI64/IntArrayCore as boxes
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-14 15:18:14 +09:00
f1fa182a4b
AotPrep collections_hot matmul tuning and bench tweaks
2025-11-14 13:36:20 +09:00
13f21334c9
fix(aot): resolve copy chains in PHI propagation for deep loop coverage
...
Fix CollectionsHot type_table to resolve copy chains when propagating types
through PHI nodes, enabling ArrayBox optimization in deeply nested loops (matmul).
**Root Cause:**
- PHI incoming values were checked directly in type_table
- Copy chains (e.g., SSA 56→11) were not resolved
- Types failed to propagate through deep loop nesting
**Solution:**
- Add copy_src_map parameter to build_type_table()
- Resolve copy chains before checking if PHI incoming values are typed
- Multi-pass fixpoint algorithm (up to 12 passes) ensures convergence
**Impact:**
- matmul: ArrayBox A/B/C now propagate through nested loops
- Expected: boxcall→externcall conversion for get/set/push
- Backwards compatible: opt-in (NYASH_AOT_COLLECTIONS_HOT=1), no behavior change when disabled
**Analysis:**
- Documented in docs/development/analysis/matmul_collections_hot_fix.md
- Box→SSA flow traced: A(dst=2)→...→71(get), B(dst=3)→...→73(get), C(dst=4)→...→105(set)
**Testing:** Pending verification due to VM step budget constraints
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-14 06:54:56 +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
dda65b94b7
Phase 21.7 normalization: optimization pre-work + bench harness expansion
...
- Add opt-in optimizations (defaults OFF)
- Ret purity verifier: NYASH_VERIFY_RET_PURITY=1
- strlen FAST enhancement for const handles
- FAST_INT gate for same-BB SSA optimization
- length cache for string literals in llvmlite
- Expand bench harness (tools/perf/microbench.sh)
- Add branch/call/stringchain/arraymap/chip8/kilo cases
- Auto-calculate ratio vs C reference
- Document in benchmarks/README.md
- Compiler health improvements
- Unify PHI insertion to insert_phi_at_head()
- Add NYASH_LLVM_SKIP_BUILD=1 for build reuse
- Runtime & safety enhancements
- Clarify Rust/Hako ownership boundaries
- Strengthen receiver localization (LocalSSA/pin/after-PHIs)
- Stop excessive PluginInvoke→BoxCall rewrites
- Update CURRENT_TASK.md, docs, and canaries
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-13 16:40:58 +09:00
9e2fa1e36e
Phase 21.6 solidification: chain green (return/binop/loop/call); add Phase 21.7 normalization plan (methodize static boxes). Update CURRENT_TASK.md and docs.
2025-11-11 22:35:45 +09:00
52b62c5772
feat(phase21.5): Stage-B parser loop fix + delegate path stabilization
...
## 修正内容
### 1. Stage-B パーサー修正(偶然の回避)
- **ファイル**:
- `lang/src/compiler/parser/expr/parser_expr_box.hako`
- `lang/src/compiler/parser/stmt/parser_control_box.hako`
- **問題**: ネストループで gpos が正しく進まず、loop の cond/body が壊れる
- **回避策**: new 式のメソッドチェーン処理追加で別ループを導入
- **結果**: MIR 生成が変わって VM gpos バグを回避
### 2. delegate パス動作確認
- **テスト**: `/tmp/loop_min.hako` → rc=10 ✅
- **MIR構造**: 正しい PHI/compare/binop を生成
- **チェーン**: hakorune parser → Rust delegate → LLVM EXE 完動
### 3. ドキュメント追加
- `docs/development/analysis/` - delegate 分析
- `docs/development/guides/` - ループテストガイド
- `docs/development/testing/` - Stage-B 検証報告
### 4. カナリーテスト追加
- `tools/smokes/v2/profiles/quick/core/phase2100/` 配下に複数追加
- emit_boxcall_length_canary_vm.sh
- stageb_parser_loop_json_canary_vm.sh
- 他
### 受け入れ基準
- ✅ delegate パス: rc=10 返す
- ✅ FORCE パス: rc=10 返す(既存)
- ✅ MIR 構造: 正しい PHI incoming と compare
- ✅ 既定挙動: 不変(dev トグルのみ)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-11 21:24:51 +09:00
b9e9c967fb
feat(phase21.5): Fix --emit-mir-json BoxCall emission + EXE staging docs
...
## Task 2: BoxCall Emission Fix ✅
- Fix: --emit-mir-json now properly emits boxcall for method calls when NYASH_MIR_UNIFIED_CALL=0
- Root cause: v0 format fallback wasn't inspecting Callee::Method enum
- Implementation: Added proper v0 boxcall emission with dst_type hints
- Location: src/runner/mir_json_emit.rs:329-368
- Preserves: All default behavior, only affects explicit NYASH_MIR_UNIFIED_CALL=0
## Task 4: Documentation Updates ✅
- Added: selfhost_exe_stageb_quick_guide.md (comprehensive usage guide)
- Added: selfhost_exe_stageb_verification_report.md (test results)
- Updated: tools/selfhost_exe_stageb.sh with prerequisite comments
- Documented: EXE test timeout recommendations (--timeout 120)
- Documented: NYASH_EXE_ARGV=1 usage with ensure_ny_main/argv_get
- Added: Phase 2034 emit_boxcall_length canary test
## Implementation Principles
- 既定挙動不変 (Default behavior unchanged)
- 最小差分 (Minimal diff)
- ロールバック容易 (Easy rollback via clear else-if block)
- Dev toggle guarded (NYASH_MIR_UNIFIED_CALL=0 explicit activation)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-11 03:28:01 +09:00
07a254fc0d
feat(phase21.5): MirBuilder optimization prep + crate EXE infrastructure
...
Phase 21.5 optimization readiness - C-level performance target:
- MirBuilder: JsonFrag purify toggle (HAKO_MIR_BUILDER_JSONFRAG_PURIFY=1)
- Normalizer: extended f64 canonicalization + dedupe improvements
- loop_opts_adapter: JsonFrag path refinement for crate EXE compatibility
Infrastructure improvements:
- provider_registry: add diagnostics + ring-1 providers (array/console/map/path)
- mir_interpreter: add normalization/purify feature gates
- tools/selfhost_exe_stageb.sh: new end-to-end Stage-B→crate EXE pipeline
- tools/perf/microbench.sh: performance measurement tooling
Smoke tests (phase2100):
- Extend timeout 15s→120s for heavy crate EXE builds
- Add stageb_loop_jsonfrag_crate_exe_canary_vm.sh (target test)
- Add s3_backend_selector_crate_exe_vm_parity_return42_canary_vm.sh
Documentation:
- ENV_VARS.md: add Phase 21.5 optimization toggles
- README updates: clarify crate backend strategy
- phase215-optimization.md: new optimization roadmap
This commit sets the stage for Phase 21.5 critical optimization:
achieving C-level performance to decide hakorune's future viability.
2025-11-11 02:07:12 +09:00
981ddd890c
Phase 22.1 WIP: SSOT resolver + TLV infrastructure + Hako MIR builder setup
...
Setup infrastructure for Phase 22.1 (TLV C shim & Resolver SSOT):
Core changes:
- Add nyash_tlv, nyash_c_core, nyash_kernel_min_c crates (opt-in)
- Implement SSOT resolver bridge (src/using/ssot_bridge.rs)
- Add HAKO_USING_SSOT=1 / HAKO_USING_SSOT_HAKO=1 env support
- Add HAKO_TLV_SHIM=1 infrastructure (requires --features tlv-shim)
MIR builder improvements:
- Fix using/alias consistency in Hako MIR builder
- Add hako.mir.builder.internal.{prog_scan,pattern_util} to nyash.toml
- Normalize LLVM extern calls: nyash.console.* → nyash_console_*
Smoke tests:
- Add phase2211 tests (using_ssot_hako_parity_canary_vm.sh)
- Add phase2220, phase2230, phase2231 test structure
- Add phase2100 S3 backend selector tests
- Improve test_runner.sh with quiet/timeout controls
Documentation:
- Add docs/ENV_VARS.md (Phase 22.1 env vars reference)
- Add docs/development/runtime/C_CORE_ABI.md
- Update de-rust-roadmap.md with Phase 22.x details
Tools:
- Add tools/hakorune_emit_mir.sh (Hako-first MIR emission wrapper)
- Add tools/tlv_roundtrip_smoke.sh placeholder
- Improve ny_mir_builder.sh with better backend selection
Known issues (to be fixed):
- Parser infinite loop in static method parameter parsing
- Stage-B output contamination with "RC: 0" (needs NYASH_JSON_ONLY=1)
- phase2211/using_ssot_hako_parity_canary_vm.sh fork bomb (needs recursion guard)
Next steps: Fix parser infinite loop + Stage-B quiet mode for green tests
2025-11-09 15:11:18 +09:00
5d2cd5bad0
de-rust phase-0: archive Rust LLVM backend to archive/rust-llvm-backend (RESTORE documented); defaults unaffected
2025-11-09 01:00:43 +09:00
024a4fecb7
phase-21.9: add De‑Rust roadmap + phase plan; stage archive script for Rust LLVM backend (no move yet)
2025-11-09 00:57:10 +09:00
fa3091061d
trace: add execution route visibility + debug passthrough; phase2170 canaries; docs
...
- Add HAKO_TRACE_EXECUTION to trace executor route
- Rust hv1_inline: stderr [trace] executor: hv1_inline (rust)
- Hakovm dispatcher: stdout [trace] executor: hakovm (hako)
- test_runner: trace lines for hv1_inline/core/hakovm routes
- Add HAKO_VERIFY_SHOW_LOGS and HAKO_DEBUG=1 (enables both)
- verify_v1_inline_file() log passthrough with numeric rc extraction
- test_runner exports via HAKO_DEBUG
- Canary expansion under phase2170 (state spec)
- Array: push×5/10 → size, len/length alias, per‑recv/global, flow across blocks
- Map: set dup-key non-increment, value_state get/has
- run_all.sh: unify, remove SKIPs; all PASS
- Docs
- ENV_VARS.md: add Debug/Tracing toggles and examples
- PLAN.md/CURRENT_TASK.md: mark 21.7 green, add Quickstart lines
All changes gated by env vars; default behavior unchanged.
2025-11-08 23:45:29 +09:00
50ac8af2b8
Phase 21.4 Complete: FileBox SSOT + Analyzer Stabilization (7 Tasks)
...
✅ Task 1: Fallback Guarantee (create_box failure → ring1/core-ro auto fallback)
- Three-tier fallback system: plugin → builtin → core-ro
- Mode control: auto/plugin-only/core-ro
- New: src/box_factory/builtin_impls/file_box.rs
- New: tools/test_filebox_fallback_smoke.sh
✅ Task 2: Provider Registration SSOT (static/dynamic/core-ro unified)
- ProviderFactory trait with priority-based selection
- Global registry PROVIDER_FACTORIES implementation
- Priority: dynamic(100) > builtin(10) > core-ro(0)
- New: src/boxes/file/builtin_factory.rs
- New: tools/smoke_provider_modes.sh
✅ Task 3: FileBox Publication Unification
- Verified: basic/file_box.rs already minimized (11 lines)
- Perfect re-export pattern maintained
✅ Task 4: ENV Unification (FILEBOX_MODE/DISABLE_PLUGINS priority)
- Removed auto-setting of NYASH_USE_PLUGIN_BUILTINS
- Removed auto-setting of NYASH_PLUGIN_OVERRIDE_TYPES
- Added deprecation warnings with migration guide
- ENV hierarchy: DISABLE_PLUGINS > BOX_FACTORY_POLICY > FILEBOX_MODE
✅ Task 5: Error Log Visibility (Analyzer rule execution errors to stderr)
- Added [rule/exec] logging before IR-based rule execution
- Format: [rule/exec] HC012 (dead_static_box) <filepath>
- VM errors now traceable via stderr output
✅ Task 6: Unnecessary Using Removal (14 rules Str alias cleanup)
- Removed unused `using ... as Str` from 14 rule files
- All rules use local _itoa() helper instead
- 14 lines of dead code eliminated
✅ Task 7: HC017 Skip & TODO Documentation (UTF-8 support required)
- Enhanced run_tests.sh with clear skip message
- Added "Known Limitations" section to README.md
- Technical requirements documented (3 implementation options)
- Re-enable timeline: Phase 22 (Unicode Support Phase)
📊 Test Results:
- Analyzer: 10 tests PASS, 1 skipped (HC017)
- FileBox fallback: All 3 modes PASS
- Provider modes: All 4 modes PASS
- Build: Success (0 errors, 0 warnings)
🎯 Key Achievements:
- 28 files modified/created
- Three-Tier Fallback System (stability)
- SSOT Provider Registry (extensibility)
- ENV unification (operational clarity)
- Error visibility (debugging efficiency)
- Code cleanup (maintainability)
- Comprehensive documentation (Phase 22 ready)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-08 17:04:21 +09:00
772149c86d
Analyzer安定化完了: NYASH_DISABLE_PLUGINS=1復元 + plugin無効化根治
...
## 修正内容
1. **hako_check.sh/run_tests.sh**: NYASH_DISABLE_PLUGINS=1 + NYASH_BOX_FACTORY_POLICY=builtin_first追加
2. **src/box_factory/plugin.rs**: NYASH_DISABLE_PLUGINS=1チェック追加
3. **src/box_factory/mod.rs**: plugin shortcut pathでNYASH_DISABLE_PLUGINS尊重
4. **tools/hako_check/render/graphviz.hako**: smart quotes修正(parse error解消)
## 根本原因
- NYASH_USE_PLUGIN_BUILTINS=1が自動設定され、ArrayBox/MapBoxがplugin経由で生成を試行
- bid/registry.rsで"Plugin loading temporarily disabled"の状態でも試行されエラー
- mod.rs:272のshortcut pathがNYASH_DISABLE_PLUGINSを無視していた
## テスト結果
- 10/11 PASS(HC011,13-18,21-22,31)
- HC012: 既存issue(JSON安定化未完)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-08 15:49:25 +09:00
cef820596f
FileBox SSOT設計移行完了: Provider Pattern実装
...
## 🎯 目的
FileBoxをSSOT(Single Source of Truth)設計に移行し、
static/dynamic/builtin providerを統一的に扱える基盤を構築。
## ✅ 実装完了(7タスク)
### 1. Provider Lock Global
**File**: `src/runtime/provider_lock.rs`
- `FILEBOX_PROVIDER: OnceLock<Arc<dyn FileIo>>` 追加
- `set_filebox_provider()` / `get_filebox_provider()` 実装
### 2. VM初期化時のProvider選択
**File**: `src/runner/modes/vm.rs`
- `execute_vm_mode()` 冒頭でprovider選択・登録
- ENV(`NYASH_FILEBOX_MODE`, `NYASH_DISABLE_PLUGINS`)対応
### 3. CoreRoFileIo完全実装
**File**: `src/boxes/file/core_ro.rs` (NEW)
- Read-onlyファイルI/O実装
- Thread-safe: `RwLock<Option<File>>`
- Newline正規化(CRLF→LF)
### 4. FileBox委譲化
**File**: `src/boxes/file/mod.rs`
- 直接`std::fs::File`使用 → `Arc<dyn FileIo>` provider委譲
- 全メソッドをprovider経由に変更
- Fail-Fast: write/delete等の非対応操作は明確エラー
### 5. basic/file_box.rs Deprecate
**File**: `src/boxes/file/basic/file_box.rs`
- 120行 → 12行に削減
- `#[deprecated]` マーク + 再エクスポート
- 後方互換性維持
### 6. Feature Flag追加
**File**: `Cargo.toml`
- `builtin-filebox = []` feature追加
### 7. Provider抽象・選択ロジック
**Files**:
- `src/boxes/file/provider.rs` (NEW) - FileIo trait定義
- `src/boxes/file/box_shim.rs` (NEW) - 薄いラッパー
- `src/runner/modes/common_util/provider_registry.rs` (NEW) - 選択ロジック
## 📊 アーキテクチャ進化
**Before**:
```
FileBox (mod.rs) ──直接使用──> std::fs::File
FileBox (basic/) ──直接使用──> std::fs
```
**After**:
```
FileBox ──委譲──> Arc<dyn FileIo> ──実装──> CoreRoFileIo
├──> PluginFileIo (future)
└──> BuiltinFileIo (future)
```
## 🔧 技術的成果
1. **Thread Safety**: `RwLock<Option<File>>` で並行アクセス安全
2. **Fail-Fast**: 非対応操作は明確エラー(silent failure無し)
3. **後方互換性**: deprecated re-exportで既存コード維持
4. **環境制御**: `NYASH_FILEBOX_MODE` でランタイム切替
## 📝 環境変数
- `NYASH_FILEBOX_MODE=auto|core-ro|plugin-only`
- `auto`: プラグインあれば使用、なければCoreRoにフォールバック
- `core-ro`: 強制的にCoreRo(read-only)
- `plugin-only`: プラグイン必須(なければFail-Fast)
- `NYASH_DISABLE_PLUGINS=1`: 強制的にcore-roモード
## 🎯 次のステップ(Future)
- [ ] Dynamic統合(plugin_loaderとの連携)
- [ ] BuiltinFileIo実装(feature builtin-filebox)
- [ ] Write/Delete等の操作対応(provider拡張)
## 📚 ドキュメント
- 詳細仕様: `docs/development/runtime/FILEBOX_PROVIDER.md`
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-08 15:13:22 +09:00
0455307418
refactor(phase-a): remove Cranelift/JIT backend legacy code (~373 lines)
...
Phase A cleanup - Safe deletions with zero risk:
## Deleted Files (6 files, 373 lines total)
1. Cranelift/JIT Backend (321 lines):
- src/runner/modes/cranelift.rs (45 lines)
- src/runner/modes/aot.rs (55 lines)
- src/runner/jit_direct.rs (152 lines)
- src/tests/core13_smoke_jit.rs (42 lines)
- src/tests/core13_smoke_jit_map.rs (27 lines)
2. Legacy MIR Builder (52 lines):
- src/mir/builder/exprs_legacy.rs
- Functionality inlined into exprs.rs (control flow constructs)
## Module Reference Cleanup
- src/backend/mod.rs: Removed cranelift feature gate exports
- src/runner/mod.rs: Removed jit_direct module reference
- src/runner/modes/mod.rs: Removed aot module reference
- src/mir/builder.rs: Removed exprs_legacy module
## Impact Analysis
- Build: Success (cargo build --release)
- Tests: All passing
- Risk Level: None (feature already archived, code unused)
- Related: Phase 15 JIT archival (archive/jit-cranelift/)
## BID Copilot Status
- Already removed in previous cleanup
- Not part of this commit
Total Reduction: 373 lines (~0.4% of codebase)
Next: Phase B - Dead code investigation
Related: #phase-21.0-cleanup
Part of: Legacy Code Cleanup Initiative
2025-11-06 22:34:18 +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
44a5158a14
hv1: early-exit at main (no plugin init); tokenizer: Stage-3 single-quote + full escapes (\/ \b \f \' \r fix); builder: route BinOp via SSOT emit_binop_to_dst; hv1 verify canary route (builder→Core); docs: phase-20.39 updates
2025-11-04 20:46:43 +09:00
ab81564174
phase-20.39 step1: introduce typed IR shadow in hv1 dispatcher; step2: remove hv1 include fallback from verify (direct route only); add IR types module export; docs+current_task updated
2025-11-04 16:45:01 +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
756af0da6c
Phase 20.33: migrate docs to lang compiler entry; add Bridge canonicalize canary skeletons (opt-in); dep_tree.sh fail-fast legacy path; Gate-C OOB strict already present
2025-11-01 19:01:55 +09:00
c331296552
P0/P1/P2: quick緑化と境界/検証強化\n\n- P0: json_lint_vm を quick で opt-in 化(既定は SKIP)し、builder デバッグノイズは filter_noise で抑制\n- P1: ArrayBox に OOB Strict タグを導入(HAKO_OOB_STRICT/NYASH_OOB_STRICT)+ Stage‑B OOB 観測カナリア整備\n- P2: Bridge/LLVM self まわりの検証を opt-in スモークで拡充(self_param_*)。ドキュメント/PLAN/CHECKLIST/SSOT を更新
2025-11-01 17:39:36 +09:00
eef6fca8cd
docs(loops): LoopForm SSOT設計ノートを追加し、Bridge側ループ降下にPHI到達検証を導入(debug時)。\n\n- 新規: docs/development/architecture/loops/loopform_ssot.md\n- 修正: src/runner/json_v0_bridge/lowering/loop_.rs に debug_verify_phi_inputs 呼び出しを追加\n- 方針: Direct MIR は既に phi_core を使用。Bridge は段階的に LoopPhiOps アダプタでSSOTに寄せる
2025-11-01 16:37:16 +09:00
01b4417c5d
docs(llvm/vm): 静的Box(self)規約を明文化 + Bridgeトグル追記; Gate‑C/Core 現状反映; CURRENT_TASK 更新。\n\n- 新規: docs/development/architecture/llvm/static_box_singleton.md\n- 追記: lang/src/vm/README.md に self 先頭規約/互換トグルを明記\n- 追記: CURRENT_TASK に本更新を記録\n- phase-20.33/CHECKLIST にドキュメント完了チェックを追加\n- bak フォルダはリポジトリ直下に存在せず(削除対象なし)\n\n併せて未コミット差分をスナップショット(Rust 層の前作業含む)
2025-11-01 16:31:48 +09:00
6a452b2dca
fix(mir): PHI検証panic修正 - update_cfg()を検証前に呼び出し
...
A案実装: debug_verify_phi_inputs呼び出し前にCFG predecessorを更新
修正箇所(7箇所):
- src/mir/builder/phi.rs:50, 73, 132, 143
- src/mir/builder/ops.rs:273, 328, 351
根本原因:
- Branch/Jump命令でsuccessorは即座に更新
- predecessorはupdate_cfg()で遅延再構築
- PHI検証が先に実行されてpredecessor未更新でpanic
解決策:
- 各debug_verify_phi_inputs呼び出し前に
if let Some(func) = self.current_function.as_mut() {
func.update_cfg();
}
を挿入してCFGを同期
影響: if/else文、論理演算子(&&/||)のPHI生成が正常動作
2025-11-01 13:28:56 +09:00
5e3d9e7ae4
restore(lang/compiler): bring back lang/src/compiler from e917d400; add Hako index canaries and docs; implement Rust-side index operator (Array/Map get/set) with Fail‑Fast diagnostics
...
- restore: lang/src/compiler/** (parser/emit/builder/pipeline_v2) from e917d400
- docs: docs/development/selfhosting/index-operator-hako.md
- smokes(hako): tools/smokes/v2/profiles/quick/core/index_operator_hako.sh (opt-in)
- smokes(vm): adjust index_operator_vm.sh for semicolon gate + stable error text
- rust/parser: allow IndexExpr and assignment LHS=Index; postfix parse LBRACK chain
- rust/builder: lower arr/map index to BoxCall get/set; annotate array/map literals; Fail‑Fast for unsupported types
- CURRENT_TASK: mark Rust side done; add Hako tasks checklist
Note: files disappeared likely due to branch FF to a lineage without lang/src/compiler; no explicit delete commit found. Added anchor checks and suggested CI guard in follow-up.
2025-10-31 20:18:39 +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
34be7d2d79
vm/router: minimal special-method extension (equals/1); toString mapping kept
...
mir: add TypeCertainty to Callee::Method (diagnostic only); plumb through builder/JSON/printer; backends ignore behaviorally
using: confirm unified prelude resolver entry for all runner modes
docs: update Callee architecture with certainty; update call-instructions; CURRENT_TASK note
tests: quick 40/40 PASS; integration (LLVM) 17/17 PASS
2025-09-28 01:33:58 +09:00
cdf826cbe7
public: publish selfhost snapshot to public repo (SSOT using + AST merge + JSON VM fixes)
...
- SSOT using profiles (aliases/packages via nyash.toml), AST prelude merge
- Parser/member guards; Builder pin/PHI and instance→function rewrite (dev on)
- VM refactors (handlers split) and JSON roundtrip/nested stabilization
- CURRENT_TASK.md updated with scope and acceptance criteria
Notes: dev-only guards remain togglable via env; no default behavior changes for prod.
2025-09-26 14:34:42 +09:00
6e1bf149fc
builder: pre-pin comparison operands in if_form and loop_builder (lower_if_in_loop/build_loop) to slots; utils: pin_to_slot pub(crate) and entry materialize for pinned slots only; continue JSON VM debug
2025-09-26 04:17:56 +09:00
fd56b8049a
mir: implement proper short-circuit lowering (&&/||) via branch+phi; vm: add NYASH_VM_TRACE exec/phi logs and reg_load diagnostics; vm-fallback: minimal Void guards (push/get_position/line/column), MapBox.birth no-op; smokes: filter builtin Array/Map plugin notices; docs: CURRENT_TASK updated
2025-09-26 03:30:59 +09:00
b3a96faccb
smokes: add JSON nested/invalid cases; force VM backend; temp nyash.toml with json_native package for resolution
2025-09-26 00:38:14 +09:00
6ce06501e1
json-native: enable float roundtrip in parser (NUMBER => float by '.'/exp); expand roundtrip smoke with more numeric cases
2025-09-26 00:32:20 +09:00
85084664c2
docs+runner+parser: SSOT+AST using finalized (legacy text inlining removed); provider verify reads nyash.toml; preflight warn hook; method-body guard removed; CURRENT_TASK updated for next JSON work
2025-09-26 00:27:02 +09:00
9384c80623
using: safer seam defaults (fix_braces OFF by default) + path-alias handling; json_native: robust integer parse + EscapeUtils unquote; add JsonCompat layer; builder: preindex static methods + fallback for bare calls; diagnostics: seam dump + function-call trace
2025-09-25 10:23:14 +09:00
9b9a91c859
feat: GC機能復活&VM整理&json_native調査完了
...
## 🎉 ChatGPT×Claude協働成果
- ✅ **GC機能復活**: vm-legacy削除で失われたGC機能を新実装で復活
- GCメトリクス追跡システム実装(alloc/collect/pause計測)
- 3種類のGCモード対応(counting/mark_sweep/generational)
- host_handles.rsでハンドル管理復活
- ✅ **VM整理とエイリアス追加**: 混乱していた名前を整理
- MirInterpreter = NyashVm = VM のエイリアス統一
- vm-legacyとインタープリターの違いを明確化
- 壊れていたvm.rsの互換性修復
- ✅ **スモークテスト整理**: v2構造でプラグイン/コア分離
- plugins/ディレクトリにプラグインテスト移動
- gc_metrics.sh, gc_mode_off.sh, async_await.sh追加
- _ensure_fixture.shでプラグイン事前ビルド確認
## 📊 json_native調査結果
- **現状**: 25%完成(配列/オブジェクトパース未実装)
- **将来性**: 並行処理でyyjson超えの可能性大
- 100KB以上のJSONで2-10倍速の可能性
- Nyash ABI実装後はゼロコピー最適化
- **判断**: 現時点では置換不可、将来の大きな足場
## 🔍 技術的発見
- vm-legacy = 完全なVM実装(GC付き)だった
- MirInterpreter = 現在のRust VM(712行、Arc使用)
- 200行簡易JSONは既に削除済み(存在しない)
ChatGPT爆速修復×Claude詳細調査の完璧な協働!
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-24 23:27:59 +09:00
6755d9bde1
feat: Phase 2.4完全検証完了 - NyKernel変革と151MB削減成功
...
✅ Phase 2.4 NyRT→NyKernel変革完了
- libnyash_kernel.a作成・全参照更新
- Plugin-First Architecture完全動作
- Handle registry/GC正常動作
✅ 151MB レガシーコード削減達成
- plugin_box_legacy.rs削除(7,757バイト)
- venv/ディレクトリ削除(143MB)
- llvm_legacy/アーカイブ化
✅ ExternCall print修正(codex貢献)
- Unicode/絵文字完全サポート
- 日本語出力正常動作確認
✅ 包括的スモークテスト追加
- 7セクション、12テスト実装
- VM/LLVM/Plugin/Stress全カバー
- 9/12テスト合格(75%成功率)
📋 既知の問題
- LLVMハーネス出力キャプチャ(実行は正常)
- mir15_smoke.sh(JIT削除により予期される失敗)
🎯 次のステップ
- Phase 15.5 Everything is Plugin準備
- BuiltinBoxFactory段階的削除
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-24 14:30:39 +09:00
f0608e9bb1
feat: Phase 2.4 レガシーアーカイブ整理完了(151MB削減)
...
## 🎉 完了項目
- ✅ plugin_box_legacy.rs削除(7.7KB、参照ゼロ確認済み)
- ✅ REMOVEDコメント整理(encode.rs簡潔化)
- ✅ venv削除(143MB節約、.gitignoreは既存)
- ✅ llvm_legacyスタブ化(8KB、compile_error!による安全化)
## 🏆 成果
- **リポジトリサイズ改善**: 151MB削減
- **コード整理**: レガシーコード安全にアーカイブ
- **プラグインファースト**: StrictPluginFirst継続動作
## ✅ 検証完了
- cargo build --release --features llvm (警告のみ、エラーなし)
- LLVMハーネス実行: print出力正常
- プラグイン動作: StringBox等正常動作
codex先生の戦略に従った安全な段階的削除を実行
Co-Authored-By: codex <noreply@anthropic.com >
2025-09-24 14:13:15 +09:00
f4fe548787
feat: Phase 2.4 NyRT→NyKernel Architecture Revolution 100%完了!
...
ChatGPT5 Pro設計分析による42%コード削減の完全実現:
- crates/nyrt → crates/nyash_kernel 完全移行
- with_legacy_vm_args系統11箇所削除(encode/birth/future/invoke系)
- Plugin-First Architecture統一(VM依存根絶)
- libnyash_kernel.a生成成功(0エラー・0警告)
- LLVM統合更新(build_llvm.sh, ny-llvmc対応)
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-24 12:57:33 +09:00
95382bcaab
feat: Phase 2.2 LLVM静的プラグイン検証完了!nyrt設計真実解明
...
✅ **Phase 2.2達成項目**:
- LLVMスモークテスト完全成功(1648バイト生成)
- プラグイン統合動作確認(StringBox/IntegerBox@LLVM)
- 静的コンパイル核心技術実証(MIR→LLVM→オブジェクト)
- Everything is Plugin革命のLLVM対応確認
🔍 **Task先生nyrt調査成果**:
- nyrt正体解明:AOT/LLVMランタイム必須インフラ
- 機能分類:58%必須(ハンドル・GC・エントリー)42%代替可能
- 設計一貫性:75%達成(Box操作完全プラグイン化)
- 削減戦略:Phase A実装で26個関数→プラグイン統合(42%削減)
🎯 **Everything is Plugin完全実現への道筋**:
- 現状:プラグインファクトリー(StrictPluginFirst)完全動作
- 課題:nyrt中央集権 vs プラグイン哲学の矛盾
- 解決:Hybrid Plugin Architecture推進
- 目標:String/Box API→プラグイン統合で設計一貫性完成
📊 **技術的成果**:
- LLVM static plugin integration: ✅ 完全動作
- Plugin priority system: ✅ 完全動作
- Object code generation: ✅ 実証済み
- nyrt architectural analysis: ✅ 完全解明
🚀 **Phase 15.5革命基盤確立**: プラグイン優先アーキテクチャ実用化完了
次段階Phase 2.3でビルトインBox段階削除+nyrt Plugin統合推進へ
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-24 12:22:08 +09:00
73b90a7c28
feat: スモークテストv2実装&Phase 15.5後のプラグイン対応
...
Phase 15.5 Core Box削除後の新テストシステム構築:
## 実装内容
- スモークテストv2システム完全実装(3段階プロファイル)
- 共通ライブラリ(test_runner/plugin_manager/result_checker/preflight)
- インタープリター層完全削除(約350行)
- PyVM重要インフラ特化保持戦略(JSON v0ブリッジ専用)
- nyash.tomlパス修正(13箇所、プラグイン正常ロード確認)
## 動作確認済み
- 基本算術演算(+, -, *, /)
- 制御構文(if, loop, break, continue)
- 変数代入とスコープ
- プラグインロード(20個の.soファイル)
## 既知の問題
- StringBox/IntegerBoxメソッドが動作しない
- オブジェクト生成は成功するがメソッド呼び出しでエラー
- Phase 15.5影響でプラグイン実装が不完全な可能性
## ドキュメント
- docs/development/testing/smoke-tests-v2.md 作成
- docs/reference/pyvm-usage-guidelines.md 作成
- CODEX_QUESTION.md(Codex相談用)作成
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-24 09:30:42 +09:00
8bbc30509c
feat: Phase 15.5-A 予約型保護解除完了+StringBox問題調査
...
🎯 **Phase 15.5 Phase A実装完了**
- ✅ is_reserved_type()修正: 環境変数による条件付きバイパス実装
- ✅ NYASH_USE_PLUGIN_BUILTINS=1 + NYASH_PLUGIN_OVERRIDE_TYPES対応
- ✅ ビルド確認: エラーなしでコンパイル成功
- ✅ プラグインロード確認: 予約型拒否エラーなし
🔍 **StringBox問題完全調査**
- 問題特定: get()/set()が空文字を返す(length=4で内部データあり)
- 全バックエンド影響: VM/プラグイン/コア すべて同じ問題
- MIRレベル正常: newbox/boxcall正しく生成
- 調査資料: /tmp/stringbox_test_results.md完備
📂 **変更ファイル**
- src/box_factory/mod.rs: 予約型保護条件付き解除
- docs/phase-15.5: Phase A完了ドキュメント更新
- nyash.toml: StringBox/IntegerBoxプラグイン設定追加
🚀 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-24 05:57:08 +09:00
57599c174d
docs: Phase 15.5 Core Box Unification計画策定
...
- コアBox(nyrt内蔵)削除→プラグイン/ユーザーBoxの2層構造へ
- 約700行削減見込み(nyrt実装600行+特別扱い100行)
- DLL動作確認→Nyashコード化の段階的移行戦略
- ChatGPTの革命的提案を実装計画に落とし込み
- ROADMAP.mdにPhase 15.5として正式追加
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-24 04:39:50 +09:00
868519c691
cleanup: MIRレガシーコード71行削除でJSON作業準備完了
...
Phase 15.5準備として、MIRコードベースの大規模クリーンアップを実施。
JSON centralization作業前の環境整備が完了しました。
削除内容(71行):
- コメントアウトされたimport文: 2行
- 不要なlegacy/removedコメント: 9行
- movedコメント大規模整理: 56行
- 開発用debugコード(eprintln!): 4行
安全性確認:
- 統一Call実装(NYASH_MIR_UNIFIED_CALL=1): 正常動作✅
- Legacy実装(NYASH_MIR_UNIFIED_CALL=0): 後方互換性維持✅
- JSON出力: mir_call形式で正常生成✅
Phase 15(80k→20k行削減)への貢献: 約0.09%
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-24 04:09:23 +09:00
b573c3e5b8
feat: LLVM_SYS_180_PREFIX環境変数削除完了!llvm-harness経路でRust LLVMバインディング不要化達成
...
🚀 Phase 15.5 MIR Call統一革命 - LLVM環境変数削除フェーズ完了
## ✅ 完了内容
- **条件分岐実装**: llvm-harness(デフォルト)はLLVM_SYS_180_PREFIX不要
- **後方互換性維持**: llvm-inkwell-legacy使用時はLLVM_SYS_180_PREFIX必要
- **全ツール統一**: 12個のビルドスクリプト・テストスクリプトを一括更新
- **ドキュメント更新**: ENV_VARS.mdでLLVM feature選択方法を明記
## 🛠️ 更新ファイル
- **コアビルド**: src/runner/build.rs, tools/build_llvm.sh, build_llvm.sh
- **スモークテスト**: tools/llvm_smoke.sh, tools/test/smoke/llvm/ir_phi_empty_check.sh
- **CI設定**: .github/workflows/min-gate.yml
- **Windows版**: build_llvm_wsl.sh, build_llvm_wsl_msvc.sh (cross-compilation)
- **開発ツール**: tools/build_compiler_exe.sh, tools/ny_mir_builder.sh
- **ドキュメント**: docs/development/runtime/ENV_VARS.md
## ⚡ 技術的成果
- **環境変数削減**: LLVM_SYS_180_PREFIX → 条件付き使用のみ
- **Python LLVM統合**: llvmliteハーネス経路でRust LLVM依存完全除去
- **ビルド簡略化**: デフォルトでllvm-config-18のみ必要
- **動作確認**: tools/llvm_smoke.sh成功 (1648バイト.oファイル生成)
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-24 03:28:24 +09:00