style: Use a RwLock'd HashMap instead of a lock-free linked list for rule node children.

I need to profile this a bit more, but talos was pretty happy about this, and it
solves the known performance issues here such as the test-case from bug 1483963
for example. This also gets rid of a bunch of unsafe code which is nice.

This still keeps the same GC scheme, removing the key from the hashmap when
needed. I kept those as release assertions, but should probably be turned into
debug-only assertions.

Differential Revision: https://phabricator.services.mozilla.com/D6801
This commit is contained in:
Emilio Cobos Álvarez 2019-05-29 23:41:01 +00:00
parent 3652a0f1e1
commit f623a6c045
2 changed files with 96 additions and 192 deletions

View file

@ -1305,11 +1305,18 @@ impl<A, B> ArcUnion<A, B> {
}
/// Returns true if the two values are pointer-equal.
#[inline]
pub fn ptr_eq(this: &Self, other: &Self) -> bool {
this.p == other.p
}
#[inline]
pub fn ptr(&self) -> ptr::NonNull<()> {
self.p
}
/// Returns an enum representing a borrow of either A or B.
#[inline]
pub fn borrow(&self) -> ArcUnionBorrow<A, B> {
if self.is_first() {
let ptr = self.p.as_ptr() as *const A;