JDK-8263131 : reduce unnecessary downwards search when using linear search to find method
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2021-03-06
  • Updated: 2021-03-09
  • Resolved: 2021-03-09
Related Reports
Duplicate :  
Relates :  
Description
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 match method.
Comments
So it not very necessary to add the if statements for the rarely used scene which increases the code's complexity. Maybe I should close this issue?
07-03-2021

_disable_method_binary_search is true only when we are dumping a CDS archive.
06-03-2021