Thu, 02 May 2019 17:12:38 +0100
Merge
1.1 --- a/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Wed May 01 06:16:36 2019 +0100 1.2 +++ b/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Thu May 02 17:12:38 2019 +0100 1.3 @@ -237,12 +237,6 @@ 1.4 } 1.5 }; 1.6 1.7 -class G1AlwaysTrueClosure: public BoolObjectClosure { 1.8 -public: 1.9 - bool do_object_b(oop p) { return true; } 1.10 -}; 1.11 -static G1AlwaysTrueClosure always_true; 1.12 - 1.13 void G1MarkSweep::mark_sweep_phase3() { 1.14 G1CollectedHeap* g1h = G1CollectedHeap::heap(); 1.15 1.16 @@ -266,7 +260,7 @@ 1.17 1.18 // Now adjust pointers in remaining weak roots. (All of which should 1.19 // have been cleared if they pointed to non-surviving objects.) 1.20 - JNIHandles::weak_oops_do(&always_true, &GenMarkSweep::adjust_pointer_closure); 1.21 + JNIHandles::weak_oops_do(&GenMarkSweep::adjust_pointer_closure); 1.22 1.23 if (G1StringDedup::is_enabled()) { 1.24 G1StringDedup::oops_do(&GenMarkSweep::adjust_pointer_closure);
2.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp Wed May 01 06:16:36 2019 +0100 2.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp Thu May 02 17:12:38 2019 +0100 2.3 @@ -594,13 +594,6 @@ 2.4 old_gen->precompact(); 2.5 } 2.6 2.7 -// This should be moved to the shared markSweep code! 2.8 -class PSAlwaysTrueClosure: public BoolObjectClosure { 2.9 -public: 2.10 - bool do_object_b(oop p) { return true; } 2.11 -}; 2.12 -static PSAlwaysTrueClosure always_true; 2.13 - 2.14 void PSMarkSweep::mark_sweep_phase3() { 2.15 // Adjust the pointers to reflect the new locations 2.16 GCTraceTime tm("phase 3", PrintGCDetails && Verbose, true, _gc_timer, _gc_tracer->gc_id()); 2.17 @@ -630,7 +623,7 @@ 2.18 // Now adjust pointers in remaining weak roots. (All of which should 2.19 // have been cleared if they pointed to non-surviving objects.) 2.20 // Global (weak) JNI handles 2.21 - JNIHandles::weak_oops_do(&always_true, adjust_pointer_closure()); 2.22 + JNIHandles::weak_oops_do(adjust_pointer_closure()); 2.23 2.24 CodeBlobToOopClosure adjust_from_blobs(adjust_pointer_closure(), CodeBlobToOopClosure::FixRelocations); 2.25 CodeCache::blobs_do(&adjust_from_blobs);
3.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Wed May 01 06:16:36 2019 +0100 3.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Thu May 02 17:12:38 2019 +0100 3.3 @@ -2441,13 +2441,6 @@ 3.4 cld->oops_do(&mark_and_push_closure, &follow_klass_closure, true); 3.5 } 3.6 3.7 -// This should be moved to the shared markSweep code! 3.8 -class PSAlwaysTrueClosure: public BoolObjectClosure { 3.9 -public: 3.10 - bool do_object_b(oop p) { return true; } 3.11 -}; 3.12 -static PSAlwaysTrueClosure always_true; 3.13 - 3.14 void PSParallelCompact::adjust_roots() { 3.15 // Adjust the pointers to reflect the new locations 3.16 GCTraceTime tm("adjust roots", print_phases(), true, &_gc_timer, _gc_tracer.gc_id()); 3.17 @@ -2470,7 +2463,7 @@ 3.18 // Now adjust pointers in remaining weak roots. (All of which should 3.19 // have been cleared if they pointed to non-surviving objects.) 3.20 // Global (weak) JNI handles 3.21 - JNIHandles::weak_oops_do(&always_true, adjust_pointer_closure()); 3.22 + JNIHandles::weak_oops_do(adjust_pointer_closure()); 3.23 3.24 CodeBlobToOopClosure adjust_from_blobs(adjust_pointer_closure(), CodeBlobToOopClosure::FixRelocations); 3.25 CodeCache::blobs_do(&adjust_from_blobs);
4.1 --- a/src/share/vm/memory/genCollectedHeap.cpp Wed May 01 06:16:36 2019 +0100 4.2 +++ b/src/share/vm/memory/genCollectedHeap.cpp Thu May 02 17:12:38 2019 +0100 4.3 @@ -745,14 +745,8 @@ 4.4 } 4.5 4.6 4.7 -class AlwaysTrueClosure: public BoolObjectClosure { 4.8 -public: 4.9 - bool do_object_b(oop p) { return true; } 4.10 -}; 4.11 -static AlwaysTrueClosure always_true; 4.12 - 4.13 void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) { 4.14 - JNIHandles::weak_oops_do(&always_true, root_closure); 4.15 + JNIHandles::weak_oops_do(root_closure); 4.16 for (int i = 0; i < _n_gens; i++) { 4.17 _gens[i]->ref_processor()->weak_oops_do(root_closure); 4.18 }
5.1 --- a/src/share/vm/memory/iterator.hpp Wed May 01 06:16:36 2019 +0100 5.2 +++ b/src/share/vm/memory/iterator.hpp Thu May 02 17:12:38 2019 +0100 5.3 @@ -219,6 +219,16 @@ 5.4 virtual bool do_object_b(oop obj) = 0; 5.5 }; 5.6 5.7 +class AlwaysTrueClosure: public BoolObjectClosure { 5.8 + public: 5.9 + bool do_object_b(oop p) { return true; } 5.10 +}; 5.11 + 5.12 +class AlwaysFalseClosure : public BoolObjectClosure { 5.13 + public: 5.14 + bool do_object_b(oop p) { return false; } 5.15 +}; 5.16 + 5.17 // Applies an oop closure to all ref fields in objects iterated over in an 5.18 // object iteration. 5.19 class ObjectToOopClosure: public ObjectClosure {
6.1 --- a/src/share/vm/memory/referenceProcessor.cpp Wed May 01 06:16:36 2019 +0100 6.2 +++ b/src/share/vm/memory/referenceProcessor.cpp Thu May 02 17:12:38 2019 +0100 6.3 @@ -275,11 +275,6 @@ 6.4 #ifndef PRODUCT 6.5 // Calculate the number of jni handles. 6.6 uint ReferenceProcessor::count_jni_refs() { 6.7 - class AlwaysAliveClosure: public BoolObjectClosure { 6.8 - public: 6.9 - virtual bool do_object_b(oop obj) { return true; } 6.10 - }; 6.11 - 6.12 class CountHandleClosure: public OopClosure { 6.13 private: 6.14 int _count; 6.15 @@ -290,8 +285,7 @@ 6.16 int count() { return _count; } 6.17 }; 6.18 CountHandleClosure global_handle_count; 6.19 - AlwaysAliveClosure always_alive; 6.20 - JNIHandles::weak_oops_do(&always_alive, &global_handle_count); 6.21 + JNIHandles::weak_oops_do(&global_handle_count); 6.22 return global_handle_count.count(); 6.23 } 6.24 #endif
7.1 --- a/src/share/vm/prims/whitebox.cpp Wed May 01 06:16:36 2019 +0100 7.2 +++ b/src/share/vm/prims/whitebox.cpp Thu May 02 17:12:38 2019 +0100 7.3 @@ -26,6 +26,7 @@ 7.4 7.5 #include "memory/metadataFactory.hpp" 7.6 #include "memory/metaspaceShared.hpp" 7.7 +#include "memory/iterator.hpp" 7.8 #include "memory/universe.hpp" 7.9 #include "oops/oop.inline.hpp" 7.10 7.11 @@ -583,11 +584,6 @@ 7.12 bool allow_nested_vm_operations() const { return true; } 7.13 }; 7.14 7.15 -class AlwaysFalseClosure : public BoolObjectClosure { 7.16 - public: 7.17 - bool do_object_b(oop p) { return false; } 7.18 -}; 7.19 - 7.20 static AlwaysFalseClosure always_false; 7.21 7.22 class VM_WhiteBoxCleanMethodData : public VM_WhiteBoxOperation {
8.1 --- a/src/share/vm/runtime/jniHandles.cpp Wed May 01 06:16:36 2019 +0100 8.2 +++ b/src/share/vm/runtime/jniHandles.cpp Thu May 02 17:12:38 2019 +0100 8.3 @@ -24,6 +24,7 @@ 8.4 8.5 #include "precompiled.hpp" 8.6 #include "classfile/systemDictionary.hpp" 8.7 +#include "memory/iterator.hpp" 8.8 #include "oops/oop.inline.hpp" 8.9 #include "prims/jvmtiExport.hpp" 8.10 #include "runtime/jniHandles.hpp" 8.11 @@ -129,6 +130,12 @@ 8.12 } 8.13 8.14 8.15 +void JNIHandles::weak_oops_do(OopClosure* f) { 8.16 + AlwaysTrueClosure always_true; 8.17 + weak_oops_do(&always_true, f); 8.18 +} 8.19 + 8.20 + 8.21 void JNIHandles::initialize() { 8.22 _global_handles = JNIHandleBlock::allocate_block(); 8.23 _weak_global_handles = JNIHandleBlock::allocate_block(); 8.24 @@ -186,11 +193,6 @@ 8.25 } 8.26 8.27 8.28 -class AlwaysAliveClosure: public BoolObjectClosure { 8.29 -public: 8.30 - bool do_object_b(oop obj) { return true; } 8.31 -}; 8.32 - 8.33 class CountHandleClosure: public OopClosure { 8.34 private: 8.35 int _count; 8.36 @@ -212,9 +214,8 @@ 8.37 "JNIHandles not initialized"); 8.38 8.39 CountHandleClosure global_handle_count; 8.40 - AlwaysAliveClosure always_alive; 8.41 oops_do(&global_handle_count); 8.42 - weak_oops_do(&always_alive, &global_handle_count); 8.43 + weak_oops_do(&global_handle_count); 8.44 8.45 st->print_cr("JNI global references: %d", global_handle_count.count()); 8.46 st->cr(); 8.47 @@ -231,10 +232,9 @@ 8.48 8.49 void JNIHandles::verify() { 8.50 VerifyHandleClosure verify_handle; 8.51 - AlwaysAliveClosure always_alive; 8.52 8.53 oops_do(&verify_handle); 8.54 - weak_oops_do(&always_alive, &verify_handle); 8.55 + weak_oops_do(&verify_handle); 8.56 } 8.57 8.58
9.1 --- a/src/share/vm/runtime/jniHandles.hpp Wed May 01 06:16:36 2019 +0100 9.2 +++ b/src/share/vm/runtime/jniHandles.hpp Thu May 02 17:12:38 2019 +0100 9.3 @@ -86,6 +86,8 @@ 9.4 static void oops_do(OopClosure* f); 9.5 // Traversal of weak global handles. Unreachable oops are cleared. 9.6 static void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f); 9.7 + // Traversal of weak global handles. 9.8 + static void weak_oops_do(OopClosure* f); 9.9 }; 9.10 9.11