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