Mercurial > hg > release > heapstats-1.0
changeset 20:ea356e72d922
Bug 1506: HeapStats agent can't track Klass relocation.
reviewed-by: shintak
author | Yasumasa Suenaga <suenaga.yasumasa@lab.ntt.co.jp> |
---|---|
date | Thu, 15 Aug 2013 10:36:43 +0900 |
parents | ebd17a919599 |
children | 8a3de8e3526c |
files | agent/ChangeLog agent/src/classContainer.hpp agent/src/oopUtil.cpp |
diffstat | 3 files changed, 53 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/agent/ChangeLog Fri Jul 26 09:40:00 2013 +0900 +++ b/agent/ChangeLog Thu Aug 15 10:36:43 2013 +0900 @@ -1,3 +1,7 @@ +2013-08-15 Yasumasa Suenaga <suenaga.yasumasa@lab.ntt.co.jp> + + * Bug 1506: HeapStats agent can't track Klass relocation. + 2013-07-25 Yasumasa Suenaga <suenaga.yasumasa@lab.ntt.co.jp> * Bug 1493: HeapStats agent should use UseCompressedKlassPointers on
--- a/agent/src/classContainer.hpp Fri Jul 26 09:40:00 2013 +0900 +++ b/agent/src/classContainer.hpp Thu Aug 15 10:36:43 2013 +0900 @@ -114,21 +114,46 @@ * \return Class data of target class. */ inline void updateClass(void *oldKlassOop, void *newKlassOop) { + + /* Get class container's spin lock. */ SpinLockWait(&lockval); { + /* Search class data. */ TClassMap::iterator it = classMap->find(oldKlassOop); + if(it != classMap->end()){ + TObjectData *cur = (*it).second; - if (it != classMap->end()) { - /* Update class data. */ - it->second->klassOop = newKlassOop; - (*classMap)[newKlassOop] = it->second; - /* Remove old klassOop. */ classMap->erase(it); - } + try{ + /* Update class data. */ + (*classMap)[newKlassOop] = cur; + cur->klassOop = newKlassOop; + } + catch(...){ + /* + * Maybe failed to allocate memory + * at "std::map::operator[]". + */ + } + } } + /* Release class container's spin lock. */ SpinLockRelease(&lockval); + + /* Get spin lock of containers queue. */ + SpinLockWait(&tlsLock); + { + TLocalClassContainer::iterator it = classContainerInTLS.begin(); + /* Broadcast to each local container. */ + for(; it != classContainerInTLS.end(); it++){ + (*it)->updateClass(oldKlassOop, newKlassOop); + } + } + /* Release spin lock of containers queue. */ + SpinLockRelease(&tlsLock); + } /*!
--- a/agent/src/oopUtil.cpp Fri Jul 26 09:40:00 2013 +0900 +++ b/agent/src/oopUtil.cpp Thu Aug 15 10:36:43 2013 +0900 @@ -2092,7 +2092,15 @@ PRINT_WARN_MSG("Failure switch function overriding. func:par"); return false; } - + + /* Switch adjust pointer hooking. */ + if(!jvmInfo->isAfterCR6964458()){ + if(unlikely(!switchOverrideFunction(adj_hook, enable))){ + PRINT_WARN_MSG("Failure switch function overriding. func:adj-ptr"); + return false; + } + } + if (list != NULL) { /* Switch hooking for each GC type. */ @@ -2271,7 +2279,15 @@ PRINT_WARN_MSG("Failure function overriding. func:JVMTI"); return false; } - + + /* Setup for pointer adjustment. */ + if(!jvmInfo->isAfterCR6964458()){ + if(unlikely(!setupOverrideFunction(adj_hook))){ + PRINT_WARN_MSG("Failure function overriding. func:adj-ptr"); + return false; + } + } + /* Setup by using GC type. */ /* Setup parallel GC and GC by user. */