Box LoadStatePayload when storing it in the heap
This commit is contained in:
@@ -1098,7 +1098,7 @@ impl Machine {
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn push_load_state_payload(&mut self) {
|
||||
let payload = LoadStatePayload::new(self);
|
||||
let payload = Box::new(LoadStatePayload::new(self));
|
||||
let addr = Addr::LoadStatePayload(
|
||||
self.machine_st
|
||||
.heap
|
||||
@@ -1171,7 +1171,8 @@ impl Machine {
|
||||
) {
|
||||
match result {
|
||||
Ok(payload) => {
|
||||
self.machine_st.heap[evacuable_h] = HeapCellValue::LoadStatePayload(payload);
|
||||
self.machine_st.heap[evacuable_h] =
|
||||
HeapCellValue::LoadStatePayload(Box::new(payload));
|
||||
}
|
||||
Err(e) => {
|
||||
self.throw_session_error(e, (clause_name!("load"), 1));
|
||||
@@ -1785,7 +1786,7 @@ impl<'a> Loader<'a, LiveTermStream> {
|
||||
|
||||
pub(super) fn from_load_state_payload(
|
||||
wam: &'a mut Machine,
|
||||
mut payload: LoadStatePayload,
|
||||
mut payload: Box<LoadStatePayload>,
|
||||
) -> Self {
|
||||
Loader {
|
||||
term_stream: mem::replace(
|
||||
|
||||
@@ -311,7 +311,7 @@ pub enum HeapCellValue {
|
||||
Atom(ClauseName, Option<SharedOpDesc>),
|
||||
DBRef(DBRef),
|
||||
Integer(Rc<Integer>),
|
||||
LoadStatePayload(LoadStatePayload),
|
||||
LoadStatePayload(Box<LoadStatePayload>),
|
||||
NamedStr(usize, ClauseName, Option<SharedOpDesc>), // arity, name, precedence/Specifier if it has one.
|
||||
Rational(Rc<Rational>),
|
||||
PartialString(PartialString, bool), // the partial string, a bool indicating whether it came from a Constant.
|
||||
@@ -324,10 +324,10 @@ impl HeapCellValue {
|
||||
pub fn as_addr(&self, focus: usize) -> Addr {
|
||||
match self {
|
||||
HeapCellValue::Addr(ref a) => *a,
|
||||
HeapCellValue::Atom(..)
|
||||
| HeapCellValue::DBRef(..)
|
||||
| HeapCellValue::Integer(..)
|
||||
| HeapCellValue::Rational(..) => Addr::Con(focus),
|
||||
HeapCellValue::Atom(..) |
|
||||
HeapCellValue::DBRef(..) |
|
||||
HeapCellValue::Integer(..) |
|
||||
HeapCellValue::Rational(..) => Addr::Con(focus),
|
||||
HeapCellValue::LoadStatePayload(_) => Addr::LoadStatePayload(focus),
|
||||
HeapCellValue::NamedStr(_, _, _) => Addr::Str(focus),
|
||||
HeapCellValue::PartialString(..) => Addr::PStrLocation(focus, 0),
|
||||
|
||||
Reference in New Issue
Block a user