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

Anton Artemov duke at openjdk.org
Wed May 14 07:35:29 UTC 2025


On Fri, 9 May 2025 15:33:09 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>>> Do we have any immediate candidate uses for this? Whilst in the past Hotspot code had a number of utility API's, these days there is a tendency to delete any unused code. So this really needs to have an imminent usage (@iklam ?) .
>>> 
>>> Code change itself looks fine. Thanks
>> 
>> I did this and found a few places, but there could be more
>> 
>> 
>> find . -name *pp | xargs grep -l strcpy | \
>>     xargs egrep -l '(RESOURCE.*char)|(resource_allocate_bytes)' | \
>>     xargs grep strcpy
>> 
>> 
>> https://github.com/openjdk/jdk/blob/9a0e6f338f34fb5da16d5f9eb710cdddd4302945/src/hotspot/share/prims/jvmtiEnvBase.cpp#L471-L472
>> https://github.com/openjdk/jdk/blob/9a0e6f338f34fb5da16d5f9eb710cdddd4302945/src/hotspot/share/classfile/classLoader.cpp#L1513-L1514
>> https://github.com/openjdk/jdk/blob/9a0e6f338f34fb5da16d5f9eb710cdddd4302945/src/hotspot/share/classfile/modules.cpp#L642-L643
>
>> Thanks @iklam ! So should we convert those places as part of this PR?
> 
> I think we should do that. @toxaart could you see if there are other cases that can also be converted?

@iklam I converted the cases you suggested and found a few more. Addressed in the latest commit.

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

PR Comment: https://git.openjdk.org/jdk/pull/24998#issuecomment-2879046824


More information about the hotspot-dev mailing list