RFR: 8264142: Remove TRAPS/THREAD parameters for verifier related functions [v3]

Coleen Phillimore coleenp at openjdk.java.net
Thu Mar 25 21:41:25 UTC 2021


On Thu, 25 Mar 2021 19:14:29 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> How about if "ResourceMark rm(THREAD)" is changed to "ResourceMark rm;" ?  Then no Thread* is need in the function.
>
> This seems fine to me.

I think the primary goal should be not avoid calling Thread::current() as much as possible.  Passing Thread* thread around, even as the first parameter just for a ResourceMark seems like unnecessary typing to me.  Getting the current thread isn't expensive.  From experience, if we optimized all the Thread::currents away, we'd get no benefits to performance, and it's nice that it's hidden here.  If we have an impasse here, go ahead and add the Thread parameter at the beginning, but I'd rather not see this extra parameter.

Some previous project that I did (I won't admit how long ago that was), was to go through all the sources in search of Thread::current() and use whatever current thread was passed in, usually via TRAPS. I didn't gain any performance from this but the code looked nicer in the end.

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

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


More information about the hotspot-runtime-dev mailing list