Add object layout, object parsing, instruction layout

* Object layout and parsing are done in the vm::obj module
* Add MemCursor, a wrapper around the std::io::Cursor type for walking
  through VM memory
* Add vm::tick module for containing the Vm::tick() method
  implementation, since it's pretty big
* Instructions are now variable-sized, and are read lazily,
  one-at-a-time directly from memory.
* Add VM runtime error structure
* Probably some other stuff I forgot

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-02-03 17:56:32 -05:00
parent 47ee61ca0d
commit 214f0b8aed
12 changed files with 554 additions and 502 deletions

9
src/vm/error.rs Normal file
View File

@@ -0,0 +1,9 @@
use snafu::Snafu;
use crate::vm::vm::*;
#[derive(Snafu, Debug, Clone)]
pub enum VmError {
MemOutOfBounds { addr: Addr, }
}
pub type Result<T, E = VmError> = std::result::Result<T, E>;