On Mon, 26 Sep 2022 10:13:18 GMT, Kim Barrett <kbarr...@openjdk.org> wrote:

>> Good idea! I implemented this instead.
>
> We can eliminate this problem:
> "I guess the risk is that you get mtInternal if you forget the parameter to 
> new."
> 
> We can instead have CHeapObj<mtFoo> that *only* allocates with mtFoo, and
> CHeapObj<> that *requires* specifying the flag when allocating the memory. (I
> did something like this for the CHeapAllocator in my prototype for Standard
> Library usage.) As part of that, we can also have the MEMFLAGS argument (when
> needed) always be the first argument in the placement list.
> 
> Very(!) lightly tested:
> https://github.com/kimbarrett/openjdk-jdk/tree/dynamic-memflags

Or you could have the class that requires dynamic mtFlag be declared with 
mtNone and assert in one place in AllocateHeap that mt != mtNone.  Actually 
that assert might already be there.  Can't really puzzle out what Kim's change 
does.

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

PR: https://git.openjdk.org/jdk/pull/10412

Reply via email to