Mercurial > hg > release > heapstats-1.1
changeset 9:d0cc4c3be1eb
Bug 1593: HeapStats agent handles concurrent mode failure incorrectly.
reviewed-by: ykubota
author | Yasumasa Suenaga <suenaga.yasumasa@lab.ntt.co.jp> |
---|---|
date | Thu, 21 Nov 2013 15:22:12 +0900 |
parents | d000aea96245 |
children | 4a902634e147 |
files | agent/ChangeLog agent/src/oopUtil.cpp agent/src/oopUtil.hpp agent/src/snapShotMain.cpp |
diffstat | 4 files changed, 46 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/agent/ChangeLog Tue Nov 19 21:24:52 2013 +0900 +++ b/agent/ChangeLog Thu Nov 21 15:22:12 2013 +0900 @@ -1,3 +1,7 @@ +2013-11-21 Yasumasa Suenaga <suenaga.yasumasa@lab.ntt.co.jp> + + * Bug 1593: HeapStats agent handles concurrent mode failure incorrectly. + 2013-11-19 KUBOTA Yuji <kubota.yuji@lab.ntt.co.jp> * Bug 1587: Refactor to improve the messaging and gathering the symbols.
--- a/agent/src/oopUtil.cpp Tue Nov 19 21:24:52 2013 +0900 +++ b/agent/src/oopUtil.cpp Thu Nov 21 15:22:12 2013 +0900 @@ -214,28 +214,6 @@ */ bool *useG1 = NULL; -/* Variable for CMS collector state. */ - -/*! - * \brief CMS collector is idling. - */ -const int CMS_IDLING = 2; -/*! - * \brief CMS collector is initial-marking phase. - */ -const int CMS_INITIALMARKING = 3; -/*! - * \brief CMS collector is marking phase. - */ -const int CMS_MARKING = 4; -/*! - * \brief CMS collector is final-making phase. - */ -const int CMS_FINALMARKING = 7; -/*! - * \brief CMS collector is sweep phase. - */ -const int CMS_SWEEPING = 8; /*! * \brief CMS collector state pointer. @@ -3003,14 +2981,15 @@ * \brief Check CMS garbage collector state. * \param state [in] State of CMS garbage collector. * \param needSnapShot [out] Is need snapshot now. + * \return CMS collector state. * \warning Please don't forget call on JVM death. */ -void checkCMSState(TGCState state, bool *needSnapShot) { +int checkCMSState(TGCState state, bool *needSnapShot) { /* Sanity check. */ if (unlikely(needSnapShot == NULL)) { PRINT_WARN_MSG("Illegal paramter!"); - return; + return -1; } static int cmsStateAtStart; @@ -3078,6 +3057,8 @@ /* Not reached here. */ PRINT_WARN_MSG("Illegal GC state."); } + + return *CMS_collectorState; } /*!
--- a/agent/src/oopUtil.hpp Tue Nov 19 21:24:52 2013 +0900 +++ b/agent/src/oopUtil.hpp Thu Nov 21 15:22:12 2013 +0900 @@ -125,6 +125,35 @@ gcLast = 3, /*!< Garbage collector is tarminating on JVM death. */ } TGCState; + +/* Variable for CMS collector state. */ + +/*! + * \brief CMS collector is idling. + */ +#define CMS_IDLING 2 + +/*! + * \brief CMS collector is initial-marking phase. + */ +#define CMS_INITIALMARKING 3 + +/*! + * \brief CMS collector is marking phase. + */ +#define CMS_MARKING 4 + +/*! + * \brief CMS collector is final-making phase. + */ +#define CMS_FINALMARKING 7 + +/*! + * \brief CMS collector is sweep phase. + */ +#define CMS_SWEEPING 8 + + /*! * \brief This structure is expressing java heap object type. */ @@ -514,9 +543,10 @@ * \brief Check CMS garbage collector state. * \param state [in] State of CMS garbage collector. * \param needSnapShot [out] Is need snapshot now. + * \return CMS collector state. * \warning Please don't forget call on JVM death. */ -void checkCMSState(TGCState state, bool *needSnapShot); +int checkCMSState(TGCState state, bool *needSnapShot); /*! * \brief Setup hooking for inner GC event.
--- a/agent/src/snapShotMain.cpp Tue Nov 19 21:24:52 2013 +0900 +++ b/agent/src/snapShotMain.cpp Thu Nov 21 15:22:12 2013 +0900 @@ -559,7 +559,7 @@ /* Get CMS state. */ bool needShapShot = false; - checkCMSState(gcStart, &needShapShot); + int cmsState = checkCMSState(gcStart, &needShapShot); /* If occurred snapshot target GC. */ if (needShapShot) { @@ -578,9 +578,13 @@ } else { snapshotByGC->clear(false); } - if (likely(snapshotByCMS == NULL)) { + + if(likely(snapshotByCMS == NULL)){ snapshotByCMS = TSnapShotContainer::getInstance(); } + else if(cmsState == CMS_FINALMARKING){ + snapshotByCMS->clear(false); + } /* Enable inner GC event. */ setupHookForInnerGCEvent(true, &onInnerGarbageCollectionInterrupt);