RFR: 8354969: Add strdup function for ResourceArea [v5]

David Holmes dholmes at openjdk.org
Mon May 19 02:06:03 UTC 2025


On Fri, 16 May 2025 13:03:25 GMT, Anton Artemov <duke at openjdk.org> wrote:

>> src/hotspot/os/windows/perfMemory_windows.cpp line 1610:
>> 
>>> 1608:   //
>>> 1609:   char* rfilename = ResourceArea::strdup(filename);
>>> 1610:   char* robjectname = ResourceArea::strdup(objectname);
>> 
>> As we have `TRAPS` available we could use the thread taking variant and save the call to `Thread::current`
>
> Thanks, if I understand what TRAPS is and how it works correctly, reducing to a single thread-taking method would require multiple changes in multiple source files, just to propagate TRAPS -> THREAD sequences to the right place. I think it is better just to have 2 methods.

What I am suggesting is:

  char* rfilename = ResourceArea::strdup(THREAD, filename);
  char* robjectname = ResourceArea::strdup(THREAD, objectname);

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24998#discussion_r2094726042


More information about the hotspot-dev mailing list