rewrite VM to support reentry (WIP)

This commit is contained in:
2026-03-22 16:41:13 +08:00
parent b3f1f4f6ff
commit 6567ed4058
18 changed files with 1728 additions and 3315 deletions
+6 -7
View File
@@ -40,19 +40,18 @@ struct ExprSource {
file: Option<PathBuf>,
}
fn run_compile(_runtime: &mut Runtime, src: ExprSource, _silent: bool) -> Result<()> {
let _src = if let Some(expr) = src.expr {
fn run_compile(runtime: &mut Runtime, src: ExprSource, silent: bool) -> Result<()> {
let src = if let Some(expr) = src.expr {
Source::new_eval(expr)?
} else if let Some(file) = src.file {
Source::new_file(file)?
} else {
unreachable!()
};
todo!()
/* match runtime.compile_bytecode(src) {
Ok(compiled) => {
match runtime.compile_bytecode(src) {
Ok(ip) => {
if !silent {
println!("{}", runtime.disassemble_colored(&compiled));
println!("{}", runtime.disassemble_colored(ip));
}
}
Err(err) => {
@@ -60,7 +59,7 @@ fn run_compile(_runtime: &mut Runtime, src: ExprSource, _silent: bool) -> Result
exit(1);
}
};
Ok(()) */
Ok(())
}
fn run_eval(runtime: &mut Runtime, src: ExprSource) -> Result<()> {