Integrated: 8306444: Don't leak memory in PhaseChaitin::PhaseChaitin

Johan Sjölen jsjolen at openjdk.org
Mon Apr 24 15:17:09 UTC 2023


On Wed, 19 Apr 2023 13:12:00 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: b2ccc973
Author:    Johan Sjölen <jsjolen at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/b2ccc9731e3a183bc6f31480c7d12f110633ea2b
Stats:     39 lines in 1 file changed: 25 ins; 6 del; 8 mod

8306444: Don't leak memory in PhaseChaitin::PhaseChaitin

Reviewed-by: kvn, roland

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

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


More information about the hotspot-compiler-dev mailing list