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

Aleksey Shipilev shade at openjdk.org
Wed Jun 28 16:38:21 UTC 2023


On Tue, 20 Jun 2023 20:13:19 GMT, Eric Caspole <ecaspole at openjdk.org> wrote:

>> Most benchmarks have a relatively small code footprint compared to enterprise applications. While trying to model an application with a very large code footprint, we developed this JMH with its own classloader generating the desired number of classes from the string literal in the file, using the existing InMemoryJavaCompiler. Then these classes are are instantiated to the desired count, and methods are called in those objects, which can fill up the code cache, possibly causing code cache sweeping or compiler shut-off. 
>> This allows to create a simulation of a large application with arbitrary java heap and code cache footprint, and take advantage of the benefits of JMH at the same time.
>> The defaults are set very low by default and the intent is that they would be customized for any given study.
>
> Eric Caspole has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix copyright header and apply Alekseys comments

Some more things that are visible from here are below. I don't think I captured _all_ the problematic things that are there, please take a closer look at the file from the style perspective.

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`.

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.

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?

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?

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

PR Review: https://git.openjdk.org/jdk/pull/14521#pullrequestreview-1503528418
PR Review Comment: https://git.openjdk.org/jdk/pull/14521#discussion_r1245484664
PR Review Comment: https://git.openjdk.org/jdk/pull/14521#discussion_r1245483757
PR Review Comment: https://git.openjdk.org/jdk/pull/14521#discussion_r1245482734
PR Review Comment: https://git.openjdk.org/jdk/pull/14521#discussion_r1245483221


More information about the hotspot-compiler-dev mailing list