[9] RFR (S): C1: compiler.escapeAnalysis.TestArrayCopy fails to throw ArrayStoreException

Zoltán Majó zoltan.majo at oracle.com
Mon Oct 31 14:09:26 UTC 2016


Hi,


please review the fix for 8167578.
https://bugs.openjdk.java.net/browse/JDK-8167578
http://cr.openjdk.java.net/~zmajo/8167578/webrev.00/

Problem: The System.arraycopy() implementation in C1 does not throw an 
ArrayStoreException withthe open/closed ARM port
- if the element type of the source array is no assignable to the 
element type of the destination array AND
- the length of the array is 0.

If the above condition holds, the arraycopy is just not performed 
(because the length is 0), even though the API documentation requires an 
exception to be thrown.  That is different from the way arraycopy works 
on other platforms / the interpreter / C2 (which all comply with the 
specification).


Solution: Removed "shortcutting" code in C1. I've not found the 
assert(s) in the stubs mentioned in the comment. It seems the stubs 
accept the length being 0; that is what the comments in the stubs also 
state. The problem is triggered (and can be reproduced) using the 
TestArrayCopy.java test to be added with Volker Simonis's already 
reviewed change for 8159611 [1]. I plan to push the fix for 8159611 
after this fix makes into the repo.


Testing: Executed all hotspot tests with the open aarch64 build with (1) 
the default flag settings and also with (2) -Xcomp 
-XX:TieredStopAtLevel=1. No new failures have shown up. Many thanks to 
Roland Westrelin for his help with testing the fix!

Thank you!

Best regards,


Zoltan

[1] 
http://cr.openjdk.java.net/~simonis/webrevs/2016/8159611.v4/test/compiler/escapeAnalysis/TestArrayCopy.java.html



More information about the hotspot-compiler-dev mailing list