Files
hakorune/include/nyrt_host_api.h
Moe Charm 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

48 lines
1.5 KiB
C

// NyRT Host Reverse-Call C ABI (Phase 12)
// Minimal header for plugins → host calls using TLV-encoded arguments.
//
// Exports:
// - nyrt_host_call_name: call method by name
// - nyrt_host_call_slot: call by numeric slot (stable ABI)
//
// TLV Tags (subset):
// tag=1 -> bool (1 byte)
// tag=2 -> i32 (4 bytes, LE)
// tag=3 -> i64/u64 (8 bytes, LE)
// tag=5 -> f64 (8 bytes, LE)
// tag=6/7-> string (utf8)
// tag=8 -> PluginHandle (type_id:u32, instance_id:u32)
// tag=9 -> HostHandle (u64) for user/builtin boxes
//
// Slots (subset):
// InstanceBox: 1(getField), 2(setField), 3(has), 4(size)
// ArrayBox: 100(get), 101(set), 102(len)
// MapBox: 200(size), 201(len), 202(has), 203(get), 204(set)
// StringBox: 300(len)
#pragma once
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
// Call a method by name on a HostHandle receiver.
// Arguments are TLV-encoded values; output is a single TLV value.
// Returns 0 on success.
int32_t nyrt_host_call_name(uint64_t handle,
const uint8_t* method_ptr, size_t method_len,
const uint8_t* args_ptr, size_t args_len,
uint8_t* out_ptr, size_t* out_len);
// Call by stable numeric slot (preferred path for performance and diagnostics).
int32_t nyrt_host_call_slot(uint64_t handle, uint64_t selector_id,
const uint8_t* args_ptr, size_t args_len,
uint8_t* out_ptr, size_t* out_len);
#ifdef __cplusplus
}
#endif