RFR: 8334223: Make Arena MEMFLAGs immutable [v2]
Thomas Stuefe
stuefe at openjdk.org
Mon Jun 17 15:33:34 UTC 2024
> Arenas carry NMT flags.
>
> An arena should never change that flag. But it does: Arenas (as ResourceAreas), used by CompilerThread, are accounted toward mtCompiler. But since the RA is already created in the parent class constructor (as mtThread), we then have to awkwardly change the flag of an already existing RA in the CompilerThread constructor.
>
> As a prerequisite for future NMT work I would like Arena MEMFLAGS to be immutable.
>
> The patch does that:
> - we hand in MEMFLAGS to the Thread constructor now (defaults to mtThread)
> - CompilerThread hands in mtCompiler, all other threads rely on the default
> - on creation, both ResourceArea and HandleArea are now accounted toward the flag handed in
> - that allows us to make Arena::flags const, and to remove ResourceArea::bias_to which changed the flag in-flight for the arena
> - it also allows us to make Arena::flags private
>
> Other, unrelated cleanups:
> - Made Arena::_size_in_bytes and Arena::_tag private
> - Merged both Arena constructors into one by specifying a default value of `Chunk::init_size` for `init_size` argument. That makes it equivalent to the old `Arena(flag, tag)` constructor
> - removed `JavaThread::JavaThread(bool)`. That constructor was used when creating threads that are getting attached. There was only a single use for that constructor, and I replaced it with functionally equivalent code.
>
> Tests:
>
> I manually verified that the NMT numbers printed don't change.
Thomas Stuefe 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:
- feedback johan
- Merge branch 'master' into arena-constify-memflags
- start
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/19693/files
- new: https://git.openjdk.org/jdk/pull/19693/files/78238a42..1dabcc59
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=19693&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=19693&range=00-01
Stats: 3421 lines in 176 files changed: 2449 ins; 476 del; 496 mod
Patch: https://git.openjdk.org/jdk/pull/19693.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/19693/head:pull/19693
PR: https://git.openjdk.org/jdk/pull/19693
More information about the hotspot-dev
mailing list