RFR: 8342102: ZGC: Optimize copy constructors in ZPhysicalMemory [v2]
Joel Sikström
jsikstro at openjdk.org
Wed Oct 16 08:29:48 UTC 2024
> ZPhysicalMemory stores a sorted array of physical memory segments. Segments are added using either add_segments or add_segment, where the former calls add_segment on each individual segment. add_segment inserts segments in address order and also merges segments when possible.
>
> When copying an instance of ZPhysicalMemory, segments are currently copied using either add_segments or add_segment, which works as described above. This requires more work than necessary and should be simplified to account for the fact that the array of segments is always sorted.
>
> When copying, the copy constructors should instead use append or appendAll from the underlying GrowableArrayCHeap and also reserve enough memory so that the array's capacity is not increased more times than necessary during copying.
>
> Tested with tiers 1-3.
Joel Sikström has updated the pull request incrementally with one additional commit since the last revision:
Add check for self-assignment
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/21523/files
- new: https://git.openjdk.org/jdk/pull/21523/files/4bb84663..dedc1e0c
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=21523&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=21523&range=00-01
Stats: 5 lines in 1 file changed: 5 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/21523.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/21523/head:pull/21523
PR: https://git.openjdk.org/jdk/pull/21523
More information about the hotspot-gc-dev
mailing list