Files
hakorune/docs/VM_README.md
Moe Charm cc2a820af7 feat(plugin): Fix plugin BoxRef return and Box argument support
- Fixed deadlock in FileBox plugin copyFrom implementation (single lock)
- Added TLV Handle (tag=8) parsing in calls.rs for returned BoxRefs
- Improved plugin loader with config path consistency and detailed logging
- Fixed loader routing for proper Handle type_id/fini_method_id resolution
- Added detailed logging for TLV encoding/decoding in plugin_loader_v2

Test docs/examples/plugin_boxref_return.nyash now works correctly:
- cloneSelf() returns FileBox Handle properly
- copyFrom(Box) accepts plugin Box arguments
- Both FileBox instances close and fini correctly

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-21 00:41:26 +09:00

807 B
Raw Blame History

Nyash VM 実行基盤ガイド(更新)

  • プラグインBox引数の最小対応を追加TLV: BoxRef
  • TLVタグ: 1=Bool, 2=I32, 3=I64, 4=F32, 5=F64, 6=String, 7=Bytes, 8=Handle(BoxRef)
    • BoxRefはプラグインBox参照type_id:u32, instance_id:u32を8バイトでエンコード
    • ユーザー定義Box・複雑なビルトインは当面非対応toStringフォールバック

現状のルーティング:

  • User-defined: MIR関数{Box}.{method}/{N}) にCall化関数存在時。それ以外はBoxCall。
  • Builtin: BoxCall → VM内の簡易ディスパッチ。
  • Plugin: BoxCall → PluginLoaderV2.invoke_instance_method。

今後のタスク:

  • VM側のfrom Parent.method対応Builder/VM両対応
  • TLVの型拡張Float/配列/BoxRef戻り値など