RFR: 8301404: Replace os::malloc with os::realloc, so we only have 1 code path

Gerard Ziemski gziemski at openjdk.org
Fri Feb 17 17:14:26 UTC 2023


On Fri, 17 Feb 2023 16:42:09 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?

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

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


More information about the hotspot-runtime-dev mailing list