Phase 12: 統一TypeBox ABI実装開始 - ChatGPT5による極小コアABI基盤構築

- TypeBox ABI雛形: メソッドスロット管理システム追加
- Type Registry: Array/Map/StringBoxの基本メソッド定義
- Host API: C ABI逆呼び出しシステム実装
- Phase 12ドキュメント整理: 設計文書統合・アーカイブ化
- MIR Builder: クリーンアップと分離実装完了

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm
2025-09-03 05:04:56 +09:00
parent e2e25f6615
commit 53d88157aa
84 changed files with 4739 additions and 2750 deletions

View File

@ -36,7 +36,7 @@ pub extern "C" fn nyash_future_await_h(arg0: i64) -> i64 {
}
let Some(fut) = fut_opt else { return 0; };
// Cooperative wait with scheduler polling and timeout
let max_ms: u64 = std::env::var("NYASH_AWAIT_MAX_MS").ok().and_then(|s| s.parse().ok()).unwrap_or(5000);
let max_ms: u64 = crate::config::env::await_max_ms();
let start = std::time::Instant::now();
while !fut.ready() {
crate::runtime::global_hooks::safepoint_and_poll();

View File

@ -158,7 +158,7 @@ pub(super) extern "C" fn nyash_console_birth_h() -> i64 {
// Minimal no-op checkpoints and barriers for reservation. They optionally trace when envs are set.
#[cfg(feature = "cranelift-jit")]
pub(super) extern "C" fn nyash_rt_checkpoint() -> i64 {
if std::env::var("NYASH_RUNTIME_CHECKPOINT_TRACE").ok().as_deref() == Some("1") {
if crate::config::env::runtime_checkpoint_trace() {
eprintln!("[nyash.rt.checkpoint] reached");
}
// Bridge to GC/scheduler if configured
@ -169,7 +169,7 @@ pub(super) extern "C" fn nyash_rt_checkpoint() -> i64 {
#[cfg(feature = "cranelift-jit")]
pub(super) extern "C" fn nyash_gc_barrier_write(handle_or_ptr: u64) -> i64 {
let _ = handle_or_ptr; // reserved; currently unused
if std::env::var("NYASH_GC_BARRIER_TRACE").ok().as_deref() == Some("1") {
if crate::config::env::gc_barrier_trace() {
eprintln!("[nyash.gc.barrier_write] h=0x{:x}", handle_or_ptr);
}
0
@ -457,6 +457,10 @@ fn nyash_plugin_invoke_name_common_i64(method: &str, argc: i64, a0: i64, a1: i64
}
}
if !appended { crate::runtime::plugin_ffi_common::encode::plugin_handle(&mut buf, p.inner.type_id, p.instance_id()); appended = true; }
} else {
// HostHandle for user/builtin boxes
let h = crate::runtime::host_handles::to_handle_arc(obj);
crate::runtime::plugin_ffi_common::encode::host_handle(&mut buf, h); appended = true;
}
}
}
@ -486,7 +490,9 @@ fn nyash_plugin_invoke_name_common_i64(method: &str, argc: i64, a0: i64, a1: i64
}
crate::runtime::plugin_ffi_common::encode::plugin_handle(&mut buf, p.inner.type_id, p.instance_id());
} else {
let s = b.to_string_box().value; crate::runtime::plugin_ffi_common::encode::string(&mut buf, &s)
// HostHandle fallback
let h = crate::runtime::host_handles::to_handle_arc(b.clone());
crate::runtime::plugin_ffi_common::encode::host_handle(&mut buf, h);
}
}
_ => {}