RFR: 8251850: Simplify ResourceMark constructors using delegation
Ioi Lam
ioi.lam at oracle.com
Sat Aug 15 03:27:02 UTC 2020
Hi Kim,
This looks good overall.
I found the following function a little confusing:
108 static Thread* current_thread_or_null() {
109 return DEBUG_ONLY(Thread::current_or_null()) NOT_DEBUG(nullptr);
In usual HotSpot code, xxx_or_null() means "if there's no xxx, use".
However, in this case, we do have a current thread, but we are just not
using it in product build.
I think it's clearer to changed the constructor
88 ResourceMark(ResourceArea* area, Thread* thread) :
to
88 ResourceMark(NOT_PRODUCT_ARG(Thread* thread) ResourceArea* area) :
and then use
119 explicit ResourceMark(ResourceArea* area)
120 : ResourceMark(NOT_PRODUCT_ARG(Thread::current()) area) {}
Also, these can be changed to NOT_PRODUCT_ARG -- but you need to move
the corresponding field declarations up a few lines
94 DEBUG_ONLY(COMMA _thread(thread))
95 DEBUG_ONLY(COMMA _previous_resource_mark(nullptr))
Thanks
- Ioi
On 8/14/20 7:29 PM, Kim Barrett wrote:
> Please review this simplification of the constructors for ResourceMark,
> accomplished using delegating constructors.
>
> Also made the constructors "explicit" and the class non-copyable.
>
> CR:
> https://bugs.openjdk.java.net/browse/JDK-8251850
>
> Webrev:
> https://cr.openjdk.java.net/~kbarrett/8251850/open.00/
>
> Testing:
> mach5 tier1
>
More information about the hotspot-runtime-dev
mailing list