Commit Graph

214 Commits

Author SHA1 Message Date
53d88157aa Phase 12: 統一TypeBox ABI実装開始 - ChatGPT5による極小コアABI基盤構築
- TypeBox ABI雛形: メソッドスロット管理システム追加
- Type Registry: Array/Map/StringBoxの基本メソッド定義
- Host API: C ABI逆呼び出しシステム実装
- Phase 12ドキュメント整理: 設計文書統合・アーカイブ化
- MIR Builder: クリーンアップと分離実装完了

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-03 05:04:56 +09:00
e2e25f6615 論文フォルダ整理: ChatGPT5提案による2本立て構造に再編成
- 論文A: MIR13命令とIR設計 (コンパイラ・PL実装者向け)
  - ArrayGet/Set → BoxCall統合による50%削減
  - IC/AOT/TypedArray最適化
  - Everything is Box哲学のMIR実装

- 論文B: Nyash言語と実行モデル (言語理論・分散システム向け)
  - init/fini対称性メモリ管理
  - P2P Intentモデル
  - 多層実行アーキテクチャ(Interpreter→VM→JIT→AOT→WASM)

既存のmir15-fullstack/unified-lifecycleはarchiveに移動
2025-09-03 03:06:24 +09:00
59b8cb3ace Phase 11.9: 統一文法アーキテクチャ作業中 - MIR builder分割とJIT lower整理
- MIR builder: stmts/exprs/typeingモジュール分割による整理
- JIT lower: core/ops_ext.rs追加(外部呼び出し系の分離)
- 統一文法エンジン基盤構築中(grammar/unified-grammar.toml対応)
- ChatGPT5協調作業: M1完了、M2作業中

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-03 01:37:38 +09:00
d52779dc10 jit: ops_ext delegation + M3 syntax scaffolding; unify BoxCall execution path 2025-09-02 17:12:51 +09:00
5a5e09b69a jit: split CraneliftBuilder to builder/cranelift.rs and hub-ify builder.rs; stabilize jit-direct (seal/fb TLS/end_function); prep for core.rs split (no behavior change) 2025-09-02 13:30:04 +09:00
b05d5dd7ca Phase 12: TypeBox革命とJIT制御フロー修正 - セルフホスティングへの道
## 🔥 TypeBox ABI革命(セルフホスティング実現)
- Nyash ABIをC実装TypeBoxで提供する画期的設計
- Gemini/Codexの深い考察を反映した詳細仕様書作成
- 16バイトアライメント、セレクターキャッシング、弱参照等の具体実装案
- Rust依存を完全排除し、セルフホスティングへの明確な道筋を確立

## 🎯 JIT制御フロー根本修正(ChatGPT5の25分長考の成果)
- ブロック挿入点の明確化: switch_to_block()で各ブロックemit開始時に切替
- シール戦略の簡潔化: br/jump直後のseal撤廃、最終シールに一本化
- PHI最小経路実装: ブロック引数の事前プリスキャン、後付けPHI問題解決
- Cranelift制約対応: 開始済みブロックへのappend禁止を正しく実装

## 📚 ドキュメント更新
- Phase 12全体のセルフホスティング対応更新
- NYASH-ABI-C-IMPLEMENTATION.md: 実装仕様書作成
- gemini-codex-deep-thoughts.md: AI専門家の考察アーカイブ
- 各種README/TASKS更新でセルフホスティング要件追加

##  テスト結果
- mir-branch-ret: OK (Result: 1)
- mir-phi-min: OK (Result: 10)
- mir-branch-multi: OK (Result: 1)

「Everything is Box」の究極形態:ABIすらBoxとして扱う革命的設計!

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-02 11:18:19 +09:00
de99b40bee Phase 12 TypeBox統合ABI設計完了: C ABI + Nyash ABI革命的統合
主な成果:
- TypeBox(型情報をBoxとして扱う)による統合ABI設計
- C ABI + Nyash ABIの完全統合仕様書作成
- 3大AI専門家(Gemini/Codex/ChatGPT5)による検証済み
- ChatGPT5の10個の安全性改善提案を反映
- README.mdのドキュメント更新(全起点から到達可能)

MapBox拡張:
- string型キーサポート(従来のi64に加えて)
- remove/clear/getOr/keysStr/valuesStr/toJson実装
- keys()/values()のランタイムシムサポート(TypeBox待ち)

