use OffsetTableImpl without synchronization by default

This commit is contained in:
Mark Thom
2025-05-22 23:49:57 -07:00
committed by Mark Thom
parent 725def07cd
commit 1332611f83
28 changed files with 1005 additions and 990 deletions

View File

@@ -2,7 +2,6 @@
use crate::arena::*;
use crate::atom_table::*;
use crate::machine::machine_indices::CodeIndex;
use crate::offset_table::*;
use crate::parser::char_reader::*;
use crate::types::HeapCellValueTag;
@@ -698,17 +697,18 @@ impl Not for Fixnum {
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[derive(Debug, Copy, Clone)]
pub enum Literal {
Atom(Atom),
CodeIndex(CodeIndex),
CodeIndexOffset(CodeIndexOffset),
Fixnum(Fixnum),
Integer(TypedArenaPtr<Integer>),
Rational(TypedArenaPtr<Rational>),
Float(F64Offset),
F64Offset(F64Offset),
}
impl From<F64Ptr> for Literal {
/*
impl From<F64Ptr<'_>> for Literal {
#[inline(always)]
fn from(ptr: F64Ptr) -> Literal {
Literal::Float(ptr.as_offset())
@@ -721,14 +721,15 @@ impl fmt::Display for Literal {
Literal::Atom(ref atom) => {
write!(f, "{}", atom.flat_index())
}
Literal::CodeIndex(i) => write!(f, "{:?}", *i.as_ptr()),
Literal::CodeIndexOffset(i) => write!(f, "{}", *i),
Literal::Fixnum(n) => write!(f, "{}", n.get_num()),
Literal::Integer(ref n) => write!(f, "{}", n),
Literal::Rational(ref n) => write!(f, "{}", n),
Literal::Float(ref n) => write!(f, "{}", *n),
Literal::FloatOffset(ref n) => write!(f, "{}", *n),
}
}
}
*/
impl Literal {
pub fn as_atom(&self, atom_tbl: &Arc<AtomTable>) -> Option<Atom> {
@@ -874,7 +875,7 @@ impl Term {
pub(crate) fn unfold_by_str_once(term: &mut Term, s: Atom) -> Option<(Term, Term)> {
if let Term::Clause(_, ref name, ref mut subterms) = term {
if let Some(Term::Literal(_, Literal::CodeIndex(_))) = subterms.last() {
if let Some(Term::Literal(_, Literal::CodeIndexOffset(_))) = subterms.last() {
subterms.pop();
}