1.1 --- a/src/share/vm/runtime/jniHandles.cpp Thu Apr 25 05:12:03 2019 +0100 1.2 +++ b/src/share/vm/runtime/jniHandles.cpp Tue Mar 15 10:11:02 2016 +0100 1.3 @@ -24,6 +24,7 @@ 1.4 1.5 #include "precompiled.hpp" 1.6 #include "classfile/systemDictionary.hpp" 1.7 +#include "memory/iterator.hpp" 1.8 #include "oops/oop.inline.hpp" 1.9 #include "prims/jvmtiExport.hpp" 1.10 #include "runtime/jniHandles.hpp" 1.11 @@ -129,6 +130,12 @@ 1.12 } 1.13 1.14 1.15 +void JNIHandles::weak_oops_do(OopClosure* f) { 1.16 + AlwaysTrueClosure always_true; 1.17 + weak_oops_do(&always_true, f); 1.18 +} 1.19 + 1.20 + 1.21 void JNIHandles::initialize() { 1.22 _global_handles = JNIHandleBlock::allocate_block(); 1.23 _weak_global_handles = JNIHandleBlock::allocate_block(); 1.24 @@ -186,11 +193,6 @@ 1.25 } 1.26 1.27 1.28 -class AlwaysAliveClosure: public BoolObjectClosure { 1.29 -public: 1.30 - bool do_object_b(oop obj) { return true; } 1.31 -}; 1.32 - 1.33 class CountHandleClosure: public OopClosure { 1.34 private: 1.35 int _count; 1.36 @@ -212,9 +214,8 @@ 1.37 "JNIHandles not initialized"); 1.38 1.39 CountHandleClosure global_handle_count; 1.40 - AlwaysAliveClosure always_alive; 1.41 oops_do(&global_handle_count); 1.42 - weak_oops_do(&always_alive, &global_handle_count); 1.43 + weak_oops_do(&global_handle_count); 1.44 1.45 st->print_cr("JNI global references: %d", global_handle_count.count()); 1.46 st->cr(); 1.47 @@ -231,10 +232,9 @@ 1.48 1.49 void JNIHandles::verify() { 1.50 VerifyHandleClosure verify_handle; 1.51 - AlwaysAliveClosure always_alive; 1.52 1.53 oops_do(&verify_handle); 1.54 - weak_oops_do(&always_alive, &verify_handle); 1.55 + weak_oops_do(&verify_handle); 1.56 } 1.57 1.58