8209447: vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_none2indy_b/TestDescription.java timed out
Summary: was walking code cache for every safepoint because redefined methods take a long time to clear out of the code cache
Reviewed-by: eosterlund, rehn
--- a/src/hotspot/share/classfile/classLoaderData.inline.hpp Wed Aug 15 10:44:56 2018 -0700
+++ b/src/hotspot/share/classfile/classLoaderData.inline.hpp Wed Aug 15 15:50:23 2018 -0400
@@ -94,9 +94,12 @@
}
bool ClassLoaderDataGraph::should_clean_metaspaces_and_reset() {
- bool do_cleaning = _safepoint_cleanup_needed && _should_clean_deallocate_lists;
+ // Only clean metaspaces after full GC.
+ bool do_cleaning = _safepoint_cleanup_needed;
#if INCLUDE_JVMTI
- do_cleaning = do_cleaning || InstanceKlass::has_previous_versions();
+ do_cleaning = do_cleaning && (_should_clean_deallocate_lists || InstanceKlass::has_previous_versions());
+#else
+ do_cleaning = do_cleaning && _should_clean_deallocate_lists;
#endif
_safepoint_cleanup_needed = false; // reset
return do_cleaning;