Commit Graph

666 Commits

Author SHA1 Message Date
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
c0b70c0e4e Plugin seeds: add FileBox minimal slots (open/read/write/close)\n- Enables method_id for common plugin calls when type known (new FileBox) 2025-08-26 23:07:43 +09:00
bd8a63911c Slot registry: seed builtin method slots (ArrayBox/MapBox/IntegerBox/StringBox)\n- Lazy seeding in resolve_slot_by_type_name\n- Enables method_id for builtin calls when receiver type known 2025-08-26 22:52:42 +09:00
7ee922130f VTable-like direct call via method_id for InstanceBox\n- Add vtable cache: (Type, slot, arity) -> function name\n- execute_boxcall uses vtable before PIC\n- Populate vtable cache on first InstanceBox method call when method_id present 2025-08-26 22:47:06 +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
b2b82c9e81 P2PBox debug reply: avoid deep clone; send via shared transport to prevent bus endpoint override\n- Use Arc<RwLock<Box<dyn Transport>>> in spawned thread\n- Keeps original node endpoint intact 2025-08-26 21:35:32 +09:00
a1fcceb606 phase_9_79b_2: Docs/tests for universal thunks + PIC skeleton\n- Add VM test for type()/equals() fast-path\n- Update phase doc with progress notes 2025-08-26 21:12:32 +09:00
35049606f3 phase_9_79b_2 (PIC skeleton): Add monomorphic PIC hit counters\n- VM stores per-(receiver-type, method_id/name) hit counts\n- execute_boxcall records hits before dispatch\n- CURRENT_TASK updated 2025-08-26 20:59:37 +09:00
edbc38daad phase_9_79b_2 (skeleton): VM BoxCall fast-path for universal slots\n- execute_boxcall now takes optional method_id\n- Fast-path thunks for toString/type/equals/clone\n- Dispatch updated; docs progress note in CURRENT_TASK 2025-08-26 20:56:06 +09:00
e21778c048 phase_9_79b_1: Add Unified Registry IDs + Builder Slotting\n- MIR BoxCall carries optional method_id (slot)\n- Slot registry with universal slots [0..3]\n- Builder resolves method_id when receiver type known\n- Printer shows method_id; backends updated\n- Update CURRENT_TASK + MIR spec note 2025-08-26 20:48:48 +09:00
6eda81f5db feat: Major documentation reorganization and unified Box design updates
## Documentation & Organization
- Moved copilot_issues.txt → 00_MASTER_ROADMAP.md (phases folder)
- Created Phase 9.79b.1 & 9.79b.2 plans for unified Box implementation
- Updated unified-box-design-deep-analysis.md with ChatGPT5 insights
- Added P2P documentation and examples (ping-pong, self-ping)

## Code Updates
- P2PBox: Reverted to original error state for demonstration
- VM: Enhanced BoxCall dispatch for unified approach
- Updated box factory, interpreter calls, and transport layer

## Cleanup & Privacy
- Removed private/ and private_test/ from git tracking
- Added private folders to .gitignore for security
- Cleaned root directory: moved backups, removed temp files
- Moved consultation files to docs/archive/consultations/

## Other Improvements
- Added object literal syntax improvement idea
- Updated CLAUDE.md with master roadmap reference
- Updated CURRENT_TASK.md with latest progress

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-26 20:30:07 +09:00
22212aa314 refactor: Major interpreter modularization and P2PBox enhancements
Major Interpreter Refactoring:
- Split core.rs (373 lines removed) into focused modules
- Split expressions/calls.rs (460 lines removed) into cleaner structure
- Added new modules: calls.rs, errors.rs, eval.rs, methods_dispatch.rs, state.rs
- Improved separation of concerns across interpreter components

P2PBox Enhancements:
- Added on_once() for one-time event handlers
- Added off() for handler deregistration
- Implemented handler flags with AtomicBool for thread-safe management
- Added loopback testing cache (last_from, last_intent_name)
- Improved Arc-based state sharing for transport and handlers

Plugin Loader Unification (In Progress):
- Created plugin_loader_unified.rs skeleton
- Created plugin_ffi_common.rs for shared FFI utilities
- Migration plan documented (2400 lines → 1100 lines target)

MIR & VM Improvements:
- Enhanced modularized MIR builder structure
- Added BoxCall dispatch improvements
- Better separation in builder modules

Documentation Updates:
- Added Phase 9.79a unified box dispatch plan
- Created plugin loader migration plan
- Updated CURRENT_TASK.md with latest progress

All tests passing (180 tests) - ready for next phase of refactoring

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-26 19:13:57 +09:00
bec61e38c5 ResultBox migration complete: remove legacy box_trait::ResultBox
- Delete deprecated ResultBox implementation from box_trait.rs
- All code paths use boxes::result::NyashResultBox (aka boxes::ResultBox)
- Tests remain green (179)
- Mark phase 9.78h acceptance: ResultBox移行完了 as done
2025-08-26 06:52:35 +09:00
b0537a4e59 Verifier: enrich diagnostics with actionable hints
- Add hints for InvalidWeakRefSource/InvalidBarrierPointer/SuspiciousBarrierContext
  under NYASH_DEBUG_VERIFIER. Keeps Phi/merge/dominator hints.
