--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Tue Oct 14 20:35:45 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Thu Oct 02 10:55:36 2014 +0200
@@ -28,6 +28,7 @@
#endif
#include "precompiled.hpp"
+#include "classfile/metadataOnStackMark.hpp"
#include "classfile/stringTable.hpp"
#include "code/codeCache.hpp"
#include "code/icBuffer.hpp"
@@ -5013,6 +5014,10 @@
clean_nmethod(claimed_nmethods[i]);
}
}
+
+ // The nmethod cleaning helps out and does the CodeCache part of MetadataOnStackMark.
+ // Need to retire the buffers now that this thread has stopped cleaning nmethods.
+ MetadataOnStackMark::retire_buffer_for_thread(Thread::current());
}
void work_second_pass(uint worker_id) {
@@ -5065,6 +5070,9 @@
// G1 specific cleanup work that has
// been moved here to be done in parallel.
ik->clean_dependent_nmethods();
+ if (JvmtiExport::has_redefined_a_class()) {
+ InstanceKlass::purge_previous_versions(ik);
+ }
}
void work() {
@@ -5099,8 +5107,18 @@
_klass_cleaning_task(is_alive) {
}
+ void pre_work_verification() {
+ assert(!MetadataOnStackMark::has_buffer_for_thread(Thread::current()), "Should be empty");
+ }
+
+ void post_work_verification() {
+ assert(!MetadataOnStackMark::has_buffer_for_thread(Thread::current()), "Should be empty");
+ }
+
// The parallel work done by all worker threads.
void work(uint worker_id) {
+ pre_work_verification();
+
// Do first pass of code cache cleaning.
_code_cache_task.work_first_pass(worker_id);
@@ -5119,6 +5137,8 @@
// Clean all klasses that were not unloaded.
_klass_cleaning_task.work();
+
+ post_work_verification();
}
};