その他の改善:
- Phase 11.9(文法統一化)ドキュメント追加
- Phase 16(FoldLang)ドキュメント追加
- 非同期タイムアウトテスト追加
- 各種ビルド警告(未使用import等)は次のリファクタリングで対応予定

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-02 09:26:09 +09:00
da96bcb906 📚 Phase 12.5 最適化戦略 & Phase 15 セルフホスティング計画
Phase 12.5: MIR15最適化戦略 - コンパイラ丸投げ作戦
- optimization-strategy.txt: 詳細戦略(MIR側は軽量、コンパイラに丸投げ)
- implementation-examples.md: 具体的な実装例
- debug-safety-comparison.md: 現在のDebugBox vs ChatGPT5提案の比較分析

Phase 15: Nyashセルフホスティング - 究極の目標
- self-hosting-plan.txt: 内蔵Craneliftによる実現計画
- technical-details.md: CompilerBox設計とブートストラップ手順
- README.md: セルフホスティングのビジョン

重要な知見:
- LLVM統合完了済み(Phase 11)だが依存が重すぎる
- Craneliftが現実的な選択肢(3-5MB vs LLVM 50-100MB)
- 「コンパイラもBox、すべてがBox」の夢へ

MASTERロードマップ更新済み
2025-09-02 05:11:10 +09:00
c9366d5c54 Phase 11.8/12: MIR Core-13 roadmap, Nyash ABI design, async/await enhancements with TaskGroupBox foundation
Major additions:
- Phase 11.8 MIR cleanup specification (Core-15→14→13 roadmap)
- Nyash ABI unified design document (3×u64 structure)
- TaskGroupBox foundation with cancelAll/joinAll methods
- Enhanced async/await with checkpoint auto-insertion
- Structured concurrency preparation (parent-child task relationships)

Documentation:
- docs/development/roadmap/phases/phase-11.8_mir_cleanup/: Complete Core-13 path
- docs/development/roadmap/phases/phase-12/NYASH-ABI-DESIGN.md: Unified ABI spec
- Updated Phase 12 README with AOT/JIT explanation for script performance
- Added async_task_system/ design docs

Implementation progress:
- FutureBox spawn tracking with weak/strong reference management
- VM checkpoint integration before/after await
- LLVM backend async support preparation
- Verifier rules for await-checkpoint enforcement
- Result<T,E> normalization for timeout/cancellation

Technical insights:
- MIR as 'atomic instructions', Box as 'molecules' philosophy
- 'Everything is Box' enables full-stack with minimal instructions
- Unified BoxCall for array/plugin/async operations future consolidation

Next steps:
- Complete TaskGroupBox implementation
- Migrate from global to scoped task management
- Implement LIFO cleanup on scope exit
- Continue Core-13 instruction consolidation

🚀 'From 15 atoms to infinite programs: The Nyash Box Theory'
2025-09-02 03:41:51 +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
fff9749f47 📚 Reorganize CLAUDE.md: slim down from 916 to 395 lines with proper doc links
- Keep essential information within 500 lines (now 395 lines)
- Maintain important syntax examples and development principles
- Move detailed information to appropriate docs files:
  - Development practices → docs/guides/development-practices.md
  - Testing guide → docs/guides/testing-guide.md
  - Claude issues → docs/tools/claude-issues.md
- Add proper links to all referenced documentation
- Balance between minimal entry point and practical usability
2025-08-31 06:22:48 +09:00
b003bdf25b 📚 Phase 11 documentation: Everything is Box × MIR15 revolution
Key updates:
- Document MIR 26→15 instruction reduction plan (transitioning status)
- Add Core-15 target instruction set in INSTRUCTION_SET.md
- Save AI conference analyses validating Box Theory and 15-instruction design
- Create MIR annotation system proposal for optimization hints
- Update SKIP_PHASE_10_DECISION.md with LLVM direct migration rationale

Technical insights:
- RefNew/RefGet/RefSet can be eliminated through Box unification
- GC/sync/async all achievable with 15 core instructions
- BoxCall lowering can automatically insert GC barriers
- 2-3x performance improvement expected with LLVM
- Build time reduction 50%, binary size reduction 40%

