RFR: 8310428: Add CollectedHeap::reserved_range() API to return reserved heap memory range
Thomas Stuefe
stuefe at openjdk.org
Wed Jun 21 18:14:12 UTC 2023
On Wed, 21 Jun 2023 15:30:17 GMT, Ashutosh Mehra <duke at openjdk.org> wrote:
> Please review this patch to add a new API `CollectedHeap::reserved_range()`. The changes are extracted out from https://github.com/openjdk/jdk/pull/14520 as per the suggestion [here](https://github.com/openjdk/jdk/pull/14520#discussion_r1234991165). Support for ZGC is not implemented yet as it can have discontiguous heap regions and unlike other collectors, it does not set `CollectedHeap::_reserved`.
Thank you for doing this.
Would it be possible to add a simple gtest for this API (something simple, as in the result of this function should correspond to MaxHeapSize)?
src/hotspot/share/gc/shared/collectedHeap.hpp line 215:
> 213: assert(!UseZGC, "Not supported for ZGC");
> 214: return _reserved;
> 215: }
Instead of asserting, would it be better to return an empty null range, and document such that "if null range is returned, this method is unsupported"? That way we don't need ZGC specific conditionals in shared code.
-------------
PR Review: https://git.openjdk.org/jdk/pull/14595#pullrequestreview-1491393165
PR Review Comment: https://git.openjdk.org/jdk/pull/14595#discussion_r1237390961
More information about the hotspot-dev
mailing list