RFR: 8296453: Simplify resource_area uses in ClassPathDirEntry::open_stream [v2]

Xin Liu xliu at openjdk.org
Fri Nov 11 06:54:41 UTC 2022


On Fri, 11 Nov 2022 03:43:49 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Xin Liu has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>> 
>>  - Add API FREE_RESOURCE_ARRAY_IN_THREAD.
>>    
>>    Remove the assert at the begining because it is redundant.
>>    We also replace ResourceArea allocation/free with their IN_THREAD variants.
>>  - Merge branch 'master' into JDK-8296453
>>  - 8296453: Simplify resource_area uses in ClassPathDirEntry::open_stream
>
> src/hotspot/share/classfile/classLoader.cpp line 245:
> 
>> 243: 
>> 244: ClassFileStream* ClassPathDirEntry::open_stream(JavaThread* current, const char* name) {
>> 245:   // current is Thread::current().
> 
> This is unnecessary

Thanks. I remove this and update the comment as well.

> src/hotspot/share/classfile/classLoader.cpp line 272:
> 
>> 270:         //                                        \hwm  \max
>> 271:         // resource_area->Afree(path, path_len) is not expected to reclaim space, but ZapResouceArea
>> 272:         // in debug builds may help us to detect memory corruption.
> 
> This could be simplified somewhat e.g.
> 
> // Freeing path is a no-op here as buffer prevents it from being reclaimed. But we keep it for
> // debug builds so that we guard against use-after-free bugs.

updated.

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

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


More information about the hotspot-runtime-dev mailing list