RFR: 8302850: Implement C1 clone intrinsic that reuses arraycopy code for primitive arrays [v10]

Boris Ulasevich bulasevich at openjdk.org
Tue Apr 23 13:32:34 UTC 2024


On Tue, 23 Apr 2024 09:09:02 GMT, Galder Zamarreño <galder at openjdk.org> wrote:

>>> please add @summary
>> 
>> +1
>> 
>>> is the purpose of the test to check that array clone throws NPE for null input and does not throw otherwise?
>> 
>> I added this test to verify that null values for the array where handled correctly when the array clone call had been C1 compiled. I added this test at the time because I discovered a bug in the implementation and I had not seen any existing tests fail.
>> 
>>> Don't we want to check the contents of the copied data?
>>> Don't we want to check different sizes and array types?
>> 
>> Verifying the contents sounds good.
>> 
>> Different sizes and types sounds good as well, but what sizes would you choose? For the types, I would limit it to primitive types since the intrinsic is only implemented for those.
>> 
>>> Is 1K iterations enough to compile the method?
>> 
>> That seemed to be enough in my case to trigger the issue, what number should I use instead? I found `Tier3CompileThreshold` that is 2000, so maybe increase it to that just in case? Is there a way to verify from the test that the method has been C1 compiled before going ahead and invoking the method with null?
>
> Added brief test summary.

Thank you!

> what sizes would you choose? For the types, I would limit it to primitive types

Yes, checking the primitive types is fine. Let it be int[], long[], and byte[]. For size I would pick an odd.


static final int ITER = 2000; // ~ Tier3CompileThreshold
static final int ARRAY_SIZE = 999;

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/17667#discussion_r1576268353


More information about the hotspot-compiler-dev mailing list