Skip to content

Commit

Permalink
Fix to weak_trace for gc ref cycles
Browse files Browse the repository at this point in the history
  • Loading branch information
nekevss committed Dec 2, 2022
1 parent 920a86f commit f4442f7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions boa_gc/src/internals/gc_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,16 @@ impl<T: Trace + ?Sized> GcBox<T> {
}
}

/// Trace inner data
/// Trace inner data and search for ephemerons to add to the ephemeron queue.
#[inline]
pub(crate) fn weak_trace_inner(&self) {
// SAFETY: if a `GcBox` has `weak_trace_inner` called, then the inner.
// value must have been deemed as reachable.
unsafe {
self.value.weak_trace();
if !self.header.is_marked() && !self.header.is_ephemeron() {
self.header.mark();
// SAFETY: if a `GcBox` has `weak_trace_inner` called, then the inner.
// value must have been deemed as reachable.
unsafe {
self.value.weak_trace();
}
}
}

Expand Down

0 comments on commit f4442f7

Please sign in to comment.