RFR: 8309976: Add microbenchmark for stressing code cache [v3]

Eric Caspole ecaspole at openjdk.org
Wed Jun 28 17:48:56 UTC 2023


On Wed, 28 Jun 2023 16:33:35 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Eric Caspole has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix copyright header and apply Alekseys comments
>
> test/micro/org/openjdk/bench/vm/compiler/CodeCacheStress.java line 82:
> 
>> 80:     String[] classNames;
>> 81: 
>> 82:     int index = 0;
> 
> Why this `index` is here? It seems not be used except that within the `setupClasses`.

Using index in this way to coordinate creating classes named like "B"+index is a convention that we have used in earlier tests such as hotspot/jtreg/serviceability/jvmti/RedefineClasses/TestMultipleClasses.java

> test/micro/org/openjdk/bench/vm/compiler/CodeCacheStress.java line 196:
> 
>> 194:                 + "   }"
>> 195:                 + " "
>> 196:                 + "   public Integer get2( Map m, String k, Integer depth) { "
> 
> Here and later `get2( ` has redundant spaces after the parenthesis.

Thanks, fixed in the next rev.

> test/micro/org/openjdk/bench/vm/compiler/CodeCacheStress.java line 321:
> 
>> 319: 
>> 320:     final String k = "key";
>> 321:     final Integer v = 1000;
> 
> What are these fields? Do they need to be here? Do they need to be `static final` and be on top?

They are used both for filling the maps passed as arguments and the key is passed later as a parameter when calling these generated methods. They could be static, yes.

> test/micro/org/openjdk/bench/vm/compiler/CodeCacheStress.java line 325:
> 
>> 323:     final String methodNames[] = {
>> 324:             "get"
>> 325:     };
> 
> Does it have to be an array? There is only a single element, should it be a single `static final` field?

In earlier versions it called more than 1 method in the generated classes, and I would prefer to keep that capability. It could be static, yes.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14521#discussion_r1245565544
PR Review Comment: https://git.openjdk.org/jdk/pull/14521#discussion_r1245565263
PR Review Comment: https://git.openjdk.org/jdk/pull/14521#discussion_r1245564598
PR Review Comment: https://git.openjdk.org/jdk/pull/14521#discussion_r1245564910


More information about the hotspot-compiler-dev mailing list