- All tests green (179).
2025-08-26 06:47:13 +09:00
bd6b0b1f8f Snapshots: add loop_nested_if golden and wire into CI check
- New: docs/status/golden/loop_nested_if.mir.txt
- Update: tools/ci_check_golden.sh to include nested-if loop case
- Source: local_tests/loop_nested_if_test.nyash
2025-08-26 06:44:13 +09:00
f1a4a78379 Docs: mark PoC features as deprecated (unified ops are default)
- mir_typeop_poc / mir_refbarrier_unify_poc are no-op now; Builder emits
  TypeOp/WeakRef/Barrier by default; Optimizer normalizes legacy ops.
- Update CURRENT_TASK and architecture/proposal docs accordingly.
2025-08-26 06:41:30 +09:00
e16c64f6ae Cleanup: remove remaining cfg gating for mir_typeop_poc in builder binary-op compare pre-cast
- Always use TypeOp(Cast) for IntegerBox pre-normalization path.
- All tests remain green (179).
2025-08-26 06:38:15 +09:00
378a2bc174 LoopBuilder: bind variable_map to Phi result on seal
- After inserting Phi at loop header, update variable_map so that
  subsequent uses (after the loop) refer to the Phi result instead of
  the latch/body value. This fixes dominance issues in verifier.
- Add tests: loop phi normalization and loop+nested-if phi; both pass.
2025-08-26 06:35:39 +09:00
ea672eaa2c Builder: emit unified MIR ops by default
- emit_type_check/emit_cast -> TypeOp(Check/Cast)
- emit_weak_new/emit_weak_load -> WeakRef(New/Load)
- emit_barrier_read/write -> Barrier(Read/Write)

This removes cfg gating in builder for unified ops; Optimizer still has
legacy normalization as a safety net. All tests green (177).
2025-08-26 06:31:21 +09:00
391a095f4c Phase 9.78h: Stabilize MIR26 pipeline
- Add lib test to sync Core Instruction names with docs (INSTRUCTION_SET.md)
- Optimizer: Pass 0 normalizes legacy ops -> unified (TypeCheck/Cast->TypeOp,
  WeakNew/WeakLoad->WeakRef, BarrierRead/Write->Barrier)
