-
Notifications
You must be signed in to change notification settings - Fork 397
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
Add isRelocatable boolean to power's loadAddressConstant API #4441
Add isRelocatable boolean to power's loadAddressConstant API #4441
Conversation
This boolean can be set by the caller to indicate that the instructions generated by loadAddressConstant need to be relocated. The reason we use this boolean is because the cg->comp()->compileRelocatableCode() query may not always return the correct answer for when relocatable code needs to be generated. For example: a regular JIT compile done remotely. So for now, we allow the caller to make the decision on if the instructions needs to be relocatable when not in an AOT compile. Signed-off-by: Dhruv Chopra <Dhruv.C.Chopra@ibm.com>
lookup schmemes 3 and 4 use the loadAddressConstant API to materialize addresses into a register. These instructions need to be relocatable. This commit specifies the boolean parameter correctly in order to indicate to the API that relocation for the instructions is necessary. Signed-off-by: Dhruv Chopra <Dhruv.C.Chopra@ibm.com>
When generating a TR_DataAddress contant using the loadAddressConstant API in accessStaticItem, we must provide the correct value for the isRelocatable parameter. This will allow the routine to create relocatable instructions for remote compilations. Signed-off-by: Dhruv Chopra <Dhruv.C.Chopra@ibm.com>
More uses of this new API can be seen in #4442 |
I have separated this PR into 3 commits to provide some logical flow and to make it easier to review. A note on the API change: Adding a new parameter to the function definition was a quick and flexible decision at the time that I was working on implementing JITServer support on Power. I'm not sure if this is the best long term solution for this problem. This is why I've opened this PR as a draft, so that we can decide on the final solution here. A better solution might be to replace the Also, |
This PR is part of the work in eclipse-openj9/openj9#6991 |
@ymanton Any thoughts on this API change? I can consolidate the Or please let me know if there's a better alternative. |
I think that would be preferable because it makes things simpler inside |
This boolean will now be used to represent if a relocation is needed for remote as well as AOT compiles. Doing so consolidates the two questions that the routine needs to answer. Since OMR is not aware of remote compilations, the decision on whether a relocation is required will not have to be made explicitly by the caller. Signed-off-by: Dhruv Chopra <Dhruv.C.Chopra@ibm.com>
Signed-off-by: Dhruv Chopra <Dhruv.C.Chopra@ibm.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also looked at how we handle the table
IL op which is similar, and that one is missing a JITServer check too, except it's not obvious. The data for that one is actually a table of branch instructions that are generated in the method itself, but we need to load the address of the table into a register and that needs relocation. The way we get that address into a register is by generating a label prior to the table and then calling fixedLoadLabelAddressIntoReg()
which will call addMetaDataFor64BitFixedLoadLabelAddressIntoReg()
which will check compileRelocatableCode()
.
Since addMetaDataFor64BitFixedLoadLabelAddressIntoReg()
is extensible we can just extend it in OpenJ9 and add a JITServer check, but we can also either use the query above or a new query like needRelocationsForTableEvaluationData()
for it.
I think we should stick to queries and have two separate queries since they're really straight forward, not too painful to add, and allow for some finer granularity and codegen flexibility.
The JITServer change in I will copy your suggestion there so we can keep track of it. |
a7bb668
to
50cbd53
Compare
50cbd53
to
d2bee3b
Compare
This query will maintain the current behaviour in OMR, while also allowing downstream projects to override its behaviour. Signed-off-by: Dhruv Chopra <Dhruv.C.Chopra@ibm.com>
d45969d
to
9c21024
Compare
This commit updates the consumers of this API to use it correctly after the new API changes. Signed-off-by: Dhruv Chopra <Dhruv.C.Chopra@ibm.com>
9c21024
to
fae6238
Compare
@ymanton This one is ready for another round of review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable.
@ymanton Thanks for the review! Once you're able to review eclipse-openj9/openj9#7796 and eclipse-openj9/openj9#7793, all three of these can be merged simultaneously. |
This new overload allows the consumer of the API to determine if a relocation record is needed. The overload is added because it will allow all consumers of this API to use the new definition of loadAddressConstant, while not breaking anything in downstream projects. Once the new definition has been accepted by downstream projects, they can begin to use the new API as well since if they choose to do so. Signed-off-by: Dhruv Chopra <Dhruv.C.Chopra@ibm.com>
@ymanton New overload defined and is now being used everywhere in OMR. PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Can you update the description and mention that it is now an overload of the existing function and is intended to be temporary? |
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@genie-omr build all |
The arm failure is:
This doesn't look related to the PR here. The x86 failure also looks unrelated as it looks like a cmake configuration issue:
The other tests passed. @fjeremic FYI. Not sure if we should to run the failing builds again or if we can ignore them. |
Changes are Power related so I'm confident in the builds which did pass. Given the infrastructure issues lately I'm ok with the current level of testing in this PR. |
This PR overloads the
loadAddressConstant
API on Power. We add a new boolean which allows the consumer of this API to determine if relocatable code needs to be generated.Once the commits are merged and have propagated into downstream projects, we will make the necessary API changes there and remove the old definition of the API since it will no longer be needed.