Commit Graph

1905 Commits

Author SHA1 Message Date
3babd8f69c filebox: add path-based I/O and exists 2025-09-10 21:15:50 +09:00
7fc5fef5cc Apply ChatGPT's FileBox method_id fixes and add build scripts
- Add plugin host initialization for LLVM mode (fixes method_id injection)
- Add FileBox method_id injection test
- Enhance MIR14 stability test
- Add warning for Mock LLVM implementation
- Create build scripts for JIT/LLVM with proper settings (24 threads, timeout)
- Update CLAUDE.md with build instructions and FileBox test results

Note: FileBox file I/O still not working in LLVM execution (separate issue)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 20:56:14 +09:00
92bbfd90bc Add Gemini compiler discussion summary
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 19:58:58 +09:00
1b5a55c795 mir: include continue snapshots in phi sealing (#130) 2025-09-10 17:39:46 +09:00
06c77c1026 chore(mir): prune legacy instruction sets (#129) 2025-09-10 17:23:26 +09:00
370e725926 docs: Update current task and loop builder SSA bug details
- Update dates to 2025-09-08
- Document loop builder SSA scope management issue
- Add notes about continue/break implementation status
- Fix birth/init consistency in CLAUDE.md
2025-09-09 09:31:39 +09:00
62246c76e3 docs(current_task): add structured tasks under docs/current_task/{main,llvm,self_current_task} and unignore path 2025-09-08 11:35:30 +09:00
a45c22891c selfhosting-dev: finalize local changes post-rebase abort (dep_tree tools, runner, grammar); keep tmp deps json in-tree 2025-09-08 11:20:13 +09:00
f22082f67c resolve: apply stashed using/module + deps bridge; remove conflict markers in runner/mod.rs 2025-09-08 04:35:50 +09:00
da5fa600d2 merge: selfhosting-dev <- origin/main; prefer main updates in cranelift builder (ARROW removal/SHR adoption) 2025-09-08 04:33:50 +09:00
17225c29f7 tests: add parser/vm bitops tests; docs: update cheatsheet and language guide for bitwise ops and shift; note Arrow(>>) removal
- Add src/tests/parser_bitops_test.rs and vm_bitops_test.rs
- Update tokenizer unit test to expect SHIFT_RIGHT
- Update quick-reference and language guide to document &,|,^,<<,>> and Arrow deprecation

Known: one unrelated test failing (consolebox println TLV vs typebox) pre-existing.
2025-09-08 04:04:19 +09:00
08d9b71297 grammar: introduce bitwise ops & shifts; retire legacy >> ARROW
- Tokenizer: add tokens for << >> & | ^ (SHIFT_LEFT/RIGHT, BIT_AND/OR/XOR); keep ||, &&, |>
- Parser: precedence layers for bit ops (| ^ &) and shift (<< >>); remove >> Arrow production
- AST: add BitAnd/BitOr/BitXor/Shr with Display
- MIR builder: map bit ops and Shr to MIR BinaryOp
- Interpreter: implement integer-only bit ops and shifts, mask shift count to 0..63

Compatibility: legacy >> Arrow removed from parser; use |> for pipeline.
2025-09-08 03:54:34 +09:00
7c2b09c647 grammar: add '<<' shift-left safely (Phase 1); map to AST/MIR/VM; keep '>>' as legacy ARROW
- Tokenizer: add SHIFT_LEFT for '<<' (before <= detection)
- Parser: introduce parse_shift() layer; left-associative; only '<<' handled in Phase 1
- AST: add BinaryOperator::Shl and display
- MIR builder: map Shl -> BinaryOp::Shl
- Interpreter: implement Shl in both execution paths (integer-only, type error otherwise)

No change to '>>' (legacy ARROW remains). No runtime gate yet for SHL as it does not collide with existing syntax.
2025-09-08 03:44:55 +09:00
2578120b23 docs(phases): restore Phase 18/19 from history (3826089)\n\n- Phase 18: LifeBox principles and LoopForm design doc\n- Phase 19: LoopForm <-> Core-13 PoC and zero-cost CI plan\n\nRecovered from commit 3826089; reintroduce missing directories under docs/development/roadmap/phases/ 2025-09-08 03:30:35 +09:00
10d6b3059a llvm: inline env.box.new_i64x arg conversion; add bitops tests/smoke; update CURRENT_TASK
- Inline-coerce env.box.new_i64x args to i64 handles (int passthrough, f64 via nyash.box.from_f64, i8* via nyash.box.from_i8_string). Removes closure that caused builder lifetime/borrow issues.
- Add unit test for bitwise/shift ops (VM=48; LLVM emit ok; compile_and_execute returns 48).
- Extend tools/llvm_smoke.sh with optional NYASH_LLVM_BITOPS_SMOKE gate; add apps/tests/ny-llvm-bitops (parser currently lacks &|^<<>> so E2E gated).
- Update CURRENT_TASK.md to reflect P1 progress and test strategy.

Build/test:
- LLVM build: LLVM_SYS_180_PREFIX=/usr/lib/llvm-18 cargo build --release --features llvm
- Unit: cargo test --no-run (env-dependent to run)
- Smoke (optional): NYASH_LLVM_BITOPS_SMOKE=1 ./tools/llvm_smoke.sh
2025-09-08 03:27:52 +09:00
6a80ce6c65 docs(current_task): restart notes for Ny syntax alignment and next steps 2025-09-08 02:24:17 +09:00
29e2973a72 docs(current_task): prepend quick self-host plan (dep-tree + bridge) for restart context 2025-09-08 02:15:33 +09:00
f8beebc456 docs(current_task): add self-host dep-tree plan; tasks: add dep_tree; Makefile: add dep-tree target 2025-09-08 01:42:50 +09:00
df88296d97 Merge branch 'main' of https://github.com/moe-charm/nyash 2025-09-08 01:41:05 +09:00
193050cba3 fix: finalize extern registry and docs dir after merge 2025-09-08 01:39:58 +09:00
df21e9e137 runner: align mod.rs with cranelift-dev (remove using/modules flow, JSON v0 via MIR interpreter) 2025-09-08 01:30:59 +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
1aad0479e7 merge: bring cranelift-dev into selfhosting-dev (VM stable, AOT/JIT smokes passing) 2025-09-08 01:24:13 +09:00
5ab3cc6688 vm: stabilize plugin-first VM output + TLV decode\n\n- runtime(plugin_loader_v2): decode plugin TLV generically (tag 1/2/3/5/6/7/8/9)\n- vm(print): coerce plugin-backed results via semantics (i64/string) for consistent output\n- vm(plugin_invoke): add decode debug; align return handling\n- bin/lib: expose runner_plugin_init in bin; fix call sites to init plugin host\n- tools(build_aot.sh): disable legacy-forbid diag and toml env for object emit\n- add VM/JIT smoke scripts (counter, filebox, jit-compare)\n\nResult: VM plugin smokes PASS; jit-direct compare PASS. AOT emit still needs CLIF block init tweak. 2025-09-08 01:08:59 +09:00
1069f558a5 selfhost/tools: add dep_tree_simple.nyash (single-box functional) and run dep_tree.sh with interpreter + plugin builtins; groundwork for include+using/module JSON deps 2025-09-07 20:59:18 +09:00
caf0e922ef selfhosting: move ny-parser-nyash into apps/selfhost/, add Ny-only dev loop and initial dep tree tools; add docs plan; make dev/dev-watch 2025-09-07 20:23:39 +09:00
1bb2d2db5b docs(current_task): add handoff plan (worktree setup, lower TODOs, commands) 2025-09-07 18:09:47 +09:00
21d2543e33 docs(current_task): update egui AOT/JIT status, scripts, and next actions (2025-09-07) 2025-09-07 17:53:48 +09:00
4a8691014f docs/private: convert to git submodule (nyash-private-docs) (#128)
Co-authored-by: Tomoaki <tomoaki@example.com>
2025-09-07 08:49:36 +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
07350c5dd9 windows/llvm: add build script (build_nyash_llvm.ps1); fix nyash.toml LLVM task paths; add screenshots dir placeholder; add which dep 2025-09-06 22:08:58 +09:00
0076a2eec1 tests: ignore instance get/set slots (ABI_STRICT vtable) and plugin ConsoleBox/FileBox e2e under default env; keep cranelift suite green 2025-09-06 21:47:14 +09:00
80fe676cd4 cranelift: fix FB block-switch panic by safe switch wrapper; add Array.set(H,H) thunk + lowering; route all builder switching via safe path; pass identical_exec add/console_log/string_len/array_map_string 2025-09-06 21:25:03 +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
c5c3a2624c Merge remote-tracking branch 'origin/main' into cranelift-dev 2025-09-06 16:45:39 +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
7a4f5052f1 jit: P3 jit-direct-only hardening; stub JitManager; guard VM/JIT identical tests under jit-only 2025-09-06 13:07:57 +09:00
4a110c1674 vm: when jit-direct-only, disable VM-side JIT manager (set None) and keep VM compiling; continue P3 guard path 2025-09-06 12:33:00 +09:00
6ec88590e7 jit: P2 shrink legacy dependencies in jit-only mode; guard legacy VM-args fallbacks with cfg(jit-direct-only); keep handle-only paths 2025-09-06 12:29:15 +09:00
f4dea3354b jit: P1 jit-direct-only feature; disable plugin-builtins branch; stub legacy VM-args TLS for JIT-only builds 2025-09-06 12:20:27 +09:00
e4c7a36e35 merge: cranelift-dev fixes (MIR return type inference, JIT return materialization, diagnostics, console bridge) 2025-09-06 12:09:04 +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
355fcedb02 cleanup: remove accidentally added nested git repos (not submodules) 2025-09-06 11:01:30 +09:00
a2f2aaaef6 merge: bring Return materialization + JIT diag + dev scaffolds 2025-09-06 11:00:29 +09:00
da81958e2d wip: save working tree before merge 2025-09-06 11:00:15 +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