Closed Bug 1386700 Opened 8 years ago Closed 8 years ago

Move trivial MBasicBlock accessors to the header file

Categories

(Core :: JavaScript Engine: JIT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached patch PatchSplinter Review
I was profiling a single speedometer test and MBasicBlock::getSlot is one of the non-inlined functions that's called most frequently (> 225,000 calls!). Turns out MBasicBlock has a lot of trivial methods that are very hot, but because they're defined in the .cpp file the compiler can't inline them.
Attachment #8892953 - Flags: review?(sstangl)
(In reply to Jan de Mooij [:jandem] from comment #0) > Turns out MBasicBlock has a lot of trivial methods that are very hot, but > because they're defined in the .cpp file the compiler can't inline them. Can you add a comment about the measured perf impact? I find we over-inline a lot of code in headers for no reason, but sometimes it does matter. It would be nice to be able to tell the difference when we have a measured perf win due to inlining.
(In reply to Ben Kelly [:bkelly] from comment #1) > Can you add a comment about the measured perf impact? I find we over-inline > a lot of code in headers for no reason, but sometimes it does matter. It > would be nice to be able to tell the difference when we have a measured perf > win due to inlining. I haven't measured that yet, but MBasicBlock::getSlot for instance is super hot (> 200,000 calls on a single test) and is just a single load in opt builds. It's definitely faster to just inline this than paying the call overhead.
I just meant a comment like: // NOTE: These methods are hot. Do not un-inline them without measuring the impact.
Comment on attachment 8892953 [details] [diff] [review] Patch Looks fine to me. The inclusion of MBasicBlock::add() is somewhat arbitrary, since that function is a bit less simple -- by what standard is addPhi() then not also in the header?
Attachment #8892953 - Flags: review?(sstangl) → review+
(In reply to Ben Kelly [:bkelly] from comment #3) > // NOTE: These methods are hot. Do not un-inline them without measuring > the impact. OK I can add something. (In reply to Sean Stangl [:sstangl] from comment #4) > The inclusion of MBasicBlock::add() is somewhat arbitrary, since that > function is a bit less simple -- by what standard is addPhi() then not also > in the header? Yeah, MBasicBlock::add() is a bit less obvious, but I included it because it's pretty hot: my single-speedometer-subtest profile had > 59,000 calls to it. I just checked and addPhi is called 529 times so it's less hot and it's probably okay to keep it out-of-line.
Pushed by jandemooij@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/71228e37d789 Define some trivial MBasicBlock methods in the header file so the compiler can inline them. r=sstangl
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
https://hg.mozilla.org/projects/date/rev/71228e37d789ff5f8846099bb71cafa426d263e9 Bug 1386700 - Define some trivial MBasicBlock methods in the header file so the compiler can inline them. r=sstangl
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: