Remove implicit sign extension assumptions from iRegStore evaluator (0.15.0) #30
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.
The
TR::iRegStore
evaluator on Z makes an implicit assumption that ifthe value being globally stored is a conversion of an appropriate type,
for example
TR::su2i
of aTR::cloadi
then the evaluators will havegenerated a full 64-bit sign extended load.
This is very dangerous as an evaluator should never implicitly assume
another evaluator will generate a specific instruction sequence to
perform some action. Because of this implicit assumption the
TR::iRegStore
evaluator omitted the generation of an explicit signextension and just assumed the evaluator has already done it. It then
marked the register via the
setAlreadySignExtended
API that theextension has been performed. Later a
TR::i2l
conversion operationconsumes the value of the
TR::su2i
and it checks whether the childregister has been marked via the
alreadySignExtended
API in whichcase it would return true, however no sign extension was performed.
This ends up being a functional problem as we could have garbage values
in the high-order 32-bits which were never cleared.
Rather than allowing implicit assumptions about sign extensions we
leave that to the LoadExtensions optimization and perform the sign
extension explicitly via an
LGFR
instruction.An example of the trees encountered is the following:
Fixes: eclipse-openj9/openj9#6248
Port of eclipse-omr/omr#4103
Signed-off-by: Filip Jeremic fjeremic@ca.ibm.com