Closed Bug 1125185 Opened 5 years ago Closed 5 years ago

MOZ_COLD attribute for infrequently executed functions

Categories

(Core :: MFBT, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla38

People

(Reporter: sunfish, Assigned: sunfish)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch cold-attribute.patch (obsolete) — Splinter Review
The attached patch adds a MOZ_COLD macro, which is __attribute__((cold)) on GCC and clang, which decorates functions with a hint to compiler optimizers that they are infrequently executed.

It also adds MOZ_COLD to a handful of what I believe are fairly obvious cold functions.

I'm primarily adding this in preparation for a patch in bug 986981, since it adds a bunch of code that's only run from the asm.js signal handler for out-of-bounds accesses, which should be cold in practice.
Attachment #8553778 - Flags: review?(jwalden+bmo)
Minor update to move MOZ_COLD out of the C++-only section of Attributes.h as apparently there are some C things in a full mozilla-central build too.
Attachment #8553778 - Attachment is obsolete: true
Attachment #8553778 - Flags: review?(jwalden+bmo)
Attachment #8553790 - Flags: review?(jwalden+bmo)
Comment on attachment 8553790 [details] [diff] [review]
cold-attribute.patch

Review of attachment 8553790 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/gc/StoreBuffer.h
@@ +24,1 @@
>  CrashAtUnhandlableOOM(const char *reason);

Just remove this declaration.  This header already includes LifoAlloc.h, so this is unnecessary.  Although, to be honest, I think this probably belongs most properly in jsutil.h -- move the single declaration there?  LifoAlloc.h includes jsutil.h, so this shouldn't require any other adjustments.
Attachment #8553790 - Flags: review?(jwalden+bmo) → review+
Ok, I moved the CrashAtUnhandlableOOM declaration as reuqested.

https://hg.mozilla.org/integration/mozilla-inbound/rev/780d7bb5eb82
https://hg.mozilla.org/mozilla-central/rev/780d7bb5eb82
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in before you can comment on or make changes to this bug.