提交 0457abfb 编写于 作者: K kamg

7012505: BreakpointWithFullGC.sh fails with Internal Error (src/share/vm/oops/methodOop.cpp:220)

Summary: Rebuild breakpoint cache at gc_epilogue instead of during oops_do
Reviewed-by: dcubed, ysr, coleenp
上级 2ec2714d
...@@ -409,15 +409,15 @@ ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass, ...@@ -409,15 +409,15 @@ ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass,
} else { } else {
fail_type = _unloaded_ciinstance_klass; fail_type = _unloaded_ciinstance_klass;
} }
klassOop found_klass; KlassHandle found_klass;
if (!require_local) { if (!require_local) {
found_klass = klassOop kls = SystemDictionary::find_constrained_instance_or_array_klass(
SystemDictionary::find_constrained_instance_or_array_klass(sym, loader, sym, loader, KILL_COMPILE_ON_FATAL_(fail_type));
KILL_COMPILE_ON_FATAL_(fail_type)); found_klass = KlassHandle(THREAD, kls);
} else { } else {
found_klass = klassOop kls = SystemDictionary::find_instance_or_array_klass(
SystemDictionary::find_instance_or_array_klass(sym, loader, domain, sym, loader, domain, KILL_COMPILE_ON_FATAL_(fail_type));
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. // 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, ...@@ -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. // 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; if (require_local) return NULL;
......
...@@ -4979,6 +4979,7 @@ void CMSCollector::checkpointRootsFinalWork(bool asynch, ...@@ -4979,6 +4979,7 @@ void CMSCollector::checkpointRootsFinalWork(bool asynch,
if (should_unload_classes()) { if (should_unload_classes()) {
CodeCache::gc_epilogue(); CodeCache::gc_epilogue();
} }
JvmtiExport::gc_epilogue();
// If we encountered any (marking stack / work queue) overflow // If we encountered any (marking stack / work queue) overflow
// events during the current CMS cycle, take appropriate // events during the current CMS cycle, take appropriate
......
...@@ -113,6 +113,7 @@ void G1MarkSweep::invoke_at_safepoint(ReferenceProcessor* rp, ...@@ -113,6 +113,7 @@ void G1MarkSweep::invoke_at_safepoint(ReferenceProcessor* rp,
Threads::gc_epilogue(); Threads::gc_epilogue();
CodeCache::gc_epilogue(); CodeCache::gc_epilogue();
JvmtiExport::gc_epilogue();
// refs processing: clean slate // refs processing: clean slate
GenMarkSweep::_ref_processor = NULL; GenMarkSweep::_ref_processor = NULL;
......
...@@ -258,6 +258,7 @@ void PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) { ...@@ -258,6 +258,7 @@ void PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
BiasedLocking::restore_marks(); BiasedLocking::restore_marks();
Threads::gc_epilogue(); Threads::gc_epilogue();
CodeCache::gc_epilogue(); CodeCache::gc_epilogue();
JvmtiExport::gc_epilogue();
COMPILER2_PRESENT(DerivedPointerTable::update_pointers()); COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
......
...@@ -1054,6 +1054,7 @@ void PSParallelCompact::post_compact() ...@@ -1054,6 +1054,7 @@ void PSParallelCompact::post_compact()
Threads::gc_epilogue(); Threads::gc_epilogue();
CodeCache::gc_epilogue(); CodeCache::gc_epilogue();
JvmtiExport::gc_epilogue();
COMPILER2_PRESENT(DerivedPointerTable::update_pointers()); COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
......
...@@ -158,6 +158,7 @@ void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, ...@@ -158,6 +158,7 @@ void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp,
Threads::gc_epilogue(); Threads::gc_epilogue();
CodeCache::gc_epilogue(); CodeCache::gc_epilogue();
JvmtiExport::gc_epilogue();
if (PrintGC && !PrintGCDetails) { if (PrintGC && !PrintGCDetails) {
gch->print_heap_change(gch_prev_used); gch->print_heap_change(gch_prev_used);
......
...@@ -2268,6 +2268,14 @@ void JvmtiExport::oops_do(OopClosure* f) { ...@@ -2268,6 +2268,14 @@ void JvmtiExport::oops_do(OopClosure* f) {
JvmtiVMObjectAllocEventCollector::oops_do_for_all_threads(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. // Onload raw monitor transition.
void JvmtiExport::transition_pending_onload_raw_monitors() { void JvmtiExport::transition_pending_onload_raw_monitors() {
JvmtiPendingMonitors::transition_raw_monitors(); JvmtiPendingMonitors::transition_raw_monitors();
......
...@@ -346,6 +346,8 @@ class JvmtiExport : public AllStatic { ...@@ -346,6 +346,8 @@ class JvmtiExport : public AllStatic {
static void cleanup_thread (JavaThread* thread) KERNEL_RETURN; static void cleanup_thread (JavaThread* thread) KERNEL_RETURN;
static void oops_do(OopClosure* f) 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; static void transition_pending_onload_raw_monitors() KERNEL_RETURN;
......
...@@ -212,7 +212,13 @@ void GrowableCache::oops_do(OopClosure* f) { ...@@ -212,7 +212,13 @@ void GrowableCache::oops_do(OopClosure* f) {
for (int i=0; i<len; i++) { for (int i=0; i<len; i++) {
GrowableElement *e = _elements->at(i); GrowableElement *e = _elements->at(i);
e->oops_do(f); e->oops_do(f);
_cache[i] = e->getCacheValue(); }
}
void GrowableCache::gc_epilogue() {
int len = _elements->length();
for (int i=0; i<len; i++) {
_cache[i] = _elements->at(i)->getCacheValue();
} }
} }
...@@ -394,6 +400,10 @@ void JvmtiBreakpoints::oops_do(OopClosure* f) { ...@@ -394,6 +400,10 @@ void JvmtiBreakpoints::oops_do(OopClosure* f) {
_bps.oops_do(f); _bps.oops_do(f);
} }
void JvmtiBreakpoints::gc_epilogue() {
_bps.gc_epilogue();
}
void JvmtiBreakpoints::print() { void JvmtiBreakpoints::print() {
#ifndef PRODUCT #ifndef PRODUCT
ResourceMark rm; ResourceMark rm;
...@@ -523,6 +533,12 @@ void JvmtiCurrentBreakpoints::oops_do(OopClosure* f) { ...@@ -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 // class VM_GetOrSetLocal
......
...@@ -117,6 +117,8 @@ public: ...@@ -117,6 +117,8 @@ public:
void clear(); void clear();
// apply f to every element and update the cache // apply f to every element and update the cache
void oops_do(OopClosure* f); void oops_do(OopClosure* f);
// update the cache after a full gc
void gc_epilogue();
}; };
...@@ -148,6 +150,7 @@ public: ...@@ -148,6 +150,7 @@ public:
void remove (int index) { _cache.remove(index); } void remove (int index) { _cache.remove(index); }
void clear() { _cache.clear(); } void clear() { _cache.clear(); }
void oops_do(OopClosure* f) { _cache.oops_do(f); } void oops_do(OopClosure* f) { _cache.oops_do(f); }
void gc_epilogue() { _cache.gc_epilogue(); }
}; };
...@@ -282,6 +285,7 @@ public: ...@@ -282,6 +285,7 @@ public:
int clear(JvmtiBreakpoint& bp); int clear(JvmtiBreakpoint& bp);
void clearall_in_class_at_safepoint(klassOop klass); void clearall_in_class_at_safepoint(klassOop klass);
void clearall(); void clearall();
void gc_epilogue();
}; };
...@@ -325,6 +329,7 @@ public: ...@@ -325,6 +329,7 @@ public:
static inline bool is_breakpoint(address bcp); static inline bool is_breakpoint(address bcp);
static void oops_do(OopClosure* f); static void oops_do(OopClosure* f);
static void gc_epilogue();
}; };
// quickly test whether the bcp matches a cached breakpoint in the list // quickly test whether the bcp matches a cached breakpoint in the list
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "precompiled.hpp" #include "precompiled.hpp"
#include "classfile/systemDictionary.hpp" #include "classfile/systemDictionary.hpp"
#include "oops/oop.inline.hpp" #include "oops/oop.inline.hpp"
#include "prims/jvmtiTagMap.hpp" #include "prims/jvmtiExport.hpp"
#include "runtime/jniHandles.hpp" #include "runtime/jniHandles.hpp"
#include "runtime/mutexLocker.hpp" #include "runtime/mutexLocker.hpp"
#ifdef TARGET_OS_FAMILY_linux #ifdef TARGET_OS_FAMILY_linux
...@@ -431,10 +431,10 @@ void JNIHandleBlock::weak_oops_do(BoolObjectClosure* is_alive, ...@@ -431,10 +431,10 @@ void JNIHandleBlock::weak_oops_do(BoolObjectClosure* is_alive,
} }
/* /*
* JvmtiTagMap may also contain weak oops. The iteration of it is placed * JVMTI data structures may also contain weak oops. The iteration of them
* here so that we don't need to add it to each of the collectors. * 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);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册