Simplify the model of handling imported/unloaded symbol specializations

This commit is contained in:
Ayaz Hafiz 2022-12-13 12:20:31 -06:00
parent f08d9c9173
commit 02eec1f60c
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -4307,7 +4307,7 @@ pub fn with_hole<'a>(
variant_var,
assigned,
hole,
tag_name.clone(),
tag_name,
procs,
layout_cache,
args,
@ -8218,14 +8218,8 @@ fn specialize_symbol<'a>(
Err(e) => return_on_layout_error_help!(env, e, "specialize_symbol"),
};
if procs.is_imported_module_thunk(original) {
let layout = match raw {
RawFunctionLayout::ZeroArgumentThunk(layout) => layout,
RawFunctionLayout::Function(_, lambda_set, _) => {
Layout::LambdaSet(lambda_set)
}
};
match raw {
RawFunctionLayout::ZeroArgumentThunk(layout) => {
let raw = RawFunctionLayout::ZeroArgumentThunk(layout);
let top_level = ProcLayout::from_raw(
env.arena,
@ -8243,14 +8237,9 @@ fn specialize_symbol<'a>(
);
force_thunk(env, original, layout, assign_to, env.arena.alloc(result))
} else {
// Figure out the lambda set this top-level function is used in.
let lambda_set = match raw {
RawFunctionLayout::Function(_, lambda_set, _) => lambda_set,
RawFunctionLayout::ZeroArgumentThunk(_) => internal_error!(
"ZATs should have been covered in the previous branch"
),
};
}
RawFunctionLayout::Function(_, lambda_set, _) => {
debug_assert!(!procs.is_imported_module_thunk(original));
let lambda_name =
find_lambda_name(env, layout_cache, lambda_set, original, &[]);
@ -8274,7 +8263,6 @@ fn specialize_symbol<'a>(
layout_cache,
);
//let_empty_struct(assign_to, env.arena.alloc(result))
construct_closure_data(
env,
procs,
@ -8287,6 +8275,7 @@ fn specialize_symbol<'a>(
)
}
}
}
_ => {
// danger: a foreign symbol may not be specialized!