Skip to content
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

Fix SVM Assert #4635

Merged
merged 2 commits into from
Feb 12, 2019
Merged

Fix SVM Assert #4635

merged 2 commits into from
Feb 12, 2019

Conversation

dsouzai
Copy link
Contributor

@dsouzai dsouzai commented Feb 6, 2019

When enabling SVM asserts for AOT w/ SVM, an assert will
trigger during the relocation of an inlined site if its caller is a
profiled inlined method who's site was disabled (as part of its
relocation). This is because, under the SVM, relocation of the inlined
table entries are guaranteed (meaning, though the inlined site may be
disabled, the J9Method pointer in the inlined table in the metadata will
be updated to not be -1). However, when a profiled inlined method is
relocated, it does not go through the same code path as other inlined
method relocations, and so did not fix up the metadata when the site was
disabled.

This PR refactors the profiled inlined method relocation to use the
class ID from the SVM. It also relocates the inlined table entry
regardless of whether the inlined site can be activated.

@dsouzai
Copy link
Contributor Author

dsouzai commented Feb 6, 2019

fyi @aviansie-ben

@fjeremic
Copy link
Contributor

fjeremic commented Feb 7, 2019

At a quick glance the PR title does not match what the commit is doing.

@dsouzai
Copy link
Contributor Author

dsouzai commented Feb 7, 2019

Heh yeah it's not immediately obvious, but i still have to write up proper commit messages, as well as a proper PR description (hence the WIP).

Irwin D'Souza added 2 commits February 7, 2019 10:12
Signed-off-by: Irwin D'Souza <dsouzai@ca.ibm.com>
When enabling SVM asserts for AOT w/ SVM, an assert will
trigger during the relocation of an inlined site if its caller is a
profiled inlined method who's site was disabled (as part of _its_
relocation). This is because, under the SVM, relocation of the inlined
table entries are guaranteed (meaning, though the inlined site may be
disabled, the J9Method pointer in the inlined table in the metadata will
be updated to *not* be -1). However, when a profiled inlined method is
relocated, it does not go through the same code path as other inlined
method relocations, and so did not fix up the metadata when the site was
disabled.

This commit refactors the profiled inlined method relocation to use the
class ID from the SVM. It also relocates the inlined table entry
regardless of whether the inlined site can be activated.

Signed-off-by: Irwin D'Souza <dsouzai@ca.ibm.com>
@dsouzai dsouzai changed the title WIP: Fix SVM Assert Fix SVM Assert Feb 7, 2019
@dsouzai
Copy link
Contributor Author

dsouzai commented Feb 7, 2019

@jdmpapin could you please review?

@@ -2277,27 +2293,22 @@ TR_RelocationRecordInlinedMethod::inlinedSiteValid(TR_RelocationRuntime *reloRun
}
else
{
inlinedSiteIsValid = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any particular significance in moving this line below the assertion? Just curious; it looks harmless

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Initially, I had moved the code that checks compileRomClass == currentRomClass into inlinedSiteCanBeActivated at whcih point the inlinedSiteIsValid = false; got changed to a return false, and so had to be moved after the check for SVM. It turns out commoning that code to also be used for profiled inlined methods didn't work (because the rom class stored in the relorecord was not the rom class of the method that was inlined), so I had to un-refactor the code. I guess that resulted in the inlinedSiteIsValid = false ended up after the if :).

TR_OpaqueMethodBlock *inlinedMethod = * (TR_OpaqueMethodBlock **) (((uint8_t *)reloPrivateData->_inlinedCodeClass) + vTableSlot(reloTarget));
inlinedMethod = * (TR_OpaqueMethodBlock **) (((uint8_t *)reloPrivateData->_inlinedCodeClass) + vTableSlot(reloTarget));
if (!inlinedMethod)
inlinedSiteIsValid = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it's possible for the vtable slot to be null

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see, do you think it's fine as is, or would you prefer I rebase with this check removed?

Copy link
Contributor

@jdmpapin jdmpapin Feb 8, 2019

Choose a reason for hiding this comment

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

I'd ask for it to be changed if there were something else to necessitate a round of updates, but I think it can be left alone. It doesn't really hurt

if (inlinedMethod)
fixInlinedSiteInfo(reloRuntime, reloTarget, inlinedMethod);
else if (reloRuntime->comp()->getOption(TR_UseSymbolValidationManager))
SVM_ASSERT(inlinedMethod != NULL, "inlinedMethod should not be NULL when using the SVM!");
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -294,6 +294,7 @@ uint8_t *J9::X86::AheadOfTimeCompile::initializeAOTRelocationHeader(TR::Iterated
case TR_ProfiledMethodGuardRelocation :
{
guard = (TR_VirtualGuard *)relocation->getTargetAddress2();
TR_OpaqueClassBlock *inlinedCodeClass = guard->getThisClass();
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the profiled class, yes? Not the defining class of the method, which may have been inherited

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that's right, we don't store the romclass of the defining class of the method.

@dsouzai
Copy link
Contributor Author

dsouzai commented Feb 8, 2019

@fjeremic do you mind shepherding this PR (since you're already here :P)

@dsouzai
Copy link
Contributor Author

dsouzai commented Feb 8, 2019

jenkins test sanity xlinux,win,plinux,zlinux jdk8,jdk11

@dsouzai
Copy link
Contributor Author

dsouzai commented Feb 8, 2019

jenkins test sanity all jdk8,jdk11

@ymanton ymanton merged commit ffe5c59 into eclipse-openj9:master Feb 12, 2019
@dsouzai dsouzai deleted the fixAssertIssue branch October 15, 2019 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants