@@ -1,6 +1,6 @@
|
||||
use crate::{obj::prelude::*, vm::inst::Inst};
|
||||
use std::fmt::{self, Debug, Formatter};
|
||||
use std::{collections::BTreeMap, sync::Arc};
|
||||
use std::fmt::{self, Formatter, Debug};
|
||||
|
||||
pub type FrameBindings = BTreeMap<usize, ObjRef>;
|
||||
|
||||
@@ -53,8 +53,18 @@ pub struct UserFrame {
|
||||
}
|
||||
|
||||
impl UserFrame {
|
||||
pub fn new(callee: ObjRef, bindings: FrameBindings, last_pc: usize, code: Arc<Vec<Inst>>) -> Self {
|
||||
Self { callee, bindings, last_pc, code, }
|
||||
pub fn new(
|
||||
callee: ObjRef,
|
||||
bindings: FrameBindings,
|
||||
last_pc: usize,
|
||||
code: Arc<Vec<Inst>>,
|
||||
) -> Self {
|
||||
Self {
|
||||
callee,
|
||||
bindings,
|
||||
last_pc,
|
||||
code,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn bindings(&self) -> &FrameBindings {
|
||||
@@ -86,7 +96,11 @@ pub struct NativeFrame {
|
||||
|
||||
impl NativeFrame {
|
||||
pub fn new(callee: ObjRef, fun_ptr: NativeFunPtr, args: Vec<ObjRef>) -> Self {
|
||||
Self { callee, fun_ptr, args }
|
||||
Self {
|
||||
callee,
|
||||
fun_ptr,
|
||||
args,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fun_ptr(&self) -> &NativeFunPtr {
|
||||
@@ -105,7 +119,10 @@ impl NativeFrame {
|
||||
impl Debug for NativeFrame {
|
||||
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("NativeFrame")
|
||||
.field("fun_ptr", &format!("{:#x}", &self.fun_ptr as *const _ as usize))
|
||||
.field(
|
||||
"fun_ptr",
|
||||
&format!("{:#x}", &self.fun_ptr as *const _ as usize),
|
||||
)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user