RFR: 8370198: Test gc/arguments/TestShrinkHeapInSteps.java crashed: assert(left >= right) failed: avoid underflow

Albert Mingkun Yang ayang at openjdk.org
Thu Nov 20 11:38:45 UTC 2025


On Thu, 20 Nov 2025 09:17:27 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

> Could this the addition be added to a function (or macro) so that the check becomes a one-liner.

I can't come up with a good name to abstract its semantics -- its correct invocation requires quite specific calling context, so I think it's best to "inline" it to the caller.

> Is there a reason why the added check couldn't be done at the beginning of the function?

`MacroAssembler::set_narrow_klass` is an example that will fail the assert, if placed at the beginning of the method.

The thing is that `CollectedHeap::is_in` need to take heap-resizing into account for input address that lie within heap-reserved space, which places some extra constraint for callers. OTOH, for outside-heap-reserved addresses, heap-resizing is orthogonal to the result, so calling constraint can be relaxed.

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

PR Comment: https://git.openjdk.org/jdk/pull/28393#issuecomment-3557516939


More information about the hotspot-gc-dev mailing list