smokes: add curated LLVM runner; archive legacy smokes; PHI-off unified across Bridge/Builder; LLVM resolver tracing; minimal Throw lowering; config env getters; dev profile and root cleaner; docs updated; CI workflow runs curated LLVM (PHI-on/off)
This commit is contained in:
@ -1,25 +1,41 @@
|
||||
#![cfg(all(feature = "plugins", not(target_arch = "wasm32")))]
|
||||
use nyash_rust::{parser::NyashParser, mir::{MirCompiler, passes::method_id_inject::inject_method_ids, instruction::MirInstruction}};
|
||||
use nyash_rust::runtime::plugin_loader_v2::{init_global_loader_v2, get_global_loader_v2};
|
||||
use nyash_rust::runtime::box_registry::get_global_registry;
|
||||
use nyash_rust::runtime::plugin_loader_v2::{get_global_loader_v2, init_global_loader_v2};
|
||||
use nyash_rust::runtime::PluginConfig;
|
||||
use nyash_rust::{
|
||||
mir::{instruction::MirInstruction, passes::method_id_inject::inject_method_ids, MirCompiler},
|
||||
parser::NyashParser,
|
||||
};
|
||||
|
||||
fn try_init_plugins() -> bool {
|
||||
if !std::path::Path::new("nyash.toml").exists() { return false; }
|
||||
if let Err(e) = init_global_loader_v2("nyash.toml") { eprintln!("init failed: {:?}", e); return false; }
|
||||
if !std::path::Path::new("nyash.toml").exists() {
|
||||
return false;
|
||||
}
|
||||
if let Err(e) = init_global_loader_v2("nyash.toml") {
|
||||
eprintln!("init failed: {:?}", e);
|
||||
return false;
|
||||
}
|
||||
let loader = get_global_loader_v2();
|
||||
let loader = loader.read().unwrap();
|
||||
if let Some(conf) = &loader.config {
|
||||
let mut map = std::collections::HashMap::new();
|
||||
for (lib, def) in &conf.libraries { for b in &def.boxes { map.insert(b.clone(), lib.clone()); } }
|
||||
for (lib, def) in &conf.libraries {
|
||||
for b in &def.boxes {
|
||||
map.insert(b.clone(), lib.clone());
|
||||
}
|
||||
}
|
||||
get_global_registry().apply_plugin_config(&PluginConfig { plugins: map });
|
||||
true
|
||||
} else { false }
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn injects_method_id_for_filebox_open() {
|
||||
if !try_init_plugins() { return; }
|
||||
if !try_init_plugins() {
|
||||
return;
|
||||
}
|
||||
let code = r#"
|
||||
local f
|
||||
f = new FileBox()
|
||||
@ -34,11 +50,17 @@ f.open("/tmp/test.txt", "r")
|
||||
for func in module2.functions.values() {
|
||||
for block in func.blocks.values() {
|
||||
for inst in &block.instructions {
|
||||
if let MirInstruction::BoxCall { method, method_id, .. } = inst {
|
||||
if method == "open" { assert!(method_id.is_some(), "open missing method_id"); return; }
|
||||
if let MirInstruction::BoxCall {
|
||||
method, method_id, ..
|
||||
} = inst
|
||||
{
|
||||
if method == "open" {
|
||||
assert!(method_id.is_some(), "open missing method_id");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
panic!("FileBox.open not found");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user