RFR: 8263131: reduce unnecessary downwards search when using linear search to find method

Lehua Ding github.com+13173904+lhtin at openjdk.java.net
Tue Mar 9 02:46:09 UTC 2021


On Mon, 8 Mar 2021 19:49:47 GMT, Lois Foltan <lfoltan at openjdk.org> wrote:

>> Hi,
>> 
>> The `InstanceKlass::find_method_by_name` and `InstanceKlass::find_method_index` use `InstanceKlass::quick_search` to find a method by name. If the method found doesn't match the expected method signature, It has to search downwards and upwards. But if `_disable_method_binary_search` was set to `true`, the `InstanceKlass::quick_search` will use linear search instead of binary search to find the method. So there no needs to search downwards because there no other method with the same name before it since the method found is the first matched method.
>> 
>> Best regards,
>> Lehua
>
> I would like to clarify your statement in the bug description that, "So there no needs to search downwards because there no other method with the same name before it since the method found is the first matched method."  Actually there can be more than one entry in the array that contain the same name.  Test case "TestConflictingDefaultsAndStaticMethod" in vmTestbase/vm/runtime/StaticMethodsTest.java test demonstrates a situation where an overpass method named "m" and a static method named "m" exist simultaneously in the array.  See JDK-8067480 for a full explanation. 
> 
> So I am concerned that we should never disable the downwards binary search through overloaded methods.  Can you please run the test cases under test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth?
> 
> Thanks,
> Lois

Thank you @lfoltan for your review and @iklam for more detail about the influence of the changes. I fully accept @iklam's views and decisions. I will close the PR.

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

PR: https://git.openjdk.java.net/jdk/pull/2857


More information about the hotspot-runtime-dev mailing list