8227054: ServiceThread needs to know about all OopStorage objects

8227053: ServiceThread cleanup of OopStorage is missing some

OopStorages provides named access and iteration.

Reviewed-by: eosterlund, pliden, coleenp
This commit is contained in:
Kim Barrett 2019-08-21 18:42:30 -04:00
parent de8d01d4d3
commit 1acad37ee6
28 changed files with 721 additions and 358 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,26 +23,24 @@
*/
#include "precompiled.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/stringTable.hpp"
#include "gc/shared/oopStorage.hpp"
#include "gc/shared/oopStorageSet.hpp"
#include "oops/access.inline.hpp"
#include "oops/oop.hpp"
#include "oops/weakHandle.inline.hpp"
#include "prims/resolvedMethodTable.hpp"
#include "utilities/debug.hpp"
#include "utilities/ostream.hpp"
template <> OopStorage* WeakHandle<vm_class_loader_data>::get_storage() {
return SystemDictionary::vm_weak_oop_storage();
return OopStorageSet::vm_weak();
}
template <> OopStorage* WeakHandle<vm_string_table_data>::get_storage() {
return StringTable::weak_storage();
return OopStorageSet::string_table_weak();
}
template <> OopStorage* WeakHandle<vm_resolved_method_table_data>::get_storage() {
return ResolvedMethodTable::weak_storage();
return OopStorageSet::resolved_method_table_weak();
}
template <WeakHandleType T>
@ -50,7 +48,9 @@ WeakHandle<T> WeakHandle<T>::create(Handle obj) {
assert(obj() != NULL, "no need to create weak null oop");
oop* oop_addr = get_storage()->allocate();
if (oop_addr == NULL) {
vm_exit_out_of_memory(sizeof(oop*), OOM_MALLOC_ERROR, "Unable to create new weak oop handle in OopStorage");
vm_exit_out_of_memory(sizeof(oop*), OOM_MALLOC_ERROR,
"Unable to create new weak oop handle in OopStorage %s",
get_storage()->name());
}
// Create WeakHandle with address returned and store oop into it.
NativeAccess<ON_PHANTOM_OOP_REF>::oop_store(oop_addr, obj());