Struct mozjs_sys::jsapi::JS::TenuredHeap
source · #[repr(C)]pub struct TenuredHeap {
pub bits: usize,
}
Expand description
The TenuredHeap
-
Pointers which are statically known to only reference “tenured” objects can avoid the extra overhead of SpiderMonkey’s write barriers.
-
Objects in the “tenured” heap have stronger alignment restrictions than those in the “nursery”, so it is possible to store flags in the lower bits of pointers known to be tenured. TenuredHeap wraps a normal tagged pointer with a nice API for accessing the flag bits and adds various assertions to ensure that it is not mis-used.
GC things are said to be “tenured” when they are located in the long-lived heap: e.g. they have gained tenure as an object by surviving past at least one GC. For performance, SpiderMonkey allocates some things which are known to normally be long lived directly into the tenured generation; for example, global objects. Additionally, SpiderMonkey does not visit individual objects when deleting non-tenured objects, so object with finalizers are also always tenured; for instance, this includes most DOM objects.
The considerations to keep in mind when using a TenuredHeap
- It is invalid for a TenuredHeap
to refer to a non-tenured thing. - It is however valid for a Heap
to refer to a tenured thing. - It is not possible to store flag bits in a Heap
.
Fields§
§bits: usize
Trait Implementations§
source§impl Clone for TenuredHeap
impl Clone for TenuredHeap
source§fn clone(&self) -> TenuredHeap
fn clone(&self) -> TenuredHeap
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TenuredHeap
impl Debug for TenuredHeap
source§impl PartialEq for TenuredHeap
impl PartialEq for TenuredHeap
impl Copy for TenuredHeap
impl StructuralPartialEq for TenuredHeap
Auto Trait Implementations§
impl Freeze for TenuredHeap
impl RefUnwindSafe for TenuredHeap
impl Send for TenuredHeap
impl Sync for TenuredHeap
impl Unpin for TenuredHeap
impl UnwindSafe for TenuredHeap
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more