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

Fix null restricted array related issues for value types #20112

Merged

Conversation

a7ehuo
Copy link
Contributor

@a7ehuo a7ehuo commented Sep 4, 2024

(1) Add utility methods for null restricted arrays
(2) Fix null restricted array related issues

  • Add recognized method jdk/internal/value/ValueClass.newArrayInstance
  • Add VP fixed class constraint if ValueClass.newArrayInstance creates null restricted array
  • Rename isArrayCompTypePrimitiveValueType to isArrayNullRestricted to reflect the updated logic
  • Update isArrayNullRestricted on how to determine whether or not an array is a null restricted array
  • Disable transformation based on type hint which is no longer sufficient enough to decide whether or not the array is null restricted or not
  • If flattenable arrays are enabled, do not create fixed class constraint for parm array class based on signature since both nullable and null restricted arrays share the same signature

Depends on

Related: #19913, #19914, #19708

@a7ehuo a7ehuo added comp:jit project:valhalla Used to track Project Valhalla related work depends:omr Pull request is dependent on a corresponding change in OMR depends:omr:breaking labels Sep 4, 2024
@a7ehuo a7ehuo requested a review from hzongaro September 4, 2024 18:12
@a7ehuo a7ehuo force-pushed the PR-valuetypes-null-restricted-array branch 2 times, most recently from c469e30 to 516a676 Compare September 4, 2024 18:21
@a7ehuo
Copy link
Contributor Author

a7ehuo commented Sep 4, 2024

@hzongaro May I ask you to review this change? Thank you very much!

This PR is created as a draft and marked as WIP for now because of all the dependencies. Regarding to the implementation itself, it is ready for review.

Since this PR depends on eclipse-omr/omr#7452, it should be review along with eclipse-omr/omr#7452.

Copy link
Member

@hzongaro hzongaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these changes look good - just a few minor comments.

Could you expand on the reason for these changes in the commit comment? May I also ask you to remove the Markdown from the commit comment?

runtime/oti/j9.h Outdated Show resolved Hide resolved
runtime/compiler/env/VMJ9.h Show resolved Hide resolved
runtime/compiler/env/VMJ9.cpp Outdated Show resolved Hide resolved
runtime/compiler/env/VMJ9.cpp Outdated Show resolved Hide resolved
runtime/compiler/env/J9ClassEnv.cpp Show resolved Hide resolved
runtime/compiler/env/VMJ9Server.cpp Outdated Show resolved Hide resolved
Copy link
Member

@hzongaro hzongaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry - I somehow neglected to review the Value Propagation changes in my first pass through this pull request

runtime/compiler/optimizer/J9ValuePropagation.cpp Outdated Show resolved Hide resolved
runtime/compiler/env/j9method.cpp Outdated Show resolved Hide resolved
runtime/compiler/optimizer/J9ValuePropagation.cpp Outdated Show resolved Hide resolved
runtime/compiler/optimizer/J9ValuePropagation.cpp Outdated Show resolved Hide resolved
runtime/compiler/optimizer/J9ValuePropagation.cpp Outdated Show resolved Hide resolved
runtime/compiler/optimizer/J9ValuePropagation.cpp Outdated Show resolved Hide resolved
runtime/compiler/optimizer/J9ValuePropagation.cpp Outdated Show resolved Hide resolved
runtime/compiler/optimizer/J9ValuePropagation.cpp Outdated Show resolved Hide resolved
@a7ehuo a7ehuo force-pushed the PR-valuetypes-null-restricted-array branch 2 times, most recently from bb24a35 to 3af4ff9 Compare October 8, 2024 15:33
@a7ehuo a7ehuo marked this pull request as ready for review October 8, 2024 15:34
@a7ehuo a7ehuo requested a review from dsouzai as a code owner October 8, 2024 15:34
@a7ehuo a7ehuo changed the title WIP: Fix null restricted array related issues for value types Fix null restricted array related issues for value types Oct 8, 2024
@a7ehuo
Copy link
Contributor Author

a7ehuo commented Oct 8, 2024

@hzongaro All comments have been addressed in the latest commits, except for the following three that will be addressed in the future PRs due to the complexity. Ready for another review. Thank you!

(1) #20112 (comment)
(2) #20112 (comment)
(3) #20112 (comment)

