Rework profiled to nop guard upgrades in VP - #6752
Merged
Merged
Conversation
jdmpapin
requested review from
0xdaryl,
mstoodle and
vijaysun-omr
as code owners
October 5, 2022 15:40
Contributor
|
This change looks good to me. |
vijaysun-omr
approved these changes
Oct 5, 2022
Contributor
|
Jenkins build all |
For all profiled guards (VFT test or method test), when the guard is not folded, replace it with a noppable guard if possible. Replacing a VFT test with a noppable guard is possible when there is a type bound C for the receiver, and C is the type expected by the VFT test, and C has not been extended. It's as though C is final (which would allow folding via a fixed-type constraint), but only until further notice. Replacing a method test with a noppable guard is possible when there is a type bound C for the receiver, and C has the expected method, and the expected method is not overridden. It's as though the expected method is final (which would allow folding), but only until further notice. By default such upgrades are performed only outside of the VM startup phase, since during startup the VM is still loading classes pretty frequently, so the non-extended or nonoverridden state is not as significant. To enable the transformation during startup, set the environment variable TR_upgradeToNopGuardDuringStartup. A new query VMEnv::isVMInStartupPhase(TR::Compilation*) is defined to detect this startup phase. It is intended for downstream projects to override. The default implementation arbitrarily returns false. There was pre-existing code that attempted to change profiled guards into nop guards, but it worked only for VFT tests, and only when the cold call was a virtual call (although part of the code appeared to be trying to handle interface calls). The new implementation also works for method tests and for interface calls, and in the case of method test, the logic that triggers the transformation is largely shared with other recent improvements to the handling of method test. As such, this commit deletes the prior implementation of this concept.
Contributor
|
Build break @jdmpapin |
jdmpapin
force-pushed
the
vp-guard-upgrade
branch
from
October 5, 2022 20:00
2b27a35 to
f4d53c2
Compare
Contributor
Author
|
Updated to remove a J9-ism |
Contributor
|
Jenkins build all |
Contributor
|
I know @jdmpapin is doing some more personal testing, and so I will await what he gets from that before I merge this. |
Contributor
Author
|
My testing has passed - this is good to go |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For all profiled guards (VFT test or method test), when the guard is not folded, replace it with a noppable guard if possible.
Replacing a VFT test with a noppable guard is possible when there is a type bound C for the receiver, and C is the type expected by the VFT test, and C has not been extended. It's as though C is final (which would allow folding via a fixed-type constraint), but only until further notice.
Replacing a method test with a noppable guard is possible when there is a type bound C for the receiver, and C has the expected method, and the expected method is not overridden. It's as though the expected method is final (which would allow folding), but only until further notice.
By default such upgrades are performed only outside of the VM startup phase, since during startup the VM is still loading classes pretty frequently, so the non-extended or nonoverridden state is not as significant. To enable the transformation during startup, set the environment variable
TR_upgradeToNopGuardDuringStartup.A new query
VMEnv::isVMInStartupPhase(TR::Compilation*)is defined to detect this startup phase. It is intended for downstream projects to override. The default implementation arbitrarily returns false.There was pre-existing code that attempted to change profiled guards into nop guards, but it worked only for VFT tests, and only when the cold call was a virtual call (although part of the code appeared to be trying to handle interface calls). The new implementation also works for method tests and for interface calls, and in the case of method test, the logic that triggers the transformation is largely shared with other recent improvements to the handling of method test. As such, this commit deletes the prior implementation of this concept.