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

Xin Liu xliu at openjdk.org
Thu Nov 10 08:39:53 UTC 2022


> Currently it is correct, but there are two places we can improve it.
> 
> 1. We should assert that current == Thread::current(). If it were not case, then we would intermix NEW_RESOURCE_ARRAY_IN_THREAD(current, char, path_len) and FREE_RESOURCE_ARRAY(char, path, path_len)!
> 
> 2. We don't need to call FREE_RESOURCE_ARRAY(char, path, path_len) for path in its first exit. It won't release anything because buffer stands in its way.
> 
> The resource area is like this. `Afree(path, path_len)` won't reclaim the space.
> 
> |path | buffer |...|
>                ^hwm

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

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/11024/files
  - new: https://git.openjdk.org/jdk/pull/11024/files/a95189f5..2de3bc53

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=11024&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11024&range=00-01

  Stats: 7689 lines in 191 files changed: 2130 ins; 4492 del; 1067 mod
  Patch: https://git.openjdk.org/jdk/pull/11024.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11024/head:pull/11024

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


More information about the hotspot-runtime-dev mailing list