Please note that I have rebased this PR to the latest master branch and this PR requires coordinated merge with eclipse-omr/omr#7452.

Copy link
Member

@hzongaro hzongaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates! Just a few more comments.

runtime/compiler/env/j9method.cpp Outdated Show resolved Hide resolved
runtime/compiler/optimizer/J9ValuePropagation.cpp Outdated Show resolved Hide resolved
runtime/compiler/optimizer/J9ValuePropagation.cpp Outdated Show resolved Hide resolved
runtime/compiler/runtime/SymbolValidationManager.cpp Outdated Show resolved Hide resolved
@a7ehuo a7ehuo force-pushed the PR-valuetypes-null-restricted-array branch 5 times, most recently from d9a0a5c to de9f0d5 Compare October 11, 2024 22:19
Whether or not an array is null-restricted is no longer
decided by array component type but by the
J9ClassArrayIsNullRestricted flag in array class.

Only the nullRestrictedArrayClass of the J9Class has
J9ClassArrayIsNullRestricted set.

(1)
Add getNullRestrictedArrayClassFromComponentClass
to retrieve nullRestrictedArrayClass from J9Class

(2)
Add isArrayNullRestricted to check if an array class
is null restricted by checking J9ClassArrayIsNullRestricted.

Signed-off-by: Annabelle Huo <[email protected]>
@a7ehuo a7ehuo force-pushed the PR-valuetypes-null-restricted-array branch from de9f0d5 to 135b856 Compare October 11, 2024 22:32
@a7ehuo
Copy link
Contributor Author

a7ehuo commented Oct 11, 2024

@hzongaro All comments are addressed. Ready for another review. Thank you!

I rebased the code in order to resolve the merge conflict in CommunicationStream.hpp

@a7ehuo a7ehuo force-pushed the PR-valuetypes-null-restricted-array branch from 135b856 to 6782be9 Compare October 11, 2024 22:40
Copy link
Member

@hzongaro hzongaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates! Just a couple of more minor comments.

runtime/compiler/optimizer/J9ValuePropagation.cpp Outdated Show resolved Hide resolved
runtime/compiler/optimizer/J9ValuePropagation.cpp Outdated Show resolved Hide resolved
@a7ehuo a7ehuo force-pushed the PR-valuetypes-null-restricted-array branch from 6782be9 to cc811af Compare October 15, 2024 16:46
@a7ehuo
Copy link
Contributor Author

a7ehuo commented Oct 15, 2024

@hzongaro All comments are addressed. Ready for another review. Thank you!

Copy link
Member

@hzongaro hzongaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks!

@hzongaro
Copy link
Member

Jenkins test sanity.functional,extended.functional xlinuxval,plinuxval,zlinuxval,alinuxval jdknext depends eclipse-omr/omr#7452

@hzongaro
Copy link
Member

Jenkins test sanity.functional,sanity.openjdk xlinuxvalst,plinuxvalst,zlinuxvalst,alinuxvalst jdknext depends eclipse-omr/omr#7452

@hzongaro
Copy link
Member

Jenkins test sanity.functional,sanity.openjdk all jdk8,jdk11,jdk17,jdk21 depends eclipse-omr/omr#7452

@a7ehuo
Copy link
Contributor Author

a7ehuo commented Oct 16, 2024

Test_openjdk11_j9_sanity.openjdk_aarch64_linux_Personal: Known issue #13756

[2024-10-15T20:03:29.491Z] java.lang.Exception
[2024-10-15T20:03:29.491Z] 	at ReplayCacheTestProc.main0(ReplayCacheTestProc.java:279)
[2024-10-15T20:03:29.491Z] 	at ReplayCacheTestProc.main(ReplayCacheTestProc.java:326)
[2024-10-15T20:03:29.491Z] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2024-10-15T20:03:29.491Z] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[2024-10-15T20:03:29.491Z] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2024-10-15T20:03:29.491Z] 	at java.base/java.lang.reflect.Method.invoke(Method.java:572)
[2024-10-15T20:03:29.491Z] 	at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
[2024-10-15T20:03:29.491Z] 	at java.base/java.lang.Thread.run(Thread.java:839)
[2024-10-15T20:03:29.491Z] java.lang.Exception
[2024-10-15T20:03:29.491Z] 	at ReplayCacheTestProc.main0(ReplayCacheTestProc.java:279)
[2024-10-15T20:03:29.491Z] 	at ReplayCacheTestProc.main(ReplayCacheTestProc.java:326)
...
[2024-10-15T20:04:55.398Z] jdk_security4_0_FAILED

