Unused code in prims/methodComparator

Daniel D. Daugherty daniel.daugherty at oracle.com
Mon Feb 8 14:01:27 UTC 2016



On 2/6/16 4:59 AM, David Holmes wrote:
> On 6/02/2016 12:26 AM, Daniel D. Daugherty wrote:
>> MethodComparator::methods_switchable() appears to be a day zero
>> function added by Misha Dmitriev back on 2000.10.23.
>
> And was it actually used? I was trying to find out when it stopped 
> being used but gave up at Java 5. :)

No. When rgrep'ing for methods_switchable, I get one hit in each file:

     src/share/vm/prims/methodComparator.hpp
     src/share/vm/prims/methodComparator.cpp
     src/share/vm/prims/SCCS/s.methodComparator.hpp
     src/share/vm/prims/SCCS/s.methodComparator.cpp

So just a declaration in a .hpp file and a definition in a .cpp file
and history shows exactly the same.

In other words, the methods_switchable() function has been dead code
from the beginning.

Dan

>
> David
>
>>
>> $ sgv src/share/vm/prims/methodComparator.cpp | grep
>> MethodComparator::methods_switchable
>> 1.17
>> 1.1     bool MethodComparator::methods_switchable(methodOop old_method,
>> methodOop new_method,
>> 383 lines
>> No id keywords (cm7)
>>
>> $ sp -r1.1 src/share/vm/prims/methodComparator.cpp
>> src/share/vm/prims/SCCS/s.methodComparator.cpp:
>>
>> D 1.1 00/10/23 18:11:25 dmitriev 1 0    00366/00000/00000
>> MRs:
>> COMMENTS:
>> Class redefinition support - comparing methods of
>> class versions
>>
>> Dan
>>
>>
>> On 2/4/16 8:30 PM, serguei.spitsyn at oracle.com wrote:
>>> Hi Thomas,
>>>
>>> The function MethodComparator::methods_switchable() was not used even
>>> in the jdk 7.
>>> I do not know the history of this function and why its usage was 
>>> dropped.
>>> Most likely, it was used initially as a part of the methods_EMCP()
>>> algorithm.
>>> The SCCS history of the old changes was dropped when the repo was
>>> moved under the Mercurial control.
>>>
>>> It seems safe to just remove it.
>>> We always can restore it from the hg history if necessary.
>>>
>>> Thanks,
>>> Serguei
>>>
>>>
>>> On 2/4/16 18:05, David Holmes wrote:
>>>> HI Thomas,
>>>>
>>>> Ultimately this is part of JVMTI so adding the serviceability folk.
>>>>
>>>> On 20/01/2016 6:31 PM, Thomas Stüfe wrote:
>>>>> Hi all,
>>>>>
>>>>> when investigating a warning about unchecked realloc() usage in
>>>>> methodComparator.hpp, I found that the offending function
>>>>> (BciMap::store_fragment_location) is not callable anymore.
>>>>>
>>>>> BciMap::store_fragment_location is called
>>>>> by MethodComparator::methods_switchable, which is not called 
>>>>> anywhere.
>>>>>
>>>>> Is there any reason we should keep this?
>>>>
>>>> Certainly seems to be dead code. Unclear when/why redefinition
>>>> dropped the notion of "switchable".
>>>>
>>>> Thanks,
>>>> David
>>>>
>>>>> Regards, Thomas
>>>>>
>>>
>>



More information about the hotspot-runtime-dev mailing list