more vm and alloc and intern

This commit is contained in:
nora 2021-12-31 14:09:06 +01:00
parent e58e6e3dc4
commit dc26b52bd2
8 changed files with 200 additions and 112 deletions

20
src/vm.rs Normal file
View file

@ -0,0 +1,20 @@
use crate::bytecode::FnBlock;
use crate::gc::RtAlloc;
type VmResult = Result<(), ()>;
pub fn execute<'bc>(bytecode: &'bc [FnBlock<'bc>], alloc: RtAlloc) -> Result<(), ()> {
let _vm = Vm {
blocks: bytecode,
current: bytecode.first().ok_or(())?,
alloc,
};
Ok(())
}
struct Vm<'bc> {
blocks: &'bc [FnBlock<'bc>],
current: &'bc FnBlock<'bc>,
alloc: RtAlloc,
}