feat(jit): JIT Strictモード実装とプラグイン経路の安定化
- InvokePolicy/Observe導入でLowererの分岐をスリム化 - ArrayBox/MapBox/StringBoxのプラグイン経路統一 - 特殊コメント機能(@jit-debug, @plugin-builtins, @jit-strict)実装 - 型ヒント伝搬パス(TypeHintPass)を独立モジュール化 - VM→Plugin引数整合の安定化(I64統一、IntegerBox自動プリミティブ化) - StringBoxのpost-birth初期化(空文字列セグフォルト修正) - JIT観測サンプル追加(Array/Map/String) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -187,6 +187,27 @@ pub(super) extern "C" fn nyash_any_length_h(handle: u64) -> i64 {
|
||||
if let Some(sb) = obj.as_any().downcast_ref::<crate::box_trait::StringBox>() {
|
||||
return sb.value.len() as i64;
|
||||
}
|
||||
} else {
|
||||
// Fallback: some call sites may still pass a parameter index instead of a handle (legacy path)
|
||||
// Try to interpret small values as param index and read from legacy VM args
|
||||
if handle <= 16 {
|
||||
let idx = handle as usize;
|
||||
let val = crate::jit::rt::with_legacy_vm_args(|args| args.get(idx).cloned());
|
||||
if let Some(v) = val {
|
||||
match v {
|
||||
crate::backend::vm::VMValue::BoxRef(b) => {
|
||||
if let Some(arr) = b.as_any().downcast_ref::<crate::boxes::array::ArrayBox>() {
|
||||
if let Some(ib) = arr.length().as_any().downcast_ref::<crate::box_trait::IntegerBox>() { return ib.value; }
|
||||
}
|
||||
if let Some(sb) = b.as_any().downcast_ref::<crate::box_trait::StringBox>() {
|
||||
return sb.value.len() as i64;
|
||||
}
|
||||
}
|
||||
crate::backend::vm::VMValue::String(s) => { return s.len() as i64; }
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user