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

Calvin Cheung calvin.cheung at oracle.com
Wed Dec 11 19:56:21 UTC 2019


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

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