changeset 37:80933f82c4c0

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:36:35 +0900
parents ab312de8b6ae
children 0f15d6873c2d
files agent/ChangeLog agent/src/oopUtil.cpp
diffstat 2 files changed, 66 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/agent/ChangeLog	Sun May 17 11:46:56 2015 +0900
+++ b/agent/ChangeLog	Mon May 18 00:36:35 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
+
 2015-05-17 Yasumasa Suenaga  <yasuenag@gmail.com>
 
 	* Bug 2364: Incorrect arguments are passed to AC_PATH_PROG(S)
--- a/agent/src/oopUtil.cpp	Sun May 17 11:46:56 2015 +0900
+++ b/agent/src/oopUtil.cpp	Mon May 18 00:36:35 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
@@ -109,7 +109,9 @@
  * \brief Select override function information macro.
  */
 #define SELECT_HOOK_FUNCS(prefix) \
-    if (enableCR8027746) {                         \
+    if (enableCR8049421) {                         \
+        prefix##_hook = CR8049421_##prefix##_hook; \
+    } else if (enableCR8027746) {                  \
         prefix##_hook = CR8027746_##prefix##_hook; \
     } else if (enableCR8000213) {                  \
         prefix##_hook = CR8000213_##prefix##_hook; \
@@ -544,10 +546,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 parallelGC.
@@ -624,10 +627,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 parallelGC.
@@ -719,10 +723,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 parallelGC.
@@ -866,6 +871,40 @@
 };
 
 /*!
+ * \brief Pointer of hook information on G1GC for after JDK-8049421.
+ */
+THookFunctionInfo CR8049421_g1_hook[] = {
+    HOOK_FUNC("_ZTV16G1ParCopyClosureIL9G1Barrier0EL6G1Mark1EE",
+        "_ZN16G1ParCopyClosureIL9G1Barrier0EL6G1Mark1EE6do_oopEPP7oopDesc",
+        &g1_override_func_0, NULL),
+    HOOK_FUNC("_ZTV16G1ParCopyClosureIL9G1Barrier0EL6G1Mark1EE",
+        "_ZN16G1ParCopyClosureIL9G1Barrier0EL6G1Mark1EE6do_oopEPj",
+        &g1_override_func_1, NULL),
+    HOOK_FUNC("_ZTV13InstanceKlass",
+        "_ZN13InstanceKlass18oop_oop_iterate_nvEP7oopDescP23G1RootRegionScanClosure",
+        &g1_override_func_2, NULL),
+    HOOK_FUNC("_ZTV13ObjArrayKlass",
+        "_ZN13ObjArrayKlass18oop_oop_iterate_nvEP7oopDescP23G1RootRegionScanClosure",
+        &g1_override_func_3, NULL),
+    HOOK_FUNC("_ZTV16InstanceRefKlass",
+        "_ZN16InstanceRefKlass18oop_oop_iterate_nvEP7oopDescP23G1RootRegionScanClosure",
+        &g1_override_func_4, NULL),
+    HOOK_FUNC("_ZTV13InstanceKlass",
+        "_ZN13InstanceKlass18oop_oop_iterate_nvEP7oopDescP14G1CMOopClosure",
+        &g1_override_func_5, NULL),
+    HOOK_FUNC("_ZTV13ObjArrayKlass",
+        "_ZN13ObjArrayKlass18oop_oop_iterate_nvEP7oopDescP14G1CMOopClosure",
+        &g1_override_func_6, NULL),
+    HOOK_FUNC("_ZTV14TypeArrayKlass",
+        "_ZN14TypeArrayKlass15oop_oop_iterateEP7oopDescP18ExtendedOopClosure",
+        &g1_override_func_7, NULL),
+    HOOK_FUNC("_ZTV16InstanceRefKlass",
+        "_ZN16InstanceRefKlass18oop_oop_iterate_nvEP7oopDescP14G1CMOopClosure",
+        &g1_override_func_8, NULL),
+    HOOK_FUNC_END
+};
+
+/*!
  * \brief Pointer of hook information on parallelGC.
  */
 THookFunctionInfo *g1_hook = NULL;
@@ -1120,6 +1159,14 @@
  */
 bool enableCR8015107 = false;
 
+/*!
+ * \brief Flag of JVM is applyed JDK-8049421.<br>
+ *        G1 Class Unloading after completing a concurrent mark cycle
+ * \sa https://bugs.openjdk.java.net/browse/JDK-8049421
+ * \sa http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/rev/2c6ef90f030a
+ */
+bool enableCR8049421 = false;
+
 /* Variable for hotspot version. */
 
 /*!
@@ -2918,6 +2965,13 @@
         const unsigned int afterCR8015107 = 25 << 24 | 51;
         enableCR8015107 = (hotSpotVersion >= afterCR8015107);
 
+        /*
+         * See JDK-8049421:
+         * G1 Class Unloading after completing a concurrent mark cycle
+         */
+        const unsigned int afterCR8049421 = 25 << 24 | 40 << 16 | 5;
+        enableCR8049421 = (hotSpotVersion >= afterCR8049421);
+
         /* Search flag symbol in libjvm. */
         if (unlikely(!searchCommonFlags())) {
             PRINT_CRIT_MSG("Failure getting java symbol information.");