aboutsummaryrefslogtreecommitdiff
path: root/src/share/vm/oops/instanceKlass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/share/vm/oops/instanceKlass.cpp')
-rw-r--r--src/share/vm/oops/instanceKlass.cpp70
1 files changed, 59 insertions, 11 deletions
diff --git a/src/share/vm/oops/instanceKlass.cpp b/src/share/vm/oops/instanceKlass.cpp
index b0b7038e3..4af6e3206 100644
--- a/src/share/vm/oops/instanceKlass.cpp
+++ b/src/share/vm/oops/instanceKlass.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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
@@ -34,6 +34,7 @@
#include "interpreter/rewriter.hpp"
#include "jvmtifiles/jvmti.h"
#include "memory/genOopClosures.inline.hpp"
+#include "memory/heapInspection.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/oopFactory.hpp"
#include "oops/fieldStreams.hpp"
@@ -55,7 +56,8 @@
#include "runtime/thread.inline.hpp"
#include "services/threadService.hpp"
#include "utilities/dtrace.hpp"
-#ifndef SERIALGC
+#include "utilities/macros.hpp"
+#if INCLUDE_ALL_GCS
#include "gc_implementation/concurrentMarkSweep/cmsOopClosures.inline.hpp"
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
@@ -66,7 +68,7 @@
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
#include "oops/oop.pcgc.inline.hpp"
-#endif
+#endif // INCLUDE_ALL_GCS
#ifdef COMPILER1
#include "c1/c1_Compiler.hpp"
#endif
@@ -2042,7 +2044,7 @@ void InstanceKlass::oop_follow_contents(oop obj) {
assert_is_in_closed_subset)
}
-#ifndef SERIALGC
+#if INCLUDE_ALL_GCS
void InstanceKlass::oop_follow_contents(ParCompactionManager* cm,
oop obj) {
assert(obj != NULL, "can't follow the content of NULL object");
@@ -2054,7 +2056,7 @@ void InstanceKlass::oop_follow_contents(ParCompactionManager* cm,
PSParallelCompact::mark_and_push(cm, p), \
assert_is_in)
}
-#endif // SERIALGC
+#endif // INCLUDE_ALL_GCS
// closure's do_metadata() method dictates whether the given closure should be
// applied to the klass ptr in the object header.
@@ -2082,7 +2084,7 @@ int InstanceKlass::oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure)
return size_helper(); \
}
-#ifndef SERIALGC
+#if INCLUDE_ALL_GCS
#define InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \
\
int InstanceKlass::oop_oop_iterate_backwards##nv_suffix(oop obj, \
@@ -2100,7 +2102,7 @@ int InstanceKlass::oop_oop_iterate_backwards##nv_suffix(oop obj,
assert_is_in_closed_subset) \
return size_helper(); \
}
-#endif // !SERIALGC
+#endif // INCLUDE_ALL_GCS
#define InstanceKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix) \
\
@@ -2124,10 +2126,10 @@ ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_DEFN)
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_DEFN)
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_DEFN_m)
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_DEFN_m)
-#ifndef SERIALGC
+#if INCLUDE_ALL_GCS
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
-#endif // !SERIALGC
+#endif // INCLUDE_ALL_GCS
int InstanceKlass::oop_adjust_pointers(oop obj) {
int size = size_helper();
@@ -2139,7 +2141,7 @@ int InstanceKlass::oop_adjust_pointers(oop obj) {
return size;
}
-#ifndef SERIALGC
+#if INCLUDE_ALL_GCS
void InstanceKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
InstanceKlass_OOP_MAP_REVERSE_ITERATE( \
obj, \
@@ -2159,7 +2161,7 @@ int InstanceKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
return size;
}
-#endif // SERIALGC
+#endif // INCLUDE_ALL_GCS
void InstanceKlass::clean_implementors_list(BoolObjectClosure* is_alive) {
assert(is_loader_alive(is_alive), "this klass should be live");
@@ -2960,6 +2962,52 @@ const char* InstanceKlass::internal_name() const {
return external_name();
}
+#if INCLUDE_SERVICES
+// Size Statistics
+void InstanceKlass::collect_statistics(KlassSizeStats *sz) const {
+ Klass::collect_statistics(sz);
+
+ sz->_inst_size = HeapWordSize * size_helper();
+ sz->_vtab_bytes = HeapWordSize * align_object_offset(vtable_length());
+ sz->_itab_bytes = HeapWordSize * align_object_offset(itable_length());
+ sz->_nonstatic_oopmap_bytes = HeapWordSize *
+ ((is_interface() || is_anonymous()) ?
+ align_object_offset(nonstatic_oop_map_size()) :
+ nonstatic_oop_map_size());
+
+ int n = 0;
+ n += (sz->_methods_array_bytes = sz->count_array(methods()));
+ n += (sz->_method_ordering_bytes = sz->count_array(method_ordering()));
+ n += (sz->_local_interfaces_bytes = sz->count_array(local_interfaces()));
+ n += (sz->_transitive_interfaces_bytes = sz->count_array(transitive_interfaces()));
+ n += (sz->_signers_bytes = sz->count_array(signers()));
+ n += (sz->_fields_bytes = sz->count_array(fields()));
+ n += (sz->_inner_classes_bytes = sz->count_array(inner_classes()));
+ sz->_ro_bytes += n;
+
+ const ConstantPool* cp = constants();
+ if (cp) {
+ cp->collect_statistics(sz);
+ }
+
+ const Annotations* anno = annotations();
+ if (anno) {
+ anno->collect_statistics(sz);
+ }
+
+ const Array<Method*>* methods_array = methods();
+ if (methods()) {
+ for (int i = 0; i < methods_array->length(); i++) {
+ Method* method = methods_array->at(i);
+ if (method) {
+ sz->_method_count ++;
+ method->collect_statistics(sz);
+ }
+ }
+ }
+}
+#endif // INCLUDE_SERVICES
+
// Verification
class VerifyFieldClosure: public OopClosure {