feat: use hashbrown

This commit is contained in:
2025-05-17 19:45:41 +08:00
parent fb14027845
commit 7b55a15281
12 changed files with 89 additions and 34 deletions

View File

@@ -1,7 +1,6 @@
use hashbrown::HashMap;
use std::rc::Rc;
use rpds::HashTrieMap;
use crate::ty::internal::{AttrSet, Const, PrimOp, Value};
use crate::vm::{Env, VM};
@@ -43,14 +42,14 @@ pub fn env<'vm>(vm: &'vm VM) -> Env<'vm> {
}),
];
let mut map = HashTrieMap::new();
let mut map = HashMap::new();
for primop in primops {
let primop = Rc::new(primop);
env.insert(
vm.new_sym(format!("__{}", primop.name)),
Value::PrimOp(primop.clone()),
);
map.insert_mut(vm.new_sym(primop.name), Value::PrimOp(primop));
map.insert(vm.new_sym(primop.name), Value::PrimOp(primop));
}
let attrs: Rc<_> = AttrSet::from_inner(map).into();
let mut builtins = Value::AttrSet(attrs);