Apply ChatGPT's FileBox method_id fixes and add build scripts

- Add plugin host initialization for LLVM mode (fixes method_id injection)
- Add FileBox method_id injection test
- Enhance MIR14 stability test
- Add warning for Mock LLVM implementation
- Create build scripts for JIT/LLVM with proper settings (24 threads, timeout)
- Update CLAUDE.md with build instructions and FileBox test results

Note: FileBox file I/O still not working in LLVM execution (separate issue)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Selfhosting Dev
2025-09-10 20:56:14 +09:00
parent 92bbfd90bc
commit 7fc5fef5cc
7 changed files with 119 additions and 3 deletions

View File

@ -71,6 +71,9 @@ impl LLVMCompiler {
) -> Result<Box<dyn NyashBox>, String> {
// Mock implementation - interprets MIR instructions to simulate execution
eprintln!("⚠️⚠️⚠️ WARNING: Using MOCK LLVM Implementation! ⚠️⚠️⚠️");
eprintln!("⚠️ This is NOT real LLVM execution!");
eprintln!("⚠️ Build with --features llvm for real compilation!");
println!("🚀 Mock LLVM Compile & Execute (MIR Interpreter Mode):");
// 1. Mock object file generation
@ -1445,6 +1448,20 @@ impl LLVMCompiler {
};
self.values.insert(*dst, Box::new(IntegerBox::new(res)));
}
I::ExternCall { dst, iface_name, method_name, args, .. } => {
if iface_name == "env.console" {
if let Some(arg0) = args.get(0).and_then(|v| self.values.get(v)) {
let msg = arg0.to_string_box().value;
match method_name.as_str() {
"log" => println!("{}", msg),
"warn" => eprintln!("[warn] {}", msg),
"error" => eprintln!("[error] {}", msg),
_ => {}
}
}
if let Some(d) = dst { self.values.insert(*d, Box::new(IntegerBox::new(0))); }
}
}
I::Return { value } => {
if let Some(v) = value { return self.values.get(v).map(|b| b.clone_box()).ok_or_else(|| format!("return %{} missing", v.0)); }
return Ok(Box::new(IntegerBox::new(0)));