On Tue, 1 Sep 2026 03:46:31 GMT, Shiv Shah <[email protected]> wrote:

>> The SA sizes a stack chunk like any fixed size instance, the layout helper 
>> only covers the header part, so the region walk steps into the copied stack 
>> data, fails to parse it as an object and gives up on the rest of the region. 
>> whatever lives after the chunk never makes it into the dump, that is what 
>> the hprof verification failures were. the fix reads the chunk’s own size 
>> field and computes the footprint the same way the vm does, header plus stack 
>> plus the gc bitmap words. the heap dump test comes off the virtual problem 
>> list since it passes now.
>> 
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Shiv Shah has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Mirror the hotspot size helpers

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceStackChunkKlass.java
 line 55:

> 53:   }
> 54: 
> 55:   public long getObjectSize(Oop object) {

Suggestion:

  @Override
  public long getObjectSize(Oop object) {

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceStackChunkKlass.java
 line 74:

> 72:     long bits = bitmapSizeInBits(stackSizeInWords);
> 73:     return ((bits + bitsPerWord - 1) & ~(bitsPerWord - 1)) / bitsPerWord;
> 74:   }

According to HotSpot, should this method return `bitmapSizeInBits() / 
bitsPerWord` (not aligned)?

inline size_t InstanceStackChunkKlass::bitmap_size(size_t stack_size_in_words) {
  return bitmap_size_in_bits(stack_size_in_words) >> LogBitsPerWord;
}

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceStackChunkKlass.java
 line 79:

> 77:     VM vm = VM.getVM();
> 78:     return stackSizeInWords * (vm.getBytesPerWord() / 
> vm.getHeapOopSize());
> 79:   }

According to HotSpot, the result of this method should be aligned.

inline size_t InstanceStackChunkKlass::bitmap_size_in_bits(size_t 
stack_size_in_words) {
  // Need one bit per potential narrowOop* or oop* address.
  size_t size_in_bits = stack_size_in_words << (LogBitsPerWord - 
LogBitsPerHeapOop);

  return align_up(size_in_bits, BitsPerWord);
}

You can use `VM.alignUp()` to align.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32525#discussion_r3900953416
PR Review Comment: https://git.openjdk.org/jdk/pull/32525#discussion_r3901049029
PR Review Comment: https://git.openjdk.org/jdk/pull/32525#discussion_r3901066241

Reply via email to