Commit Graph

9 Commits

Author SHA1 Message Date
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
be8593fb02 jit/mir: fix String.len return-type inference; stabilize jit-direct returns; add CLIF/sig/call tracing; host-bridge console thunks; update AGENTS.md for Cranelift focus 2025-09-06 12:05:35 +09:00
d631beba37 dev: add selfhosting/cranelift workspaces; jit: add return materialization, ret_slot, hostcall arity pad, and dbg imports for diagnosis 2025-09-06 10:59:33 +09:00
f6e0d5111e Phase A リファクタリング: String.length デバッグ基盤の強化
## 実装内容(振る舞い変更なし)

A-1: Hostcall シンボルの定数化
- 直書き文字列を SYM_* 定数に統一
- nyash.handle.of / nyash.string.len_h / nyash.console.birth_h

A-2: string_len ヘルパー抽出(共通化)
- src/jit/lower/core/string_len.rs 新設
- emit_len_with_fallback_{param,local_handle,literal} を移設
- 二段フォールバック(string.len_h → any.length_h)の集約

A-3: 観測の統一
- import 呼び出しトレース機能を追加(NYASH_JIT_TRACE_IMPORT=1)
- CraneliftBuilder/ObjectBuilder の emit_host_call に構造化イベント
- observe::lower_hostcall で len_h/any.length_h の追跡

## 今後の道筋(CURRENT_TASK.md に記載)
- P0: フェイルセーフ(NYASH_LEN_FORCE_BRIDGE=1)
- P1: シンボル解決の可視化
- P2: リテラル最優先の安定化
- P3: Return 材化の後方走査

バグは手強いけど、デバッグ基盤が整ったにゃ!

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 08:09:46 +09:00
8c02093cfe AOT/JIT: StringBox.length デバッグ追跡とローカル材化強化
- ops_ext: StringBox.len/lengthの結果を必ずローカルに保存
  - param/local/literal/handle.of全経路で dst があれば local_index に格納
  - Returnが確実に値を拾えるよう修正

- デバッグ計測追加:
  - NYASH_JIT_TRACE_LOWER: BoxCall処理の追跡
  - NYASH_JIT_TRACE_RET: Return時の値解決追跡
  - NYASH_JIT_TRACE_LOCAL: ローカルslot I/O追跡
  - NYASH_JIT_TRACE_LEN: string.len_h thunk実行追跡

- 診断用プローブ追加: tmp_len_stringbox_probe.nyash
- CURRENT_TASK更新: 3rdハンドオフ進捗記録

現状: lowering/Return/ローカル材化は正しく配線されているが、
hostcall実行時に0を返している疑い。シンボル解決の追跡継続中。

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 07:45:20 +09:00
4c5301e700 wip(jit): AOTコア機能の継続的改善
JIT/AOTシステムのコア部分の改修を継続。
ChatGPTによる詳細な実装作業。

主な変更点:
- extern/collections.rs: 外部関数コレクション管理の改善
- lower/builder/cranelift.rs: Craneliftビルダーの最適化
- lower/core.rs: コア lowering ロジックの改修
- lower/core/ops_ext.rs: 拡張演算子のlowering処理
- lower/extern_thunks.rs: 外部関数サンクの実装改善

AOTビルドの安定性向上に向けた継続的な作業。

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 06:46:04 +09:00
f939ad0033 Phase 12 完了: JIT/VM完全一致実装 - ChatGPT5による統一実行パス確立
🎯 VM/JIT同一実行の達成:
- InstanceBox: getField/setField完全一致(field3統一API)
- StringBox: 文字列リテラル最適化(u64x2)+ len操作一致
- NewBox: グローバルレジストリ経由の統一生成
- 全Box型でVM/JIT結果が完全同一に

技術的実装:
- host-bridge拡張: field3(固定3引数)でget/set統一
- 文字列処理: emit_string_handle_from_literal + from_u64x2
- Instance生成: nyash.instance.birth_name_u64x2 thunk
- JitEngine経路: LowerCore→CraneliftBuilder統合

テスト強化:
- PersonFactory: VM/JIT両系で同一レジストリ使用
- getField/setField: センチネル値(-1)による識別
- 文字列操作: リテラル/Box両対応

これでNyashは「Real Language」として完成!
同一コードが異なる実行系で完全に同じ結果を保証。

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-03 09:55:25 +09:00
773256380d Phase 12: VM/JIT identical execution tests + host API slot routing
ChatGPT5による統一実行パス実装:
- VM/JIT同一実行テスト追加(Array/Map/String/Instance)
- host_api slot経由呼び出し(NYASH_JIT_HOST_BRIDGE=1)
- extern_registry拡張(console系メソッドslot登録)
- CI: vm-jit-identical.yml(STRICT/非STRICT両系テスト)
- InstanceBox getField/setField slot 1,2統一

技術的改善:
- JIT: ops_ext委譲による統一メソッド解決
- VM: vtable/PIC/名前ベースフォールバック階層
- host_bridge: TLV encode/decode BoxRef対応
- C ABI: nyrt_host_api.h外部公開ヘッダー

テスト追加:
- identical_exec_collections: Array/Map操作一致
- identical_exec_instance: ユーザー定義Box一致
- identical_exec_string: StringBox操作一致
- host_reverse_slot: 逆引きslot解決テスト

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-03 09:12:39 +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