docs/ci: selfhost bootstrap/exe-first workflows; add ny-llvmc scaffolding + JSON v0 schema validation; plan: unify to Nyash ABI v2 (no backwards compat)

This commit is contained in:
Selfhosting Dev
2025-09-17 20:33:19 +09:00
parent a5054a271b
commit 4ea3ca2685
56 changed files with 2275 additions and 1623 deletions

35
src/runtime/gc_trace.rs Normal file
View File

@ -0,0 +1,35 @@
//! Minimal GC tracing helpers (skeleton)
//!
//! Downcast-based child edge enumeration for builtin containers.
//! This is a non-invasive helper to support diagnostics and future collectors.
use std::sync::Arc;
use crate::box_trait::NyashBox;
/// Visit child boxes of a given object and invoke `visit(child)` for each.
/// This function recognizes builtin containers (ArrayBox/MapBox) and is a no-op otherwise.
pub fn trace_children(obj: &dyn NyashBox, visit: &mut dyn FnMut(Arc<dyn NyashBox>)) {
// ArrayBox
if let Some(arr) = obj.as_any().downcast_ref::<crate::boxes::array::ArrayBox>() {
if let Ok(items) = arr.items.read() {
for it in items.iter() {
// Convert Box<dyn NyashBox> to Arc<dyn NyashBox>
let arc: Arc<dyn NyashBox> = Arc::from(it.clone_box());
visit(arc);
}
}
return;
}
// MapBox
if let Some(map) = obj.as_any().downcast_ref::<crate::boxes::map_box::MapBox>() {
if let Ok(data) = map.get_data().read() {
for (_k, v) in data.iter() {
let arc: Arc<dyn NyashBox> = Arc::from(v.clone_box());
visit(arc);
}
}
return;
}
}