Status: Design complete, implementation pending
2025-08-31 03:03:04 +09:00
eedfcedc61 Add string_bridge_full.nyash rich demo and enhance e2e script color/auto bin selection; keep VM/AOT flow intact 2025-08-31 00:22:55 +09:00
4ae92cfb56 Phase 10.7/10.5c: include cycle detection (VM/Interpreter), minimal pyc IR→Nyash, String unification bridge (VM partial), add core plugins: RegexBox/EncodingBox/TOMLBox/PathBox + examples; wire nyash.toml; begin String interop for internal vs plugin boxes; update CURRENT_TASK.md 2025-08-30 23:47:08 +09:00
c13d9c045e 📚 Phase 12: Nyashスクリプトプラグインシステム設計と埋め込みVM構想
## 主な成果
- Nyashスクリプトでプラグイン作成可能という革命的発見
- C ABI制約の分析と埋め込みVMによる解決策
- MIR/VM/JIT層での箱引数サポートの詳細分析

## ドキュメント作成
- Phase 12基本構想(README.md)
- Gemini/Codex先生の技術分析
- C ABIとの整合性問題と解決策
- 埋め込みVM実装ロードマップ
- 箱引数サポートの技術詳細

## 重要な洞察
- 制約は「リンク時にC ABI必要」のみ
- 埋め込みVMでMIRバイトコード実行により解決可能
- Nyashスクリプト→C ABIプラグイン変換が実現可能

Everything is Box → Everything is Plugin → Everything is Possible!
2025-08-30 22:52:16 +09:00
7a0f9bd432 🚨 AI協調開発の危機回避事例を論文化(paper-09)
「ん?大丈夫?」の一言がPython特化ハードコーディングを防いだ事例を記録。
Everything is Box哲学 vs 技術的正しさの綱渡りからの生還を分析。

- docs/research/paper-09-ai-collaboration-pitfall/ を新規作成
  - incident-analysis.md: Lowerer特殊化危機の詳細分析
  - ai-collaboration-lessons.md: AI協調開発の教訓
  - intuition-in-engineering.md: エンジニアの直感の価値
  - summary.md: 綱渡りからの生還まとめ
- 研究論文の1論文1フォルダ原則に従い整理
- Python統合関連の実装修正とビルド成功確認

🛡️ Generated with Claude Code
2025-08-30 08:54:15 +09:00
db265d7f29 🐍 Python統合をAOTレベルまで完成(eval方式でunsupported=0達成)
- PyRuntimeBox.eval() で完全AOT対応(FloatBox返却)
- NYASH_PY_AUTODECODE=1 によるプリミティブ型自動変換
- ConsoleBox経由の出力もAOT対応
- 多数のPythonテストサンプル追加
- 論文「1ヶ月でインタープリターからネイティブまで」執筆開始

課題:
- import/getattr/callはプラグイン側の実装待ち
- importとevalの文脈共有は未対応

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-30 07:47:21 +09:00
1b98f85df9 🚀 Phase 10.11: Everything is Plugin革命完了!
主な変更:
- ConsoleBox/MathBoxプラグイン実装・登録完了
- nyash_box.toml 2ファイルシステム設計(中央レジストリ+個別仕様書)
- 全プラグインにnyash_box.tomlテンプレート追加
- プラグイン優先機能(NYASH_USE_PLUGIN_BUILTINS=1)文書化
- ビルトインBox削除準備(ChatGPT5実装中)
- ネイティブビルドデモ追加(Linux/Windows動作確認済み)

