|
|
f9d100ce01
|
chore: Phase 25.1 完了 - LoopForm v2/Stage1 CLI/環境変数削減 + Phase 26-D からの変更
Phase 25.1 完了成果:
- ✅ LoopForm v2 テスト・ドキュメント・コメント完備
- 4ケース(A/B/C/D)完全テストカバレッジ
- 最小再現ケース作成(SSAバグ調査用)
- SSOT文書作成(loopform_ssot.md)
- 全ソースに [LoopForm] コメントタグ追加
- ✅ Stage-1 CLI デバッグ環境構築
- stage1_cli.hako 実装
- stage1_bridge.rs ブリッジ実装
- デバッグツール作成(stage1_debug.sh/stage1_minimal.sh)
- アーキテクチャ改善提案文書
- ✅ 環境変数削減計画策定
- 25変数の完全調査・分類
- 6段階削減ロードマップ(25→5、80%削減)
- 即時削除可能変数特定(NYASH_CONFIG/NYASH_DEBUG)
Phase 26-D からの累積変更:
- PHI実装改善(ExitPhiBuilder/HeaderPhiBuilder等)
- MIRビルダーリファクタリング
- 型伝播・最適化パス改善
- その他約300ファイルの累積変更
🎯 技術的成果:
- SSAバグ根本原因特定(条件分岐内loop変数変更)
- Region+next_iパターン適用完了(UsingCollectorBox等)
- LoopFormパターン文書化・テスト化完了
- セルフホスティング基盤強化
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: ChatGPT <noreply@openai.com>
Co-Authored-By: Task Assistant <task@anthropic.com>
|
2025-11-21 06:25:17 +09:00 |
|
|
|
3e3e6318bb
|
refactor(builder): me-call構造クリーンアップ - 無駄な委譲削除
🎯 箱理論改善: 責務の重複と無駄な中間レイヤー削除
## 問題
- handle_me_method_call → try_handle_me_direct_call → try_build_me_method_call
- 3層の委譲で責務が重複
- try_handle_me_direct_call が単なる委譲で独自の責務なし
## 改善
✅ try_handle_me_direct_call を削除
✅ try_build_me_method_call の処理を handle_me_method_call に統合
✅ 責務を1箇所に集約(method_call_handlers.rs)
## 効果
- 🎯 責務の明確化(1つの関数が1つの責務)
- ⚡ 無駄な関数呼び出し削減
- 📖 可読性向上
- 🐛 循環依存の構造的根絶
## ファイル変更
- builder_calls.rs: try_handle_me_direct_call削除(-15行)
- build.rs: try_build_me_method_call削除(-47行)
- method_call_handlers.rs: handle_me_method_call統合(+43行)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-17 20:26:32 +09:00 |
|
|
|
fbf4687ea1
|
fix(bridge): implement env.box_introspect.kind lowering + Stage0 build fixes
Phase 25.1b type system groundwork - env.* namespace support in Bridge layer
Changes:
- Bridge layer (JSON v0 → MIR):
- Add 'env' as well-known variable in MapVars::resolve()
- Implement env.box_introspect.kind(value) → ExternCall lowering
- Pattern: Method { recv: Method { recv: Var("env"), method: "box_introspect" }, method: "kind" }
- VM/extern fixes:
- Add Arc::from() conversion for env.box_introspect.kind result
- Fix MapBox API usage in extern_functions.rs logging
- Build fixes:
- Comment out missing llvm_legacy/llvm modules in src/backend/mod.rs
- Comment out missing gui_visual_node_prototype in Cargo.toml
- New files:
- lang/src/shared/common/box_type_inspector_box.hako (type introspection API)
Context:
- Enables BoxTypeInspectorBox to query runtime Box types via env.box_introspect.kind
- Required for selfhost MirBuilder type-aware lowering (multi-carrier loops, etc.)
- Part of Phase 25.1b "no fallback" selfhosting strategy
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-16 17:19:56 +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 |
|
|
|
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 |
|
|
|
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 |
|
|
|
22b668927e
|
refactor: complete error message unification (Phase 3.5)
Migrate remaining 45 error generation patterns to unified helpers:
- calls.rs: 13 sites → 0
- extern_provider.rs: 9 sites → 0
- externals.rs: 5 sites → 0
- boxes_plugin.rs: 5 sites → 0
- boxes.rs: 5 sites → 0
- boxes_string.rs: 4 sites → 0
- boxes_instance.rs: 2 sites → 0
- mod.rs + boxes_array.rs: 2 sites → 0
Error patterns now 100% unified:
- All 80 InvalidInstruction sites use helpers (100%)
- Consistent error formatting across entire codebase
- Single source of truth for error messages
Code reduction:
- Phase 3.5: 50-70 lines saved
- Cumulative (Phase 1+2+3+3.5): 200-267 lines removed (6-8% handlers)
- Total patterns unified: 192 (destination 60 + args 52 + errors 80)
Benefits:
- 100% error message consistency achieved
- Easy to modify error formats globally
- Foundation for i18n support ready
- Improved maintainability and testability
Test results: ✓ Build successful, Phase 21.0 smoke tests passing
Related: Phase 21.0 refactoring milestone complete
Risk: Low (error messages only, behavior preserved)
|
2025-11-06 23:34:46 +09:00 |
|
|
|
0287020a5b
|
refactor: unify error message generation (Phase 3)
Add ErrorBuilder utility and migrate 35 error generation sites
Phase 3: Error Message Generation Unification
============================================
Infrastructure:
- Add src/backend/mir_interpreter/utils/error_helpers.rs (255 lines)
- Implement ErrorBuilder with 7 standardized error patterns
- Add MirInterpreter convenience methods (err_invalid, err_type_mismatch, etc.)
Migration Results:
- Total patterns migrated: 35 instances (80 → 45, 44% reduction)
- calls.rs: 37 → 13 patterns (65% reduction)
- extern_provider.rs: 20 → 9 patterns (55% reduction)
- Lines saved: 33 lines (1.0% of handlers)
Error Patterns Unified:
1. Invalid instruction errors → ErrorBuilder::invalid_instruction()
2. Type mismatch errors → ErrorBuilder::type_mismatch()
3. Argument count errors → ErrorBuilder::arg_count_mismatch()
4. Method not found → ErrorBuilder::method_not_found()
5. Unsupported operations → ErrorBuilder::unsupported_operation()
6. Context errors → ErrorBuilder::with_context()
7. Bounds errors → ErrorBuilder::out_of_bounds()
Benefits:
- Consistent error message formatting across all handlers
- Single point of change for error improvements
- Better IDE autocomplete support
- Easier future i18n integration
- Reduced code duplication
Cumulative Impact (Phase 1+2+3):
- Total lines saved: 150-187 lines (4.5-5.7% of handlers)
- Total patterns unified: 124 instances
* Phase 1: 37 destination patterns
* Phase 2: 52 argument validation patterns
* Phase 3: 35 error generation patterns
Remaining Work:
- 45 error patterns still to migrate (estimated 50-80 lines)
- Complex cases requiring manual review
Testing:
- Build: ✅ 0 errors, 0 new warnings
- Smoke tests: ⚠️ 8/9 passed (1 timeout unrelated)
- Core functionality: ✅ Verified
Related: Phase 21.0 MIR Interpreter refactoring
Risk: Low (error messages only, behavior preserved)
Impact: High (maintainability, consistency, i18n-ready)
Co-authored-by: Claude Code <claude@anthropic.com>
|
2025-11-06 23:18:10 +09:00 |
|
|
|
8d179e9499
|
refactor: add MIR interpreter utility helpers (Phase 1)
- Add destination write helpers (write_box_result, write_void, write_result)
- Add argument validation helpers (validate_args_exact/range/min)
- Add receiver conversion helper (convert_to_box)
- Update handlers to use new helpers
Reduces code duplication:
- Destination patterns: 37 call sites converted
- Each replacement saves 2-3 lines (74-111 lines saved)
- Helper infrastructure: 178 lines added
- Net improvement: Reduced duplication + better maintainability
Impact:
- Build: ✓ SUCCESS (0 errors, 146 warnings)
- Tests: ✓ 8/9 smoke tests PASS
- Functionality: ✓ PRESERVED (no behavior changes)
Files created:
- src/backend/mir_interpreter/utils/mod.rs
- src/backend/mir_interpreter/utils/destination_helpers.rs
- src/backend/mir_interpreter/utils/arg_validation.rs
- src/backend/mir_interpreter/utils/receiver_helpers.rs
Files modified: 15 handler files
- arithmetic.rs, boxes.rs, boxes_array.rs, boxes_instance.rs
- boxes_map.rs, boxes_object_fields.rs, boxes_plugin.rs
- boxes_string.rs, calls.rs, extern_provider.rs, externals.rs
- memory.rs, misc.rs, mod.rs
Related: Phase 21.0 refactoring
Risk: Low (pure refactoring, no behavior change)
|
2025-11-06 22:50:46 +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 |
|
|
|
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 |
|
|
|
06a729ff40
|
vm(hako): add v1 reader/dispatcher (flagged), commonize mir_call handler, share block scan; smokes: add v1 hakovm canary; docs: 20.37/20.38 plans, OOB policy; runner: v1 hakovm toggle; include SKIP summary
|
2025-11-03 23:21:48 +09:00 |
|