changeset 50:6fee1594fa18

Bug 2365: Adapt to G1GC hook points of JDK-8049421 reviewed-by: yasuenag
author KUBOTA Yuji <kubota.yuji@lab.ntt.co.jp>
date Mon, 18 May 2015 00:45:30 +0900
parents 6eca428685f8
children a4398da82c5b
files agent/ChangeLog agent/src/jvmInfo.hpp agent/src/oopUtil.cpp agent/src/oopUtil.hpp agent/src/overrideFunc.S
diffstat 5 files changed, 102 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/agent/ChangeLog	Sun Dec 14 00:52:12 2014 +0900
+++ b/agent/ChangeLog	Mon May 18 00:45:30 2015 +0900
@@ -1,3 +1,7 @@
+2015-05-18 KUBOTA Yuji  <kubota.yuji@lab.ntt.co.jp>
+
+	* Bug 2365: Adapt to G1GC hook points of JDK-8049421
+
 2014-12-14  KUBOTA Yuji  <kubota.yuji@lab.ntt.co.jp>
 
 	* Bug 2114: Default values are different from binary-builtin and heapstats.conf.
--- a/agent/src/jvmInfo.hpp	Sun Dec 14 00:52:12 2014 +0900
+++ b/agent/src/jvmInfo.hpp	Mon May 18 00:45:30 2015 +0900
@@ -1,7 +1,7 @@
 /*!
  * \file jvmInfo.hpp
  * \brief This file is used to get JVM performance information.
- * Copyright (C) 2011-2014 Nippon Telegraph and Telephone Corporation
+ * Copyright (C) 2011-2015 Nippon Telegraph and Telephone Corporation
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -421,6 +421,14 @@
     }
 
     /*!
+     * \brief Decision for JDK-8049421: G1 Class Unloading after completing a concurrent mark cycle
+     */
+    inline bool isAfterCR8049421(void){
+      // hs25.40-b05
+      return (this->_hsVersion >= MAKE_HS_VERSION(25, 40, 0, 5));
+    }
+
+    /*!
      * \brief Get JVM name.
      * \return JVM name.
      */
--- a/agent/src/oopUtil.cpp	Sun Dec 14 00:52:12 2014 +0900
+++ b/agent/src/oopUtil.cpp	Mon May 18 00:45:30 2015 +0900
@@ -1,7 +1,7 @@
 /*!
  * \file oopUtil.cpp
  * \brief This file is used to getting information inner JVM.<br>
- * Copyright (C) 2011-2014 Nippon Telegraph and Telephone Corporation
+ * Copyright (C) 2011-2015 Nippon Telegraph and Telephone Corporation
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -141,6 +141,11 @@
 DEFINE_OVERRIDE_FUNC_9(CR8027746_g1)
 
 /*!
+ * \brief Override function for instance object on G1GC for after CR8049421.
+ */
+DEFINE_OVERRIDE_FUNC_9(CR8049421_g1)
+
+/*!
  * \brief Override function for cleanup event on G1GC.
  */
 DEFINE_OVERRIDE_FUNC_3(g1Event)
@@ -168,7 +173,9 @@
 /* Macro. */
 
 #define SELECT_HOOK_FUNCS(result, prefix) \
-  if(jvmInfo->isAfterCR8027746())       \
+  if(jvmInfo->isAfterCR8049421())       \
+    result = CR8049421_##prefix##_hook; \
+  else if(jvmInfo->isAfterCR8027746())  \
     result = CR8027746_##prefix##_hook; \
   else if(jvmInfo->isAfterCR8000213())  \
     result = CR8000213_##prefix##_hook; \
@@ -514,10 +521,11 @@
 };
 
 /*!
- * \brief Pointer of hook information on parallelGC for after CR8027746.
- * (no change)
+ * \brief Pointers of hook information on parallelGC for several CRs.<br>
+ *        These CRs have no impact on parallelGC, so refer to the last.
  */
 #define CR8027746_par_hook CR8000213_par_hook