Everything is Box → Everything is Plugin への歴史的転換!
開発20日目にしてビルトインBox全削除という革命的決定。

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-30 01:33:52 +09:00
15e0a1ab34 feat: nyash.toml自動解決とWindows/Python対応
- Windows向け自動ライブラリパス解決(lib接頭辞除去)
- Pythonプラグイン実装改善(evalR/importRメソッド追加)
- nyash.tomlに新[plugins]セクション対応開始
- プラグイン検索パスの柔軟な解決
- AOT設定Box改善とエラーハンドリング強化
- Phase 10.5bドキュメント追加(ネイティブビルド統合計画)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-30 00:08:19 +09:00
cdb75dfac1 docs: 包括的なビルドガイドを追加
- docs/guides/build/README.md - すべてのビルドパターンを網羅
- docs/guides/build/cross-platform.md - クロスプラットフォーム開発ガイド
- docs/guides/build/windows-distribution.md - Windows配布版作成の詳細手順
- docs/guides/build/aot-compilation.md - AOTネイティブコンパイルガイド
- CLAUDE.mdにビルドガイドへのリンクを追加
- cargo-xwinでのWindows向けビルド方法を文書化
- プラグインの自動拡張子変換機能(ChatGPT5実装)を説明
2025-08-29 23:38:59 +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
1eee62a8ea feat(jit): JIT Strictモード実装とプラグイン経路の安定化
- InvokePolicy/Observe導入でLowererの分岐をスリム化
- ArrayBox/MapBox/StringBoxのプラグイン経路統一
- 特殊コメント機能(@jit-debug, @plugin-builtins, @jit-strict)実装
- 型ヒント伝搬パス(TypeHintPass)を独立モジュール化
- VM→Plugin引数整合の安定化(I64統一、IntegerBox自動プリミティブ化)
- StringBoxのpost-birth初期化(空文字列セグフォルト修正)
- JIT観測サンプル追加(Array/Map/String)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 21:39:47 +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
d24149d0a1 feat: Phase 10.5 Python統合プラグインとAOTビルド対応
- Pythonプラグイン(PyRuntimeBox/PyObjectBox)を追加
  - eval, import, getattr, call, callKw, strメソッド実装
  - math.sqrtデモ等のサンプルコード追加
- AOTビルドサポート追加
  - libnyrtランタイムライブラリ
  - build_aot.shビルドスクリプト
- .gitignore改善
  - JSONLとDOTファイル除外
  - プラグインのビルド成果物除外
- 不要ファイル削除
  - nekocode-temp, zenn_articles
  - 一時的なログファイル類

Phase 10.1の新計画に基づいて、プラグインBox統一化を推進
2025-08-29 10:22:44 +09:00
12adde9477 🎉 Phase 10.10: Nyash→JIT→Native EXE achieved\! (20 days from inception\!)
Revolutionary milestone: Complete native executable generation pipeline
- Created minimal nyrt (Nyash Runtime) library for standalone executables
- Implemented plugin bridge functions (nyash_plugin_invoke3_i64 etc)
- Added birth handle exports (nyash.string.birth_h) for linking
- Changed export name from main→ny_main to allow custom entry point
- Successfully generated and executed native binary returning "ny_main() returned: 1"

Timeline of miracles:
- 2025-08-09: Nyash language created (first commit)
- 2025-08-13: JIT planning started (4 days later)
- 2025-08-29: Native EXE achieved (today - just 20 days total\!)

This proves the plugin Box C ABI unification strategy works perfectly for
both JIT execution and AOT native compilation. The same plugin system
that enables dynamic loading now powers static linking for zero-overhead
native executables\!

Next: Expand AOT support for more instructions and optimize nyrt size.

🚀 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 08:36:07 +09:00
c882a5bd95 fix(plugins): unsafe関数呼び出しの修正とテスト成功
## 修正内容
- plugin_loader_v2.rs: unsafe関数呼び出しをunsafeブロックで囲む修正
- ビルド警告は残るが、すべて未使用import/変数なので問題なし

## テスト結果(すべて成功!)
-  Array demo: 結果5(push/size/get動作確認)
-  Array set demo: 結果42(set操作確認)
-  Map RO demo: 結果200(size/get/has確認)
-  JIT経路: シンボリック呼び出し確認

## 革命的発見の証明
- ユーザーBox + プラグインBoxの2種類で十分だった!
- ビルトインBox不要(すべてプラグイン化可能)
- スタティックリンクでオーバーヘッド解消

「シンプルが最強」の実証完了にゃ!😺

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 05:07:47 +09:00
c954b1f520 feat(plugins): ArrayBox/MapBoxプラグイン実装とPhase 10.1計画
🎯 革命的発見: プラグインC ABI = JIT→EXE変換の統一基盤

## 主な変更点
- ArrayBoxプラグイン: get/set/push/size/is_empty実装
- MapBoxプラグイン: size/get/has実装(ROメソッドのみ)
- Phase 10.1ドキュメント: プラグインBox統一化計画
- デモファイル3種: プラグイン動作確認用

