Un-inline some methods initializing thread_local! …

… in order to limit stack frame sizes after extra inlining from
https://github.com/rust-lang/rust/pull/43931

See https://github.com/servo/servo/pull/18420#issuecomment-328769322
This commit is contained in:
Simon Sapin 2017-09-12 10:10:55 +02:00
parent 7f4cb1861b
commit 0d4168034f
2 changed files with 12 additions and 0 deletions

View file

@ -121,6 +121,12 @@ impl<E: TElement> StyleBloom<E> {
/// Create an empty `StyleBloom`. Because StyleBloom acquires the thread-
/// local filter buffer, creating multiple live StyleBloom instances at
/// the same time on the same thread will panic.
// Forced out of line to limit stack frame sizes after extra inlining from
// https://github.com/rust-lang/rust/pull/43931
//
// See https://github.com/servo/servo/pull/18420#issuecomment-328769322
#[inline(never)]
pub fn new() -> Self {
let bloom_arc = BLOOM_KEY.with(|b| b.clone());
let filter = OwningHandle::new_with_fn(bloom_arc, |x| unsafe { x.as_ref() }.unwrap().borrow_mut());

View file

@ -465,6 +465,12 @@ impl<E: TElement> StyleSharingCandidateCache<E> {
}
/// Create a new style sharing candidate cache.
// Forced out of line to limit stack frame sizes after extra inlining from
// https://github.com/rust-lang/rust/pull/43931
//
// See https://github.com/servo/servo/pull/18420#issuecomment-328769322
#[inline(never)]
pub fn new() -> Self {
assert_eq!(mem::size_of::<SharingCache<E>>(), mem::size_of::<TypelessSharingCache>());
assert_eq!(mem::align_of::<SharingCache<E>>(), mem::align_of::<TypelessSharingCache>());