Test_openjdk11_j9_sanity.openjdk_x86-64_windows_Personal: Known issue #17743

[2024-10-16T02:47:35.873Z] java.lang.RuntimeException: PortUnreachableException not thrown.
[2024-10-16T02:47:35.873Z] 	at Unreachable.main(Unreachable.java:102)
...
[2024-10-16T02:52:31.349Z] jdk_security4_1_FAILED

Test_openjdk17_j9_sanity.openjdk_ppc64_aix_Personal: Known issue: #19962

[2024-10-15T22:10:03.705Z] ACTION: main -- Error. Agent communication error: java.io.EOFException; check console log for any additional details
[2024-10-15T22:10:03.705Z] REASON: Assumed action based on file name: run main TestCipherMode 
...
[2024-10-15T22:15:02.584Z] jdk_security2_1_FAILED

Test_openjdk17_j9_sanity.openjdk_x86-64_windows_Personal: Known issue #18708

[2024-10-16T01:51:10.631Z] Caused by: java.lang.OutOfMemoryError: Java heap space
[2024-10-16T01:51:10.631Z] 	at java.base/java.lang.String.repeat(String.java:5202)
...
[2024-10-16T02:02:18.562Z] jdk_util_0_FAILED

Test_openjdk8_j9_sanity.functional_x86-64_linux_Personal: Known issue: #19224

[2024-10-15T22:44:29.181Z]  [ERR] /home/jenkins/workspace/Test_openjdk8_j9_sanity.functional_x86-64_linux_Personal_testList_1/aqa-tests/TKG/../../jvmtest/functional/cmdLineTests/jitserver/jitserverconfig.sh: line 30: lsof: command not found
...
[2024-10-15T22:44:29.181Z] testJitserverArguments_0_FAILED

Valhalla test passes on x86-64 which is what I have tested locally. Valhalla on other platforms (Power, Z, aarch64) fail, which I will take a look at next.

I'm not sure about vt_standard tests yet

@hzongaro
Copy link
Member

hzongaro commented Oct 16, 2024

I took a quick look at the sanity.functional and sanity.openjdk "vt-standard" testing. It looks like those tests have seen many failures in recent runs. For instance, an aarch64 Linux sanity.functional vt-standard PR test run from earlier this month yielded 55 failures.

We'll need to do further investigation, but it seems unlikely that this pull request is responsible for the failures. These failures will not hold back merging this pull request.

@a7ehuo
Copy link
Contributor Author

a7ehuo commented Oct 16, 2024

Valhalla test passes on x86-64 which is what I have tested locally. Valhalla on other platforms (Power, Z, aarch64) fail, which I will take a look at next.

Two main tests fail on Power, Z, and Aarch64: ValueTypeArrayTestsJIT and ValueTypeSystemArraycopyTests.

I looked at the failure in ValueTypeArrayTestsJIT first. The failure is related to how instanceOf is evaluated on Power, Z, and Aarch64. On x86, we call helper jitInstanceOf which explains why it passes.

It failed because instanceOf doesn't think null restricted array PointPV[] is an instance of [Lorg/openj9/test/lworld/ValueTypeArrayTests$PointPV; in ValueTypeArrayTests.runTest

[ValueTypeArrayTests] [INFO] calling runTest testArrays[3] NullRestrictedArray nullObj kinds[0] OBJ_TYPE 1 kinds[0] OBJ_TYPE 1
[ValueTypeArrayTests] [INFO] --------------------------
[ValueTypeArrayTests] [INFO] runTest staticArrayKind=OBJ_TYPE 1 staticSourceKind=OBJ_TYPE 1
[ValueTypeArrayTests] [INFO] runTest arr: actualArrayKind=IFACE_TYPE 2 sourceVal: actualSourceKind=NULL_REF 0 //<--- wrong actualArrayKind should be PRIM_TYPE 4 since testArrays[3] is NullRestrictedArray
[ValueTypeArrayTests] [INFO] runTest expectedExceptionClass null
[ValueTypeArrayTests] [INFO] assignDispatch arrKind=OBJ_TYPE srcKind=OBJ_TYPE idx=1
[ValueTypeArrayTests] [INFO] runTest caughtThrowable=java.lang.ArrayStoreException

@hzongaro
Copy link
Member

I looked at the failure in ValueTypeArrayTestsJIT first. The failure is related to how instanceOf is evaluated on Power, Z, and Aarch64. On x86, we call helper jitInstanceOf which explains why it passes.

It failed because instanceOf doesn't think null restricted array PointPV[] is an instance of [Lorg/openj9/test/lworld/ValueTypeArrayTests$PointPV; in ValueTypeArrayTests.runTest

Thanks, @a7ehuo! Should the relevant tests still be disabled and an issue opened, or do you plan to try to fix this problem in this pull request?

@a7ehuo
Copy link
Contributor Author

a7ehuo commented Oct 17, 2024

I plan to disable the related two tests (ValueTypeArrayTestsJIT, ValueTypeSystemArraycopyTests) for now and open new PRs when ready.

There are already issues opened on them. I think I will reuse them for future submission. I will make a note in these two issues that this PR doesn't fix them on all hardware.
#19913
#19914

I'll run some Jenkins Valhalla tests on all platforms before pushing another commit

(1) Add recognized methods from jdk/internal/value/ValueClass
and jdk/internal/value/NullRestrictedCheckedType

(2)
Add VP fixed class constraint if ValueClass.newArrayInstance
creates null restricted array using NullRestrictedCheckedType

(3)
Rename isArrayCompTypePrimitiveValueType
to isArrayNullRestricted to reflect the updated logic

Update isArrayNullRestricted on how to determine
whether or not an array is a null restricted array

(4)
Disable transformation based on type hint which is no longer
sufficient enough to decide whether or not the array is null
restricted or not

(5)
If flattenable arrays are enabled, do not create fixed class
constraint for parm array class based on signature since
both nullable and null restricted arrays share the same signature

Related: eclipse-openj9#19913, eclipse-openj9#19914, eclipse-openj9#19708

Signed-off-by: Annabelle Huo <[email protected]>
@a7ehuo a7ehuo force-pushed the PR-valuetypes-null-restricted-array branch from cc811af to f2c432a Compare October 18, 2024 17:44
@a7ehuo
Copy link
Contributor Author

a7ehuo commented Oct 18, 2024

@hzongaro I reverted test/functional/Valhalla/playlist.xml to baseline and tested internally that the Valhalla functional tests pass on all platforms. It's ready for another review. Thanks you!

Copy link
Member

@hzongaro hzongaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks! I'll rerun testing, in order to verify that the playlist.xml was updated correctly, and also so I can ensure the coordinated merge that will be required can proceed.

@hzongaro
Copy link
Member

Jenkins test sanity.functional,extended.functional xlinuxval,plinuxval,zlinuxval,alinuxval jdknext depends eclipse-omr/omr#7452

@hzongaro
Copy link
Member

Jenkins test sanity.functional,sanity.openjdk all jdk8,jdk11,jdk17,jdk21 depends eclipse-omr/omr#7452

@hzongaro
Copy link
Member

Jenkins test sanity.functional,sanity.openjdk xmac jdk11 depends eclipse-omr/omr#7452

@a7ehuo
Copy link
Contributor Author

a7ehuo commented Oct 21, 2024

Checked three failed tests and all known issues (details as below).

Waiting for openjdk11_j9_sanity.functional_x86-64_mac to complete

Test_openjdk21_j9_sanity.openjdk_x86-64_mac: Known issue: #19987

[2024-10-21T02:28:49.205Z] STDERR:
[2024-10-21T02:28:49.205Z] javax.security.auth.login.LoginException: Unable to obtain Principal Name for authentication 
[2024-10-21T02:28:49.205Z] 	at jdk.security.auth/com.sun.security.auth.module.Krb5LoginModule.promptForName(Krb5LoginModule.java:818)
…