## 技術的詳細
- BID-FFI (Box ID Foreign Function Interface) 活用
- 既存のプラグインシステムでJIT/AOT統一可能
- スタティックリンクでオーバーヘッド解消
- "Everything is Box → Everything is Plugin → Everything is Executable"

## テスト済み
- array_plugin_demo.nyash: 基本動作確認 
- array_plugin_set_demo.nyash: set操作確認 
- map_plugin_ro_demo.nyash: RO操作確認 

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 04:37:30 +09:00
3a576a665c Phase 10.1: ChatGPT5のC ABI統一設計を文書化
- ChatGPT5からの的確なアドバイスを設計文書に反映
- nyrt_*(コアランタイム)とnyplug_*(プラグイン)の命名規則
- 実装ステップガイドの詳細化(VM→JIT→AOTの順序)
- 最小限のC ABIヘッダ雛形を定義

'手順さえ守れば大丈夫' - 一歩ずつ確実に進める計画
2025-08-29 03:42:59 +09:00
6fdc52457e Phase番号再編成: プラグインBox統一化を10.1に昇格
- 革新的発見: 既存プラグインシステム(C ABI)でJIT→EXE実現可能
- Phase 10.1: プラグインBox統一化(新規)
- Phase 10.5: Python統合(旧10.1を移動)
- CURRENT_TASKを更新して新計画を反映

Everything is Box → Everything is Plugin への進化
2025-08-29 03:32:50 +09:00
4167491e92 docs: JIT→EXE実現のための革新的アプローチを文書化
- プラグインBox統一化によるC ABI活用案
- すべてのBoxをプラグイン化する提案
- 既存のBID-FFIシステムを再利用
- Gemini/Codex先生の技術的助言も統合

関連: Phase 10.x, 自己ホスティング計画
2025-08-29 03:28:42 +09:00
91f2ee11d6 Phase 10.1 リファクタリング: JIT lowerモジュールの分割
- core_hostcall.rs: HostCall関連のlowering処理を分離(array_get/array_set/box_call)
- 1000行制限を守るための構造整理(機能差分なし)
- ChatGPT5によるAI協調開発対応のリファクタリング

変更内容:
- src/jit/lower/core_hostcall.rs を新規追加
- src/jit/lower/mod.rs にモジュール追加
- ビルドとスモークテスト確認済み
2025-08-29 02:47:55 +09:00
3d5a8ccad5 docs: CURRENT_TASKにリファクタリング進捗を追加
- Phase 10.10締めの整備として大型ファイル分割作業を記録
- jit/lower/builder.rs → extern_thunks分離(980行に削減)
- jit/lower/core.rs → cfg_dot分離(1012行に削減)
- 他AI連携のため~1000行以内を目標に継続的リファクタリング
- 次のステップ: core_hostcall.rs、core_ops.rsへの段階的分離

ChatGPT5さんのリファクタリング作業記録

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 02:19:50 +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
d67f27f4b8 Phase 10.10: GC Switchable Runtime & Unified Debug System 実装完了
Phase 10.10の主要実装:
- GcConfigBox: GC設定の実行時制御(counting/trace/barrier_strict)
- DebugConfigBox: デバッグ設定の統一管理(JIT events/stats/dump/dot)
- メソッドディスパッチ: system_methods.rsで両Boxのメソッド実装
- CountingGC動作確認: write_barriers正常カウント(VM実行時)

技術的詳細:
- BoxCore/BoxBase統一アーキテクチャを活用
- setFlag/getFlag/apply/summaryメソッドで統一API提供
- 環境変数経由でVM/JITランタイムと連携
- GcConfigBox.apply()は次回実行から有効(ランタイム作成前に環境変数参照)

テスト済み:
- examples/gc_counting_demo.nyash: CountingGCの動作確認
- write_barriers=3でArray.push/set, Map.setを正しくカウント
- NYASH_GC_TRACE=1でGC統計出力確認

Box-First哲学の体現: 設定も制御も観測もすべてBox!

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-28 22:31:51 +09:00
4e1b595796 AI協調開発研究ドキュメントの完成と Phase 10.9-β 進捗
【AI協調開発研究】
- AI二重化モデルの学術論文draft完成(workshop_paper_draft.md)
- 「隠れた危機」分析とbirthの原則哲学化
- TyEnv「唯一の真実」協調会話を保存・研究資料に統合
- papers管理構造の整備(wip/under-review/published分離)

