transition to reference counted constants

This commit is contained in:
Mark Thom
2018-01-09 22:38:17 -07:00
parent 9b225a0a56
commit 848068c734
10 changed files with 215 additions and 220 deletions

View File

@@ -2,6 +2,7 @@ use prolog::ast::*;
use std::collections::{HashMap, VecDeque};
use std::hash::Hash;
use std::rc::Rc;
#[derive(Clone, Copy)]
enum IntIndex {
@@ -11,7 +12,7 @@ enum IntIndex {
pub struct CodeOffsets {
pub constants: HashMap<Constant, ThirdLevelIndex>,
pub lists: ThirdLevelIndex,
pub structures: HashMap<(Atom, usize), ThirdLevelIndex>
pub structures: HashMap<(Rc<Atom>, usize), ThirdLevelIndex>
}
impl CodeOffsets {
@@ -144,7 +145,8 @@ impl CodeOffsets {
}
}
fn switch_on_structure(str_ind: HashMap<(Atom, usize), ThirdLevelIndex>, prelude: &mut CodeDeque)
fn switch_on_structure(str_ind: HashMap<(Rc<Atom>, usize), ThirdLevelIndex>,
prelude: &mut CodeDeque)
-> IntIndex
{
let str_ind = Self::second_level_index(str_ind, prelude);