RFR (S) 8249137: Remove CollectedHeap::obj_size

Daniel D. Daugherty daniel.daugherty at oracle.com
Thu Jul 9 13:34:15 UTC 2020


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