First pass at specialized erased

This commit is contained in:
Ayaz Hafiz 2023-06-27 15:49:14 -05:00
parent 2cb2e37fd7
commit fbad6bcb90
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
3 changed files with 42 additions and 26 deletions

View file

@ -1396,13 +1396,23 @@ impl<'a> LambdaName<'a> {
}
/// Closure data for a function
enum ClosureDataKind<'a> {
#[derive(Debug, Clone, Copy)]
pub(crate) enum ClosureDataKind<'a> {
/// The function is compiled with lambda sets.
LambdaSet(LambdaSet<'a>),
/// The function is compiled as type-erased.
Erased,
}
impl<'a> ClosureDataKind<'a> {
pub fn data_layout(&self) -> InLayout<'a> {
match self {
Self::LambdaSet(lambda_set) => lambda_set.full_layout,
Self::Erased => Layout::OPAQUE_PTR,
}
}
}
fn build_function_closure_data<'a>(
env: &mut Env<'a, '_>,
args: VariableSubsSlice,