[8u] RFR(XS) 8245617: ObjectSizeCalculator is not supported on OpenJDK

Andrew Hughes gnu.andrew at redhat.com
Sat May 23 10:41:41 UTC 2020


On 23/05/2020 02:31, Yangfei (Felix) wrote:
> 
> 
>> -----Original Message-----
>> From: Andrew Haley [mailto:aph at redhat.com]
>> Sent: Friday, May 22, 2020 5:30 PM
>> To: Yangfei (Felix) <felix.yang at huawei.com>; 'jdk8u-dev at openjdk.java.net'
>> <jdk8u-dev at openjdk.java.net>
>> Subject: Re: [8u] RFR(XS) 8245617: ObjectSizeCalculator is not supported on
>> OpenJDK
>>
>> On 5/22/20 9:36 AM, Yangfei (Felix) wrote:
>>
>>> 8u-specific bug: https://bugs.openjdk.java.net/browse/JDK-8245617
>>> ObjectSizeCalculator is not supported for the latest openjdk 8u release, as
>> indicated by the test case.
>>> Method getEffectiveMemoryLayoutSpecification in
>> ObjectSizeCalculator.java is expecting a vmName which starts with "Java
>> HotSpot(TM) ".
>>> For openjdk 8u release, we have a vmName like: "OpenJDK 64-Bit Server
>> VM".
>>>
>>> Fix is trivial:
>>> diff -r f5a3d8f60cf5
>> src/jdk/nashorn/internal/ir/debug/ObjectSizeCalculator.java
>>> --- a/src/jdk/nashorn/internal/ir/debug/ObjectSizeCalculator.java       Tue
>> May 19 05:11:20 2020 +0100
>>> +++ b/src/jdk/nashorn/internal/ir/debug/ObjectSizeCalculator.java       Fri
>> May 22 15:50:37 2020 +0800
>>> @@ -396,7 +396,8 @@
>>>       */
>>>      public static MemoryLayoutSpecification
>> getEffectiveMemoryLayoutSpecification() {
>>>          final String vmName = System.getProperty("java.vm.name");
>>> -        if (vmName == null || !vmName.startsWith("Java HotSpot(TM) ")) {
>>> +        if (vmName == null
>>> +            || (!vmName.startsWith("OpenJDK ") &&
>>> + !vmName.startsWith("Java HotSpot(TM) "))) {
>>>              throw new UnsupportedOperationException(
>>>                      "ObjectSizeCalculator only supported on HotSpot VM");
>>>          }
>>
>> This code looks almost absurdly fragile. Does it do anything useful at all?
>> I suppose it'd give you an error message if you tried to run it on J9.
> 
> Indeed.  The code is there since 2013.

For the record, this is only not applicable to 11u and later because it
was removed by JDK-8189617.

At the time of removal, it still had this code, unfixed for OpenJDK.
It seems trying to fix this was actually the motivation for removing it
altogether, because it's completely broken with the OpenJDK 9 module &
versioning changes:

https://bugs.openjdk.java.net/browse/JDK-8171934

I've reopened that and this fix to 8u should be pushed under that ID.
8245617 has been closed as a dupe.

> 
>> Anyway, never mind, it's not worth spending any more time thinking about.
>>
>> Your patch is OK, thanks.
> 
> Thanks for the quick review.  Will push this trivial change.
> 
> Felix
> 

Pushes to jdk8u require jdk8u-fix-yes
(https://wiki.openjdk.java.net/display/jdk8u/Main, step #11). Please
flag JDK-8171934 with a jdk8u-fix-request and I'll approve.

Thanks,
-- 
Andrew :)

Senior Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

PGP Key: ed25519/0xCFDA0F9B35964222 (hkp://keys.gnupg.net)
Fingerprint = 5132 579D D154 0ED2 3E04  C5A0 CFDA 0F9B 3596 4222



More information about the jdk8u-dev mailing list