mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #16847 - glandium:master, r=bholley
Opt-in to thread-local jemalloc arenas for stylo rayon threads <!-- Please describe your changes on the following line: --> Servo part of https://bugzilla.mozilla.org/show_bug.cgi?id=1361258 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because they're gecko-specific <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/16847) <!-- Reviewable:end -->
This commit is contained in:
commit
642cd08f21
2 changed files with 19 additions and 11 deletions
|
@ -250,16 +250,16 @@ pub type RawServoSupportsRuleBorrowed<'a> = &'a RawServoSupportsRule;
|
|||
pub type RawServoSupportsRuleBorrowedOrNull<'a> = Option<&'a RawServoSupportsRule>;
|
||||
enum RawServoSupportsRuleVoid { }
|
||||
pub struct RawServoSupportsRule(RawServoSupportsRuleVoid);
|
||||
pub type RawServoRuleNodeStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoRuleNode>;
|
||||
pub type RawServoRuleNodeBorrowed<'a> = &'a RawServoRuleNode;
|
||||
pub type RawServoRuleNodeBorrowedOrNull<'a> = Option<&'a RawServoRuleNode>;
|
||||
enum RawServoRuleNodeVoid { }
|
||||
pub struct RawServoRuleNode(RawServoRuleNodeVoid);
|
||||
pub type RawServoDocumentRuleStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoDocumentRule>;
|
||||
pub type RawServoDocumentRuleBorrowed<'a> = &'a RawServoDocumentRule;
|
||||
pub type RawServoDocumentRuleBorrowedOrNull<'a> = Option<&'a RawServoDocumentRule>;
|
||||
enum RawServoDocumentRuleVoid { }
|
||||
pub struct RawServoDocumentRule(RawServoDocumentRuleVoid);
|
||||
pub type RawServoRuleNodeStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoRuleNode>;
|
||||
pub type RawServoRuleNodeBorrowed<'a> = &'a RawServoRuleNode;
|
||||
pub type RawServoRuleNodeBorrowedOrNull<'a> = Option<&'a RawServoRuleNode>;
|
||||
enum RawServoRuleNodeVoid { }
|
||||
pub struct RawServoRuleNode(RawServoRuleNodeVoid);
|
||||
pub type RawServoStyleSetOwned = ::gecko_bindings::sugar::ownership::Owned<RawServoStyleSet>;
|
||||
pub type RawServoStyleSetOwnedOrNull = ::gecko_bindings::sugar::ownership::OwnedOrNull<RawServoStyleSet>;
|
||||
pub type RawServoStyleSetBorrowed<'a> = &'a RawServoStyleSet;
|
||||
|
@ -421,18 +421,18 @@ extern "C" {
|
|||
extern "C" {
|
||||
pub fn Servo_SupportsRule_Release(ptr: RawServoSupportsRuleBorrowed);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_RuleNode_AddRef(ptr: RawServoRuleNodeBorrowed);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_RuleNode_Release(ptr: RawServoRuleNodeBorrowed);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_DocumentRule_AddRef(ptr: RawServoDocumentRuleBorrowed);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_DocumentRule_Release(ptr: RawServoDocumentRuleBorrowed);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_RuleNode_AddRef(ptr: RawServoRuleNodeBorrowed);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_RuleNode_Release(ptr: RawServoRuleNodeBorrowed);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleSet_Drop(ptr: RawServoStyleSetOwned);
|
||||
}
|
||||
|
@ -1587,6 +1587,9 @@ extern "C" {
|
|||
URLMatchingFunction)
|
||||
-> bool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_SetJemallocThreadLocalArena(enabled: bool);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_Element_ClearData(node: RawGeckoElementBorrowed);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
use context::StyleSystemOptions;
|
||||
use gecko_bindings::bindings::{Gecko_RegisterProfilerThread, Gecko_UnregisterProfilerThread};
|
||||
use gecko_bindings::bindings::Gecko_SetJemallocThreadLocalArena;
|
||||
use num_cpus;
|
||||
use rayon;
|
||||
use shared_lock::SharedRwLock;
|
||||
|
@ -33,6 +34,9 @@ fn thread_name(index: usize) -> String {
|
|||
}
|
||||
|
||||
fn thread_startup(index: usize) {
|
||||
unsafe {
|
||||
Gecko_SetJemallocThreadLocalArena(true);
|
||||
}
|
||||
let name = thread_name(index);
|
||||
let name = CString::new(name).unwrap();
|
||||
unsafe {
|
||||
|
@ -44,6 +48,7 @@ fn thread_startup(index: usize) {
|
|||
fn thread_shutdown(_: usize) {
|
||||
unsafe {
|
||||
Gecko_UnregisterProfilerThread();
|
||||
Gecko_SetJemallocThreadLocalArena(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue