fix compile error

This commit is contained in:
able 2023-06-26 18:42:55 -05:00
parent 567871d18e
commit 06868b516f

View file

@ -1,25 +1,22 @@
use {
crate::host::TrapHandler,
alloc::vec::Vec,
hbvm::{validate::validate, vm::Vm},
};
use {crate::host::TrapHandler, alloc::vec::Vec, hbvm::vm::Vm};
pub struct Scheduler<'a> {
data: Vec<Vm<'a, TrapHandler>>,
}
impl Scheduler<'_> {
fn new_process(&mut self, program: Vec<u8>) {
#[allow(clippy::redundant_else)]
if let Err(e) = validate(&program) {
log::error!("Program validation error: {e:?}");
} else {
log::info!("valid program");
unsafe {
let mut vm = Vm::new_unchecked(&program, TrapHandler);
vm.memory.insert_test_page();
self.data.push(vm);
}
}
}
// fn new_process(&mut self, program: Vec<u8>) {
// let prog = program.clone();
// #[allow(clippy::redundant_else)]
// if let Err(e) = validate(&prog) {
// log::error!("Program validation error: {e:?}");
// } else {
// log::info!("valid program");
// unsafe {
// let mut vm = Vm::new_unchecked(&prog, TrapHandler);
// vm.memory.insert_test_page();
// self.data.push(vm);
// }
// }
// }
}