-
Notifications
You must be signed in to change notification settings - Fork 728
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: Transformation of System.arraycopy doesn't handle flattened value type array correctly #17586
Comments
@hzongaro fyi |
The root cause of the issue is that the existing implementation of the transformation of When The flattened primitive value type array is considered reference array here, but the element size should be the total size of all fields of the array component class. For the above test, there is one field To make the transformation of [1]
|
Required by JEP 401: If null restricted value type is enabled, we need to preform null check on the value being stored in order to throw a `NullPointerException` if the array is null-restricted and the value to write is null. If it is this case, `System.arraycopy` cannot be transformed into arraycopy instructions. Based on whether or not the source array and the destination array are null restricted value type, and whether or not they are flattened, VP decides whether or not transform `System.arraycopy`. Fixes: eclipse-openj9/openj9#17196,eclipse-openj9/openj9#17586 Signed-off-by: Annabelle Huo <[email protected]>
Required by JEP 401: If null restricted value type is enabled, we need to preform null check on the value being stored in order to throw a `NullPointerException` if the array is null-restricted and the value to write is null. If it is this case, `System.arraycopy` cannot be transformed into arraycopy instructions. Based on whether or not the source array and the destination array are null restricted value type, and whether or not they are flattened, VP decides whether or not transform `System.arraycopy`. Fixes: eclipse-openj9/openj9#17196,eclipse-openj9/openj9#17586 Signed-off-by: Annabelle Huo <[email protected]>
Required by JEP 401: If null restricted value type is enabled, we need to preform null check on the value being stored in order to throw a `NullPointerException` if the array is null-restricted and the value to write is null. If it is this case, `System.arraycopy` cannot be transformed into arraycopy instructions. Based on whether or not the source array and the destination array are null restricted value type, and whether or not they are flattened, VP decides whether or not transform `System.arraycopy`. Fixes: eclipse-openj9/openj9#17196,eclipse-openj9/openj9#17586 Signed-off-by: Annabelle Huo <[email protected]>
Required by JEP 401: If null restricted value type is enabled, we need to preform null check on the value being stored in order to throw a `NullPointerException` if the array is null-restricted and the value to write is null. If it is this case, `System.arraycopy` cannot be transformed into arraycopy instructions. Based on whether or not the source array and the destination array are null restricted value type, and whether or not they are flattened, VP decides whether or not transform `System.arraycopy`. Fixes: eclipse-openj9/openj9#17196,eclipse-openj9/openj9#17586 Signed-off-by: Annabelle Huo <[email protected]>
Required by JEP 401: If null restricted value type is enabled, we need to preform null check on the value being stored in order to throw a `NullPointerException` if the array is null-restricted and the value to write is null. If it is this case, `System.arraycopy` cannot be transformed into arraycopy instructions. Based on whether or not the source array and the destination array are null restricted value type, and whether or not they are flattened, VP decides whether or not transform `System.arraycopy`. Fixes: eclipse-openj9/openj9#17196,eclipse-openj9/openj9#17586 Signed-off-by: Annabelle Huo <[email protected]>
Fixed by OMR pull request eclipse-omr/omr#7084 |
I have a simple code that tests
System.arraycopy
with flattened value type arrays [1]. The data in the destination array afterSystem.arraycopy
is incorrect with the JIT'd method. If the array is an interface array with flattened value type array component, the result is also incorrect [2]. I suspect there might be some miscalculation on offsets whenSystem.arraycopy
is transformed intoarraycopy
instructions.[1]
[2]
The text was updated successfully, but these errors were encountered: