8210864: Reduce the use of metaspaceShared.hpp

Reviewed-by: coleenp, lfoltan
This commit is contained in:
Ioi Lam 2018-09-18 21:46:17 -07:00
parent f0108ea40c
commit 1619cbd14b
13 changed files with 56 additions and 17 deletions

View File

@ -37,7 +37,7 @@
#include "logging/log.hpp"
#include "logging/logStream.hpp"
#include "memory/oopFactory.hpp"
#include "memory/metaspaceShared.hpp"
#include "memory/metaspaceShared.inline.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
#include "oops/fieldStreams.hpp"

View File

@ -35,7 +35,7 @@
#include "logging/logStream.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/filemap.hpp"
#include "memory/metaspaceShared.hpp"
#include "memory/metaspaceShared.inline.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
#include "oops/access.inline.hpp"

View File

@ -79,7 +79,7 @@
#include "logging/log.hpp"
#include "memory/allocation.hpp"
#include "memory/iterator.hpp"
#include "memory/metaspaceShared.hpp"
#include "memory/metaspaceShared.inline.hpp"
#include "memory/resourceArea.hpp"
#include "oops/access.inline.hpp"
#include "oops/compressedOops.inline.hpp"

View File

@ -27,7 +27,6 @@
#include "classfile/classLoaderData.inline.hpp"
#include "gc/serial/markSweep.hpp"
#include "memory/metaspaceShared.hpp"
#include "memory/universe.hpp"
#include "oops/markOop.inline.hpp"
#include "oops/access.inline.hpp"

View File

@ -33,7 +33,7 @@
#include "memory/iterator.inline.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspaceClosure.hpp"
#include "memory/metaspaceShared.hpp"
#include "memory/metaspaceShared.inline.hpp"
#include "memory/resourceArea.hpp"
#include "oops/compressedOops.inline.hpp"
#include "oops/oop.inline.hpp"

View File

@ -65,7 +65,6 @@
#include "utilities/defaultStream.hpp"
#include "utilities/hashtable.inline.hpp"
#if INCLUDE_G1GC
#include "gc/g1/g1Allocator.inline.hpp"
#include "gc/g1/g1CollectedHeap.hpp"
#endif
@ -1966,10 +1965,6 @@ void MetaspaceShared::archive_klass_objects(Thread* THREAD) {
}
}
bool MetaspaceShared::is_archive_object(oop p) {
return (p == NULL) ? false : G1ArchiveAllocator::is_archive_object(p);
}
void MetaspaceShared::fixup_mapped_heap_regions() {
FileMapInfo *mapinfo = FileMapInfo::current_info();
mapinfo->fixup_mapped_heap_regions();

View File

@ -125,7 +125,7 @@ class MetaspaceShared : AllStatic {
}
#endif
static bool is_archive_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);
inline static bool is_archive_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);
static bool is_heap_object_archiving_allowed() {
CDS_JAVA_HEAP_ONLY(return (UseG1GC && UseCompressedOops && UseCompressedClassPointers);)

View File

@ -0,0 +1,39 @@
/*
* Copyright (c) 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_MEMORY_METASPACESHARED_INLINE_HPP
#define SHARE_VM_MEMORY_METASPACESHARED_INLINE_HPP
#include "memory/metaspaceShared.hpp"
#if INCLUDE_G1GC
#include "gc/g1/g1Allocator.inline.hpp"
#endif
#if INCLUDE_CDS_JAVA_HEAP
bool MetaspaceShared::is_archive_object(oop p) {
return (p == NULL) ? false : G1ArchiveAllocator::is_archive_object(p);
}
#endif
#endif // SHARE_VM_MEMORY_METASPACESHARED_INLINE_HPP

View File

@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "classfile/altHashing.hpp"
#include "classfile/javaClasses.inline.hpp"
#include "memory/metaspaceShared.inline.hpp"
#include "memory/resourceArea.hpp"
#include "oops/access.inline.hpp"
#include "oops/oop.inline.hpp"
@ -141,6 +142,12 @@ bool oopDesc::is_unlocked_oop() const {
if (!Universe::heap()->is_in_reserved(this)) return false;
return mark()->is_unlocked();
}
#if INCLUDE_CDS_JAVA_HEAP
bool oopDesc::is_archive_object(oop p) {
return MetaspaceShared::is_archive_object(p);
}
#endif
#endif // PRODUCT
VerifyOopClosure VerifyOopClosure::verify_oop;

View File

@ -256,6 +256,7 @@ class oopDesc {
static bool is_oop_or_null(oop obj, bool ignore_mark_word = false);
#ifndef PRODUCT
inline bool is_unlocked_oop() const;
static bool is_archive_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);
#endif
// garbage collection

View File

@ -26,7 +26,6 @@
#define SHARE_VM_OOPS_OOP_INLINE_HPP
#include "gc/shared/collectedHeap.hpp"
#include "memory/metaspaceShared.hpp"
#include "oops/access.inline.hpp"
#include "oops/arrayKlass.hpp"
#include "oops/arrayOop.hpp"
@ -352,8 +351,8 @@ void oopDesc::forward_to(oop p) {
"forwarding to something not aligned");
assert(Universe::heap()->is_in_reserved(p),
"forwarding to something not in heap");
assert(!MetaspaceShared::is_archive_object(oop(this)) &&
!MetaspaceShared::is_archive_object(p),
assert(!is_archive_object(oop(this)) &&
!is_archive_object(p),
"forwarding archive object");
markOop m = markOopDesc::encode_pointer_as_mark(p);
assert(m->decode_pointer() == p, "encoding must be reversable");

View File

@ -37,7 +37,7 @@
#include "gc/shared/genCollectedHeap.hpp"
#include "jvmtifiles/jvmtiEnv.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspaceShared.hpp"
#include "memory/metaspaceShared.inline.hpp"
#include "memory/iterator.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, 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
@ -25,7 +25,6 @@
#ifndef SHARE_VM_RUNTIME_JVMFLAGRANGELIST_HPP
#define SHARE_VM_RUNTIME_JVMFLAGRANGELIST_HPP
#include "memory/metaspaceShared.hpp"
#include "runtime/flags/jvmFlag.hpp"
#include "utilities/growableArray.hpp"