[2024-10-21T02:29:13.877Z] -----------------------------------
[2024-10-21T02:29:13.877Z] jdk_security4_1_FAILED
[2024-10-21T02:29:13.877Z] -----------------------------------

Test_openjdk8_j9_sanity.functional_x86-64_linux: Known issue: #18599

[2024-10-21T04:03:57.367Z]  [ERR] /home/jenkins/workspace/Test_openjdk8_j9_sanity.functional_x86-64_linux_Personal_testList_1/aqa-tests/TKG/../../jvmtest/functional/cmdLineTests/jitserver/jitserverconfig.sh: line 30: lsof: command not found
[2024-10-21T04:03:57.367Z]  [ERR] /home/jenkins/workspace/Test_openjdk8_j9_sanity.functional_x86-64_linux_Personal_testList_1/aqa-tests/TKG/../../jvmtest/functional/cmdLineTests/jitserver/jitserverconfig.sh: line 30: lsof: command not found
[2024-10-21T04:03:57.367Z]  [ERR] Generating RSA private key, 2048 bit long modulus
…
[2024-10-21T04:03:57.367Z]  [ERR] failed to configure SSL ecdh: Success
[2024-10-21T04:03:57.367Z]  [ERR] Failed to initialize the SSL context
[2024-10-21T04:03:57.367Z]  [ERR] 
[2024-10-21T04:03:57.367Z]  [ERR] JITServer is ready to accept incoming requests
…

[2024-10-21T04:04:04.002Z] -----------------------------------
[2024-10-21T04:04:04.002Z] testJitserverArguments_0_FAILED
[2024-10-21T04:04:04.002Z] -----------------------------------

Test_openjdk8_j9_sanity.openjdk_s390x_linux: Known issue: #14948 (comment)

[2024-10-21T03:27:55.722Z] Caused by: java.io.IOException: write beyond end of stream
[2024-10-21T03:27:55.722Z] 	at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:201)
[2024-10-21T03:27:55.722Z] 	at CloseInflaterDeflaterTest.lambda$testDeflaterOutputStream$4(CloseInflaterDeflaterTest.java:153)
[2024-10-21T03:27:55.722Z] 	at org.testng.Assert.expectThrows(Assert.java:1005)
[2024-10-21T03:27:55.722Z] 	... 30 more
[2024-10-21T03:27:55.722Z] test CloseInflaterDeflaterTest.testDeflaterOutputStream(false): failure
…
[2024-10-21T03:27:55.723Z] Caused by: java.io.IOException: write beyond end of stream
[2024-10-21T03:27:55.723Z] 	at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:201)
[2024-10-21T03:27:55.723Z] 	at CloseInflaterDeflaterTest.lambda$testDeflaterOutputStream$4(CloseInflaterDeflaterTest.java:153)
[2024-10-21T03:27:55.723Z] 	at org.testng.Assert.expectThrows(Assert.java:1005)
[2024-10-21T03:27:55.723Z] 	... 30 more
[2024-10-21T03:27:55.723Z] test CloseInflaterDeflaterTest.testGZip(true): failure
…
[2024-10-21T03:27:55.723Z] test CloseInflaterDeflaterTest.testZipCloseEntry(java.util.zip.ZipOutputStream@108de3fe): failure
[2024-10-21T03:27:55.723Z] java.io.IOException
[2024-10-21T03:27:55.723Z] 	at CloseInflaterDeflaterTest$1.write(CloseInflaterDeflaterTest.java:54)
…
[2024-10-21T03:28:01.017Z] -----------------------------------
[2024-10-21T03:28:01.017Z] jdk_util_1_FAILED
[2024-10-21T03:28:01.017Z] -----------------------------------

@a7ehuo
Copy link
Contributor Author

a7ehuo commented Oct 21, 2024

@hzongaro
Copy link
Member

Failures were due to known issues. OMR pull request eclipse-omr/omr#7452 that this change depends upon has been merged and promoted. Merging.

@hzongaro hzongaro merged commit f165fd4 into eclipse-openj9:master Oct 21, 2024
96 of 99 checks passed
@a7ehuo a7ehuo deleted the PR-valuetypes-null-restricted-array branch October 28, 2024 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:jit depends:omr:breaking depends:omr Pull request is dependent on a corresponding change in OMR project:valhalla Used to track Project Valhalla related work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants