Compare commits
1 commit
main
...
just-print
Author | SHA1 | Date | |
---|---|---|---|
|
09e533f768 |
3 changed files with 31 additions and 0 deletions
20
crates/fogtix-vm/src/just_print.rs
Normal file
20
crates/fogtix-vm/src/just_print.rs
Normal file
|
@ -0,0 +1,20 @@
|
|||
use crate::{InstrPtr, Origin, StackEntValue};
|
||||
use fogtix_bytecode::{Atom, Pointer};
|
||||
use once_cell::sync::Lazy;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct JpOrigin;
|
||||
impl Origin for JpOrigin {
|
||||
fn call(&self, p: &Pointer, a: &Atom, stack: &mut Vec<StackEntValue>) -> InstrPtr {
|
||||
println!(
|
||||
"({:x}, {:x}), ({:x}, {:x}) {:x?}",
|
||||
p.hmac, p.payload, a.0, a.1, stack
|
||||
);
|
||||
(Arc::clone(&crate::noop::NOOP_MODULE), 0)
|
||||
}
|
||||
fn incr_refcount(&self, _p: &Pointer) {}
|
||||
fn decr_refcount(&self, _p: &Pointer) {}
|
||||
}
|
||||
|
||||
pub static JP_ORIGIN: Lazy<Arc<dyn Origin>> = Lazy::new(|| Arc::new(JpOrigin));
|
|
@ -4,6 +4,8 @@ use std::sync::Arc;
|
|||
|
||||
mod noop;
|
||||
use noop::NOOP_ORIGIN;
|
||||
mod just_print;
|
||||
use just_print::JP_ORIGIN;
|
||||
|
||||
pub struct Module {
|
||||
h: readfilez::FileHandle,
|
||||
|
@ -371,5 +373,14 @@ fn main() {
|
|||
instrp: (main_mod, 0),
|
||||
};
|
||||
|
||||
prc.stack.push(StackEntValue::Pointer(WrappedPointer {
|
||||
orig: Arc::clone(&*JP_ORIGIN),
|
||||
p: Pointer {
|
||||
hmac: 0,
|
||||
payload: 0,
|
||||
},
|
||||
_h: PhantomData,
|
||||
}));
|
||||
|
||||
prc.run();
|
||||
}
|
||||
|
|
BIN
docs/jpex.fgtxo
Normal file
BIN
docs/jpex.fgtxo
Normal file
Binary file not shown.
Loading…
Reference in a new issue