Merge
authorstefank
Tue, 15 Mar 2016 15:29:42 +0100
changeset 37107 e89fc0bf4ecb
parent 37105 e66ce2ddedf8 (current diff)
parent 37106 0856b64af754 (diff)
child 37109 e8530ec83532
child 37110 0c468eab5c66
Merge
--- a/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp	Tue Mar 15 13:46:48 2016 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp	Tue Mar 15 15:29:42 2016 +0100
@@ -220,12 +220,6 @@
   }
 };
 
-class G1AlwaysTrueClosure: public BoolObjectClosure {
-public:
-  bool do_object_b(oop p) { return true; }
-};
-static G1AlwaysTrueClosure always_true;
-
 void G1MarkSweep::mark_sweep_phase3() {
   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 
@@ -248,7 +242,7 @@
 
   // Now adjust pointers in remaining weak roots.  (All of which should
   // have been cleared if they pointed to non-surviving objects.)
-  JNIHandles::weak_oops_do(&always_true, &GenMarkSweep::adjust_pointer_closure);
+  JNIHandles::weak_oops_do(&GenMarkSweep::adjust_pointer_closure);
 
   if (G1StringDedup::is_enabled()) {
     G1StringDedup::oops_do(&GenMarkSweep::adjust_pointer_closure);
--- a/hotspot/src/share/vm/gc/parallel/psMarkSweep.cpp	Tue Mar 15 13:46:48 2016 +0100
+++ b/hotspot/src/share/vm/gc/parallel/psMarkSweep.cpp	Tue Mar 15 15:29:42 2016 +0100
@@ -570,13 +570,6 @@
   old_gen->precompact();
 }
 
-// This should be moved to the shared markSweep code!
-class PSAlwaysTrueClosure: public BoolObjectClosure {
-public:
-  bool do_object_b(oop p) { return true; }
-};
-static PSAlwaysTrueClosure always_true;
-
 void PSMarkSweep::mark_sweep_phase3() {
   // Adjust the pointers to reflect the new locations
   GCTraceTime(Trace, gc) tm("Phase 3: Adjust pointers", _gc_timer);
@@ -603,7 +596,7 @@
   // Now adjust pointers in remaining weak roots.  (All of which should
   // have been cleared if they pointed to non-surviving objects.)
   // Global (weak) JNI handles
-  JNIHandles::weak_oops_do(&always_true, adjust_pointer_closure());
+  JNIHandles::weak_oops_do(adjust_pointer_closure());
 
   CodeBlobToOopClosure adjust_from_blobs(adjust_pointer_closure(), CodeBlobToOopClosure::FixRelocations);
   CodeCache::blobs_do(&adjust_from_blobs);
--- a/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp	Tue Mar 15 13:46:48 2016 +0100
+++ b/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp	Tue Mar 15 15:29:42 2016 +0100
@@ -2125,13 +2125,6 @@
   _gc_tracer.report_object_count_after_gc(is_alive_closure());
 }
 
-// This should be moved to the shared markSweep code!
-class PSAlwaysTrueClosure: public BoolObjectClosure {
-public:
-  bool do_object_b(oop p) { return true; }
-};
-static PSAlwaysTrueClosure always_true;
-
 void PSParallelCompact::adjust_roots(ParCompactionManager* cm) {
   // Adjust the pointers to reflect the new locations
   GCTraceTime(Trace, gc, phases) tm("Adjust Roots", &_gc_timer);
@@ -2157,7 +2150,7 @@
   // Now adjust pointers in remaining weak roots.  (All of which should
   // have been cleared if they pointed to non-surviving objects.)
   // Global (weak) JNI handles
-  JNIHandles::weak_oops_do(&always_true, &oop_closure);
+  JNIHandles::weak_oops_do(&oop_closure);
 
   CodeBlobToOopClosure adjust_from_blobs(&oop_closure, CodeBlobToOopClosure::FixRelocations);
   CodeCache::blobs_do(&adjust_from_blobs);
--- a/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp	Tue Mar 15 13:46:48 2016 +0100
+++ b/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp	Tue Mar 15 15:29:42 2016 +0100
@@ -684,15 +684,8 @@
   _process_strong_tasks->all_tasks_completed(scope->n_threads());
 }
 
-
-class AlwaysTrueClosure: public BoolObjectClosure {
-public:
-  bool do_object_b(oop p) { return true; }
-};
-static AlwaysTrueClosure always_true;
-
 void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) {
-  JNIHandles::weak_oops_do(&always_true, root_closure);
+  JNIHandles::weak_oops_do(root_closure);
   _young_gen->ref_processor()->weak_oops_do(root_closure);
   _old_gen->ref_processor()->weak_oops_do(root_closure);
 }
