# HG changeset patch # User KUBOTA Yuji # Date 1431877530 -32400 # Node ID 6fee1594fa18de39ea7c31dbafc8dbbb87efaa77 # Parent 6eca428685f82f445b373390a23cd86e9a01ae60 Bug 2365: Adapt to G1GC hook points of JDK-8049421 reviewed-by: yasuenag diff -r 6eca428685f8 -r 6fee1594fa18 agent/ChangeLog --- 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 + + * Bug 2365: Adapt to G1GC hook points of JDK-8049421 + 2014-12-14 KUBOTA Yuji * Bug 2114: Default values are different from binary-builtin and heapstats.conf. diff -r 6eca428685f8 -r 6fee1594fa18 agent/src/jvmInfo.hpp --- 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. */ diff -r 6eca428685f8 -r 6fee1594fa18 agent/src/oopUtil.cpp --- 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.
- * 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.
+ * 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.
+ * 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.
+ * 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[] = { diff -r 6eca428685f8 -r 6fee1594fa18 agent/src/oopUtil.hpp --- 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.
- * 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[]; diff -r 6eca428685f8 -r 6fee1594fa18 agent/src/overrideFunc.S --- 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.
- * 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() */