RFR: 8313224: Avoid calling JavaThread::current() in MemAllocator::Allocation constructor [v2]
Ioi Lam
iklam at openjdk.org
Thu Aug 10 15:50:31 UTC 2023
On Thu, 10 Aug 2023 14:50:40 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> I wanted to minimize the use of `JavaThread`. Most of the MemAllocator APIs take `Thread`, so any occurrence of `JavaThread` looks suspicious and may cause people to unwittingly cast from `Thread` to `JavaThread` in the future.
>
> This is a most confusing set of classes. Why doesn't MemAllocator take a JavaThread? Which _thread does this code use? I think the more specific type is generally better. It doesn't seem like a bad thing for the caller to be required to have a JavaThread. Its caller does have a JavaThread.
Sometimes MemAllocator is used by non-Java threads (e.g., GC threads uses it to create filler objects).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15058#discussion_r1290331688
More information about the hotspot-gc-dev
mailing list