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

Value Types: Check the list of *.toArray() methods that can skip null check in storing into non-nullable arrays #18576

Open
a7ehuo opened this issue Dec 7, 2023 · 1 comment
Labels
project:valhalla Used to track Project Valhalla related work

Comments

@a7ehuo
Copy link
Contributor

a7ehuo commented Dec 7, 2023

This issue is created to track a follow up work item related to #18464 (comment). A list of *.toArray() methods are disabled in canSkipNonNullableArrayNullStoreCheck[] since they explicitly store null into arrays. We need to check in the future after these methods are update if we can skip null check in storing into non-nullable arrays.

   // TR::java_util_EnumMap__nec_, // Disable it for now because EnumMap.toArray explicitly stores null into array element
   // TR::java_util_ArrayList_all, // Disable it for now because ArrayList.toArray explicitly stores null into array element
   // TR::java_util_concurrent_ConcurrentHashMap_all, // Disable it for now because ConcurrentHashMap.toArray explicitly stores null into array element
   // TR::java_util_Vector_all, // Disable it for now because Vector.toArray explicitly stores null into array element

   // The following list is identified after running sanity.functional tests
   // TR::java_util_AbstractCollection_all, // Disable it for now because AbstractCollection.toArray explicitly stores null into array element
   // TR::java_util_ArrayDeque_all, // Disable it for now because ArrayDeque.toArray explicitly stores null into array element
   // TR::java_util_IdentityHashMap_all, // Disable it for now because IdentityHashMap.toArray explicitly stores null into array element
   // TR::java_util_ImmutableCollections_all, // Disable it for now because ImmutableCollections.toArray explicitly stores null into array element
   // TR::java_util_LinkedList_all, // Disable it for now because LinkedList.toArray explicitly stores null into array element
@a7ehuo a7ehuo added the project:valhalla Used to track Project Valhalla related work label Dec 7, 2023
@hzongaro
Copy link
Member

hzongaro commented Dec 7, 2023

We need to check in the future after these methods are update if we can skip null check in storing into non-nullable arrays.

Alternatively, if the store of a null reference is kept even when null-restricted arrays are supported, we might want to recognize those toArray methods, so that all other methods in those classes can fall under the _all enumerated value, and be recognized as not requiring checks for stores of null references to null-restricted arrays.

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

No branches or pull requests

2 participants