aot(core): EXE path green (return 7); migrate NyRT jit handles → runtime::host_handles; fix mir_call.py indent; workspace excludes for missing plugins; docs(phase-33) status update

This commit is contained in:
nyash-codex
2025-10-31 18:30:50 +09:00
parent c11803797a
commit 712b370013
15 changed files with 133 additions and 122 deletions

View File

@ -3,14 +3,14 @@
// size: (handle) -> i64
#[export_name = "nyash.map.size_h"]
pub extern "C" fn nyash_map_size_h(handle: i64) -> i64 {
use nyash_rust::jit::rt::handles;
use nyash_rust::runtime::host_handles as handles;
if std::env::var("NYASH_LLVM_MAP_DEBUG").ok().as_deref() == Some("1") {
eprintln!("[MAP] size_h(handle={})", handle);
}
if handle <= 0 {
return 0;
}
if let Some(obj) = handles::get(handle) {
if let Some(obj) = handles::get(handle as u64) {
if let Some(map) = obj
.as_any()
.downcast_ref::<nyash_rust::boxes::map_box::MapBox>()
@ -35,7 +35,7 @@ pub extern "C" fn nyash_map_size_h(handle: i64) -> i64 {
pub extern "C" fn nyash_map_get_h(handle: i64, key: i64) -> i64 {
use nyash_rust::{
box_trait::{IntegerBox, NyashBox},
jit::rt::handles,
runtime::host_handles as handles,
};
if std::env::var("NYASH_LLVM_MAP_DEBUG").ok().as_deref() == Some("1") {
eprintln!("[MAP] get_h(handle={}, key={})", handle, key);
@ -43,7 +43,7 @@ pub extern "C" fn nyash_map_get_h(handle: i64, key: i64) -> i64 {
if handle <= 0 {
return 0;
}
if let Some(obj) = handles::get(handle) {
if let Some(obj) = handles::get(handle as u64) {
if let Some(map) = obj
.as_any()
.downcast_ref::<nyash_rust::boxes::map_box::MapBox>()
@ -51,7 +51,7 @@ pub extern "C" fn nyash_map_get_h(handle: i64, key: i64) -> i64 {
let kbox: Box<dyn NyashBox> = Box::new(IntegerBox::new(key));
let v = map.get(kbox);
let arc: std::sync::Arc<dyn NyashBox> = std::sync::Arc::from(v);
let h = handles::to_handle(arc);
let h = handles::to_handle_arc(arc) as u64;
if std::env::var("NYASH_LLVM_MAP_DEBUG").ok().as_deref() == Some("1") {
eprintln!("[MAP] get_h => handle {}", h);
}
@ -66,18 +66,18 @@ pub extern "C" fn nyash_map_get_h(handle: i64, key: i64) -> i64 {
pub extern "C" fn nyash_map_get_hh(handle: i64, key_any: i64) -> i64 {
use nyash_rust::{
box_trait::{IntegerBox, NyashBox},
jit::rt::handles,
runtime::host_handles as handles,
};
if handle <= 0 {
return 0;
}
if let Some(obj) = handles::get(handle) {
if let Some(obj) = handles::get(handle as u64) {
if let Some(map) = obj
.as_any()
.downcast_ref::<nyash_rust::boxes::map_box::MapBox>()
{
let key_box: Box<dyn NyashBox> = if key_any > 0 {
if let Some(k) = handles::get(key_any) {
if let Some(k) = handles::get(key_any as u64) {
k.clone_box()
} else {
Box::new(IntegerBox::new(key_any))
@ -87,7 +87,7 @@ pub extern "C" fn nyash_map_get_hh(handle: i64, key_any: i64) -> i64 {
};
let v = map.get(key_box);
let arc: std::sync::Arc<dyn NyashBox> = std::sync::Arc::from(v);
let h = handles::to_handle(arc);
let h = handles::to_handle_arc(arc) as u64;
return h as i64;
}
}
@ -99,7 +99,7 @@ pub extern "C" fn nyash_map_get_hh(handle: i64, key_any: i64) -> i64 {
pub extern "C" fn nyash_map_set_h(handle: i64, key: i64, val: i64) -> i64 {
use nyash_rust::{
box_trait::{IntegerBox, NyashBox},
jit::rt::handles,
runtime::host_handles as handles,
};
if std::env::var("NYASH_LLVM_MAP_DEBUG").ok().as_deref() == Some("1") {
eprintln!("[MAP] set_h(handle={}, key={}, val={})", handle, key, val);
@ -107,14 +107,14 @@ pub extern "C" fn nyash_map_set_h(handle: i64, key: i64, val: i64) -> i64 {
if handle <= 0 {
return 0;
}
if let Some(obj) = handles::get(handle) {
if let Some(obj) = handles::get(handle as u64) {
if let Some(map) = obj
.as_any()
.downcast_ref::<nyash_rust::boxes::map_box::MapBox>()
{
let kbox: Box<dyn NyashBox> = Box::new(IntegerBox::new(key));
let vbox: Box<dyn NyashBox> = if val > 0 {
if let Some(o) = handles::get(val) {
if let Some(o) = handles::get(val as u64) {
o.clone_box()
} else {
Box::new(IntegerBox::new(val))
@ -143,18 +143,18 @@ pub extern "C" fn nyash_map_set_h(handle: i64, key: i64, val: i64) -> i64 {
pub extern "C" fn nyash_map_set_hh(handle: i64, key_any: i64, val_any: i64) -> i64 {
use nyash_rust::{
box_trait::{IntegerBox, NyashBox},
jit::rt::handles,
runtime::host_handles as handles,
};
if handle <= 0 {
return 0;
}
if let Some(obj) = handles::get(handle) {
if let Some(obj) = handles::get(handle as u64) {
if let Some(map) = obj
.as_any()
.downcast_ref::<nyash_rust::boxes::map_box::MapBox>()
{
let kbox: Box<dyn NyashBox> = if key_any > 0 {
if let Some(k) = handles::get(key_any) {
if let Some(k) = handles::get(key_any as u64) {
k.clone_box()
} else {
Box::new(IntegerBox::new(key_any))
@ -163,7 +163,7 @@ pub extern "C" fn nyash_map_set_hh(handle: i64, key_any: i64, val_any: i64) -> i
Box::new(IntegerBox::new(key_any))
};
let vbox: Box<dyn NyashBox> = if val_any > 0 {
if let Some(v) = handles::get(val_any) {
if let Some(v) = handles::get(val_any as u64) {
v.clone_box()
} else {
Box::new(IntegerBox::new(val_any))
@ -183,18 +183,18 @@ pub extern "C" fn nyash_map_set_hh(handle: i64, key_any: i64, val_any: i64) -> i
pub extern "C" fn nyash_map_has_hh(handle: i64, key_any: i64) -> i64 {
use nyash_rust::{
box_trait::{BoolBox, IntegerBox, NyashBox},
jit::rt::handles,
runtime::host_handles as handles,
};
if handle <= 0 {
return 0;
}
if let Some(obj) = handles::get(handle) {
if let Some(obj) = handles::get(handle as u64) {
if let Some(map) = obj
.as_any()
.downcast_ref::<nyash_rust::boxes::map_box::MapBox>()
{
let kbox: Box<dyn NyashBox> = if key_any > 0 {
if let Some(k) = handles::get(key_any) {
if let Some(k) = handles::get(key_any as u64) {
k.clone_box()
} else {
Box::new(IntegerBox::new(key_any))
@ -214,11 +214,11 @@ pub extern "C" fn nyash_map_has_hh(handle: i64, key_any: i64) -> i64 {
// has_h: (map_handle, key_i64) -> i64 (0/1)
#[export_name = "nyash.map.has_h"]
pub extern "C" fn nyash_map_has_h(handle: i64, key: i64) -> i64 {
use nyash_rust::{box_trait::IntegerBox, jit::rt::handles};
use nyash_rust::{box_trait::IntegerBox, runtime::host_handles as handles};
if handle <= 0 {
return 0;
}
if let Some(obj) = handles::get(handle) {
if let Some(obj) = handles::get(handle as u64) {
if let Some(map) = obj
.as_any()
.downcast_ref::<nyash_rust::boxes::map_box::MapBox>()