+#define CR8049421_par_hook CR8000213_par_hook
 
 /*!
  * \brief Pointer of hook information on parallelOldGC.
@@ -589,10 +597,11 @@
 };
 
 /*!
- * \brief Pointer of hook information on parallelOldGC for after CR8027746.
- * (no change)
+ * \brief Pointers of hook information on parallelOldGC for several CRs.<br>
+ *        These CRs have no impact on parallelOldGC, so refer to the last.
  */
 #define CR8027746_parOld_hook CR8000213_parOld_hook
+#define CR8049421_parOld_hook CR8000213_parOld_hook
 
 /*!
  * \brief Pointer of hook information on CMSGC.
@@ -674,10 +683,11 @@
 };
 
 /*!
- * \brief Pointer of hook information on CMSGC for after CR8027746.
- * (no change)
- */
+ * \brief Pointers of hook information on CMSGC for several CRs.<br>
+ *        These CRs have no impact on CMSGC, so refer to the last.
+*/
 #define CR8027746_cms_new_hook CR8000213_cms_new_hook
+#define CR8049421_cms_new_hook CR8000213_cms_new_hook
 
 /*!
  * \brief Pointer of hook information on G1GC.
@@ -820,6 +830,41 @@
 };
 
 /*!
+ * \brief Pointer of hook information on G1GC for after JDK-8049421.
+ */
+THookFunctionInfo CR8049421_g1_hook[] = {
+  HOOK_FUNC("_ZTV16G1ParCopyClosureIL9G1Barrier0EL6G1Mark1EE",
+    "_ZN16G1ParCopyClosureIL9G1Barrier0EL6G1Mark1EE6do_oopEPP7oopDesc",
+    &CR8049421_g1_override_func_0, NULL),
+  HOOK_FUNC("_ZTV16G1ParCopyClosureIL9G1Barrier0EL6G1Mark1EE",
+    "_ZN16G1ParCopyClosureIL9G1Barrier0EL6G1Mark1EE6do_oopEPj",
+    &CR8049421_g1_override_func_1, NULL),
+  HOOK_FUNC("_ZTV13InstanceKlass",
+    "_ZN13InstanceKlass18oop_oop_iterate_nvEP7oopDescP23G1RootRegionScanClosure",
+    &CR8049421_g1_override_func_2, NULL),
+  HOOK_FUNC("_ZTV13ObjArrayKlass",
+    "_ZN13ObjArrayKlass18oop_oop_iterate_nvEP7oopDescP23G1RootRegionScanClosure",
+    &CR8049421_g1_override_func_3, NULL),
+  HOOK_FUNC("_ZTV16InstanceRefKlass",
+    "_ZN16InstanceRefKlass18oop_oop_iterate_nvEP7oopDescP23G1RootRegionScanClosure",
+    &CR8049421_g1_override_func_4, NULL),
+
+  HOOK_FUNC("_ZTV13InstanceKlass",
+    "_ZN13InstanceKlass18oop_oop_iterate_nvEP7oopDescP14G1CMOopClosure",
+    &CR8049421_g1_override_func_5, NULL),
+  HOOK_FUNC("_ZTV13ObjArrayKlass",
+    "_ZN13ObjArrayKlass18oop_oop_iterate_nvEP7oopDescP14G1CMOopClosure",
+    &CR8049421_g1_override_func_6, NULL),
+  HOOK_FUNC("_ZTV14TypeArrayKlass",
+    "_ZN14TypeArrayKlass15oop_oop_iterateEP7oopDescP18ExtendedOopClosure",
+    &CR8049421_g1_override_func_7, NULL),
+  HOOK_FUNC("_ZTV16InstanceRefKlass",
+    "_ZN16InstanceRefKlass18oop_oop_iterate_nvEP7oopDescP14G1CMOopClosure",
+    &CR8049421_g1_override_func_8, NULL),
+  HOOK_FUNC_END
+};
+
+/*!
  * \brief Pointer of hook information on G1GC cleanup event.
  */
 THookFunctionInfo g1Event_hook[] = {
--- a/agent/src/oopUtil.hpp	Sun Dec 14 00:52:12 2014 +0900
+++ b/agent/src/oopUtil.hpp	Mon May 18 00:45:30 2015 +0900
@@ -1,7 +1,7 @@
 /*!
  * \file oopUtil.hpp
  * \brief This file is used to getting information inner JVM.<br>
- * Copyright (C) 2011-2014 Nippon Telegraph and Telephone Corporation
+ * Copyright (C) 2011-2015 Nippon Telegraph and Telephone Corporation
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -311,6 +311,11 @@
 extern "C" THookFunctionInfo CR8027746_g1_hook[];
 
 /*!
+ * \brief Pointer of hook information on G1GC after CR8049421.
+ */
+extern "C" THookFunctionInfo CR8049421_g1_hook[];
+
+/*!
  * \brief Pointer of hook information on G1GC event.
  */
 extern "C" THookFunctionInfo g1Event_hook[];
--- a/agent/src/overrideFunc.S	Sun Dec 14 00:52:12 2014 +0900
+++ b/agent/src/overrideFunc.S	Mon May 18 00:45:30 2015 +0900
@@ -1,7 +1,7 @@
 /*!
  * \file overrideFunc.S
  * \brief This file is used to override JVM inner function.<br>
- * Copyright (C) 2011-2014 Nippon Telegraph and Telephone Corporation
+ * Copyright (C) 2011-2015 Nippon Telegraph and Telephone Corporation
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -687,6 +687,34 @@
 /* InstanceRefKlass::oop_oop_iterate_nv(oopDesc*, G1CMOopClosure*) */
 OVERRIDE_OOP_OOP_ITERATE(CR8027746_g1, 8)
 
+/* For G1 (JDK-8049421). */
+
+/* initial-mark */
+/* G1ParScanAndMarkExtRootClosure::do_oop(oopDesc**) */
+/* G1ParCopyClosure<(G1Barrier)0, G1MarkFromRoot>::do_oop(oopDesc**) */
+OVERRIDE_CALLBACK_DEFINE(CR8049421_g1, 0, callbackForDoOop);
+/* G1ParScanAndMarkExtRootClosure::do_oop(unsigned int*) */
+/* G1ParCopyClosure<(G1Barrier)0, G1MarkFromRoot>::do_oop(unsigned int*) */
+OVERRIDE_CALLBACK_DEFINE(CR8049421_g1, 1, callbackForDoNarrowOop);
+
+/* concurrent-root-region-scan */
+/* InstanceKlass::oop_oop_iterate_nv(oopDesc*, G1RootRegionScanClosure*) */
+OVERRIDE_OOP_OOP_ITERATE(CR8049421_g1, 2)
+/* objArrayKlass::oop_oop_iterate_nv(oopDesc*, G1RootRegionScanClosure*) */
+OVERRIDE_OOP_OOP_ITERATE(CR8049421_g1, 3)
+/* InstanceRefKlass::oop_oop_iterate_nv(oopDesc*, G1RootRegionScanClosure*) */
+OVERRIDE_OOP_OOP_ITERATE(CR8049421_g1, 4)
+
+/* concurrent-mark / remark */
+/* InstanceKlass::oop_oop_iterate_nv(oopDesc*, G1CMOopClosure*) */
+OVERRIDE_OOP_OOP_ITERATE(CR8049421_g1, 5)
+/* ObjArrayKlass::oop_oop_iterate_nv(oopDesc*, G1CMOopClosure*) */
+OVERRIDE_OOP_OOP_ITERATE(CR8049421_g1, 6)
+/* TypeArrayKlass::oop_oop_iterate(oopDesc*, ExtendedOopClosure*) */
+OVERRIDE_OOP_OOP_ITERATE_WITH_CALLER_CHECK(CR8049421_g1, 7, VTableForTypeArrayOopClosure)
+/* InstanceRefKlass::oop_oop_iterate_nv(oopDesc*, G1CMOopClosure*) */
+OVERRIDE_OOP_OOP_ITERATE(CR8049421_g1, 8)
+
 /* G1 events */
 
 /* CMCleanUp::do_void() */