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
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
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
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
cf3908d438
deprecations: warn-once for nyash.toml (already wired) + child_env audit (spawns use helper); docs sweep to prefer and hako.toml in README.*; smokes: add Core‑Direct negative rc canaries (array oob set, map bad key) and verified quick/core core_direct suite green
2025-11-02 19:02:23 +09:00
b988d309f0
Stage‑B + Bridge v1 tests and docs sweep
...
- Add opt-in negative canary: canonicalize_closure_captures_negative_vm (v1 bridge Closure malformed captures)
- Add opt-in Stage‑B canary: stageb_bundle_alias_table_bad_vm (malformed alias table fails)
- README.md/ja: replace hardcoded ./target/release/nyash with (branding/prefs)
- Keep Stage‑B heavy tests opt-in (SMOKES_ENABLE_STAGEB); quick remains green
2025-11-02 17:54:35 +09:00
dd6876e1c6
Phase 20.12b: quick green + structural cleanup
...
- Deprecations: add warn-once for nyash.toml (runtime::deprecations); apply in plugin loader v2 (singletons/method_resolver)
- Child env + runner hygiene: unify Stage‑3/quiet/disable-fallback env in test/runner; expand LLVM noise filters
- Docs/branding: prefer and hako.toml in README.md/README.ja.md and smokes README
- VM: implement Map.clear in MIR interpreter (boxes_map)
- Stage‑B: gate bundle/alias/require smokes behind SMOKES_ENABLE_STAGEB; fix include cwd and resolve() call even for require-only cases
- Core‑Direct: gate rc boundary canary behind SMOKES_ENABLE_CORE_DIRECT
- Smokes: inject Stage‑3 and disable selfhost fallback for LLVM runs; filter using/* logs
- Quick profile: 168/168 PASS locally
This commit accelerates Phase 20.33 (80/20) by stabilizing quick suite, reducing noise, and gating heavy/experimental paths for speed.
2025-11-02 17:50:06 +09:00
59eb39e8a0
docs: mark WASM/browser as paused/unmaintained; update README (en/ja), wasm guides banner; archive note in projects/nyash-wasm README
2025-09-28 20:47:45 +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
cb236b7f5a
json(vm): fix birth dispatch; unify constructor naming (Box.birth/N); JsonNode factories return JsonNodeInstance; quick: enable heavy JSON with probe; builder: NYASH_BUILDER_DEBUG_LIMIT guard; json_query_min(core) harness; docs/tasks updated
2025-09-27 08:45:25 +09:00
041cef875a
json-native: token positions (line/column); escape utils BMP coverage + surrogate guard; add smokes for string escapes, nested, and error cases (AST/VM)
2025-09-26 00:42:55 +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
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
da78fc174b
selfhost/runtime: Stage 0-1 runner + MIR JSON loader (summary) with trace; compiler: scopebox/loopform prepass wiring (flags, child args); libs: add P1 standard boxes (console/string/array/map) as thin wrappers; runner: pass --box-pref via env; ops_calls dispatcher skeleton; docs: selfhost executor roadmap + scopebox/loopform notes; smokes: selfhost runner + identity prepasses; CURRENT_TASK: update plan and box lib schedule
2025-09-22 21:52:39 +09:00
c8063c9e41
pyvm: split op handlers into ops_core/ops_box/ops_ctrl; add ops_flow + intrinsic; delegate vm.py without behavior change
...
net-plugin: modularize constants (consts.rs) and sockets (sockets.rs); remove legacy commented socket code; fix unused imports
mir: move instruction unit tests to tests/mir_instruction_unit.rs (file lean-up); no semantic changes
runner/pyvm: ensure using pre-strip; misc docs updates
Build: cargo build ok; legacy cfg warnings remain as before
2025-09-21 08:53:00 +09:00
da32455afc
freeze: macro platform complete; default ON with profiles; env consolidation; docs + smokes\n\n- Profiles: --profile {lite|dev|ci|strict} (dev-like default for macros)\n- Macro paths: prefer NYASH_MACRO_PATHS (legacy envs deprecated with warnings)\n- Selfhost pre-expand: auto mode, PyVM-only, add smokes (array/map)\n- Docs: user-macros updated; new macro-profiles guide; AGENTS freeze note; CURRENT_TASK freeze\n- Compat: non-breaking; legacy envs print deprecation notices\n
2025-09-19 22:27:59 +09:00
5e818eeb7e
stage3: unify to cleanup; MIR return-defer; docs+smokes updated; LLVM(harness): finalize_phis ownership, ret.py simplified, uses-predeclare; cleanup return override green; method-postfix cleanup return WIP (PHI head)
2025-09-19 02:07:38 +09:00
3fe908eb0d
docs/runtime: externcall + println normalization; NyRT silent result flag; PyVM console warn/error/trace routing\nselfhost(M2): add MirEmitterBox (Return(Int)->const+ret) and --emit-mir switch; initial selfhost smoke\nrunner: child args/env hardening for selfhost (NYASH_NY_COMPILER_CHILD_ARGS under --; NYASH_JSON_ONLY=1, NYASH_VM_USE_PY=1, NYASH_DISABLE_PLUGINS=1); VM path strips using lines when NYASH_ENABLE_USING=1\nmeta: clarify PyVM/llvmlite as primary (vm/interpreter legacy OFF) in CURRENT_TASK.md; README links to externcall docs
2025-09-18 06:35:49 +09:00
a5054a271b
llvm(py): introduce BuildCtx + trace hub; refactor if-merge prepass + PHI wiring into module; unify logs; ctx-enable compare/ret/call/boxcall/externcall/typeop/newbox/safepoint; curated smoke option for if-merge; README updates; keep behavior stable
2025-09-17 16:11:01 +09:00
d99b941218
docs: add MIR13 mode doc and set PHI-off as default; bridge lowering split (if/loop/try); llvmlite resolver stabilization; curated runner default PHI-off; refresh CURRENT_TASK.md
2025-09-17 10:58:12 +09:00
c014e78fb4
feat(llvm): Complete plugin system unification and environment variable elimination
...
🎉 Major Achievement: LLVM Plugin Environment Variable Problem Completely Resolved
## ✅ Completed Major Features:
1. **Plugin Implementation** ✅ - nyash.plugin.invoke_* functions in nyrt library working
2. **Plugin Calls** ✅ - Method calls working without environment variables
3. **Return Value Type Inference Fix** ✅ - Added plugin method type inference to MIR builder
4. **by-id Unification Complete** ✅ - Removed by-name fallback, unified to method_id system
5. **Environment Variable Elimination** ✅ - Removed NYASH_LLVM_ALLOW_BY_NAME=1 requirement
6. **Simple Execution Achieved** ✅ - ./target/release/nyash --backend llvm program.nyash
## 🔧 Technical Changes:
### Core Fixes:
- **src/mir/builder.rs**: Added plugin method return type inference
- CounterBox.get() -> Integer
- MathBox.sqrt() -> Float
- FileBox.read() -> String
- FileBox.exists() -> Bool
- **src/backend/llvm/compiler.rs**: Removed by-name fallback completely
- Deleted NYASH_LLVM_ALLOW_BY_NAME environment variable check
- Removed ~50 lines of fallback logic
- Unified to method_id-based calls only
### Documentation Updates:
- **CLAUDE.md**: Updated all plugin examples to remove environment variables
- **README.md/README.ja.md**: Removed environment variable documentation
- **tools/llvm_smoke.sh**: Removed NYASH_LLVM_ALLOW_BY_NAME from all test scripts
### Performance & Maintainability:
- **Better Performance**: method_id calls more efficient than by-name lookups
- **Type Safety**: method_id system provides compile-time guarantees
- **Code Simplification**: Removed complex fallback logic
- **User Experience**: No environment variables to remember
## 🧪 Verification:
- ✅ Plugin execution without environment variables
- ✅ method_id injection working: [LLVM] method_id injected: 4-5 places
- ✅ Type inference working: [BUILDER] Type inference: CounterBox get -> Integer
- ✅ Compilation success with LLVM backend
## 🔍 Remaining Investigation:
Plugin return value display issue identified as separate runtime layer problem
(plugin methods execute and side effects work, but return values not displayed in print())
🚀 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-10 23:24:02 +09:00
864473336e
merge: resolve conflicts (prefer cranelift-dev for Core-13 defaults; drop modules/using, add env.local/env.box shims)
2025-09-08 01:28:39 +09:00
b8bdb867d8
Merge selfhosting-dev into main (Core-13 pure CI/tests + LLVM bridge) ( #126 )
...
* WIP: sync before merging origin/main
* fix: unify using/module + build CLI; add missing helper in runner; build passes; core smokes green; jit any.len string now returns 3
* Apply local changes after merging main; keep docs/phase-15 removed per main; add phase-15.1 docs and tests
* Remove legacy docs/phase-15/README.md to align with main
* integration: add Core-13 pure CI, tests, and minimal LLVM execute bridge (no docs) (#125 )
Co-authored-by: Tomoaki <tomoaki@example.com >
---------
Co-authored-by: Selfhosting Dev <selfhost@example.invalid >
Co-authored-by: Tomoaki <tomoaki@example.com >
2025-09-07 07:36:15 +09:00
d62114c705
Core-13 pure: add CI workflows, VM e2e tests, LLVM parity bridge (minimal); do not touch private docs
2025-09-07 07:28:53 +09:00
9e6b77226e
docs: add --build (MVP) usage to READMEs; guide updated with WSL tips. cli/runner: wire minimal --build to produce EXE (plugins→core→AOT→link).
2025-09-06 16:53:12 +09:00
07f270b966
aot: enable plugin invokes in ObjectBuilder (tagged by-id), add generic NewBox birth via nyash.instance.birth_name_u64x2; egui(plugin): cross-platform run + debug logs; docs: WSL Wayland→X11 troubleshooting and one‑shot scripts; CURRENT_TASK + READMEs updated (JIT runtime sealed).
2025-09-06 16:18:46 +09:00
19f775c34d
feat(phase12.7): 糖衣構文Phase 12.7-B完了 + 自律型AI開発システム制御機能
...
🚀 Phase 12.7-B: ChatGPT5糖衣構文(基本実装完了)
- パイプライン演算子(|>)実装
- セーフアクセス(?.)とデフォルト値(??)実装
- sugar gateによる段階的有効化機能
- 糖衣構文テストスイート追加
🤖 自律型AI開発システム改善
- codex-async-notify.sh: タスク制御指示追加
- "下の箱を積み過ぎないように先に進んでください"
- "フェーズが終わったと判断したら止まってください"
- プロセス数表示機能の改善(count_running_codex_display)
- 自動停止機能が正常動作(Phase 12.7-C前で停止確認)
📚 ドキュメント更新
- Paper 13: 自律型AI協調開発システムの革新性を文書化
- ANCP可逆マッピング仕様追加
- nyfmt PoC(フォーマッター)計画追加
🧱 箱理論の体現
- 74k行のコードベース(Phase 15で20k行を目指す)
- ANCP適用で最終的に6k行相当を狙う
- 世界最小の実用コンパイラへの道
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-05 05:16:21 +09:00
11506cee3b
Phase 11-12: LLVM backend initial, semantics layer, plugin unification
...
Major changes:
- LLVM backend initial implementation (compiler.rs, llvm mode)
- Semantics layer integration in interpreter (operators.rs)
- Phase 12 plugin architecture revision (3-layer system)
- Builtin box removal preparation
- MIR instruction set documentation (26→Core-15 migration)
- Cross-backend testing infrastructure
- Await/nowait syntax support
New features:
- LLVM AOT compilation support (--backend llvm)
- Semantics layer for interpreter→VM flow
- Tri-backend smoke tests
- Plugin-only registry mode
Bug fixes:
- Interpreter plugin box arithmetic operations
- Branch test returns incorrect values
Documentation:
- Phase 12 README.md updated with new plugin architecture
- Removed obsolete NYIR proposals
- Added LLVM test programs documentation
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-01 23:44:34 +09:00
8e58942726
feat: プラグインパスをOS非依存に更新(.so拡張子削除)
...
- nyash.tomlからすべての.so拡張子を削除
- plugin_loader_v2のresolve_library_pathが自動的に適切な拡張子を追加
- Linux: .so
- Windows: .dll
- macOS: .dylib
- クロスプラットフォーム対応の準備完了
2025-08-29 23:11:21 +09:00
3d8ba3f3ec
fix(jit): NewBoxのJIT安全化とDebugBox Phase 1実装
...
- NewBoxのJIT扱いを安全化(src/jit/lower/core.rs)
- NYASH_USE_PLUGIN_BUILTINS=1 && args.is_empty() かつ StringBox/IntegerBox のみJIT許可
- ArrayBox/MapBox等のプラグインBoxまたは引数ありはunsupportedとしてカウント
- unsupported>0の関数はJIT対象外となりVM実行にフォールバック(Segfault回避)
- DebugBox Phase 1実装(JITトレース機能)
- tracePluginCalls(bool)でJITシムトレースON/OFF
- getJitEvents()で直近のJITイベント取得
- src/jit/shim_trace.rs追加でトレース基盤実装
- Printのサポート
- PrintはJIT非対応に戻しVM経路で確実に出力(出力消失解消)
- テストとサンプル追加
- examples/jit_plugin_invoke_param_array.nyash: 最小JITスモークテスト
- examples/py_result_*.nyash: Python plugin結果チェーン処理デモ
- PyRuntimeBox拡張
- str()メソッドでPyObjectのstring表現を取得可能に
- エラーハンドリング改善とResultチェーンサポート
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-08-29 13:46:18 +09:00
a9e82933cc
docs: README更新 - 20日でネイティブEXE達成を反映
...
- 英語版・日本語版ともに最新の成果を反映
- 20日間の開発タイムラインを強調
- 5つの実行モード(インタープリター/VM/JIT/ネイティブ/WASM)を明記
- プラグインシステムとPython統合の実例を追加
- パフォーマンスベンチマーク結果を更新(最大27倍高速化)
2025-08-29 11:49:01 +09:00
25fbebd650
docs: AOT/ネイティブコンパイル情報をexecution-backends.mdに追加
...
- 4つ目の実行方式としてAOT(Ahead-of-Time)コンパイルを文書化
- MIR→WASM→.cwasm のコンパイルパイプラインを説明
- wasm-backend featureでのビルド方法を明記
- 現在の実装状況(完全なスタンドアロン実行ファイルはTODO)を記載
- CLAUDE.mdのWASM説明も3種類(Rust→WASM、Nyash→WASM、Nyash→AOT)に更新
- CURRENT_TASK.mdにPhase 10.9/10.10の完了項目を追加
ChatGPT5さんのAOT試行に対応した適切なドキュメント配置を実施
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-08-29 02:05:39 +09:00
5f3cdc3020
fix: Add README.ja.md to root directory for GitHub
...
- Fixes 404 error when accessing Japanese documentation on GitHub
- Copied from docs/archive/README.ja.md
- Now both English and Japanese READMEs are available at root level
🇯🇵 日本語版READMEをルートディレクトリに追加して404エラーを解消
2025-08-27 01:14:55 +09:00
621bf7cc3d
docs: reorganize into 説明書/予定/archive; update docs/README.md and CLAUDE.md; move root .nyash to local_tests; consolidate native-plan notes into README + archive
2025-08-13 18:54:02 +09:00
a4d32b3c57
📝 docs: Windows版ビルド手順を全ドキュメントに追記
...
🪟 新機能追加:
• cargo-xwinクロスコンパイル手順
• Windows実行ファイル (916KB) 生成方法
• Linux/WSL/Windows/WebAssembly 4プラットフォーム対応
📚 更新ドキュメント:
• CLAUDE.md - 開発ガイド更新
• README.md - 英語版に Windows クロスコンパイル
• README.ja.md - 日本語版に Windows 手順
🎯 完全マルチプラットフォーム対応達成!
Linux + Windows + WebAssembly のトリプル展開可能
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-08-09 16:19:22 +09:00
5d4bae2402
🌍 feat: バイリンガル対応 - 英語・日本語README分離
...
✨ 新機能:
• README.md - 英語版(国際標準)
• README.ja.md - 日本語版(完全翻訳)
• 相互リンクで行き来可能
• 各言語ユーザーに最適化
🎯 国際展開準備:
• GitHub自動言語認識対応
• メンテナンス効率化
• 世界中の開発者に対応
🌏 Global reach with localized experience!
2025-08-09 15:37:24 +09:00