2011-03-18 16:00:34 -07:00
|
|
|
/*
|
2014-04-08 13:58:38 -04:00
|
|
|
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
2011-03-18 16:00:34 -07:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "precompiled.hpp"
|
|
|
|
#include "classfile/javaClasses.hpp"
|
|
|
|
#include "classfile/systemDictionary.hpp"
|
|
|
|
#include "gc_implementation/shared/markSweep.inline.hpp"
|
|
|
|
#include "gc_interface/collectedHeap.inline.hpp"
|
|
|
|
#include "memory/genOopClosures.inline.hpp"
|
|
|
|
#include "memory/oopFactory.hpp"
|
|
|
|
#include "oops/instanceKlass.hpp"
|
|
|
|
#include "oops/instanceMirrorKlass.hpp"
|
|
|
|
#include "oops/instanceOop.hpp"
|
|
|
|
#include "oops/oop.inline.hpp"
|
|
|
|
#include "oops/symbol.hpp"
|
|
|
|
#include "runtime/handles.inline.hpp"
|
2013-01-23 13:02:39 -05:00
|
|
|
#include "utilities/macros.hpp"
|
|
|
|
#if INCLUDE_ALL_GCS
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
#include "gc_implementation/concurrentMarkSweep/cmsOopClosures.inline.hpp"
|
2011-03-18 16:00:34 -07:00
|
|
|
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
|
|
|
|
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
|
|
|
|
#include "gc_implementation/g1/g1RemSet.inline.hpp"
|
|
|
|
#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
|
|
|
|
#include "gc_implementation/parNew/parOopClosures.inline.hpp"
|
|
|
|
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
|
|
|
|
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
|
|
|
|
#include "oops/oop.pcgc.inline.hpp"
|
2013-01-23 13:02:39 -05:00
|
|
|
#endif // INCLUDE_ALL_GCS
|
2011-03-18 16:00:34 -07:00
|
|
|
|
2012-09-07 12:04:16 -04:00
|
|
|
int InstanceMirrorKlass::_offset_of_static_fields = 0;
|
2011-03-18 16:00:34 -07:00
|
|
|
|
|
|
|
#ifdef ASSERT
|
|
|
|
template <class T> void assert_is_in(T *p) {
|
|
|
|
T heap_oop = oopDesc::load_heap_oop(p);
|
|
|
|
if (!oopDesc::is_null(heap_oop)) {
|
|
|
|
oop o = oopDesc::decode_heap_oop_not_null(heap_oop);
|
|
|
|
assert(Universe::heap()->is_in(o), "should be in heap");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
template <class T> void assert_is_in_closed_subset(T *p) {
|
|
|
|
T heap_oop = oopDesc::load_heap_oop(p);
|
|
|
|
if (!oopDesc::is_null(heap_oop)) {
|
|
|
|
oop o = oopDesc::decode_heap_oop_not_null(heap_oop);
|
|
|
|
assert(Universe::heap()->is_in_closed_subset(o), "should be in closed");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
template <class T> void assert_is_in_reserved(T *p) {
|
|
|
|
T heap_oop = oopDesc::load_heap_oop(p);
|
|
|
|
if (!oopDesc::is_null(heap_oop)) {
|
|
|
|
oop o = oopDesc::decode_heap_oop_not_null(heap_oop);
|
|
|
|
assert(Universe::heap()->is_in_reserved(o), "should be in reserved");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
template <class T> void assert_nothing(T *p) {}
|
|
|
|
|
|
|
|
#else
|
|
|
|
template <class T> void assert_is_in(T *p) {}
|
|
|
|
template <class T> void assert_is_in_closed_subset(T *p) {}
|
|
|
|
template <class T> void assert_is_in_reserved(T *p) {}
|
|
|
|
template <class T> void assert_nothing(T *p) {}
|
|
|
|
#endif // ASSERT
|
|
|
|
|
|
|
|
#define InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE( \
|
|
|
|
T, start_p, count, do_oop, \
|
|
|
|
assert_fn) \
|
|
|
|
{ \
|
|
|
|
T* p = (T*)(start_p); \
|
|
|
|
T* const end = p + (count); \
|
|
|
|
while (p < end) { \
|
|
|
|
(assert_fn)(p); \
|
|
|
|
do_oop; \
|
|
|
|
++p; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define InstanceMirrorKlass_SPECIALIZED_BOUNDED_OOP_ITERATE( \
|
|
|
|
T, start_p, count, low, high, \
|
|
|
|
do_oop, assert_fn) \
|
|
|
|
{ \
|
|
|
|
T* const l = (T*)(low); \
|
|
|
|
T* const h = (T*)(high); \
|
|
|
|
assert(mask_bits((intptr_t)l, sizeof(T)-1) == 0 && \
|
|
|
|
mask_bits((intptr_t)h, sizeof(T)-1) == 0, \
|
|
|
|
"bounded region must be properly aligned"); \
|
|
|
|
T* p = (T*)(start_p); \
|
|
|
|
T* end = p + (count); \
|
|
|
|
if (p < l) p = l; \
|
|
|
|
if (end > h) end = h; \
|
|
|
|
while (p < end) { \
|
|
|
|
(assert_fn)(p); \
|
|
|
|
do_oop; \
|
|
|
|
++p; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define InstanceMirrorKlass_OOP_ITERATE(start_p, count, \
|
|
|
|
do_oop, assert_fn) \
|
|
|
|
{ \
|
|
|
|
if (UseCompressedOops) { \
|
|
|
|
InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE(narrowOop, \
|
|
|
|
start_p, count, \
|
|
|
|
do_oop, assert_fn) \
|
|
|
|
} else { \
|
|
|
|
InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE(oop, \
|
|
|
|
start_p, count, \
|
|
|
|
do_oop, assert_fn) \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
// The following macros call specialized macros, passing either oop or
|
|
|
|
// narrowOop as the specialization type. These test the UseCompressedOops
|
|
|
|
// flag.
|
|
|
|
#define InstanceMirrorKlass_BOUNDED_OOP_ITERATE(start_p, count, low, high, \
|
|
|
|
do_oop, assert_fn) \
|
|
|
|
{ \
|
|
|
|
if (UseCompressedOops) { \
|
|
|
|
InstanceMirrorKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(narrowOop, \
|
|
|
|
start_p, count, \
|
|
|
|
low, high, \
|
|
|
|
do_oop, assert_fn) \
|
|
|
|
} else { \
|
|
|
|
InstanceMirrorKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(oop, \
|
|
|
|
start_p, count, \
|
|
|
|
low, high, \
|
|
|
|
do_oop, assert_fn) \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-09-07 12:04:16 -04:00
|
|
|
void InstanceMirrorKlass::oop_follow_contents(oop obj) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
InstanceKlass::oop_follow_contents(obj);
|
|
|
|
|
|
|
|
// Follow the klass field in the mirror.
|
|
|
|
Klass* klass = java_lang_Class::as_Klass(obj);
|
|
|
|
if (klass != NULL) {
|
2013-12-10 10:31:00 +01:00
|
|
|
// An anonymous class doesn't have its own class loader, so the call
|
|
|
|
// to follow_klass will mark and push its java mirror instead of the
|
|
|
|
// class loader. When handling the java mirror for an anonymous class
|
|
|
|
// we need to make sure its class loader data is claimed, this is done
|
|
|
|
// by calling follow_class_loader explicitly. For non-anonymous classes
|
|
|
|
// the call to follow_class_loader is made when the class loader itself
|
|
|
|
// is handled.
|
2013-11-26 14:35:38 +01:00
|
|
|
if (klass->oop_is_instance() && InstanceKlass::cast(klass)->is_anonymous()) {
|
|
|
|
MarkSweep::follow_class_loader(klass->class_loader_data());
|
|
|
|
} else {
|
|
|
|
MarkSweep::follow_klass(klass);
|
|
|
|
}
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
} else {
|
|
|
|
// If klass is NULL then this a mirror for a primitive type.
|
|
|
|
// We don't have to follow them, since they are handled as strong
|
|
|
|
// roots in Universe::oops_do.
|
|
|
|
assert(java_lang_Class::is_primitive(obj), "Sanity check");
|
|
|
|
}
|
|
|
|
|
2011-03-18 16:00:34 -07:00
|
|
|
InstanceMirrorKlass_OOP_ITERATE( \
|
|
|
|
start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj), \
|
|
|
|
MarkSweep::mark_and_push(p), \
|
|
|
|
assert_is_in_closed_subset)
|
|
|
|
}
|
|
|
|
|
2013-01-23 13:02:39 -05:00
|
|
|
#if INCLUDE_ALL_GCS
|
2012-09-07 12:04:16 -04:00
|
|
|
void InstanceMirrorKlass::oop_follow_contents(ParCompactionManager* cm,
|
2011-03-18 16:00:34 -07:00
|
|
|
oop obj) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
InstanceKlass::oop_follow_contents(cm, obj);
|
|
|
|
|
|
|
|
// Follow the klass field in the mirror.
|
|
|
|
Klass* klass = java_lang_Class::as_Klass(obj);
|
|
|
|
if (klass != NULL) {
|
2013-12-10 10:31:00 +01:00
|
|
|
// An anonymous class doesn't have its own class loader, so the call
|
|
|
|
// to follow_klass will mark and push its java mirror instead of the
|
|
|
|
// class loader. When handling the java mirror for an anonymous class
|
|
|
|
// we need to make sure its class loader data is claimed, this is done
|
|
|
|
// by calling follow_class_loader explicitly. For non-anonymous classes
|
|
|
|
// the call to follow_class_loader is made when the class loader itself
|
|
|
|
// is handled.
|
|
|
|
if (klass->oop_is_instance() && InstanceKlass::cast(klass)->is_anonymous()) {
|
|
|
|
PSParallelCompact::follow_class_loader(cm, klass->class_loader_data());
|
|
|
|
} else {
|
|
|
|
PSParallelCompact::follow_klass(cm, klass);
|
|
|
|
}
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
} else {
|
|
|
|
// If klass is NULL then this a mirror for a primitive type.
|
|
|
|
// We don't have to follow them, since they are handled as strong
|
|
|
|
// roots in Universe::oops_do.
|
|
|
|
assert(java_lang_Class::is_primitive(obj), "Sanity check");
|
|
|
|
}
|
|
|
|
|
2011-03-18 16:00:34 -07:00
|
|
|
InstanceMirrorKlass_OOP_ITERATE( \
|
|
|
|
start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj), \
|
|
|
|
PSParallelCompact::mark_and_push(cm, p), \
|
|
|
|
assert_is_in)
|
|
|
|
}
|
2013-01-23 13:02:39 -05:00
|
|
|
#endif // INCLUDE_ALL_GCS
|
2011-03-18 16:00:34 -07:00
|
|
|
|
2012-09-07 12:04:16 -04:00
|
|
|
int InstanceMirrorKlass::oop_adjust_pointers(oop obj) {
|
2011-03-18 16:00:34 -07:00
|
|
|
int size = oop_size(obj);
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
InstanceKlass::oop_adjust_pointers(obj);
|
|
|
|
|
2011-03-18 16:00:34 -07:00
|
|
|
InstanceMirrorKlass_OOP_ITERATE( \
|
|
|
|
start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj), \
|
|
|
|
MarkSweep::adjust_pointer(p), \
|
|
|
|
assert_nothing)
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE_DEFN(T, nv_suffix) \
|
|
|
|
InstanceMirrorKlass_OOP_ITERATE( \
|
|
|
|
start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj), \
|
|
|
|
(closure)->do_oop##nv_suffix(p), \
|
|
|
|
assert_is_in_closed_subset) \
|
|
|
|
return oop_size(obj); \
|
|
|
|
|
|
|
|
#define InstanceMirrorKlass_BOUNDED_SPECIALIZED_OOP_ITERATE(T, nv_suffix, mr) \
|
|
|
|
InstanceMirrorKlass_BOUNDED_OOP_ITERATE( \
|
|
|
|
start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj), \
|
|
|
|
mr.start(), mr.end(), \
|
|
|
|
(closure)->do_oop##nv_suffix(p), \
|
|
|
|
assert_is_in_closed_subset) \
|
|
|
|
return oop_size(obj); \
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
#define if_do_metadata_checked(closure, nv_suffix) \
|
|
|
|
/* Make sure the non-virtual and the virtual versions match. */ \
|
|
|
|
assert(closure->do_metadata##nv_suffix() == closure->do_metadata(), \
|
|
|
|
"Inconsistency in do_metadata"); \
|
|
|
|
if (closure->do_metadata##nv_suffix())
|
|
|
|
|
2012-09-07 12:04:16 -04:00
|
|
|
// Macro to define InstanceMirrorKlass::oop_oop_iterate for virtual/nonvirtual for
|
2011-03-18 16:00:34 -07:00
|
|
|
// all closures. Macros calling macros above for each oop size.
|
|
|
|
|
|
|
|
#define InstanceMirrorKlass_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \
|
|
|
|
\
|
2012-09-07 12:04:16 -04:00
|
|
|
int InstanceMirrorKlass:: \
|
2011-03-18 16:00:34 -07:00
|
|
|
oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { \
|
|
|
|
/* Get size before changing pointers */ \
|
|
|
|
SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk); \
|
|
|
|
\
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
InstanceKlass::oop_oop_iterate##nv_suffix(obj, closure); \
|
|
|
|
\
|
|
|
|
if_do_metadata_checked(closure, nv_suffix) { \
|
|
|
|
Klass* klass = java_lang_Class::as_Klass(obj); \
|
|
|
|
/* We'll get NULL for primitive mirrors. */ \
|
|
|
|
if (klass != NULL) { \
|
|
|
|
closure->do_klass##nv_suffix(klass); \
|
|
|
|
} \
|
|
|
|
} \
|
2011-03-18 16:00:34 -07:00
|
|
|
\
|
|
|
|
if (UseCompressedOops) { \
|
|
|
|
InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE_DEFN(narrowOop, nv_suffix); \
|
|
|
|
} else { \
|
|
|
|
InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE_DEFN(oop, nv_suffix); \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2013-01-23 13:02:39 -05:00
|
|
|
#if INCLUDE_ALL_GCS
|
2011-03-18 16:00:34 -07:00
|
|
|
#define InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \
|
|
|
|
\
|
2012-09-07 12:04:16 -04:00
|
|
|
int InstanceMirrorKlass:: \
|
2011-03-18 16:00:34 -07:00
|
|
|
oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) { \
|
|
|
|
/* Get size before changing pointers */ \
|
|
|
|
SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk); \
|
|
|
|
\
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
InstanceKlass::oop_oop_iterate_backwards##nv_suffix(obj, closure); \
|
2011-03-18 16:00:34 -07:00
|
|
|
\
|
|
|
|
if (UseCompressedOops) { \
|
|
|
|
InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE_DEFN(narrowOop, nv_suffix); \
|
|
|
|
} else { \
|
|
|
|
InstanceMirrorKlass_SPECIALIZED_OOP_ITERATE_DEFN(oop, nv_suffix); \
|
|
|
|
} \
|
|
|
|
}
|
2013-01-23 13:02:39 -05:00
|
|
|
#endif // INCLUDE_ALL_GCS
|
2011-03-18 16:00:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
#define InstanceMirrorKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix) \
|
|
|
|
\
|
2012-09-07 12:04:16 -04:00
|
|
|
int InstanceMirrorKlass:: \
|
2011-03-18 16:00:34 -07:00
|
|
|
oop_oop_iterate##nv_suffix##_m(oop obj, \
|
|
|
|
OopClosureType* closure, \
|
|
|
|
MemRegion mr) { \
|
|
|
|
SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk); \
|
|
|
|
\
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
InstanceKlass::oop_oop_iterate##nv_suffix##_m(obj, closure, mr); \
|
|
|
|
\
|
|
|
|
if_do_metadata_checked(closure, nv_suffix) { \
|
|
|
|
if (mr.contains(obj)) { \
|
|
|
|
Klass* klass = java_lang_Class::as_Klass(obj); \
|
|
|
|
/* We'll get NULL for primitive mirrors. */ \
|
|
|
|
if (klass != NULL) { \
|
|
|
|
closure->do_klass##nv_suffix(klass); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
\
|
2011-03-18 16:00:34 -07:00
|
|
|
if (UseCompressedOops) { \
|
|
|
|
InstanceMirrorKlass_BOUNDED_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, mr); \
|
|
|
|
} else { \
|
|
|
|
InstanceMirrorKlass_BOUNDED_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, mr); \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceMirrorKlass_OOP_OOP_ITERATE_DEFN)
|
|
|
|
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_DEFN)
|
2013-01-23 13:02:39 -05:00
|
|
|
#if INCLUDE_ALL_GCS
|
2011-03-18 16:00:34 -07:00
|
|
|
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
|
|
|
|
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
|
2013-01-23 13:02:39 -05:00
|
|
|
#endif // INCLUDE_ALL_GCS
|
2011-03-18 16:00:34 -07:00
|
|
|
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceMirrorKlass_OOP_OOP_ITERATE_DEFN_m)
|
|
|
|
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_DEFN_m)
|
|
|
|
|
2013-01-23 13:02:39 -05:00
|
|
|
#if INCLUDE_ALL_GCS
|
2012-09-07 12:04:16 -04:00
|
|
|
void InstanceMirrorKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// Note that we don't have to follow the mirror -> klass pointer, since all
|
|
|
|
// klasses that are dirty will be scavenged when we iterate over the
|
|
|
|
// ClassLoaderData objects.
|
|
|
|
|
|
|
|
InstanceKlass::oop_push_contents(pm, obj);
|
2011-03-18 16:00:34 -07:00
|
|
|
InstanceMirrorKlass_OOP_ITERATE( \
|
|
|
|
start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),\
|
|
|
|
if (PSScavenge::should_scavenge(p)) { \
|
|
|
|
pm->claim_or_forward_depth(p); \
|
|
|
|
}, \
|
|
|
|
assert_nothing )
|
|
|
|
}
|
|
|
|
|
2012-09-07 12:04:16 -04:00
|
|
|
int InstanceMirrorKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
int size = oop_size(obj);
|
|
|
|
InstanceKlass::oop_update_pointers(cm, obj);
|
|
|
|
|
2011-03-18 16:00:34 -07:00
|
|
|
InstanceMirrorKlass_OOP_ITERATE( \
|
|
|
|
start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),\
|
|
|
|
PSParallelCompact::adjust_pointer(p), \
|
|
|
|
assert_nothing)
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
return size;
|
2011-03-18 16:00:34 -07:00
|
|
|
}
|
2013-01-23 13:02:39 -05:00
|
|
|
#endif // INCLUDE_ALL_GCS
|
2011-03-18 16:00:34 -07:00
|
|
|
|
2012-09-07 12:04:16 -04:00
|
|
|
int InstanceMirrorKlass::instance_size(KlassHandle k) {
|
2011-03-18 16:00:34 -07:00
|
|
|
if (k() != NULL && k->oop_is_instance()) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
return align_object_size(size_helper() + InstanceKlass::cast(k())->static_field_size());
|
2011-03-18 16:00:34 -07:00
|
|
|
}
|
|
|
|
return size_helper();
|
|
|
|
}
|
|
|
|
|
2012-09-07 12:04:16 -04:00
|
|
|
instanceOop InstanceMirrorKlass::allocate_instance(KlassHandle k, TRAPS) {
|
2011-03-18 16:00:34 -07:00
|
|
|
// Query before forming handle.
|
|
|
|
int size = instance_size(k);
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
KlassHandle h_k(THREAD, this);
|
2014-04-08 13:58:38 -04:00
|
|
|
instanceOop i = (instanceOop)CollectedHeap::obj_allocate(h_k, size, CHECK_NULL);
|
|
|
|
|
|
|
|
// Since mirrors can be variable sized because of the static fields, store
|
|
|
|
// the size in the mirror itself.
|
|
|
|
java_lang_Class::set_oop_size(i, size);
|
|
|
|
|
2011-03-18 16:00:34 -07:00
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2012-09-07 12:04:16 -04:00
|
|
|
int InstanceMirrorKlass::oop_size(oop obj) const {
|
2011-03-18 16:00:34 -07:00
|
|
|
return java_lang_Class::oop_size(obj);
|
|
|
|
}
|
|
|
|
|
2012-09-07 12:04:16 -04:00
|
|
|
int InstanceMirrorKlass::compute_static_oop_field_count(oop obj) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* k = java_lang_Class::as_Klass(obj);
|
|
|
|
if (k != NULL && k->oop_is_instance()) {
|
|
|
|
return InstanceKlass::cast(k)->static_oop_field_count();
|
2011-03-18 16:00:34 -07:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|