mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 08:34:33 +00:00
Revert "inline subs operations more aggressively"
This reverts commit f4cb2ec254
.
it'll be merged by a different PR
This commit is contained in:
parent
ba13ad71a6
commit
b6f7f77aae
2 changed files with 23 additions and 39 deletions
42
vendor/ena/src/unify/mod.rs
vendored
42
vendor/ena/src/unify/mod.rs
vendored
|
@ -298,35 +298,21 @@ impl<S: UnificationStore> UnificationTable<S> {
|
|||
///
|
||||
/// NB. This is a building-block operation and you would probably
|
||||
/// prefer to call `probe` below.
|
||||
///
|
||||
/// This is an always-inlined version of this function for the hot
|
||||
/// callsites. `uninlined_get_root_key` is the never-inlined version.
|
||||
#[inline(always)]
|
||||
pub fn inlined_get_root_key(&mut self, vid: S::Key) -> S::Key {
|
||||
let redirect = {
|
||||
match self.value(vid).parent(vid) {
|
||||
None => return vid,
|
||||
Some(redirect) => redirect,
|
||||
pub fn get_root_key(&mut self, vid: S::Key) -> S::Key {
|
||||
match self.value(vid).parent(vid) {
|
||||
None => vid,
|
||||
Some(redirect) => {
|
||||
let root_key: S::Key = self.get_root_key(redirect);
|
||||
if root_key != redirect {
|
||||
// Path compression
|
||||
self.update_value(vid, |value| value.parent = root_key);
|
||||
}
|
||||
|
||||
root_key
|
||||
}
|
||||
};
|
||||
|
||||
let root_key: S::Key = self.uninlined_get_root_key(redirect);
|
||||
if root_key != redirect {
|
||||
// Path compression
|
||||
self.update_value(vid, |value| value.parent = root_key);
|
||||
}
|
||||
|
||||
root_key
|
||||
}
|
||||
|
||||
// This is a never-inlined version of this function for cold callsites.
|
||||
// 'inlined_get_root_key` is the always-inlined version.
|
||||
#[inline(never)]
|
||||
fn uninlined_get_root_key(&mut self, vid: S::Key) -> S::Key {
|
||||
self.inlined_get_root_key(vid)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn get_root_key_without_compacting(&self, mut vid: S::Key) -> S::Key {
|
||||
while let Some(redirect) = self.value(vid).parent(vid) {
|
||||
vid = redirect;
|
||||
|
@ -449,7 +435,7 @@ where
|
|||
K1: Into<K>,
|
||||
{
|
||||
let id = id.into();
|
||||
self.inlined_get_root_key(id)
|
||||
self.get_root_key(id)
|
||||
}
|
||||
|
||||
/// Returns the current value for the given key. If the key has
|
||||
|
@ -460,7 +446,7 @@ where
|
|||
K1: Into<K>,
|
||||
{
|
||||
let id = id.into();
|
||||
let id = self.inlined_get_root_key(id);
|
||||
let id = self.get_root_key(id);
|
||||
self.value(id).value.clone()
|
||||
}
|
||||
|
||||
|
@ -484,7 +470,7 @@ where
|
|||
K1: Into<K>,
|
||||
{
|
||||
let id = id.into();
|
||||
let id = self.inlined_get_root_key(id);
|
||||
let id = self.get_root_key(id);
|
||||
self.value_mut(id)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue