Skip to content

Make EntryPointInfo::callsCount usable by redeferral heuristic. #1757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

pleath
Copy link
Contributor

@pleath pleath commented Oct 17, 2016

Change the uint8's toi uint32's, which in turn allows us to dispense with the full-JIT code that saturates these values at 255.

…e the uint8's toi uint32's, which in turn allows us to dispense with the full-JIT code that saturates these values at 255.
Assert(simpleJitLimit == 0 ? callCount == 0 : simpleJitLimit > callCount);
return callCount == 0 ?
static_cast<uint16>(simpleJitLimit) :
static_cast<uint16>(simpleJitLimit) - callCount - 1;
static_cast<uint16>(simpleJitLimit) - static_cast<uint8>(callCount) - 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static_cast(callCount) [](start = 50, length = 29)

won't this give wrong values for callCount>255?

Copy link
Contributor Author

@pleath pleath Oct 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The call count can't be > 255 while we're decrementing from the simple JIT limit toward zero. We could probably do without the static cast, but I didn't want any static tools complaining about overflow.

@rajatd
Copy link
Contributor

rajatd commented Oct 28, 2016

IIRC, the reason for saturating the call count at 255 was that if it were allowed to grow to uin32_max, and we started bailing out, it will take a long time for the call count to get to 0 and, in turn, for us to rejit the function. Is that not a concern anymore?

@pleath
Copy link
Contributor Author

pleath commented Oct 30, 2016

I think @LouisLaf had an idea for mitigating this. Should be easy to add it later.


// bcs $overflow
Lowerer::InsertBranch(Js::OpCode::BrLt_A, true, overflowLabel, overflowLabel);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With int32, I think we don't even care about the overflow. Plus, with saturation, it doesn't fix the retiring problem, it just delays it.

@@ -1763,7 +1763,7 @@ void BailOutRecord::ScheduleFunctionCodeGen(Js::ScriptFunction * function, Js::S
bailOutRecordNotConst->bailOutCount++;

Js::FunctionEntryPointInfo *entryPointInfo = function->GetFunctionEntryPointInfo();
uint8 callsCount = entryPointInfo->callsCount;
uint32 callsCount = entryPointInfo->callsCount;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just change this to:
uint32 callsCount = MIN(entryPointInfo->callsCount, 255);
to retain the previous bailout behavior we had with saturation.

entryPointInfo->totalJittedLoopIterations = UINT8_MAX;
}
uint8 totalJittedLoopIterations = (uint8)entryPointInfo->totalJittedLoopIterations;
uint32 totalJittedLoopIterations = entryPointInfo->totalJittedLoopIterations;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uint32 totalJittedLoopIterations = entryPointInfo->totalJittedLoopIterations; [](start = 4, length = 77)

In keeping with @LouisLaf 's suggestion in ScheduleFunctionCodeGen, we should retain the existing code here.

@rajatd rajatd mentioned this pull request Nov 7, 2016
@pleath pleath closed this Nov 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants