mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 23:31:12 +00:00
Merge remote-tracking branch 'origin/trunk' into builtins-in-roc
This commit is contained in:
commit
bd31503855
182 changed files with 10241 additions and 3799 deletions
|
@ -657,35 +657,43 @@ pub fn construct_optimization_passes<'a>(
|
|||
OptLevel::Development | OptLevel::Normal => {
|
||||
pmb.set_optimization_level(OptimizationLevel::None);
|
||||
}
|
||||
OptLevel::Size => {
|
||||
pmb.set_optimization_level(OptimizationLevel::Default);
|
||||
// TODO: For some usecase, like embedded, it is useful to expose this and tune it.
|
||||
pmb.set_inliner_with_threshold(50);
|
||||
}
|
||||
OptLevel::Optimize => {
|
||||
pmb.set_optimization_level(OptimizationLevel::Aggressive);
|
||||
// this threshold seems to do what we want
|
||||
pmb.set_inliner_with_threshold(275);
|
||||
|
||||
// TODO figure out which of these actually help
|
||||
|
||||
// function passes
|
||||
|
||||
fpm.add_cfg_simplification_pass();
|
||||
mpm.add_cfg_simplification_pass();
|
||||
|
||||
fpm.add_jump_threading_pass();
|
||||
mpm.add_jump_threading_pass();
|
||||
|
||||
fpm.add_memcpy_optimize_pass(); // this one is very important
|
||||
|
||||
fpm.add_licm_pass();
|
||||
|
||||
// turn invoke into call
|
||||
mpm.add_prune_eh_pass();
|
||||
|
||||
// remove unused global values (often the `_wrapper` can be removed)
|
||||
mpm.add_global_dce_pass();
|
||||
|
||||
mpm.add_function_inlining_pass();
|
||||
}
|
||||
}
|
||||
|
||||
// Add optimization passes for Size and Optimize.
|
||||
if matches!(opt_level, OptLevel::Size | OptLevel::Optimize) {
|
||||
// TODO figure out which of these actually help
|
||||
|
||||
// function passes
|
||||
|
||||
fpm.add_cfg_simplification_pass();
|
||||
mpm.add_cfg_simplification_pass();
|
||||
|
||||
fpm.add_jump_threading_pass();
|
||||
mpm.add_jump_threading_pass();
|
||||
|
||||
fpm.add_memcpy_optimize_pass(); // this one is very important
|
||||
|
||||
fpm.add_licm_pass();
|
||||
|
||||
// turn invoke into call
|
||||
mpm.add_prune_eh_pass();
|
||||
|
||||
// remove unused global values (often the `_wrapper` can be removed)
|
||||
mpm.add_global_dce_pass();
|
||||
|
||||
mpm.add_function_inlining_pass();
|
||||
}
|
||||
|
||||
pmb.populate_module_pass_manager(&mpm);
|
||||
pmb.populate_function_pass_manager(&fpm);
|
||||
|
||||
|
@ -3611,7 +3619,12 @@ fn expose_function_to_host_help_c_abi_v2<'a, 'ctx, 'env>(
|
|||
_ => (¶ms[..], ¶m_types[..]),
|
||||
};
|
||||
|
||||
debug_assert_eq!(params.len(), param_types.len());
|
||||
debug_assert!(
|
||||
params.len() == param_types.len(),
|
||||
"when exposing a function to the host, params.len() was {}, but param_types.len() was {}",
|
||||
params.len(),
|
||||
param_types.len()
|
||||
);
|
||||
|
||||
let it = params.iter().zip(param_types).map(|(arg, fastcc_type)| {
|
||||
let arg_type = arg.get_type();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue