diff --git a/src/share/vm/ci/ciEnv.cpp b/src/share/vm/ci/ciEnv.cpp index eab8de7670d1c623d6dfb55708005ba737564b73..2f20fcc986121a4dd5a31e06626b49e0e1faf470 100644 --- a/src/share/vm/ci/ciEnv.cpp +++ b/src/share/vm/ci/ciEnv.cpp @@ -409,15 +409,15 @@ ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass, } else { fail_type = _unloaded_ciinstance_klass; } - klassOop found_klass; + KlassHandle found_klass; if (!require_local) { - found_klass = - SystemDictionary::find_constrained_instance_or_array_klass(sym, loader, - KILL_COMPILE_ON_FATAL_(fail_type)); + klassOop kls = SystemDictionary::find_constrained_instance_or_array_klass( + sym, loader, KILL_COMPILE_ON_FATAL_(fail_type)); + found_klass = KlassHandle(THREAD, kls); } else { - found_klass = - SystemDictionary::find_instance_or_array_klass(sym, loader, domain, - KILL_COMPILE_ON_FATAL_(fail_type)); + klassOop kls = SystemDictionary::find_instance_or_array_klass( + sym, loader, domain, KILL_COMPILE_ON_FATAL_(fail_type)); + found_klass = KlassHandle(THREAD, kls); } // If we fail to find an array klass, look again for its element type. @@ -444,9 +444,9 @@ ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass, } } - if (found_klass != NULL) { + if (found_klass() != NULL) { // Found it. Build a CI handle. - return get_object(found_klass)->as_klass(); + return get_object(found_klass())->as_klass(); } if (require_local) return NULL; diff --git a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index 797ddb3f920ca53ef20b6824bd3838a14fcd132d..2bbe0aa1f9fb21643e36cfe3ef678c47fe4b8d77 100644 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -4979,6 +4979,7 @@ void CMSCollector::checkpointRootsFinalWork(bool asynch, if (should_unload_classes()) { CodeCache::gc_epilogue(); } + JvmtiExport::gc_epilogue(); // If we encountered any (marking stack / work queue) overflow // events during the current CMS cycle, take appropriate diff --git a/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp b/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp index 765ef8bc62f0567004f1a5ea768abb2014338861..753427e68bf73642b66f861686d45ead9b3358c9 100644 --- a/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp +++ b/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp @@ -113,6 +113,7 @@ void G1MarkSweep::invoke_at_safepoint(ReferenceProcessor* rp, Threads::gc_epilogue(); CodeCache::gc_epilogue(); + JvmtiExport::gc_epilogue(); // refs processing: clean slate GenMarkSweep::_ref_processor = NULL; diff --git a/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp b/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp index 3efa4ceaeae3edcab1ed986bff30a6d2cec3acdd..4c96c3d41d0d2acf0d55695cfc9cbe15fb68162c 100644 --- a/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp +++ b/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp @@ -258,6 +258,7 @@ void PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) { BiasedLocking::restore_marks(); Threads::gc_epilogue(); CodeCache::gc_epilogue(); + JvmtiExport::gc_epilogue(); COMPILER2_PRESENT(DerivedPointerTable::update_pointers()); diff --git a/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp index 79e269dc7f3737ce9a1cbe3533e2949126ebca11..87ba37e496b27131227ab3cd77ee123a40f2ac47 100644 --- a/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +++ b/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp @@ -1054,6 +1054,7 @@ void PSParallelCompact::post_compact() Threads::gc_epilogue(); CodeCache::gc_epilogue(); + JvmtiExport::gc_epilogue(); COMPILER2_PRESENT(DerivedPointerTable::update_pointers()); diff --git a/src/share/vm/memory/genMarkSweep.cpp b/src/share/vm/memory/genMarkSweep.cpp index 95056cd8f420f34e9a878ac2a25276d6218cac84..44b958d1e23e471e42a9419be4927954bf679265 100644 --- a/src/share/vm/memory/genMarkSweep.cpp +++ b/src/share/vm/memory/genMarkSweep.cpp @@ -158,6 +158,7 @@ void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, Threads::gc_epilogue(); CodeCache::gc_epilogue(); + JvmtiExport::gc_epilogue(); if (PrintGC && !PrintGCDetails) { gch->print_heap_change(gch_prev_used); diff --git a/src/share/vm/prims/jvmtiExport.cpp b/src/share/vm/prims/jvmtiExport.cpp index 4cf7d187b364cf8556c40a02a5d09e8f1006f0a4..5fc3281400cd40781ce83a58eb72752fe4d96a3c 100644 --- a/src/share/vm/prims/jvmtiExport.cpp +++ b/src/share/vm/prims/jvmtiExport.cpp @@ -2268,6 +2268,14 @@ void JvmtiExport::oops_do(OopClosure* f) { JvmtiVMObjectAllocEventCollector::oops_do_for_all_threads(f); } +void JvmtiExport::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f) { + JvmtiTagMap::weak_oops_do(is_alive, f); +} + +void JvmtiExport::gc_epilogue() { + JvmtiCurrentBreakpoints::gc_epilogue(); +} + // Onload raw monitor transition. void JvmtiExport::transition_pending_onload_raw_monitors() { JvmtiPendingMonitors::transition_raw_monitors(); diff --git a/src/share/vm/prims/jvmtiExport.hpp b/src/share/vm/prims/jvmtiExport.hpp index b46c9c126228e9f4c50205fbef6a59fb3bbbd6a4..31b4e1ba91aa6de32449ee0409b731add3230416 100644 --- a/src/share/vm/prims/jvmtiExport.hpp +++ b/src/share/vm/prims/jvmtiExport.hpp @@ -346,6 +346,8 @@ class JvmtiExport : public AllStatic { static void cleanup_thread (JavaThread* thread) KERNEL_RETURN; static void oops_do(OopClosure* f) KERNEL_RETURN; + static void weak_oops_do(BoolObjectClosure* b, OopClosure* f) KERNEL_RETURN; + static void gc_epilogue() KERNEL_RETURN; static void transition_pending_onload_raw_monitors() KERNEL_RETURN; diff --git a/src/share/vm/prims/jvmtiImpl.cpp b/src/share/vm/prims/jvmtiImpl.cpp index 2e6a7df0f656c57e6f4c8ce75d0f2487279661d4..f8f94c8445a2d79d53f87363632a2886de6abf02 100644 --- a/src/share/vm/prims/jvmtiImpl.cpp +++ b/src/share/vm/prims/jvmtiImpl.cpp @@ -212,7 +212,13 @@ void GrowableCache::oops_do(OopClosure* f) { for (int i=0; iat(i); e->oops_do(f); - _cache[i] = e->getCacheValue(); + } +} + +void GrowableCache::gc_epilogue() { + int len = _elements->length(); + for (int i=0; iat(i)->getCacheValue(); } } @@ -394,6 +400,10 @@ void JvmtiBreakpoints::oops_do(OopClosure* f) { _bps.oops_do(f); } +void JvmtiBreakpoints::gc_epilogue() { + _bps.gc_epilogue(); +} + void JvmtiBreakpoints::print() { #ifndef PRODUCT ResourceMark rm; @@ -523,6 +533,12 @@ void JvmtiCurrentBreakpoints::oops_do(OopClosure* f) { } } +void JvmtiCurrentBreakpoints::gc_epilogue() { + if (_jvmti_breakpoints != NULL) { + _jvmti_breakpoints->gc_epilogue(); + } +} + /////////////////////////////////////////////////////////////// // // class VM_GetOrSetLocal diff --git a/src/share/vm/prims/jvmtiImpl.hpp b/src/share/vm/prims/jvmtiImpl.hpp index 023fe93874dd3f8350a5c71c81b333078664bd1f..4f543cc43226e88e3fdbe3a3894cc0bdd3d3b6fe 100644 --- a/src/share/vm/prims/jvmtiImpl.hpp +++ b/src/share/vm/prims/jvmtiImpl.hpp @@ -117,6 +117,8 @@ public: void clear(); // apply f to every element and update the cache void oops_do(OopClosure* f); + // update the cache after a full gc + void gc_epilogue(); }; @@ -148,6 +150,7 @@ public: void remove (int index) { _cache.remove(index); } void clear() { _cache.clear(); } void oops_do(OopClosure* f) { _cache.oops_do(f); } + void gc_epilogue() { _cache.gc_epilogue(); } }; @@ -282,6 +285,7 @@ public: int clear(JvmtiBreakpoint& bp); void clearall_in_class_at_safepoint(klassOop klass); void clearall(); + void gc_epilogue(); }; @@ -325,6 +329,7 @@ public: static inline bool is_breakpoint(address bcp); static void oops_do(OopClosure* f); + static void gc_epilogue(); }; // quickly test whether the bcp matches a cached breakpoint in the list diff --git a/src/share/vm/runtime/jniHandles.cpp b/src/share/vm/runtime/jniHandles.cpp index 40f82864423ab8611ae1322786f57577498aae8e..31595688fe5283ae514ccf2b83da5ec2d95b584e 100644 --- a/src/share/vm/runtime/jniHandles.cpp +++ b/src/share/vm/runtime/jniHandles.cpp @@ -25,7 +25,7 @@ #include "precompiled.hpp" #include "classfile/systemDictionary.hpp" #include "oops/oop.inline.hpp" -#include "prims/jvmtiTagMap.hpp" +#include "prims/jvmtiExport.hpp" #include "runtime/jniHandles.hpp" #include "runtime/mutexLocker.hpp" #ifdef TARGET_OS_FAMILY_linux @@ -431,10 +431,10 @@ void JNIHandleBlock::weak_oops_do(BoolObjectClosure* is_alive, } /* - * JvmtiTagMap may also contain weak oops. The iteration of it is placed - * here so that we don't need to add it to each of the collectors. + * JVMTI data structures may also contain weak oops. The iteration of them + * is placed here so that we don't need to add it to each of the collectors. */ - JvmtiTagMap::weak_oops_do(is_alive, f); + JvmtiExport::weak_oops_do(is_alive, f); }