Browse Source

Fix to weak_trace for `boa_tester` (#2470)

<!---
Thank you for contributing to Boa! Please fill out the template below, and remove or add any
information as you feel necessary.
--->

This Pull Request fixes the current issue with the `boa_gc` when running `boa_tester` in parallel on Ubuntu. It looks like since we are running the `gc` in parallel something may not being cleaned up correctly that creates a reference cycle. The below changes should account for that.

It changes the following:

- Updates `weak_trace` to account for `Gc` reference cycles.
pull/2469/head
Kevin 2 years ago
parent
commit
8da46a9d21
  1. 13
      boa_gc/src/internals/gc_box.rs

13
boa_gc/src/internals/gc_box.rs

@ -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] #[inline]
pub(crate) fn weak_trace_inner(&self) { pub(crate) fn weak_trace_inner(&self) {
// SAFETY: if a `GcBox` has `weak_trace_inner` called, then the inner. if !self.header.is_marked() && !self.header.is_ephemeron() {
// value must have been deemed as reachable. self.header.mark();
unsafe { // SAFETY: if a `GcBox` has `weak_trace_inner` called, then the inner.
self.value.weak_trace(); // value must have been deemed as reachable.
unsafe {
self.value.weak_trace();
}
} }
} }

Loading…
Cancel
Save