fix(vm): trivial errors found during initial testing
This commit is contained in:
parent
a7c2068b01
commit
bc96f9f130
|
@ -1,6 +1,5 @@
|
|||
use fogtix_bytecode::{Atom, Parse, Pointer, Value as BcValue};
|
||||
use std::marker::PhantomData;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
mod noop;
|
||||
|
@ -65,6 +64,7 @@ impl Process {
|
|||
use fogtix_bytecode::consts::{AtomOp, MathBinOp};
|
||||
use fogtix_bytecode::Instr;
|
||||
let previptr = self.instrp.1;
|
||||
tracing::trace!("previptr = {}", previptr);
|
||||
let nxti_arr = match self.instrp.0.h.get(previptr..) {
|
||||
None => {
|
||||
tracing::error!(
|
||||
|
@ -86,7 +86,7 @@ impl Process {
|
|||
}
|
||||
Ok(x) => x,
|
||||
};
|
||||
self.instrp.1 += nxtiptr.len() - nxti_arr.len();
|
||||
self.instrp.1 += nxti_arr.len() - nxtiptr.len();
|
||||
match nxti {
|
||||
Instr::Label => {}
|
||||
Instr::CallRemote(atom, arity) => {
|
||||
|
@ -196,7 +196,7 @@ impl Process {
|
|||
Instr::Return => match self.callstack.pop() {
|
||||
Some(x) => self.instrp = x,
|
||||
None => {
|
||||
tracing::error!("return called on empty callstack @ {}", previptr);
|
||||
//tracing::error!("return called on empty callstack @ {}", previptr);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
@ -338,13 +338,14 @@ fn main() {
|
|||
Arg::new("main")
|
||||
.short('m')
|
||||
.help("the module whose entry point should be used")
|
||||
.takes_value(true)
|
||||
.required(true),
|
||||
)
|
||||
.get_matches();
|
||||
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
let main_mod_path = matches.get_one::<PathBuf>("main").unwrap();
|
||||
let main_mod_path = matches.get_one::<String>("main").unwrap();
|
||||
|
||||
let main_mod = Arc::new(Module {
|
||||
h: readfilez::read_from_file(std::fs::File::open(&main_mod_path))
|
||||
|
|
Loading…
Reference in a new issue