mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
Always start off with an empty cache
Adding a cache layer can only be done with a snapshot and rollback. This is necessary to prevent extra variables just lying around on the toplevel of the layout cache.
This commit is contained in:
parent
1e22a2bbcd
commit
a16ea95a04
2 changed files with 6 additions and 4 deletions
|
@ -5731,6 +5731,8 @@ fn build_pending_specializations<'a>(
|
|||
derived_module: &derived_module,
|
||||
};
|
||||
|
||||
let layout_cache_snapshot = layout_cache.snapshot();
|
||||
|
||||
// Add modules' decls to Procs
|
||||
for index in 0..declarations.len() {
|
||||
use roc_can::expr::DeclarationTag::*;
|
||||
|
@ -6108,6 +6110,8 @@ fn build_pending_specializations<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
layout_cache.rollback_to(layout_cache_snapshot);
|
||||
|
||||
procs_base.module_thunks = module_thunks.into_bump_slice();
|
||||
|
||||
let find_specializations_end = Instant::now();
|
||||
|
|
|
@ -120,10 +120,8 @@ pub struct LayoutCache<'a> {
|
|||
|
||||
impl<'a> LayoutCache<'a> {
|
||||
pub fn new(interner: TLLayoutInterner<'a>, target_info: TargetInfo) -> Self {
|
||||
let mut cache = std::vec::Vec::with_capacity(4);
|
||||
cache.push(CacheLayer::default());
|
||||
let mut raw_cache = std::vec::Vec::with_capacity(4);
|
||||
raw_cache.push(CacheLayer::default());
|
||||
let cache = std::vec::Vec::with_capacity(4);
|
||||
let raw_cache = std::vec::Vec::with_capacity(4);
|
||||
Self {
|
||||
target_info,
|
||||
cache,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue