mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1929493 - Minor cleanups to the wasm inlining budget logic. r=rhunt.
Bug 1927061 introduced inlining budgets for functions and for entire modules. That has unfortunately a couple of rough edges that this patch fixes. * The situation where a per-function or per-module budget is exactly zero is ambiguous. As a result the logging machinery (MOZ_LOG=wasmPerf:3) can print the "Inlining budget for fI=... exceeded" message a different number of times from the number shown in the final "... functions overran inlining budget" message. It also causes the "Inlining budget for fI=... exceeded" message to be printed for all functions when we have --wasm-compiler=ion. This patch removes the ambiguity and fixes the above by having a value of zero mean "budget not exceeded"; hence it is the zero-to-negative transition that is important. * two JS_LOGs were not protected by #ifdef JS_JITSPEW as they should have been. Differential Revision: https://phabricator.services.mozilla.com/D228197
This commit is contained in:
parent
7779560e29
commit
eb7c0a4e97
@ -490,12 +490,14 @@ class FunctionCompiler {
|
||||
// point in updating it further.
|
||||
if (inliningBudget_ >= 0) {
|
||||
inliningBudget_ -= int64_t(inlineeBytecodeSize);
|
||||
if (inliningBudget_ <= 0) {
|
||||
#ifdef JS_JITSPEW
|
||||
if (inliningBudget_ < 0) {
|
||||
JS_LOG(wasmPerf, mozilla::LogLevel::Info,
|
||||
"CM=..%06lx FC::updateILStats "
|
||||
"Inlining budget for fI=%u exceeded",
|
||||
0xFFFFFF & (unsigned long)uintptr_t(&codeMeta_), funcIndex());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
FunctionCompiler* toplevelCompiler() { return toplevelCompiler_; }
|
||||
@ -697,16 +699,18 @@ class FunctionCompiler {
|
||||
if (guard->inliningBudget >= 0) {
|
||||
guard->inliningBudget -= int64_t(stats_.inlinedDirectBytecodeSize);
|
||||
guard->inliningBudget -= int64_t(stats_.inlinedCallRefBytecodeSize);
|
||||
if (guard->inliningBudget <= 0) {
|
||||
#ifdef JS_JITSPEW
|
||||
if (guard->inliningBudget < 0) {
|
||||
JS_LOG(wasmPerf, mozilla::LogLevel::Info,
|
||||
"CM=..%06lx FC::finish "
|
||||
"Inlining budget for entire module exceeded",
|
||||
0xFFFFFF & (unsigned long)uintptr_t(&codeMeta_));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// If this particular top-level function overran the function-level
|
||||
// limit, note that in the module too.
|
||||
if (inliningBudget_ <= 0) {
|
||||
if (inliningBudget_ < 0) {
|
||||
guard->partialInlineBudgetOverruns++;
|
||||
}
|
||||
}
|
||||
@ -2623,15 +2627,15 @@ class FunctionCompiler {
|
||||
// budget.
|
||||
//
|
||||
// This logic will cause `availableBudget` to be driven slightly negative
|
||||
// (or zero) if a budget overshoot happens, so we will have performed
|
||||
// slightly more inlining than allowed by the initial setting of
|
||||
// `availableBudget`. The size of this overshoot is however very limited
|
||||
// -- it can't exceed the size of one function body that is inlined. And
|
||||
// that is limited by InliningHeuristics::isSmallEnoughToInline.
|
||||
// if a budget overshoot happens, so we will have performed slightly more
|
||||
// inlining than allowed by the initial setting of `availableBudget`. The
|
||||
// size of this overshoot is however very limited -- it can't exceed the
|
||||
// size of one function body that is inlined. And that is limited by
|
||||
// InliningHeuristics::isSmallEnoughToInline.
|
||||
const int64_t availableBudget = toplevelCompiler_
|
||||
? toplevelCompiler_->inliningBudget_
|
||||
: inliningBudget_;
|
||||
if (availableBudget <= 0) {
|
||||
if (availableBudget < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user