diff -r 7fe2cda84af1 -r a8441ccaff15 src/share/vm/runtime/jniHandles.cpp --- a/src/share/vm/runtime/jniHandles.cpp Thu Apr 25 05:12:03 2019 +0100 +++ b/src/share/vm/runtime/jniHandles.cpp Tue Mar 15 10:11:02 2016 +0100 @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "classfile/systemDictionary.hpp" +#include "memory/iterator.hpp" #include "oops/oop.inline.hpp" #include "prims/jvmtiExport.hpp" #include "runtime/jniHandles.hpp" @@ -129,6 +130,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(); @@ -186,11 +193,6 @@ } -class AlwaysAliveClosure: public BoolObjectClosure { -public: - bool do_object_b(oop obj) { return true; } -}; - class CountHandleClosure: public OopClosure { private: int _count; @@ -212,9 +214,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(); @@ -231,10 +232,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); }