--- a/hotspot/src/share/vm/gc/shared/referenceProcessor.cpp	Tue Mar 15 13:46:48 2016 +0100
+++ b/hotspot/src/share/vm/gc/shared/referenceProcessor.cpp	Tue Mar 15 15:29:42 2016 +0100
@@ -266,11 +266,6 @@
 #ifndef PRODUCT
 // Calculate the number of jni handles.
 size_t ReferenceProcessor::count_jni_refs() {
-  class AlwaysAliveClosure: public BoolObjectClosure {
-  public:
-    virtual bool do_object_b(oop obj) { return true; }
-  };
-
   class CountHandleClosure: public OopClosure {
   private:
     size_t _count;
@@ -281,8 +276,7 @@
     size_t count() { return _count; }
   };
   CountHandleClosure global_handle_count;
-  AlwaysAliveClosure always_alive;
-  JNIHandles::weak_oops_do(&always_alive, &global_handle_count);
+  JNIHandles::weak_oops_do(&global_handle_count);
   return global_handle_count.count();
 }
 #endif
--- a/hotspot/src/share/vm/memory/iterator.hpp	Tue Mar 15 13:46:48 2016 +0100
+++ b/hotspot/src/share/vm/memory/iterator.hpp	Tue Mar 15 15:29:42 2016 +0100
@@ -213,6 +213,16 @@
   virtual bool do_object_b(oop obj) = 0;
 };
 
+class AlwaysTrueClosure: public BoolObjectClosure {
+ public:
+  bool do_object_b(oop p) { return true; }
+};
+
+class AlwaysFalseClosure : public BoolObjectClosure {
+ public:
+  bool do_object_b(oop p) { return false; }
+};
+
 // Applies an oop closure to all ref fields in objects iterated over in an
 // object iteration.
 class ObjectToOopClosure: public ObjectClosure {
--- a/hotspot/src/share/vm/prims/whitebox.cpp	Tue Mar 15 13:46:48 2016 +0100
+++ b/hotspot/src/share/vm/prims/whitebox.cpp	Tue Mar 15 15:29:42 2016 +0100
@@ -33,6 +33,7 @@
 #include "jvmtifiles/jvmtiEnv.hpp"
 #include "memory/metadataFactory.hpp"
 #include "memory/metaspaceShared.hpp"
+#include "memory/iterator.hpp"
 #include "memory/universe.hpp"
 #include "oops/constantPool.hpp"
 #include "oops/oop.inline.hpp"
@@ -711,11 +712,6 @@
   return result;
 WB_END
 
-class AlwaysFalseClosure : public BoolObjectClosure {
- public:
-  bool do_object_b(oop p) { return false; }
-};
-
 static AlwaysFalseClosure always_false;
 
 WB_ENTRY(void, WB_ClearMethodState(JNIEnv* env, jobject o, jobject method))
--- a/hotspot/src/share/vm/runtime/jniHandles.cpp	Tue Mar 15 13:46:48 2016 +0100
+++ b/hotspot/src/share/vm/runtime/jniHandles.cpp	Tue Mar 15 15:29:42 2016 +0100
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "logging/log.hpp"
+#include "memory/iterator.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "runtime/jniHandles.hpp"
@@ -128,6 +129,12 @@
 }
 
 
+void JNIHandles::weak_oops_do(OopClosure* f) {
+  AlwaysTrueClosure always_true;
+  weak_oops_do(&always_true, f);
+}
+
+
 void JNIHandles::initialize() {
   _global_handles      = JNIHandleBlock::allocate_block();
   _weak_global_handles = JNIHandleBlock::allocate_block();
@@ -185,11 +192,6 @@
 }
 
 
-class AlwaysAliveClosure: public BoolObjectClosure {
-public:
-  bool do_object_b(oop obj) { return true; }
-};
-
 class CountHandleClosure: public OopClosure {
 private:
   int _count;
@@ -211,9 +213,8 @@
          "JNIHandles not initialized");
 
   CountHandleClosure global_handle_count;
-  AlwaysAliveClosure always_alive;
   oops_do(&global_handle_count);
-  weak_oops_do(&always_alive, &global_handle_count);
+  weak_oops_do(&global_handle_count);
 
   st->print_cr("JNI global references: %d", global_handle_count.count());
   st->cr();
@@ -230,10 +231,9 @@
 
 void JNIHandles::verify() {
   VerifyHandleClosure verify_handle;
-  AlwaysAliveClosure always_alive;
 
   oops_do(&verify_handle);
-  weak_oops_do(&always_alive, &verify_handle);
+  weak_oops_do(&verify_handle);
 }
 
 
--- a/hotspot/src/share/vm/runtime/jniHandles.hpp	Tue Mar 15 13:46:48 2016 +0100
+++ b/hotspot/src/share/vm/runtime/jniHandles.hpp	Tue Mar 15 15:29:42 2016 +0100
@@ -86,6 +86,8 @@
   static void oops_do(OopClosure* f);
   // Traversal of weak global handles. Unreachable oops are cleared.
   static void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f);
+  // Traversal of weak global handles.
+  static void weak_oops_do(OopClosure* f);
 };