RFR: 8313224: Avoid calling JavaThread::current() in MemAllocator::Allocation constructor [v3]

Ioi Lam iklam at openjdk.org
Fri Aug 11 00:10:59 UTC 2023


On Thu, 10 Aug 2023 15:39:08 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> 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).

I reverted the change in `PreserveObj`, which is a private inner class of `MemAllocator::Allocation`, so the use of `JavaThread*` doesn't leak to the outside world.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15058#discussion_r1290776343


More information about the hotspot-gc-dev mailing list