mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +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,
|
derived_module: &derived_module,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let layout_cache_snapshot = layout_cache.snapshot();
|
||||||
|
|
||||||
// Add modules' decls to Procs
|
// Add modules' decls to Procs
|
||||||
for index in 0..declarations.len() {
|
for index in 0..declarations.len() {
|
||||||
use roc_can::expr::DeclarationTag::*;
|
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();
|
procs_base.module_thunks = module_thunks.into_bump_slice();
|
||||||
|
|
||||||
let find_specializations_end = Instant::now();
|
let find_specializations_end = Instant::now();
|
||||||
|
|
|
@ -120,10 +120,8 @@ pub struct LayoutCache<'a> {
|
||||||
|
|
||||||
impl<'a> LayoutCache<'a> {
|
impl<'a> LayoutCache<'a> {
|
||||||
pub fn new(interner: TLLayoutInterner<'a>, target_info: TargetInfo) -> Self {
|
pub fn new(interner: TLLayoutInterner<'a>, target_info: TargetInfo) -> Self {
|
||||||
let mut cache = std::vec::Vec::with_capacity(4);
|
let cache = std::vec::Vec::with_capacity(4);
|
||||||
cache.push(CacheLayer::default());
|
let raw_cache = std::vec::Vec::with_capacity(4);
|
||||||
let mut raw_cache = std::vec::Vec::with_capacity(4);
|
|
||||||
raw_cache.push(CacheLayer::default());
|
|
||||||
Self {
|
Self {
|
||||||
target_info,
|
target_info,
|
||||||
cache,
|
cache,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue