Merge pull request #5569 from roc-lang/finally-trmc

tail recursion modulo cons
This commit is contained in:
Ayaz 2023-06-25 15:31:34 -05:00 committed by GitHub
commit 0edcd23657
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
79 changed files with 4544 additions and 2671 deletions

View file

@ -20,7 +20,8 @@ use roc_debug_flags::dbg_do;
#[cfg(debug_assertions)]
use roc_debug_flags::{
ROC_CHECK_MONO_IR, ROC_PRINT_IR_AFTER_DROP_SPECIALIZATION, ROC_PRINT_IR_AFTER_REFCOUNT,
ROC_PRINT_IR_AFTER_RESET_REUSE, ROC_PRINT_IR_AFTER_SPECIALIZATION, ROC_PRINT_LOAD_LOG,
ROC_PRINT_IR_AFTER_RESET_REUSE, ROC_PRINT_IR_AFTER_SPECIALIZATION, ROC_PRINT_IR_AFTER_TRMC,
ROC_PRINT_LOAD_LOG,
};
use roc_derive::SharedDerivedModule;
use roc_error_macros::internal_error;
@ -3104,6 +3105,16 @@ fn update<'a>(
let ident_ids = state.constrained_ident_ids.get_mut(&module_id).unwrap();
roc_mono::tail_recursion::apply_trmc(
arena,
&mut layout_interner,
module_id,
ident_ids,
&mut state.procedures,
);
debug_print_ir!(state, &layout_interner, ROC_PRINT_IR_AFTER_TRMC);
inc_dec::insert_inc_dec_operations(
arena,
&layout_interner,
@ -5832,7 +5843,7 @@ fn make_specializations<'a>(
);
let external_specializations_requested = procs.externals_we_need.clone();
let (procedures, restored_procs_base) = procs.get_specialized_procs_without_rc(&mut mono_env);
let (procedures, restored_procs_base) = procs.get_specialized_procs_without_rc();
// Turn `Bytes.Decode.IdentId(238)` into `Bytes.Decode.238`, we rely on this in mono tests
mono_env.home.register_debug_idents(mono_env.ident_ids);