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

Do not trust nullable arrayclass type in VP #20420

Conversation

a7ehuo
Copy link
Contributor

@a7ehuo a7ehuo commented Oct 28, 2024

Update isUnreliableSignatureType to check if the class is an array class. If the class is an array class and its component class is value type and the array class is not null-restricted array, the type is not reliable because it can either be a nullable array class type or a null-restricted array type.

Fixes: #19914

@a7ehuo a7ehuo requested a review from hzongaro October 28, 2024 14:03
@a7ehuo
Copy link
Contributor Author

a7ehuo commented Oct 28, 2024

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

The detailed analysis related to this change is in #19914 (comment)

@hangshao0 hangshao0 added project:valhalla Used to track Project Valhalla related work comp:jit labels Oct 28, 2024
@a7ehuo a7ehuo force-pushed the valuetype-fix-null-restricted-array-type-vp branch from 79e5a3e to 49082ab Compare October 28, 2024 21:51
@a7ehuo
Copy link
Contributor Author

a7ehuo commented Oct 29, 2024

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

Update isUnreliableSignatureType to check if the class
is an array class, and if its component class is value
type, and if the array class is not null-restricted array.
If so, the type is not reliable because it can either be a
nullable array class type or a null-restricted array type.

Fixes: eclipse-openj9#19914
Signed-off-by: Annabelle Huo <[email protected]>
@a7ehuo a7ehuo force-pushed the valuetype-fix-null-restricted-array-type-vp branch from 49082ab to 04ce59f Compare October 29, 2024 16:59
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,alinuxval,zlinuxval,plinuxval jdknext

@hzongaro
Copy link
Member

Jenkins test sanity.functional,sanity.openjdk xlinux jdk8,jdk21

@a7ehuo
Copy link
Contributor Author

a7ehuo commented Oct 30, 2024

Test_openjdk21_j9_sanity.openjdk_x86-64_linux_Personal failed with the following 4 vector tests (#55).

They also fail in other PR tests: #52 #54 #53

The nightly build hasn't completed yet but I can see it shows jdk_vector_long128_j9_0 fails in nightly build, which seems similar to these failures.

[2024-10-29T21:21:30.760Z] FAILED test targets:
[2024-10-29T21:21:30.760Z] 	jdk_vector_double128_j9_0 - Test results: error: 1 
[2024-10-29T21:21:30.760Z] 		Failed test cases: 
[2024-10-29T21:21:30.760Z] 			TEST: jdk/incubator/vector/Double128VectorTests.java
[2024-10-29T23:26:16.492Z] FAILED test targets:
[2024-10-29T23:26:16.492Z] 	jdk_vector_float128_j9_0 - Test results: error: 1 
[2024-10-29T23:26:16.492Z] 		Failed test cases: 
[2024-10-29T23:26:16.492Z] 			TEST: jdk/incubator/vector/Float128VectorTests.java
[2024-10-29T23:26:16.492Z]         
[2024-10-29T23:26:16.492Z] 	jdk_vector_short128_j9_0 - Test results: error: 1 
[2024-10-29T23:26:16.492Z] 		Failed test cases: 
[2024-10-29T23:26:16.492Z] 			TEST: jdk/incubator/vector/Short128VectorTests.java
[2024-10-29T23:26:16.492Z]         
[2024-10-29T23:26:16.492Z] 	jdk_vector_byte64_j9_0 - Test results: error: 1 
[2024-10-29T23:26:16.492Z] 		Failed test cases: 
[2024-10-29T23:26:16.492Z] 			TEST: jdk/incubator/vector/Byte64VectorTests.java

@hzongaro
Copy link
Member

Value types testing was successful. Failures in non-value types testing were due to known problems. Merging.

@hzongaro hzongaro merged commit 3974d87 into eclipse-openj9:master Oct 30, 2024
19 of 21 checks passed
@jdmpapin
Copy link
Contributor

jdmpapin commented Nov 11, 2024

I don't think arrays of value types really need to be treated as unreliable like interfaces are

If the class is an array class and its component class is value type and the array class is not null-restricted array, the type is not reliable because it can either be a nullable array class type or a null-restricted array type.

This should be fine because the null-restricted array type is a subtype of the regular/unrestricted array type (#20305), so in particular null-restricted arrays are also instances of the unrestricted array type (just not exactly that type), which is the one named in the signature

AFAICT the real problem in #19914 (comment) is the "fixed class" here:

n6n aload gets new constraint: value 6 is fixed class 0000000001A18A00 [L...SomeValueClass;

VP sees that the component type is final, and so it creates a fixed-type constraint for the array. This is correct when the component type is not a value type (so until recently it was always correct). But now with value types having these two different array types, when the component type is a value type and the innermost array type is unrestricted, that array type now has a (strict) subtype even though its component type is final. So I'm pretty sure that VP can still use the type bound, but it just needs to detect that situation and avoid concluding that the type is fixed

@a7ehuo
Copy link
Contributor Author

a7ehuo commented Nov 11, 2024

now with value types having these two different array types, when the component type is a value type and the innermost array type is unrestricted, that array type now has a subtype even though its component type is final. ... needs to detect that situation and avoid concluding that the type is fixed

@jdmpapin Thank you very much for finding this issue! I'll take a look at an appropriate fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:jit project:valhalla Used to track Project Valhalla related work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix tests in disabled variations of ValueTypeSystemArraycopyTests
4 participants