feat(machine): reduce term allocations
* remove term from VBuiltin * and also means we don't need the useless wrapping Co-authored-by: Lucas Rosa <x@rvcas.dev>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use std::rc::Rc;
|
||||
|
||||
use crate::ast::{NamedDeBruijn, Term};
|
||||
use crate::ast::{Constant, NamedDeBruijn, Term};
|
||||
|
||||
use super::value::{Env, Value};
|
||||
|
||||
@@ -28,7 +28,9 @@ pub(super) fn value_as_term(value: Value) -> Rc<Term<NamedDeBruijn>> {
|
||||
match stack_frame {
|
||||
DischargeStep::DischargeValue(value) => match value {
|
||||
Value::Con(x) => arg_stack.push(Term::Constant(x.clone()).into()),
|
||||
Value::Builtin { term, .. } => arg_stack.push(term.clone()),
|
||||
Value::Builtin { .. } => {
|
||||
arg_stack.push(Term::Constant(Constant::Unit.into()).into())
|
||||
}
|
||||
Value::Delay(body, env) => {
|
||||
stack.push(DischargeStep::DischargeValueEnv(
|
||||
0,
|
||||
|
||||
@@ -24,7 +24,6 @@ pub enum Value {
|
||||
},
|
||||
Builtin {
|
||||
fun: DefaultFunction,
|
||||
term: Rc<Term<NamedDeBruijn>>,
|
||||
runtime: BuiltinRuntime,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user