Skip to content

Commit

Permalink
style: Use a RwLock'd HashMap instead of a lock-free linked list for …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
emilio committed Jun 4, 2019
1 parent 3652a0f commit f623a6c
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 191 deletions.
7 changes: 7 additions & 0 deletions components/servo_arc/lib.rs
Expand Up @@ -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;
Expand Down

0 comments on commit f623a6c

Please sign in to comment.