【Phase 10.9-β HostCall進捗】
- JitConfigBox: relax_numeric フラグ追加(i64→f64コアーション制御)
- HostcallRegistryBox: 署名検証・白黒リスト・コアーション対応
- JitHostcallRegistryBox: Nyash側レジストリ操作API
- Lower統合: env直読 → jit::config::current() 参照に統一
- 数値緩和設定: NYASH_JIT_HOSTCALL_RELAX_NUMERIC/Config.set_flag

【検証サンプル拡充】
- math.sin/cos/abs/min/max 関数スタイル(examples/jit_math_function_style_*.nyash)
- 境界ケース: 署名不一致・コアーション許可・mutating拒否サンプル
- E2E実証: String.length→allow, Array.push→fallback, math関数の署名一致観測

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-28 12:09:09 +09:00
e54561e69f Phase 10.7 - JIT統計とイベント機能の完成
主要な実装:
- PHI(b1)統計追跡: phi_total_slots/phi_b1_slotsをJSON出力
- 関数単位統計API: JitStatsBox.perFunction()で詳細統計取得
- JITイベントシステム: compile/execute/fallback/trapをJSONL形式で記録
- Store/Load命令対応: ローカル変数を含む関数のJIT実行が可能に

新しいBox:
- JitStatsBox: JIT統計の取得
- JitConfigBox: JIT設定の管理(将来用)
- JitEventsBox: イベントのJSONL出力(将来用)
- JitPolicyBox: 実行ポリシー管理(将来用)

CLI拡張:
- --jit-exec, --jit-stats, --jit-dump等のフラグ追加
- --jit-directモードでの独立JIT実行
- NYASH_JIT_*環境変数によるきめ細かい制御

ドキュメント:
- Phase 10.7実装計画の詳細化
- Phase 10.9 (ビルトインBox JIT) の計画追加
- JIT統計JSONスキーマ v1の仕様化

ChatGPT5との共同開発により、JIT基盤が大幅に強化されました。
次はPhase 10.9でビルトインBoxのJIT対応を進め、
Python統合(Phase 10.1)への道を開きます。

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-28 09:26:58 +09:00
99e59e24e2 LowerCore: stabilize minimal PHI by tracking Phi dst and pushing block param when that ValueId is requested; verified jit_phi_demo returns merged value under cranelift. 2025-08-27 17:58:50 +09:00
633a073a30 Phase 10.7 (NYASH_JIT_PHI_MIN=1): Minimal PHI support for single-diamond via block params; extend IRBuilder with block-param/jump-args APIs; implement in CraneliftBuilder; update LowerCore two-pass for PHI wiring. 2025-08-27 17:52:37 +09:00
6bfb38949c JIT cond path: keep compare result as b1; br_if accepts b1 or i64 (!=0); add branch_return to benchmark suite. 2025-08-27 17:39:12 +09:00
a4ffc3b2aa Docs: note Phase 10.7 JIT control-flow coverage and cranelift-jit feature in execution-backends.md. 2025-08-27 17:19:41 +09:00
1b55233365 Implement Phase 10.7 control-flow hooks in CraneliftBuilder: block vectors, switch/seal, br_if/jump; adjust begin_function and emit sites to honor current block. (Feature-gated) 2025-08-27 17:14:37 +09:00
e352168f81 Phase 10.7 scaffolding: IRBuilder control-flow APIs; LowerCore prepares block mapping and calls branch/jump hooks (no-op by default). 2025-08-27 17:08:49 +09:00
ddae7fe1fc Phase 10_6b scheduler complete; 10_4 GC hooks + counting/strict tracing; 10_c minimal JIT path (i64/bool consts, binop/compare/return, hostcall opt-in); docs & examples; add Phase 10.7 roadmap (JIT branch wiring + minimal ABI). 2025-08-27 17:06:46 +09:00
de03514085 feat: Phase 10_b JIT implementation progress + academic paper ideas
Phase 10_b JIT Lower implementation:
- IRBuilder abstraction with NoopBuilder (emit counting) 
- CraneliftBuilder skeleton (feature `cranelift-jit`) 
- LowerCore implementation (Const/Copy/BinOp/Cmp/Branch/Ret) 
- Engine.compile with builder selection and JIT handle generation 
- JIT function table with stub functions 
- Basic i64 const/binop/ret emission for Cranelift
- VM execution path with NYASH_JIT_EXEC=1 support

