Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GC the rule tree only when the free list gets to a certain size. #14256

Merged
merged 2 commits into from Nov 20, 2016

Conversation

@heycam
Copy link
Member

heycam commented Nov 17, 2016

Use a heuristic similar to Gecko's to decide when to GC the rule tree.

r? @emilio


This change is Reviewable

@highfive
Copy link

highfive commented Nov 17, 2016

Heads up! This PR modifies the following files:

  • @bholley: components/style/rule_tree/mod.rs
  • @emilio: components/style/rule_tree/mod.rs
@highfive
Copy link

highfive commented Nov 17, 2016

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
  • These commits modify style code, but no tests are modified. Please consider adding a test!
@emilio
emilio approved these changes Nov 17, 2016
Copy link
Member

emilio left a comment

Looks good to me with that comment added, and probably your patch imported too :)

@@ -533,6 +563,7 @@ impl Drop for StrongRuleNode {
Ordering::SeqCst);
if existing == next_free {
// Successfully inserted, yay! Otherwise try again.
root.free_count.fetch_add(1, Ordering::SeqCst);

This comment has been minimized.

Copy link
@emilio

emilio Nov 17, 2016

Member

This can be Ordering::Relaxed, given we're gc'ing in the main thread.

This comment has been minimized.

Copy link
@heycam

heycam Nov 18, 2016

Author Member

And the load and store we do in gc() itself remain Order::SeqCst?

/// just used as a heuristic to decide when to run GC.)
///
/// Only used on the root RuleNode.
free_count: AtomicUsize,

This comment has been minimized.

Copy link
@emilio

emilio Nov 17, 2016

Member

Seems unfortunate to pay this price in every node only for this, probably we should be able to reuse one of the sibling pointers for that, but that's fine as a followup I guess. Could you leave a comment here on that?

// the list, find a good heuristic here for that.
unsafe { shared_layout_context.style_context.stylist.rule_tree.gc() }
// GC the rule tree if some heuristics are met.
unsafe { shared_layout_context.style_context.stylist.rule_tree.maybe_gc(); }

This comment has been minimized.

Copy link
@emilio

emilio Nov 17, 2016

Member

I guess this will need the patch over in https://bugzilla.mozilla.org/show_bug.cgi?id=1318238 to avoid leaking right? Feel free to drop it here :)

This comment has been minimized.

Copy link
@heycam

heycam Nov 18, 2016

Author Member

Ended up putting it in #14273.

@emilio
Copy link
Member

emilio commented Nov 17, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Nov 17, 2016

Trying commit ce27483 with merge 2c8bed1...

bors-servo added a commit that referenced this pull request Nov 17, 2016
GC the rule tree only when the free list gets to a certain size.

<!-- Please describe your changes on the following line: -->

Use a heuristic similar to Gecko's to decide when to GC the rule tree.

r? @emilio

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14256)
<!-- Reviewable:end -->
@bors-servo bors-servo mentioned this pull request Nov 17, 2016
@bors-servo
Copy link
Contributor

bors-servo commented Nov 17, 2016

💥 Test timed out

@heycam
Copy link
Member Author

heycam commented Nov 18, 2016

@heycam heycam force-pushed the heycam:rn-gc-heuristic branch from ce27483 to 4e52bb4 Nov 18, 2016
@heycam
Copy link
Member Author

heycam commented Nov 18, 2016

@bors-servo r=emilio

@bors-servo
Copy link
Contributor

bors-servo commented Nov 18, 2016

📌 Commit 4e52bb4 has been approved by emilio

@bors-servo
Copy link
Contributor

bors-servo commented Nov 18, 2016

Testing commit 4e52bb4 with merge 13c3bd8...

bors-servo added a commit that referenced this pull request Nov 18, 2016
GC the rule tree only when the free list gets to a certain size.

<!-- Please describe your changes on the following line: -->

Use a heuristic similar to Gecko's to decide when to GC the rule tree.

r? @emilio

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14256)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 19, 2016

💔 Test failed - mac-rel-wpt1

@emilio
Copy link
Member

emilio commented Nov 19, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Nov 19, 2016

Testing commit 4e52bb4 with merge 1666561...

bors-servo added a commit that referenced this pull request Nov 19, 2016
GC the rule tree only when the free list gets to a certain size.

<!-- Please describe your changes on the following line: -->

Use a heuristic similar to Gecko's to decide when to GC the rule tree.

r? @emilio

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14256)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 19, 2016

💔 Test failed - linux-rel-wpt

@KiChjang
Copy link
Member

KiChjang commented Nov 19, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Nov 19, 2016

Testing commit 4e52bb4 with merge f6396d4...

bors-servo added a commit that referenced this pull request Nov 19, 2016
GC the rule tree only when the free list gets to a certain size.

<!-- Please describe your changes on the following line: -->

Use a heuristic similar to Gecko's to decide when to GC the rule tree.

r? @emilio

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14256)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 19, 2016

💔 Test failed - linux-rel-wpt

@highfive
Copy link

highfive commented Nov 19, 2016

  ▶ FAIL [expected PASS] /_mozilla/css/incremental_trailing_whitespace_a.html
  └   → /_mozilla/css/incremental_trailing_whitespace_a.html da54041086f2975f8e3c776d2283ad6609e6862a
/_mozilla/css/incremental_trailing_whitespace_ref.html f5d0147c8bddbdc772a7e5e86c7c9e433fcd486b
Testing da54041086f2975f8e3c776d2283ad6609e6862a == f5d0147c8bddbdc772a7e5e86c7c9e433fcd486b
@heycam
Copy link
Member Author

heycam commented Nov 20, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Nov 20, 2016

Testing commit 4e52bb4 with merge b78622b...

bors-servo added a commit that referenced this pull request Nov 20, 2016
GC the rule tree only when the free list gets to a certain size.

<!-- Please describe your changes on the following line: -->

Use a heuristic similar to Gecko's to decide when to GC the rule tree.

r? @emilio

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14256)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 20, 2016

💔 Test failed - mac-rel-wpt1

@heycam
Copy link
Member Author

heycam commented Nov 20, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Nov 20, 2016

Previous build results for arm32, arm64, linux-dev, linux-rel-css, mac-dev-unit, mac-rel-css, mac-rel-wpt2, windows-dev are reusable. Rebuilding only linux-rel-wpt, mac-rel-wpt1...

@bors-servo
Copy link
Contributor

bors-servo commented Nov 20, 2016

@bors-servo bors-servo merged commit 4e52bb4 into servo:master Nov 20, 2016
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.