RFR: 8306444: Don't leak memory in PhaseChaitin::PhaseChaitin [v3]
Johan Sjölen
jsjolen at openjdk.org
Thu Apr 20 13:00:42 UTC 2023
> Hi,
>
> First, `PhaseChaitin::PhaseChaitin` used to create 4 resource array of size `_cfg.number_of_blocks`: one to store all of the block pointers in (`_blks`), and three to do a sorting of the blocks in some order. The latter three weren't freed in the constructor, causing them to hang around for the entire duration of the phase. This is unnecessary, so this patch frees the arrays when we're done with them. It also allocates all of the resources arrays in one go.
>
> Second, it copied over each partially filled bucket into the `_blks`, one block at a time. This patch changes this so that we don't allocate the `_blks` resource array at all, instead we simply squash all of the partially filled buckets into the first one using `::memmove`.
>
> I haven't done any micro benchmarking, but this should be faster and take less space.
>
> This is currently passing tier1.
Johan Sjölen 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 five additional commits since the last revision:
- Merge remote-tracking branch 'origin/master' into opt-chaitin
- Apply Kozlov's comments
- Use nr_blocks in assert
- Merge loops
- Optimize PhaseChaitin
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13533/files
- new: https://git.openjdk.org/jdk/pull/13533/files/52db05ef..c6fe3ec7
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13533&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13533&range=01-02
Stats: 6222 lines in 152 files changed: 5434 ins; 432 del; 356 mod
Patch: https://git.openjdk.org/jdk/pull/13533.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13533/head:pull/13533
PR: https://git.openjdk.org/jdk/pull/13533
More information about the hotspot-compiler-dev
mailing list