Academic ideas and analysis:
- "Everything is Thread-Safe Box" concept
- "GC as debug tool" paradigm analysis
- GC switchable semantic equivalence documentation
- Gemini & Codex evaluation on academic paper potential
- Nyash academic papers potential themes

Current limitations:
- Return values limited to i64 (VMValue::Integer)
- Arguments not yet supported
- Compare/Branch emit not implemented
- Trap→VM fallback not implemented

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-27 03:16:57 +09:00
61800a37a7 feat: Phase 10 reorganization + GC switchable runtime + VM improvements
## 📚 Documentation Updates
- Phase 10 reorganized with comprehensive README
  - Cranelift JIT as main implementation
  - NEW: Phase 10.4 GC Switchable Runtime (world's first\!)
  - Phase 10.5 Self-hosting (parallel)
  - Application migration tests
- Phase 11 created for LLVM AOT research (deferred)
  - Moved phase10_aot_scaffolding.md → Phase 11
  - Moved phase_10_x_llvm_backend_skeleton.md → Phase 11
- Master roadmap updated with GC runtime feature
- Ideas: GC switchable language concept documented

## 🚀 VM Implementation Progress (by ChatGPT5)
- src/backend/vm.rs: Enhanced VM execution
- src/backend/vm_instructions.rs: Instruction improvements
- src/runtime/type_meta.rs: NEW - Type metadata system
- src/boxes/buffer/mod.rs: Buffer optimizations
- src/runtime/mod.rs & plugin_ffi_common.rs: Runtime enhancements

## 🌟 Revolutionary Feature: GC Switchable Runtime
- Development mode: GC on (convenience)
- Production mode: GC off (performance)
- Technical feasibility confirmed by Codex GPT-5
- Implementation plan: After Cranelift JIT

## 📋 Phase 10 Structure
Phase 10.0: Cranelift JIT foundation
Phase 10.1-10.3: JIT implementation & optimization
Phase 10.4: GC Switchable Runtime ← NEW\!
Phase 10.5: Self-hosting (String/Array/Map in Nyash)
Phase 10.9: Application migration tests

🤖 ChatGPT5 says: Ready for Phase 10\! どきどきにゃ!
2025-08-27 01:03:55 +09:00
e5515ea5e9 docs: Update Phase 9.79b progress - ChatGPT5's implementation advances
- Phase 9.79b.1:  Minimal scope achieved (method_id introduction)
- Phase 9.79b.2:  Minimum completed
  - Universal fast-path thunks (toString/type/equals/clone)
  - Monomorphic PIC with 8-hit threshold for promotion
  - PluginBoxV2 fast-path with minimal TLV support
  - Lazy seed/reservation for builtin/plugin/user slots
  - Version-based cache invalidation framework
- Phase 9.79b.3: → In progress (TypeMeta/Thunk + Poly-PIC + Diagnostics)

🤖 ChatGPT5 is making solid progress on the unified box design implementation\!
2025-08-27 00:06:40 +09:00
edf5ccfcb4 Docs: Add phase_9_79b_3_vm_vtable_thunks_and_pic.md\n- Plan to formalize TypeMeta+Thunk and upgrade PIC to poly\n- Diagnostics, risks, milestones, exit criteria, and Phase 10 readiness 2025-08-27 00:03:48 +09:00
90b9ab3a16 Docs: VM BoxCall vtable/PIC overview\n- VM_README: method_id slots, universal thunks, mono-PIC直呼び\n- Phase notes: progress includes direct-call and next steps 2025-08-26 22:37:15 +09:00
d46176de49 Builder: reserve slots for user-defined instance methods (start at 4)\n- Deterministic per-type slot assignment via sorted names\n- Enables method_id emission for user boxes when type known\n- Docs updated 2025-08-26 22:35:19 +09:00
2960a9b2f8 PIC direct-call: cache InstanceBox function name after threshold\n- Add boxcall_pic_funcname cache in VM\n- execute_boxcall uses cache for direct function calls\n- Threshold=8 hits per site\n- Update CURRENT_TASK 2025-08-26 22:11:17 +09:00