RFR: 8290833: Remove ConstantPoolCache::walk_entries_for_initialization() [v6]
Ioi Lam
iklam at openjdk.org
Thu Aug 11 21:51:25 UTC 2022
> **Background:**
>
> `ConstantPoolCache::walk_entries_for_initialization()` is called by `ConstantPoolCache::remove_unshareable_info()` to restore the CpCache to the state immediately after the class has been rewritten by the Rewriter (which happens during the class linking phase). In most part, this means the `ConstantPoolCacheEntry`'s need to be zeroed. However, the `_f2` fields of some of the entries are initialized to be non-zero by the Rewriter and must be preserved.
>
> The reason `walk_entries_for_initialization()` exists is that after `Rewriter::rewrite()` has finished, some information about what is stored inside the CpCache is discarded (e.g., `Rewriter::_invokedynamic_references_map`). As a result, we cannot easily determine which entries has a `_f2` field that need to be preserved. We must walk all the bytecodes in all the methods of this class to recompute this information.
>
> This is awkward and time consuming. It also needs to be updated if the `Rewriter` ever changes.
>
> Also, for future optimizations, we may need to pre-resolve a subset of the CpCache entries during CDS dump time. Trying to make that work alongside `walk_entries_for_initialization()` seems too complicated.
>
> **Fix:**
>
> Store a copy of the CpCache after rewritting. Use this to revert the CpCache's state inside `ConstantPoolCache::remove_unshareable_info()`.
Ioi Lam 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 ten additional commits since the last revision:
- fixed typo
- Merge branch 'master' of https://github.com/openjdk/jdk into 8290833-remove-walk_entries_for_initialization
- Merge branch 'master' of https://github.com/openjdk/jdk into 8290833-remove-walk_entries_for_initialization
- added some comments about the translation between "src" and "dumped" addresses (will be properly fixed in JDK-8292225)
- @coleenp review comments; added asserts
- Use a separate _saved_cpcache_entries_table
- review comments by @calvinccheung and @coleenp
- fixed minimal build
- 8290833: Remove ConstantPoolCache::walk_entries_for_initialization()
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/9759/files
- new: https://git.openjdk.org/jdk/pull/9759/files/cb56a3ff..c061f2bd
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=9759&range=05
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=9759&range=04-05
Stats: 2303 lines in 108 files changed: 664 ins; 1215 del; 424 mod
Patch: https://git.openjdk.org/jdk/pull/9759.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/9759/head:pull/9759
PR: https://git.openjdk.org/jdk/pull/9759
More information about the hotspot-runtime-dev
mailing list