-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8270086: ARM32-softfp: Do not load CONSTANT_double using the condy helper methods in the interpreter #4767
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
Conversation
…lper methods in the interpreter
|
👋 Welcome back cgo! A progress list of the required criteria for merging this PR into |
Webrevs
|
|
/cc hotspot-runtime |
|
@dean-long |
|
@dholmes-ora or @coleenp, could you maybe have a look at this, since you already looked into #4582? |
|
Sorry @mychris I never noticed this PR mail. I have taken a look and the logic seems sounds to me but I'm no expert at writing ARM code so I can't really approve it in detail. David |
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 see that this patch does, and I think it goes in the right direction. Let's follow the form of other arches TemplateTable::ldc2_w does, and what other places in ARM32 template interpreter do?
These are my suggestions:
- Rename label
CondytoNotLong - Rename label
exittoDone - Handle only double path under !_ABI_HARD_PATH
Something like (drafting it blindly):
Label NotDouble, NotLong, Done;
__ cmp(Rtemp, JVM_CONSTANT_Double);
__ b(NotDouble, ne);
#ifdef __ABI_HARD__
__ ldr_double(D0_tos, Address(Rbase, base_offset));
#else
__ ldr(R0_tos_lo, Address(Rbase, base_offset + 0 * wordSize));
__ ldr(R1_tos_hi, Address(Rbase, base_offset + 1 * wordSize));
#endif
__ push(dtos);
__ b(Done);
__ bind(NotDouble);
__ cmp(Rtemp, JVM_CONSTANT_Long);
__ b(NotLong, ne);
__ ldr(R0_tos_lo, Address(Rbase, base_offset + 0 * wordSize));
__ ldr(R1_tos_hi, Address(Rbase, base_offset + 1 * wordSize));
__ push(ltos);
__ b(Done);
__ bind(NotLong);
condy_helper(Done);
__ bind(Done);
|
TBH, I am not even sure that we need to check |
|
Thanks for looking into this, Aleksey. I will look into your suggestions. The reason I did a bigger #ifdef block was, because I think the problem was introduced because the softfp path was mixed into the hardfp one. For me, this makes the softfp path harder to understand, in contrast to my suggested solution. I know that having bigger #ifdef brings other problems with it. Do you think it is better to keep the #ifdef as small as possible and mix the softfp path into the hardfp?
I don't quite understand what you mean here. Both, ABI_HARD and SOFTFP should be macros which specify which ABI should be used, so for me, if |
|
AFAICS, the real problem is that "double" path is not implemented for "!ABI_HARD" path, so it slides right into condy helper, right? Which calls for fixing that part, and that part only. This also avoids touching the "long" path and relying on the "ltos" being fine for doubles. Other parts of template interpreter deal with this already, see AFAIU, |
That makes sense.
My assumption was that This suggests that we need to be consistent within the template interpreter and always use |
|
I changed the code as suggested. Now SOFTFP is used instead of ABI_HARD and the |
shipilev
left a comment
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.
This looks fine to me, thanks! Assuming it passes tier1 on soft/hard-float targets, we are good to go.
|
@mychris This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 209 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@shipilev) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
|
Yes, hotspot tier1 on ARMv7-A (hard fload) and ARMv5TE (soft float) are passing. |
OK, good. I'll be happy to sponsor this. |
|
Thanks, but don't we need a second reviewer, or is this change trivial enough? |
For ARM-specific code, I don't think you would get more Oracle reviewers. Maybe @bulasevich wants to take a look. |
|
(I am not a formal reviewer) I like the change. Though I do catch what was the original motivation, was it an incorrect behavior? Is there any test for that? And, frankly, I do not quite understand (NotLong && NotDouble) case for ldc2_w bytecode template which is designed to get long or double. Is condy_helper ever called here? |
|
Thanks for looking into this. The motivation is an incorrect behavior. The For this specific faulty behavior, there is no test case and I don't think there can be one, as loading is done using the wrong path, but still succeeds. I don't think there are any test cases for loading primitive constants (as this is done while loading the runtime and therefor tested alot without a specific test case). There are some tests for constant dynamics in |
|
Ok, thanks. |
|
Thank you. |
|
/sponsor |
|
Going to push as commit a066c7b.
Your commit was automatically rebased without conflicts. |
Hi,
please review this fix for the template interpreter for ARM32-softfp.
With the introduction of condy, the interpreter started to load double constants using the condy_helper, which is unnecessary. Also, the resolve_ldc implementation of the interpreter runtime might not be designed to load constant values. It should only load strings and condy.
jdk/src/hotspot/cpu/arm/templateTable_arm.cpp
Lines 515 to 560 in 2ee56fd
I refactored the ldc2_w bytecode imlpementation. Now, the ifdef between soft and hard float covers both types, CONSTANT_Long and CONSTANT_Double. I did this, because for the softfp, we can use a conditional cmp, since double and long are both placed on the stack in the same way. The same is also done for CONSTANT_Integer and CONSTANT_Float in the ldc bytecode implementation. Also, I think it is easier to follow the code this way.
Old ldc2_w implementation (before condy was implemented for ARM32):
jdk/src/hotspot/cpu/arm/templateTable_arm.cpp
Lines 497 to 537 in 7101b28
Testing: ARMv7-A (hardfp) hotspot tier1, ARMv5TE (softfp) hotspot tier1
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4767/head:pull/4767$ git checkout pull/4767Update a local copy of the PR:
$ git checkout pull/4767$ git pull https://git.openjdk.java.net/jdk pull/4767/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 4767View PR using the GUI difftool:
$ git pr show -t 4767Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4767.diff