RFR(S) 8235629 Remove unnecessary calls to Thread::current

Ioi Lam ioi.lam at oracle.com
Wed Dec 11 23:27:24 UTC 2019


Thanks Calvin, Coleen and Harold for the review. Pushed.

- Ioi


On 12/11/2019 1:25 PM, coleen.phillimore at oracle.com wrote:
>
>
> On 12/11/19 4:15 PM, Ioi Lam wrote:
>>
>>
>> On 12/11/19 11:56 AM, Calvin Cheung wrote:
>>>
>>> On 12/11/19 10:19 AM, Ioi Lam wrote:
>>>> https://bugs.openjdk.java.net/browse/JDK-8235629
>>>> http://cr.openjdk.java.net/~iklam/jdk14/8235629-remove-thread-current.v01/ 
>>>>
>>>>
>>>> + In mutex.cpp, put "assert_owner(Thread::current())" into 
>>>> DEBUG_ONLY to avoid
>>>>   the evaluation of the call in product builds.
>>>> + Changed various "ResourceMark rm;" to "rm(THREAD)".
>>>
>>> Found a few more of the above in the following functions:
>>>
>>> void MetaspaceShared::preload_and_dump(TRAPS)
>>> int MetaspaceShared::preload_classes
>>> bool MetaspaceShared::try_link_class
>>>
>>> methodHandle Method::make_method_handle_intrinsic
>>>
>>> bool klassVtable::needs_new_vtable_entry
>>>
>>
>> Hi Calvin,
>>
>> Thanks for the info. I've added these to my patch. Here's the delta 
>> from the last webrev
>>
>> http://cr.openjdk.java.net/~iklam/jdk14/8235629-remove-thread-current.v02.delta/ 
>>
>>
>> I think there are probably many other cases that aren't found in my 
>> profile. I'll try to write a script to find all the cases and fix 
>> them in a separate RFE.
>
> I assume there are many others.  I think this set is good for now.
> Coleen
>
>>
>> Thanks
>> - Ioi
>>
>>
>>> thanks,
>>>
>>> Calvin
>>>
>>>> + In UL logs, use "ResourceMark rm" only conditionally.
>>>>
>>>> I found these locations by running "java -version" in gdb, setting 
>>>> a breakpoint
>>>> at Thread::current() and logging all the callstacks. So these are 
>>>> by no means complete,
>>>> but are rather an easy-to-fix part of JVM start-up.
>>>>
>>>> Before: 0.0420053188 sec
>>>> After:  0.0417649239 sec
>>>>         99.42770374% = about .6% improvement
>>>>
>>>> Thanks
>>>> - Ioi
>>>>
>>>>
>>
>



More information about the hotspot-runtime-dev mailing list