Phase 21.2 Complete: VM Adapter正規実装 + devブリッジ完全撤去
## 🎉 Phase 21.2完全達成 ### ✅ 実装完了 - VM static box 永続化(singleton infrastructure) - devブリッジ完全撤去(adapter_dev.rs削除、by-name dispatch削除) - .hako正規実装(MirCallV1Handler, AbiAdapterRegistry等) - text-merge経路完全動作 - 全phase2120 adapter reps PASS(7テスト) ### 🐛 バグ修正 1. strip_local_decl修正 - トップレベルのみlocal削除、メソッド内は保持 - src/runner/modes/common_util/hako.rs:29 2. static box フィールド永続化 - MirInterpreter singleton storage実装 - me parameter binding修正(1:1マッピング) - getField/setField string→singleton解決 - src/backend/mir_interpreter/{mod,exec,handlers/boxes_object_fields}.rs 3. Map.len alias rc=0修正 - [map/missing]パターン検出でnull扱い(4箇所) - lang/src/vm/boxes/mir_call_v1_handler.hako:91-93,131-133,151-153,199-201 ### 📁 主要変更ファイル #### Rust(VM Runtime) - src/backend/mir_interpreter/mod.rs - static box singleton storage - src/backend/mir_interpreter/exec.rs - parameter binding fix - src/backend/mir_interpreter/handlers/boxes_object_fields.rs - singleton resolution - src/backend/mir_interpreter/handlers/calls.rs - dev bridge removal - src/backend/mir_interpreter/utils/mod.rs - adapter_dev module removal - src/backend/mir_interpreter/utils/adapter_dev.rs - DELETED (7555 bytes) - src/runner/modes/vm.rs - static box declaration collection - src/runner/modes/common_util/hako.rs - strip_local_decl fix - src/instance_v2.rs - Clone implementation #### Hako (.hako実装) - lang/src/vm/boxes/mir_call_v1_handler.hako - [map/missing] detection - lang/src/vm/boxes/abi_adapter_registry.hako - NEW (adapter registry) - lang/src/vm/helpers/method_alias_policy.hako - method alias support #### テスト - tools/smokes/v2/profiles/quick/core/phase2120/s3_vm_adapter_*.sh - 7 new tests ### 🎯 テスト結果 ``` ✅ s3_vm_adapter_array_len_canary_vm.sh ✅ s3_vm_adapter_array_len_per_recv_canary_vm.sh ✅ s3_vm_adapter_array_length_alias_canary_vm.sh ✅ s3_vm_adapter_array_size_alias_canary_vm.sh ✅ s3_vm_adapter_map_len_alias_state_canary_vm.sh ✅ s3_vm_adapter_map_length_alias_state_canary_vm.sh ✅ s3_vm_adapter_map_size_struct_canary_vm.sh ``` 環境フラグ: HAKO_ABI_ADAPTER=1 HAKO_ABI_ADAPTER_DEV=0 ### 🏆 設計品質 - ✅ ハードコード禁止(AGENTS.md 5.1)完全準拠 - ✅ 構造的・一般化設計(特定Box名のif分岐なし) - ✅ 後方互換性保持(既存コード破壊ゼロ) - ✅ text-merge経路(.hako依存関係正しくマージ) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -228,6 +228,52 @@ pub extern "C" fn nyash_box_from_i64(val: i64) -> i64 {
|
||||
handles::to_handle_arc(arc) as i64
|
||||
}
|
||||
|
||||
// integer.get_h(handle) -> i64
|
||||
// Extract IntegerBox value from a handle. Returns 0 if handle is invalid or not an IntegerBox.
|
||||
#[export_name = "nyash.integer.get_h"]
|
||||
pub extern "C" fn nyash_integer_get_h_export(h: i64) -> i64 {
|
||||
use nyash_rust::{box_trait::IntegerBox, runtime::host_handles as handles};
|
||||
if h <= 0 {
|
||||
return 0;
|
||||
}
|
||||
if let Some(obj) = handles::get(h as u64) {
|
||||
if let Some(ib) = obj.as_any().downcast_ref::<IntegerBox>() {
|
||||
return ib.value;
|
||||
}
|
||||
}
|
||||
0
|
||||
}
|
||||
|
||||
// bool.get_h(handle) -> i64 (0/1)
|
||||
#[export_name = "nyash.bool.get_h"]
|
||||
pub extern "C" fn nyash_bool_get_h_export(h: i64) -> i64 {
|
||||
use nyash_rust::{box_trait::BoolBox, runtime::host_handles as handles};
|
||||
if h <= 0 {
|
||||
return 0;
|
||||
}
|
||||
if let Some(obj) = handles::get(h as u64) {
|
||||
if let Some(bb) = obj.as_any().downcast_ref::<BoolBox>() {
|
||||
return if bb.value { 1 } else { 0 };
|
||||
}
|
||||
}
|
||||
0
|
||||
}
|
||||
|
||||
// float.get_bits_h(handle) -> i64 (f64 bits)
|
||||
#[export_name = "nyash.float.get_bits_h"]
|
||||
pub extern "C" fn nyash_float_get_bits_h_export(h: i64) -> i64 {
|
||||
use nyash_rust::{boxes::FloatBox, runtime::host_handles as handles};
|
||||
if h <= 0 {
|
||||
return 0;
|
||||
}
|
||||
if let Some(obj) = handles::get(h as u64) {
|
||||
if let Some(fb) = obj.as_any().downcast_ref::<FloatBox>() {
|
||||
return fb.value.to_bits() as i64;
|
||||
}
|
||||
}
|
||||
0
|
||||
}
|
||||
|
||||
// env.box.new(type_name: *const i8) -> handle (i64)
|
||||
// Minimal shim for Core-13 pure AOT: constructs Box via registry by name (no args)
|
||||
#[export_name = "nyash.env.box.new"]
|
||||
|
||||
Reference in New Issue
Block a user