RFR: 8301404: Factor out os::malloc with os::realloc common code, so that we only have 1 code path [v8]

Gerard Ziemski gziemski at openjdk.org
Tue Apr 1 13:26:26 UTC 2025


On Tue, 1 Apr 2025 13:03:34 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> Gerard Ziemski has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   revert last checkin - wrong issue
>
> src/hotspot/share/nmt/nmtPreInit.hpp line 270:
> 
>> 268:   // *rc contains the return address.
>> 269:   static bool handle_malloc(void** rc, size_t size) {
>> 270:     size = MAX2((size_t)1, size);         // malloc(0)
> 
> Not this change, but why are these functions in the hpp file? They seem more appropriate in the cpp file.

A good question, I was wondering the same. I personally don't know.

> src/hotspot/share/runtime/os.cpp line 632:
> 
>> 630:   // Special handling for NMT preinit phase before arguments are parsed
>> 631:   void* rc = nullptr;
>> 632:   if (NMTPreInit::handle_malloc(&rc, size)) {
> 
> So it looks like this was the only call to handle_malloc.  Is it now unused since malloc and realloc() call this function?

Correct, we would no longer need to use this.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24189#discussion_r2022847441
PR Review Comment: https://git.openjdk.org/jdk/pull/24189#discussion_r2022845618


More information about the hotspot-runtime-dev mailing list