Redefer function bodies - #1585
Conversation
|
Merged with OOP JIT. That was fun. :) |
|
Fully synched. |
ea45851 to
d6ac8c3
Compare
154d897 to
317462a
Compare
|
|
||
| Js::FunctionEntryPointInfo *entryPointInfo = function->GetFunctionEntryPointInfo(); | ||
| uint8 callsCount = entryPointInfo->callsCount; | ||
| uint32 callsCount = entryPointInfo->callsCount; |
| entryPointInfo->totalJittedLoopIterations = UINT8_MAX; | ||
| } | ||
| uint8 totalJittedLoopIterations = (uint8)entryPointInfo->totalJittedLoopIterations; | ||
| uint32 totalJittedLoopIterations = (uint8)entryPointInfo->totalJittedLoopIterations; |
189c0f3 to
0826835
Compare
|
Reverted to treating call counts as saturating uint8's in bailout code. (Thanks, @rajatd.) |
| uint gcSinceLastRedeferral; | ||
| uint gcSinceCallCountsCollected; | ||
|
|
||
| static const uint InitialRedeferralDelay = 5; |
There was a problem hiding this comment.
InitialRedeferralDelay [](start = 22, length = 22)
should we have these as configurable values so we can tune redeferral in the future if need be?
| @@ -2062,19 +2080,6 @@ ThreadContext::ExecuteRecyclerCollectionFunction(Recycler * recycler, Collection | |||
|
|
|||
| BOOL ret = FALSE; | |||
|
|
|||
There was a problem hiding this comment.
RedeferFunctionBodies [](start = 23, length = 21)
Correct me if I'm wrong, but I think we should also pass the result of this->GetRedeferralalCollectionInterval() to ScriptContext::RedeferFunctionBodies. Right now, the result of ThreadContext::GetRedeferralInactiveThreshold is being used in FunctionBody::DoRedeferFunction to determine if a function has remained inactive for long enough that it could be redeferred.
There was a problem hiding this comment.
Thanks for explaining offline. No action needed for this comment.
| uint inactiveCount; | ||
| auto fn = [&](){ inactiveCount = 0xFFFFFFFF; }; | ||
| inactiveCount = UInt32Math::Mul(this->GetInactiveCount(), this->GetCompileCount(), fn); | ||
| if (inactiveCount < inactiveThreshold) |
There was a problem hiding this comment.
inactiveCount < inactiveThreshold [](start = 16, length = 33)
The idea here is that if a function was parsed after having been redeferred, make it less likely to be deferred again, right? If so, shouldn't we multiply the threshold by the compileCount?
| (Attributes)(this->GetAttributes() & ~(Attributes::DeferredDeserialize | Attributes::DeferredParse)), | ||
| Js::FunctionBody::FunctionBodyFlags::Flags_HasNoExplicitReturnValue | ||
| #ifdef PERF_COUNTERS | ||
| , false /* is function from deferred deserialized proxy */ |
There was a problem hiding this comment.
Is this assert no longer valid? If so, can we just remove it?
| static_cast<uint16>(simpleJitLimit) - callCount - 1; | ||
| static_cast<uint16>(simpleJitLimit) - static_cast<uint16>(callCount) - 1; | ||
| } | ||
|
|
There was a problem hiding this comment.
Just silencing any possible complaint about overflow.
| else if (!canAllocInPreReservedHeapPageSegment && isAnyJittedCode) | ||
| { | ||
| *isAllJITCodeInPreReservedRegion = false; | ||
| } |
There was a problem hiding this comment.
not part of your change, right?
There was a problem hiding this comment.
Well, it's a real issue that my change exposed, probably by causing more re-jitting.
|
LGTM apart from the comments. |
|
@dotnet-bot please test Windows x86_release |
b5b2104 to
223b4a9
Compare
eligible for deferred parsing (e.g., not arrow functions, not functions-in-block). Define a force mode in which all eligible functions are redeferred on GC, as well as a 'stress' mode in which all candidates are redeferred on each stack probe.
Merge pull request #1585 from pleath:redefer Redefer function bodies that are not currently being executed and are eligible for deferred parsing (e.g., not arrow functions, not functions-in-block). Define a 'force' mode in which all eligible functions are redeferred on GC, as well as a 'stress' mode in which all candidates are redeferred on each stack probe.
Redefer function bodies that are not currently being executed and are eligible for deferred parsing (e.g., not arrow functions, not functions-in-block). Define a 'force' mode in which all eligible functions are redeferred on GC, as well as a 'stress' mode in which all candidates are redeferred on each stack probe.