track f64 offsets in Literal (#1190)

This commit is contained in:
Mark Thom
2022-05-04 21:54:46 -06:00
parent 0f502fff84
commit 6030fae685
13 changed files with 163 additions and 71 deletions

View File

@@ -415,7 +415,7 @@ impl Machine {
Literal::Fixnum(n)
}
(HeapCellValueTag::F64, f) => {
Literal::Float(f)
Literal::Float(f.as_offset())
}
(HeapCellValueTag::Atom, (atom, arity)) => {
debug_assert_eq!(arity, 0);

View File

@@ -24,7 +24,7 @@ impl From<Literal> for HeapCellValue {
Literal::Rational(bigint_ptr) => {
typed_arena_ptr_as_cell!(bigint_ptr)
}
Literal::Float(f) => HeapCellValue::from(f),
Literal::Float(f) => HeapCellValue::from(f.as_ptr()),
Literal::String(s) => {
if s == atom!("") {
empty_list_as_cell!()
@@ -55,7 +55,7 @@ impl TryFrom<HeapCellValue> for Literal {
Ok(Literal::Fixnum(n))
}
(HeapCellValueTag::F64, f) => {
Ok(Literal::Float(f))
Ok(Literal::Float(f.as_offset()))
}
(HeapCellValueTag::Cons, cons_ptr) => {
match_untyped_arena_ptr!(cons_ptr,

View File

@@ -742,7 +742,7 @@ impl MachineState {
self.unify_rational(n, nx);
}
Ok(Term::Literal(_, Literal::Float(n))) => {
self.unify_f64(n, nx);
self.unify_f64(n.as_ptr(), nx);
}
Ok(Term::Literal(_, Literal::Integer(n))) => {
self.unify_big_int(n, nx);