-
Notifications
You must be signed in to change notification settings - Fork 720
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
Throw ArrayStoreException if null is stored in non-nullable array #20291
Throw ArrayStoreException if null is stored in non-nullable array #20291
Conversation
@a7ehuo, @0xdaryl, may I ask you to review this change? This change will require a coordinated merge with OMR pull request 7477. |
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, just minor comments related to code comments
I've added commit 686080c to address review comments. Once you're both OK with those changes, I can squash the commits. |
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. Thanks for the update!
Looks fine to me. Can you squash so I can launch the acceptance tests? |
686080c
to
0ea95d8
Compare
@0xdaryl, done. |
Jenkins test sanity.functional,sanity.openjdk all jdk8,jdk21 depends eclipse-omr/omr#7477 |
|
Running value types testing: Jenkins test sanity,extended xlinuxval jdknext depends eclipse-omr/omr#7477 |
Non-Valhalla failures are known, as you point out. Valhallla test failures are configuration related. Do you want to try and repair it and try again? |
It looks like this was due to the change recently introduced by pull request #20203. Previously, I had only intended to run I'll look at opening a pull request that will avoid expanding |
On second thought, I'm getting myself lost in the groovy scripts for the build. @AdamBrousseau, would it be possible to only expand |
Are you saying these PRs can be merged now or should wait for that testing? |
I was saying they can be merged. Sorry for the confusion. |
@hzongaro you'd probably be able to wrap this line in an
|
There was another coordinated merge merged on Oct 4 just before the acceptance tests for this PR were launched. I'd be more comfortable if you could rebase this PR (and its OMR counterpart) to pick up those changes just to be sure there are no conflicts. I'll use my judgement then on whether to relaunch the acceptance tests (I'm leaning toward "no" at this time from my quick inspection of the PRs). |
Attempting to store a null reference to a non-nullable array is expected to throw an ArrayStoreException. Previously that was expected to result in a NullPointerException. This modifies Tree Lowering optimization's transformation of calls to <nonNullableArrayNullStoreCheckhelper> to use ZEROCHK to call jitArrayStoreException if the value to be stored is null and the array is non-nullable. Further, if Value Propagation determines at compile-time that an array is non-nullable, it used to generate a NULLCHK for the value. With this change, it will generate a ZEROCHK that tests whether the value is a null reference. Finally, this change renames the utility method TR_J9VMBase::checkArrayCompClassPrimitiveValueType to TR_J9VMBase::testIsArrayClassNullRestrictedType, to reflect more recent terminology. It also removes the argument that expected an "if" OpCode and will instead generate IL that yields a zero or non-zero result to indicate whether the array is null-restricted, leaving it to the caller to decide whether to generate IL that will branch or perform some other action based on the result. Signed-off-by: Henry Zongaro <zongaro@ca.ibm.com>
0ea95d8
to
3cd0898
Compare
Rebased changes onto current HEAD of master branch. |
In the value types prototype implementation, attempting to store a null reference to a non-nullable array is expected to throw an
ArrayStoreException
. Previously that was expected to result in aNullPointerException
. This pull request modifies Tree Lowering optimization's transformation of calls to<nonNullableArrayNullStoreCheckhelper>
to useZEROCHK
to calljitArrayStoreException
if the value to be stored is null and the array is non-nullable.Further, if Value Propagation determines at compile-time that an array is non-nullable, it used to generate a
NULLCHK
for the value. With this change, it will generate aZEROCHK
that tests whether the value is a null reference.Finally, this change renames the utility method
TR_J9VMBase::checkArrayCompClassPrimitiveValueType
toTR_J9VMBase::testIsArrayClassNullRestrictedType
, to reflect more recent terminology. It also removes the argument that expected an "if" OpCode and will instead generate IL that yields a zero or non-zero result to indicate whether the array is null-restricted, leaving it to the caller to decide whether to generate IL that will branch or perform some other action based on the result.