RFR: 8294308: Allow dynamically choosing the MEMFLAGS of a type without ResourceObj [v3]
Johan Sjölen
jsjolen at openjdk.org
Wed Sep 28 13:45:54 UTC 2022
On Mon, 26 Sep 2022 15:34:29 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> 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.
I added a mtInvalid flag and did the assert. mtNone seems to be dealt with in some code, I'm not sure if it's appropriate to use it as an invalid value. Regardless, mtInvalid is a better name (for this purpose), so maybe we can change mtNone to mtInvalid in the future?
-------------
PR: https://git.openjdk.org/jdk/pull/10412
More information about the serviceability-dev
mailing list