- Optimizer: diagnostics for legacy ops; forbid via NYASH_OPT_DIAG_FORBID_LEGACY=1
- Runner: treat diagnostics (unlowered/legacy) as fatal when enabled
- Printer: unify legacy print style to TypeOp/WeakRef/Barrier
- Verifier: treat Phi inputs correctly (skip merge/dominance violations for Phi)
- Docs: update PHI_NORMALIZATION_PLAN; CURRENT_TASK: add risk note for op duplication
- Misc: PHI debugging/logs kept stable; snapshots still green
2025-08-26 06:30:01 +09:00
ff53fc90b1 docs: fix VM_README link in CLAUDE.md to docs/VM_README.md 2025-08-26 05:51:59 +09:00
bf4b87526e phase(9.78h): stabilize MIR/VM pipeline
- Add MIR26 doc≡code sync test (tests/mir_instruction_set_sync.rs)
- Quiet snapshots; filter plugin/net logs; golden all green
- Delegate VM phi selection to LoopExecutor (borrow-safe)
- ResultBox migration: remove legacy box_trait::ResultBox paths
- VM BoxRef arithmetic fallbacks via toString().parse::<i64>()
- Bridge BoxCall(InstanceBox) to Class.method/arity in VM
- Fix Effects purity (READ -> readonly, not pure)
- Mark Catch as CONTROL to prevent DCE; Try/Catch test green
- Add env-gated debug logs (effects, verifier, mir-printer, trycatch, ref, bin)
- Update CURRENT_TASK with progress and next steps
2025-08-26 05:49:23 +09:00
248c3ba183 vm: extract instruction dispatch into backend::dispatch::execute_instruction; route from vm.rs; keep behavior and env debug flags; moderate refactor 2025-08-26 04:50:04 +09:00
88318d439c vm: introduce ExecutionFrame for current_block/pc/last_result; use control_flow::record_transition; keep behavior identical 2025-08-26 04:45:19 +09:00
0ac6e07eea runner: refactor execute_file_mode into modes::common::run_file dispatcher; keep runner.rs thin; verify VM path 2025-08-26 04:42:52 +09:00
abdf9fb5cd runner: move WASM/AOT and common interpreter execution into runner::modes; finalize mode split; keep demo helpers local 2025-08-26 04:39:16 +09:00
1e735d7717 runner: split modes (mir/vm/llvm/bench) and extract plugin init; interpreter: split objects into ops/methods/fields; VM logs gated; Phi selection minimal fix; CURRENT_TASK updated; remove legacy backups 2025-08-26 04:34:14 +09:00
11c149ac2b docs(current): refresh reboot shortcuts, smoke cmds, and next steps after VM compare fix; add quick restart guide 2025-08-26 03:33:01 +09:00
fd2eb25eb9 vm(compare): fix BoxRef(IntegerBox) comparisons by upstream casts and fallbacks; unify IntegerBox (re-export); as_bool truthiness; NewBox primitive fastpath; phi minimal fallback; add temp debug logs for route tracing 2025-08-26 03:26:55 +09:00
5765953e5f docs(current): record VM and/or truthiness, unify IntegerBox (re-export), and note loop-compare fix plan 2025-08-26 02:39:52 +09:00
44305404e4 Update CURRENT_TASK: mark MIR26 consolidation confirmed; note loop builder stabilization, CLI core-ci guide/script, ResultBox stage-0; update last-updated date. Ready to reopen without stream issues. 2025-08-26 01:44:14 +09:00
9c94e88b86 ResultBox migration (stage 0): suppress legacy deprecation warnings in box_trait impls; keep dual handling in VM. Fix verifier Display for SuspiciousBarrierContext. Expose VM stats fields to vm_stats module. CLI core_ci guide and script in place. 2025-08-26 01:42:18 +09:00
7705508b99 9.78h mainline: add TypeOp mixed-case MIR snapshot and include in CI golden checks; VM module headers for AI-friendly navigation; CURRENT_TASK updated with refactor goals. 2025-08-26 01:09:17 +09:00
7ccd5420ac Docs/CurrentTask: add explicit refactor goals/milestones/steps. VM modules: add Purpose/Responsibilities/Key APIs/Typical Callers headers. Build+goldens green. 2025-08-26 01:07:23 +09:00
edadf67ca0 Refactor (structure): add vm_stats module; move BoxCall debug logger into vm_boxcall; add quick-reference/code-map.md for AI-friendly repo navigation. Keep behavior unchanged. 2025-08-26 00:58:57 +09:00
2a02eb7a52 Refactor (light): move VM value ops to backend/vm_values.rs; add backend/vm_boxcall.rs with call_box_method_impl and rewire call_unified_method. Update CURRENT_TASK for refactor start. 2025-08-26 00:48:09 +09:00
63656c1d1b Phase 9.78h: Minor cleanup — suppress deprecation warnings for legacy box_trait::ResultBox handling in VM to keep logs clean while migrating to boxes::ResultBox. 2025-08-26 00:32:33 +09:00
320fbf0955 Phase 9.78h: Expand MIR golden snapshots (extern_call, loop, boxcall); add extern_console_log test; update CI golden check. Report refactoring candidates >1000 lines. 2025-08-26 00:12:53 +09:00
f82ad5a84d Phase 9.78h: VM BinOp and/or short-circuit + BoxRef<Integer> arithmetic; add diagnostic hooks. Update CURRENT_TASK with progress and VM path-tracing TODO. Align docs: MIR26 canonical spec and phase docs. 2025-08-26 00:06:35 +09:00
3a8f7092e6 MIR loop_api: extend facade with CFG/phi helpers (add_predecessor, seal_block, insert_phi_at_block_start) and implement for legacy/modularized builders to prepare SSA loop reintroduction. 2025-08-25 22:22:14 +09:00
144974ede7 Tests(MIR): add lightweight dump checks for BoxCall (.push) and Await to improve regression coverage without brittle snapshots. 2025-08-25 22:00:08 +09:00
f2a8e31842 MIR(builder_modularized/control_flow): switch loop lowering to loop_api::build_simple_loop via LoopBuilderApi facade; keeps semantics and decouples from legacy loop builder. 2025-08-25 20:20:46 +09:00
48499f593f MIR(builder_modularized): implement LoopBuilderApi for modularized MirBuilder to use shared loop helpers in future. 2025-08-25 20:19:42 +09:00
f665787511 Tests(MIR): add extern_call console.log lowering test and verbose MIR dump assertion. 2025-08-25 20:19:04 +09:00
317e6af0bf MIR: add loop_api facade trait and simple lowering helper; implement LoopBuilderApi for legacy MirBuilder to enable adapter-based migration. 2025-08-25 20:16:42 +09:00
46d47e2948 Tests(MIR): add lowering tests ensuring TypeOp for print(isType(...)) and print(obj.is(...)); note: cargo check passes, test harness currently blocked by CLI config fields unrelated to MIR changes. 2025-08-25 20:09:12 +09:00
06cdc7aff6 MIR builder (modularized/control_flow): replace LoopBuilder dependency with simplified loop lowering to decouple types; add TODO for SSA phi reintroduction. 2025-08-25 19:54:59 +09:00