Closed
Bug 1435569
Opened 6 years ago
Closed 6 years ago
Reduce redundancy in CacheIR attachment spewing
Categories
(Core :: JavaScript Engine: JIT, enhancement, P3)
Tracking
()
RESOLVED
FIXED
mozilla60
Tracking | Status | |
---|---|---|
firefox60 | --- | fixed |
People
(Reporter: mgaudet, Assigned: mgaudet)
Details
Attachments
(2 files, 6 obsolete files)
23.47 KB,
patch
|
tcampbell
:
review+
|
Details | Diff | Splinter Review |
6.66 KB,
patch
|
mgaudet
:
review+
|
Details | Diff | Splinter Review |
The implementations of trackAttached() and trackNotAttached() in the subclasses of IRGenerator are all very self similar, which suggests that there's probably commonality to be extracted.
Assignee | ||
Updated•6 years ago
|
Assignee: nobody → mgaudet
Assignee | ||
Updated•6 years ago
|
Severity: normal → enhancement
Assignee | ||
Comment 1•6 years ago
|
||
This patch mandates that all CacheIR IR generators create spew code to ensure tracking by making the IRGenerator abstract virtual.
Attachment #8948261 -
Flags: review?(evilpies)
Comment 2•6 years ago
|
||
Really nice simplification, but I am concerned that the compiler will keep around the vtable even when we don't build with spewing enabled. Can you check that? We also usually add the override specifier.
Comment 3•6 years ago
|
||
I wonder if we could do something where the derived classes call a method in the base class (IRGenerator) and pass a lambda to spew the contents? We've been trying to avoid virtual functions in the CacheIR code and we're trying to remove them from Ion too (bug 1425580).
Updated•6 years ago
|
Priority: -- → P3
Comment 4•6 years ago
|
||
My alternate unrefined proposal:
> void
> InstanceOfIRGenerator::trackAttached(const char* name)
> {
> #ifdef JS_CACHEIR_SPEW
> if (CacheIRSpewer::Guard sp = CacheIRSpewer::getICSpewer(this, name)) {
> sp.valueProperty("lhs", lhsVal_);
> sp.valueProperty("rhs", ObjectValue(*rhsObj_));
> }
> #endif
> }
I'd also like to revisit the question of can we merge trackAttached and trackNotAttached, instead of nullptr or some named sentinel.
Comment 5•6 years ago
|
||
Comment on attachment 8948261 [details] [diff] [review] Refactor CacheIR attachment spewing code to reduce redundancy Resetting the review request for now. Combining trackAttached and trackNotAttached sounds good.
Attachment #8948261 -
Flags: review?(evilpies)
Assignee | ||
Comment 6•6 years ago
|
||
This patch adds an inner class to CacheIRSpewer that manages access to the CacheIRSpewer and dramatically simplifies the consuming code. Note: this changes the CacheIRSpewer to no longer use LockGuard; instead the raw mutex is managed by CacheIRSpewer. This is because the RAII nature of CacheIRSpewer::Guard prevents constructing the LockGuard if-and-only-if the spewer is enabled.
Attachment #8950796 -
Flags: review?(evilpies)
Assignee | ||
Updated•6 years ago
|
Attachment #8948261 -
Attachment is obsolete: true
Assignee | ||
Comment 7•6 years ago
|
||
Note, unlike Ted's sketch, I didn't implement a getter for CacheIRSpewer::Guard.
Comment 8•6 years ago
|
||
Please wrap those nullptrs in something with a name. |constexpr char* CacheIRSpewer::NotAttached = nullptr;| or something.
Comment 9•6 years ago
|
||
Comment on attachment 8950796 [details] [diff] [review] Change CacheIRSpewer to allow less redundency in spewing Review of attachment 8950796 [details] [diff] [review]: ----------------------------------------------------------------- This actually extremely nice looking, thanks for cleaning this up! Please include Ted's nullptr suggestion as well. ::: js/src/jit/CacheIRSpewer.h @@ +46,5 @@ > + > + class MOZ_RAII Guard { > + CacheIRSpewer& sp_; > + const IRGenerator& gen_; > + const char * name_; Super nit: * goes with the type.
Attachment #8950796 -
Flags: review?(evilpies) → review+
Comment 10•6 years ago
|
||
Actually Ted's suggestion might not work, because CacheIRSpewer is #ifdef on JS_CACHEIR_SPEW.
Assignee | ||
Comment 11•6 years ago
|
||
This patch adds an inner class to CacheIRSpewer that manages access to the CacheIRSpewer and dramatically simplifies the consuming code. Note: this changes the CacheIRSpewer to no longer use LockGuard; instead the raw mutex is managed by CacheIRSpewer. This is because the RAII nature of CacheIRSpewer::Guard prevents constructing the LockGuard if-and-only-if the spewer is enabled.
Assignee | ||
Updated•6 years ago
|
Attachment #8950796 -
Attachment is obsolete: true
Assignee | ||
Comment 12•6 years ago
|
||
Assignee | ||
Comment 13•6 years ago
|
||
Comment on attachment 8950921 [details] [diff] [review] Change CacheIRSpewer to allow less redundency in spewing Nit addressed, carrying evilpie's r+
Attachment #8950921 -
Flags: review+
Assignee | ||
Comment 14•6 years ago
|
||
Comment on attachment 8950922 [details] [diff] [review] Give the "NotAttached" case a name Because the NotAttached case is referred to externally, in contexts where CacheIRSpewer isn't already imported, this patch puts the name inside the IRGenerator.
Attachment #8950922 -
Flags: review?(evilpies)
Updated•6 years ago
|
Attachment #8950922 -
Flags: review?(evilpies) → review+
Assignee | ||
Comment 15•6 years ago
|
||
Try build looks green -- setting checkin-needed flag https://treeherder.mozilla.org/#/jobs?repo=try&revision=efc83f62363e36f69e111b13300d185b5f6df1c9
Keywords: checkin-needed
Comment 16•6 years ago
|
||
Pushed by apavel@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/7cff9cca3774 Change CacheIRSpewer to allow less redundency in spewing r=evilpie https://hg.mozilla.org/integration/mozilla-inbound/rev/fa3a63240665 Give the "NotAttached" case a name r=evilpie
Keywords: checkin-needed
Comment 17•6 years ago
|
||
Backed out for build bustages at /builds/worker/workspace/build/src/js/src/jit/CacheIR.cpp:1906 push that started the failures: https://treeherder.mozilla.org/#/jobs?repo=mozilla-inbound&revision=9659c9a29139b0b66e1cfdeb26dd7735f4846006 failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=162444426&repo=mozilla-inbound&lineNumber=10565 backout: https://hg.mozilla.org/integration/mozilla-inbound/rev/bcc2e391c8208908e44f76783416ea10491e8323
Flags: needinfo?(mgaudet)
Assignee | ||
Comment 18•6 years ago
|
||
This patch adds an inner class to CacheIRSpewer that manages access to the CacheIRSpewer and dramatically simplifies the consuming code. Note: this changes the CacheIRSpewer to no longer use LockGuard; instead the raw mutex is managed by CacheIRSpewer. This is because the RAII nature of CacheIRSpewer::Guard prevents constructing the LockGuard if-and-only-if the spewer is enabled.
Assignee | ||
Updated•6 years ago
|
Attachment #8950921 -
Attachment is obsolete: true
Assignee | ||
Comment 19•6 years ago
|
||
Assignee | ||
Updated•6 years ago
|
Attachment #8950922 -
Attachment is obsolete: true
Assignee | ||
Updated•6 years ago
|
Attachment #8951311 -
Attachment is obsolete: true
Flags: needinfo?(mgaudet)
Assignee | ||
Comment 20•6 years ago
|
||
This patch adds an inner class to CacheIRSpewer that manages access to the CacheIRSpewer and dramatically simplifies the consuming code. Note: this changes the CacheIRSpewer to no longer use LockGuard; instead the raw mutex is managed by CacheIRSpewer. This is because the RAII nature of CacheIRSpewer::Guard prevents constructing the LockGuard if-and-only-if the spewer is enabled.
Assignee | ||
Updated•6 years ago
|
Attachment #8951310 -
Attachment is obsolete: true
Assignee | ||
Comment 21•6 years ago
|
||
Assignee | ||
Comment 22•6 years ago
|
||
Comment on attachment 8951315 [details] [diff] [review] Give the "NotAttached" case a name Carrying evilpie's r+
Attachment #8951315 -
Flags: review+
Assignee | ||
Comment 23•6 years ago
|
||
Comment on attachment 8951314 [details] [diff] [review] Change CacheIRSpewer to allow less redundency in spewing This patch addresses a static analysis failure by changing the guard to capture a const reference. This means copy elision occurs, which means no temporary, and the static analysis passes (https://treeherder.mozilla.org/#/jobs?repo=try&revision=20bee090afa6cdb4f4ee0204e066a6db093b7c64&selectedJob=162453749)
Attachment #8951314 -
Flags: review?(tcampbell)
Comment 24•6 years ago
|
||
Comment on attachment 8951314 [details] [diff] [review] Change CacheIRSpewer to allow less redundency in spewing Review of attachment 8951314 [details] [diff] [review]: ----------------------------------------------------------------- Looks like a reasonable fix for the static analysis bug.
Attachment #8951314 -
Flags: review?(tcampbell) → review+
Assignee | ||
Updated•6 years ago
|
Keywords: checkin-needed
Comment 25•6 years ago
|
||
Pushed by nbeleuzu@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/114d2a3202c0 Change CacheIRSpewer to allow less redundency in spewing. r=tcampbell https://hg.mozilla.org/integration/mozilla-inbound/rev/287ae6668ed2 Give the "NotAttached" case a name r=evilpie
Keywords: checkin-needed
Comment 26•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/114d2a3202c0 https://hg.mozilla.org/mozilla-central/rev/287ae6668ed2
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
You need to log in
before you can comment on or make changes to this bug.
Description
•