RFR (S) 8249137: Remove CollectedHeap::obj_size

Daniel D. Daugherty daniel.daugherty at oracle.com
Fri Jul 10 15:07:01 UTC 2020


On 7/10/20 4:37 AM, Aleksey Shipilev wrote:
> Okay, thanks.
>
> I already have 2 reviewers (rkennke, tschatzl), do I need more specifically from serviceability-dev@?

Since you're touching the Serviceability team's code, it would be
polite to wait for a review...

Dan


>
> -Aleksey
>
> On 7/9/20 3:34 PM, Daniel D. Daugherty wrote:
>> Adding serviceability-dev at ... since a couple of JVM/TI files are changed
>> in this RFR. Also, I moved the bug from hotspot/runtime -> hotspot/gc.
>>
>> Dan
>>
>>
>> On 7/9/20 2:36 AM, Aleksey Shipilev wrote:
>>> RFE:
>>>     https://bugs.openjdk.java.net/browse/JDK-8249137
>>>
>>> It was added by JDK-8211270 to support old-style Shenandoah that needed a separate fwdptr slot.
>>> After JDK-8224584 it does not need this anymore. Additionally, CH::obj_size may disagree with other
>>> code that pokes at layout helper directly, for example GraphKit::new_instance.
>>>
>>> This also avoids a virtual call on some paths, although those paths are not very performance-sensitive.
>>>
>>> The patch is a simple series of few-liners:
>>>
>>> diff -r 9cc348ebdc82 src/hotspot/share/gc/shared/collectedHeap.cpp
>>> --- a/src/hotspot/share/gc/shared/collectedHeap.cpp     Thu Jul 09 04:32:30 2020 +0200
>>> +++ b/src/hotspot/share/gc/shared/collectedHeap.cpp     Thu Jul 09 08:05:46 2020 +0200
>>> @@ -578,6 +578,2 @@
>>>
>>> -size_t CollectedHeap::obj_size(oop obj) const {
>>> -  return obj->size();
>>> -}
>>> -
>>>    uint32_t CollectedHeap::hash_oop(oop obj) const {
>>> diff -r 9cc348ebdc82 src/hotspot/share/gc/shared/collectedHeap.hpp
>>> --- a/src/hotspot/share/gc/shared/collectedHeap.hpp     Thu Jul 09 04:32:30 2020 +0200
>>> +++ b/src/hotspot/share/gc/shared/collectedHeap.hpp     Thu Jul 09 08:05:46 2020 +0200
>>> @@ -495,4 +495,2 @@
>>>
>>> -  virtual size_t obj_size(oop obj) const;
>>> -
>>>      // Non product verification and debugging.
>>> diff -r 9cc348ebdc82 src/hotspot/share/prims/jvmtiEnv.cpp
>>> --- a/src/hotspot/share/prims/jvmtiEnv.cpp      Thu Jul 09 04:32:30 2020 +0200
>>> +++ b/src/hotspot/share/prims/jvmtiEnv.cpp      Thu Jul 09 08:05:46 2020 +0200
>>> @@ -488,3 +488,3 @@
>>>      NULL_CHECK(mirror, JVMTI_ERROR_INVALID_OBJECT);
>>> -  *size_ptr = (jlong)Universe::heap()->obj_size(mirror) * wordSize;
>>> +  *size_ptr = (jlong)mirror->size() * wordSize;
>>>      return JVMTI_ERROR_NONE;
>>> diff -r 9cc348ebdc82 src/hotspot/share/prims/jvmtiExport.cpp
>>> --- a/src/hotspot/share/prims/jvmtiExport.cpp   Thu Jul 09 04:32:30 2020 +0200
>>> +++ b/src/hotspot/share/prims/jvmtiExport.cpp   Thu Jul 09 08:05:46 2020 +0200
>>> @@ -1067,3 +1067,3 @@
>>>         _jobj = (jobject)to_jobject(obj);
>>> -     _size = Universe::heap()->obj_size(obj) * wordSize;
>>> +     _size = obj->size() * wordSize;
>>>       };
>>> diff -r 9cc348ebdc82 src/hotspot/share/prims/whitebox.cpp
>>> --- a/src/hotspot/share/prims/whitebox.cpp      Thu Jul 09 04:32:30 2020 +0200
>>> +++ b/src/hotspot/share/prims/whitebox.cpp      Thu Jul 09 08:05:46 2020 +0200
>>> @@ -389,3 +389,3 @@
>>>      oop p = JNIHandles::resolve(obj);
>>> -  return Universe::heap()->obj_size(p) * HeapWordSize;
>>> +  return p->size() * HeapWordSize;
>>>    WB_END
>>>
>>> Testing: tier{1,2}; jdk-submit (running)
>>>
>




More information about the hotspot-gc-dev mailing list