RFR: 8301404: Replace os::malloc with os::realloc, so we only have 1 code path
Thomas Stuefe
stuefe at openjdk.org
Fri Feb 17 22:02:28 UTC 2023
On Fri, 17 Feb 2023 16:56:12 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:
>> Please review this enhancement, which eliminates a duplicate and almost identical path we have for malloc() and realloc(), and collapses them down to only one codepath, by taking advantage of fact that `malloc() == realloc(NULL)`
>>
>> Tested with MACH5 tier1,2,3,4,5
>
> src/hotspot/share/services/mallocHeader.hpp line 125:
>
>> 123: const size_t size;
>> 124: const MEMFLAGS flags;
>> 125: const uint32_t mst_marker;
>
> I need help with this part. I'm not familiar with C++ enough to make my change work while keeping these fields `const`
>
> Can someone suggest a better approach here, or is it OK to drop the `const` modifier off?
Its a warning sign that something is off. From first glance, a FreeInfo should be immutable; there should be no reason to modify it once its created.
-------------
PR: https://git.openjdk.org/jdk/pull/12621
More information about the hotspot-runtime-dev
mailing list