RFR: 8295657: SA: Allow larger object alignments

Aleksey Shipilev shade at openjdk.org
Wed Oct 19 20:30:17 UTC 2022


On Wed, 19 Oct 2022 19:42:31 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> Found this when working on JOL support ([CODETOOLS-7903364](https://bugs.openjdk.org/browse/CODETOOLS-7903364)). If you try to attach to VM running with -XX:ObjectAlignmentInBytes=32, then SA would fail with:
>> 
>> 
>> Caused by: java.lang.RuntimeException: Object alignment 32 not yet supported
>> at jdk.hotspot.agent/sun.jvm.hotspot.runtime.VM.<init>(VM.java:510)
>> at jdk.hotspot.agent/sun.jvm.hotspot.runtime.VM.initialize(VM.java:544)
>> at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.setupVM(HotSpotAgent.java:444)
>> 
>> 
>> This code was added by [JDK-6916623](https://bugs.openjdk.org/browse/JDK-6916623), but I don't see a reason why it should only handle 8 and 16 byte alignment.
>> 
>> Additional testing:
>>  - [x] New regression test
>>  - [x] Linux x86_64 fastdebug `serviceability/sa`
>>     - default
>>     - with `-XX:ObjectAlignmentInBytes=16`
>>     - with `-XX:ObjectAlignmentInBytes=32`
>>     - with `-XX:ObjectAlignmentInBytes=64`
>>     - with `-XX:ObjectAlignmentInBytes=128`
>>     - with `-XX:ObjectAlignmentInBytes=256`
>
> src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java line 505:
> 
>> 503: 
>> 504:     minObjAlignmentInBytes = getObjectAlignmentInBytes();
>> 505:     if (minObjAlignmentInBytes < 8 || minObjAlignmentInBytes > 256 ||
> 
> Is it necessary to restrict it to the 8 -> 256 range. I know this is the current hotspot restriction, but if hotspot decided to allow a larger range, is there any reason SA wouldn't still work?

I don't think there is anything specific in SA that prohibits it to follow what Hotspot is capable of. Are you proposing to drop the range check altogether? I can do that.

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

PR: https://git.openjdk.org/jdk/pull/10762


More information about the serviceability-dev mailing list