Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upMake Stylist no longer an unsafe pointer once we have fast RWArcs #2604
Comments
|
|
|
@SimonSapin I believe |
|
Took a look at this with help from @Ms2ger on IRC—an implementation moving the |
|
That was master...mt2d2:stylist_arc_rwlock |
|
Probably needs finer-grained locking inside the Stylist then? |
Not sure if this is the best way to structure the code; there are a lot of mutexes involved. Fixes servo#2604. Pretty sure the issue with the other version mentioned there was just that it held on to the lock too long.
Not sure if this is the best way to structure the code; there are a lot of mutexes involved. Fixes servo#2604. Pretty sure the issue with the other version mentioned there was just that it held on to the lock too long.
Not sure if this is the best way to structure the code; there are a lot of mutexes involved. Fixes servo#2604. Pretty sure the issue with the other version mentioned there was just that it held on to the lock too long.
Making the Stylist usage threadsafe without unsafe code or extra locking required some changes to WorkQueue; the changes are mostly straightforward. Fixes servo#2604. Pretty sure the issue with the other version mentioned there was just that it held on to the lock too long.
Making the Stylist usage threadsafe without unsafe code or extra locking required some changes to WorkQueue; the changes are mostly straightforward. Fixes servo#2604. Pretty sure the issue with the other version mentioned there was just that it held on to the lock too long.
Making the Stylist usage threadsafe without unsafe code or extra locking required some changes to WorkQueue; the changes are mostly straightforward. Fixes servo#2604. Pretty sure the issue with the other version mentioned there was just that it held on to the lock too long.
Making the Stylist usage threadsafe without unsafe code or extra locking required some changes to WorkQueue; the changes are mostly straightforward. Fixes servo#2604. Pretty sure the issue with the other version mentioned there was just that it held on to the lock too long.
Making the Stylist usage threadsafe without unsafe code or extra locking required some changes to WorkQueue; the changes are mostly straightforward. Some refactoring of LayoutTaskData was also required: this is basically just splitting the structure in two so the borrow checker can understand that building a SharedLayoutContext only borrows part of LayoutTaskData. The "frozen" part is the part that can't be safely modified while a parallel work-queue is running. Fixes servo#2604. Pretty sure the issue with the other version mentioned there was just that it held on to the lock too long.
|
I can try to work on this. How can I test this codepath? Edit: Ah, I see that @eefriedman is on it. Nevermind. |
|
I believe #7524 is taking care of this. |
Making the Stylist usage threadsafe without unsafe code or extra locking required some changes to WorkQueue; the changes are mostly straightforward. Some refactoring of LayoutTaskData was also required: this is basically just splitting the structure in two so the borrow checker can understand that building a SharedLayoutContext only borrows part of LayoutTaskData. The "frozen" part is the part that can't be safely modified while a parallel work-queue is running. It might be worth considering switching to some sort of threadsafe channel to avoid the mutexes... see Rust RFC PR servo#1299. Fixes servo#2604. Pretty sure the issue with the other version mentioned there was just that it held on to the lock too long.
Making the Stylist usage threadsafe without unsafe code or extra locking required some changes to WorkQueue; the changes are mostly straightforward. Some refactoring of LayoutTaskData was also required: this is basically just splitting the structure in two so the borrow checker can understand that building a SharedLayoutContext only borrows part of LayoutTaskData. The "frozen" part is the part that can't be safely modified while a parallel work-queue is running. It might be worth considering switching to some sort of threadsafe channel to avoid the mutexes... see Rust RFC PR servo#1299. Fixes servo#2604. Pretty sure the issue with the other version mentioned there was just that it held on to the lock too long.
|
I tried to just wrap it into |
|
Sure, you can wrap it in a Mutex... but what does that do to the performance? (That's what sent me down the path of borrowing it.) |
|
Alternatively, we could try to move the |
|
Move it tot the document node, similar to #8039 ? |
|
I don't follow. |
|
You mention moving |
|
If we intentionally want to dynamically check the borrowing of Stylist, I think we can just stuff it into an Arc, and use I don't see how changing the ownership of the Stylist helps. |
|
I don’t think we need dynamic checks at all if |
|
Oh, right... if Stylist is in the DOM, we don't need to mutate it from layout. Makes sense. |
|
Latest attempt at #7524. |
|
#10815 Should take care of this. It uses an |
|
@emilio |
|
@SimonSapin: Stylist is not cloneable, I'm using |
|
Oh yeah, sorry, I got confused with |
|
I think not since it has to be handed out to layout traversal (I mean to The refcount is always one when we update the stylist in the layout thread, but not always. |
|
This is closed by #10815 |
Currently RWArcs use Sems and that is very slow. Once that is no longer the case, put Stylist in an RWArc.