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

Refactor NullChk Evaluators to OpenJ9 #3530

Closed
dchopra001 opened this issue Jan 30, 2019 · 5 comments · Fixed by #4581
Closed

Refactor NullChk Evaluators to OpenJ9 #3530

dchopra001 opened this issue Jan 30, 2019 · 5 comments · Fixed by #4581

Comments

@dchopra001
Copy link
Contributor

dchopra001 commented Jan 30, 2019

The follow evaluators:
NULLCHKEvaluator
resolveAndNULLCHKEvaluator

should be moved to OpenJ9. Currently, the x86 implementations are the only ones defined in OpenJ9. The ARM, Power, and Z codegen implementations are in OMR. For example, the OMR implementation for Z is here (ARM and Power implementations can be found in their respective directories):
https://github.com/eclipse/omr/blob/a733f7fc302de366bdc87bca57fdb6d4a8537f4b/compiler/z/codegen/ControlFlowEvaluator.cpp#L2549-L2553

And here:
https://github.com/eclipse/omr/blob/a733f7fc302de366bdc87bca57fdb6d4a8537f4b/compiler/z/codegen/ControlFlowEvaluator.cpp#L2478-L2482

On the other hand, the x86 implementations can be found in the OpenJ9 repository:
https://github.com/eclipse/openj9/blob/071bae0a8b4de6b9ef94da70dd8cc888f0c1eafd/runtime/compiler/x/codegen/J9TreeEvaluator.cpp#L2126-L2135

The ARM, Power and Z implementations should also be moved to OpenJ9.

While making this change, we should move the TR::TreeEvaluator::evaluateNULLCHKWithPossibleResolve routine to OpenJ9 as well.

@mhaque5
Copy link
Contributor

mhaque5 commented Sep 19, 2019

Working on this. If anyone has any suggestions, please share.

@aarongraham9
Copy link
Contributor

Any thoughts on this one @0xdaryl?

@Leonardo2718
Copy link
Contributor

Thinking on this a bit, I'm wondering whether moving these evaluators to OpenJ9 is the right thing to do.

The definition of these opcodes is in OMR so keeping their evaluators in OMR seems appropriate. More generally, I think it makes sense to keep evaluators and opcode definitions in the same project (I know this is not always the case currently because of historic reasons).

That said, I can see arguments for why NULLCHK and resolveAndNULLCHK could be considered "Java opcodes" and should, therefore, be moved to OpenJ9. Moving the opcodes themselves though will require more discussion.

In the case of NULLCHK, the current implementation may be Java-focused, but the general concept of a null-check is applicable to other languages. So, it could be possible to use the NULLCHK opcode in other languages with some OMR-side refactoring. For resolveAndNULLCHK, I find it a little harder to see how it could be used outside of a Java context as not many other languages have the concept of unresolved symbols.

In any case, I think a little more thought is needed as to whether moving the evaluators for these opcodes to OpenJ9 without the opcodes themselves the right thing to do.

mhaque5 added a commit to CAS-Atlantic/omr that referenced this issue Nov 20, 2019
This commit moves the following functions from OMR to OpenJ9
for ARM, Power, Z and Aarch64 codegen implementations:
- NULLCHKEvaluator
- resolveAndNULLCHKEvaluator
- evaluateNULLCHKWithPossibleResolve

All these functions are moved to OpenJ9 and are no longer needed in OMR.

Fixes: eclipse-omr#3530
Signed-off-by: Md. Ariful Haque <mhaque5@unb.ca>
@mhaque5
Copy link
Contributor

mhaque5 commented Nov 20, 2019

Necessary changes have been made according to the instructions. Please, review it. Thanks in advance.

@0xdaryl
Copy link
Contributor

0xdaryl commented Nov 20, 2019

The semantics of the entire family of "check" opcodes all need to be properly specified from an OMR point-of-view. The semantics of what "thing" is being checked, how that check is accomplished, and what the course of action is when the check passes or fails need to be worked out in a project-neutral way. I'm not convinced (yet) that it is possible, but I do believe that some progress can be made. However, I don't think OMR will have answers to those questions in the short term.

For the NULLCHK case specifically, the code generator evaluators are largely unchanged from when OMR was distilled from OpenJ9. In effect, they are the OpenJ9 implementations and executing that implementation can only occur exclusively in an OpenJ9 VM. They shouldn't need to exist in OMR simply to provide inspiration for when the opcode semantics are properly specified, as we can simply look at OpenJ9 for such information.

This issue, I believe, is about relocating something highly OpenJ9-specific to the OpenJ9 project. Yes, check opcodes need a proper specification and perhaps a default implementation but I don't think there's a strong reason to keep this code around in OMR until that happens.

mhaque5 added a commit to CAS-Atlantic/openj9 that referenced this issue Nov 21, 2019
This commit moves the following functions from OMR to OpenJ9
for ARM, Power, Z and Aarch64 codegen implementations:
- NULLCHKEvaluator
- resolveAndNULLCHKEvaluator
- evaluateNULLCHKWithPossibleResolve

Issue: eclipse-omr/omr#3530
Signed-off-by: Md. Ariful Haque <mhaque5@unb.ca>
babsingh pushed a commit to babsingh/omr that referenced this issue Dec 9, 2019
This commit moves the following functions from OMR to OpenJ9
for ARM, Power, Z and Aarch64 codegen implementations:
- NULLCHKEvaluator
- resolveAndNULLCHKEvaluator
- evaluateNULLCHKWithPossibleResolve

All these functions are moved to OpenJ9 and are no longer needed in OMR.

Fixes: eclipse-omr#3530
Signed-off-by: Md. Ariful Haque <mhaque5@unb.ca>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants