RFR: CODETOOLS-7903056: perfasm can report wrong stub name

Aleksey Shipilev shade at openjdk.java.net
Thu Nov 11 07:03:52 UTC 2021


On Thu, 11 Nov 2021 06:57:37 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> This patch changes `IntervalMap::get` to check that the value falls within an interval's high/low bounds. Otherwise it returns the closest entry < value which can be misleading.
>> 
>> Example of the new output, where previously the `<unknown>` line reported the wrong stub routine:
>> 
>> 
>>  18.19%           libjvm.so  ProgrammableUpcallHandler::on_entry
>>  13.94%                      <unknown>
>>   9.39%           libjvm.so  ProgrammableUpcallHandler::on_exit
>>   8.36%         c2, level 4  java.lang.invoke.LambdaForm$MH.0x00000008001b8400::invoke, version 1595
>
> jmh-core/src/main/java/org/openjdk/jmh/util/IntervalMap.java line 42:
> 
>> 40:         @Override
>> 41:         public int compareTo(Interval other) {
>> 42:             return (int)(this.from - other.from);
> 
> Suggestion:
> 
>             return Long.compare(this.from, other.from);

I also believe the Java style requires `equals` and `hashCode` that is coherent with newly added `compareTo`. Please autogenerate one in IDE, using `from` field?

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

PR: https://git.openjdk.java.net/jmh/pull/54


More information about the jmh-dev mailing list