RFR: 8366424: Missing type profiling in generated Record Object methods [v2]

Chen Liang liach at openjdk.org
Mon Oct 20 21:09:46 UTC 2025


On Fri, 10 Oct 2025 16:17:46 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:
>> 
>>  - Extract method type desc
>>  - Reviews
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/object-methods-profile
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/object-methods-profile
>>  - Improve bench, add comment
>>  - Fix profiling issue with record shared code
>>  - Unsuccessful attempt to fix record regression
>
> src/java.base/share/classes/java/lang/runtime/ObjectMethods.java line 178:
> 
>> 176:     private static boolean isMonomorphic(Class<?> type) {
>> 177:         // Includes primitives and final classes
>> 178:         return Modifier.isFinal(type.getModifiers()) && !type.isArray();
> 
> Why are arrays excluded here? Could you add a comment?

Added that `Object[].class` is reported final but it has subtype `String[].class`.

> test/micro/org/openjdk/bench/java/lang/runtime/RecordMethodsBenchmark.java line 51:
> 
>> 49: @OutputTimeUnit(TimeUnit.MICROSECONDS)
>> 50: @BenchmarkMode(Mode.Throughput)
>> 51: public class RecordMethodsBenchmark {
> 
> I think it would be interesting to add another case here where the records fields are monomorphic, to see how that compares against the specialized case.

Added benchmarks for specialized record fields.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27533#discussion_r2446118748
PR Review Comment: https://git.openjdk.org/jdk/pull/27533#discussion_r2446126747


More information about the core-libs-dev mailing list