7133260: AllocationProfiler uses space in metadata and doesn't seem to do anything useful.
Summary: Remove -Xaprof and Klass::_alloc_count & ArrayKlass::_alloc_size.
Reviewed-by: stefank, coleenp
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java Wed Jul 03 17:26:59 2013 -0400
@@ -49,7 +49,6 @@
higherDimension = new MetadataField(type.getAddressField("_higher_dimension"), 0);
lowerDimension = new MetadataField(type.getAddressField("_lower_dimension"), 0);
vtableLen = new CIntField(type.getCIntegerField("_vtable_len"), 0);
- allocSize = new CIntField(type.getCIntegerField("_alloc_size"), 0);
componentMirror = new OopField(type.getOopField("_component_mirror"), 0);
javaLangCloneableName = null;
javaLangObjectName = null;
@@ -64,7 +63,6 @@
private static MetadataField higherDimension;
private static MetadataField lowerDimension;
private static CIntField vtableLen;
- private static CIntField allocSize;
private static OopField componentMirror;
public Klass getJavaSuper() {
@@ -76,7 +74,6 @@
public Klass getHigherDimension() { return (Klass) higherDimension.getValue(this); }
public Klass getLowerDimension() { return (Klass) lowerDimension.getValue(this); }
public long getVtableLen() { return vtableLen.getValue(this); }
- public long getAllocSize() { return allocSize.getValue(this); }
public Oop getComponentMirror() { return componentMirror.getValue(this); }
// constant class names - javaLangCloneable, javaIoSerializable, javaLangObject
@@ -147,7 +144,6 @@
visitor.doMetadata(higherDimension, true);
visitor.doMetadata(lowerDimension, true);
visitor.doCInt(vtableLen, true);
- visitor.doCInt(allocSize, true);
visitor.doOop(componentMirror, true);
}
}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java Wed Jul 03 17:26:59 2013 -0400
@@ -57,7 +57,6 @@
accessFlags = new CIntField(type.getCIntegerField("_access_flags"), 0);
subklass = new MetadataField(type.getAddressField("_subklass"), 0);
nextSibling = new MetadataField(type.getAddressField("_next_sibling"), 0);
- allocCount = new CIntField(type.getCIntegerField("_alloc_count"), 0);
LH_INSTANCE_SLOW_PATH_BIT = db.lookupIntConstant("Klass::_lh_instance_slow_path_bit").intValue();
LH_LOG2_ELEMENT_SIZE_SHIFT = db.lookupIntConstant("Klass::_lh_log2_element_size_shift").intValue();
@@ -87,7 +86,6 @@
private static CIntField accessFlags;
private static MetadataField subklass;
private static MetadataField nextSibling;
- private static CIntField allocCount;
private Address getValue(AddressField field) {
return addr.getAddressAt(field.getOffset());
@@ -108,7 +106,6 @@
public AccessFlags getAccessFlagsObj(){ return new AccessFlags(getAccessFlags()); }
public Klass getSubklassKlass() { return (Klass) subklass.getValue(this); }
public Klass getNextSiblingKlass() { return (Klass) nextSibling.getValue(this); }
- public long getAllocCount() { return allocCount.getValue(this); }
// computed access flags - takes care of inner classes etc.
// This is closer to actual source level than getAccessFlags() etc.
@@ -172,7 +169,6 @@
visitor.doCInt(accessFlags, true);
visitor.doMetadata(subklass, true);
visitor.doMetadata(nextSibling, true);
- visitor.doCInt(allocCount, true);
}
public long getObjectSize() {
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Wed Jul 03 17:26:59 2013 -0400
@@ -2017,12 +2017,6 @@
ALL_SINCE_SAVE_MARKS_CLOSURES(CFLS_OOP_SINCE_SAVE_MARKS_DEFN)
-
-void CompactibleFreeListSpace::object_iterate_since_last_GC(ObjectClosure* cl) {
- // ugghh... how would one do this efficiently for a non-contiguous space?
- guarantee(false, "NYI");
-}
-
bool CompactibleFreeListSpace::linearAllocationWouldFail() const {
return _smallLinearAllocBlock._word_size == 0;
}
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp Wed Jul 03 17:26:59 2013 -0400
@@ -396,7 +396,6 @@
// iteration support for promotion
void save_marks();
bool no_allocs_since_save_marks();
- void object_iterate_since_last_GC(ObjectClosure* cl);
// iteration support for sweeping
void save_sweep_limit() {
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Wed Jul 03 17:26:59 2013 -0400
@@ -3130,26 +3130,6 @@
ALL_SINCE_SAVE_MARKS_CLOSURES(CMS_SINCE_SAVE_MARKS_DEFN)
void
-ConcurrentMarkSweepGeneration::object_iterate_since_last_GC(ObjectClosure* blk)
-{
- // Not currently implemented; need to do the following. -- ysr.
- // dld -- I think that is used for some sort of allocation profiler. So it
- // really means the objects allocated by the mutator since the last
- // GC. We could potentially implement this cheaply by recording only
- // the direct allocations in a side data structure.
- //
- // I think we probably ought not to be required to support these
- // iterations at any arbitrary point; I think there ought to be some
- // call to enable/disable allocation profiling in a generation/space,
- // and the iterator ought to return the objects allocated in the
- // gen/space since the enable call, or the last iterator call (which
- // will probably be at a GC.) That way, for gens like CM&S that would
- // require some extra data structure to support this, we only pay the
- // cost when it's in use...
- cmsSpace()->object_iterate_since_last_GC(blk);
-}
-
-void
ConcurrentMarkSweepGeneration::younger_refs_iterate(OopsInGenClosure* cl) {
cl->set_generation(this);
younger_refs_in_space_iterate(_cmsSpace, cl);
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp Wed Jul 03 17:26:59 2013 -0400
@@ -1273,7 +1273,6 @@
// Iteration support and related enquiries
void save_marks();
bool no_allocs_since_save_marks();
- void object_iterate_since_last_GC(ObjectClosure* cl);
void younger_refs_iterate(OopsInGenClosure* cl);
// Iteration support specific to CMS generations
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Wed Jul 03 17:26:59 2013 -0400
@@ -54,7 +54,6 @@
#include "memory/referenceProcessor.hpp"
#include "oops/oop.inline.hpp"
#include "oops/oop.pcgc.inline.hpp"
-#include "runtime/aprofiler.hpp"
#include "runtime/vmThread.hpp"
size_t G1CollectedHeap::_humongous_object_threshold_in_words = 0;
@@ -2665,11 +2664,6 @@
heap_region_iterate(&blk);
}
-void G1CollectedHeap::object_iterate_since_last_GC(ObjectClosure* cl) {
- // FIXME: is this right?
- guarantee(false, "object_iterate_since_last_GC not supported by G1 heap");
-}
-
// Calls a SpaceClosure on a HeapRegion.
class SpaceClosureRegionClosure: public HeapRegionClosure {
@@ -3598,8 +3592,6 @@
void G1CollectedHeap::gc_prologue(bool full /* Ignored */) {
// always_do_update_barrier = false;
assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer");
- // Call allocation profiler
- AllocationProfiler::iterate_since_last_gc();
// Fill TLAB's and such
ensure_parsability(true);
}
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Wed Jul 03 17:26:59 2013 -0400
@@ -1360,11 +1360,6 @@
object_iterate(cl);
}
- // Iterate over all objects allocated since the last collection, calling
- // "cl.do_object" on each. The heap must have been initialized properly
- // to support this function, or else this call will fail.
- virtual void object_iterate_since_last_GC(ObjectClosure* cl);
-
// Iterate over all spaces in use in the heap, in ascending address order.
virtual void space_iterate(SpaceClosure* cl);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Wed Jul 03 17:26:59 2013 -0400
@@ -43,7 +43,6 @@
#include "oops/instanceRefKlass.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jvmtiExport.hpp"
-#include "runtime/aprofiler.hpp"
#include "runtime/biasedLocking.hpp"
#include "runtime/fprofiler.hpp"
#include "runtime/synchronizer.hpp"
--- a/hotspot/src/share/vm/memory/defNewGeneration.cpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp Wed Jul 03 17:26:59 2013 -0400
@@ -450,11 +450,6 @@
}
}
-void DefNewGeneration::object_iterate_since_last_GC(ObjectClosure* cl) {
- // $$$ This may be wrong in case of "scavenge failure"?
- eden()->object_iterate(cl);
-}
-
void DefNewGeneration::younger_refs_iterate(OopsInGenClosure* cl) {
assert(false, "NYI -- are you sure you want to call this?");
}
--- a/hotspot/src/share/vm/memory/defNewGeneration.hpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/memory/defNewGeneration.hpp Wed Jul 03 17:26:59 2013 -0400
@@ -252,7 +252,6 @@
// Iteration
void object_iterate(ObjectClosure* blk);
- void object_iterate_since_last_GC(ObjectClosure* cl);
void younger_refs_iterate(OopsInGenClosure* cl);
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp Wed Jul 03 17:26:59 2013 -0400
@@ -42,7 +42,6 @@
#include "memory/space.hpp"
#include "oops/oop.inline.hpp"
#include "oops/oop.inline2.hpp"
-#include "runtime/aprofiler.hpp"
#include "runtime/biasedLocking.hpp"
#include "runtime/fprofiler.hpp"
#include "runtime/handles.hpp"
@@ -873,12 +872,6 @@
}
}
-void GenCollectedHeap::object_iterate_since_last_GC(ObjectClosure* cl) {
- for (int i = 0; i < _n_gens; i++) {
- _gens[i]->object_iterate_since_last_GC(cl);
- }
-}
-
Space* GenCollectedHeap::space_containing(const void* addr) const {
for (int i = 0; i < _n_gens; i++) {
Space* res = _gens[i]->space_containing(addr);
@@ -1186,8 +1179,6 @@
CollectedHeap::accumulate_statistics_all_tlabs();
ensure_parsability(true); // retire TLABs
- // Call allocation profiler
- AllocationProfiler::iterate_since_last_gc();
// Walk generations
GenGCPrologueClosure blk(full);
generation_iterate(&blk, false); // not old-to-young.
--- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp Wed Jul 03 17:26:59 2013 -0400
@@ -222,7 +222,6 @@
void oop_iterate(MemRegion mr, ExtendedOopClosure* cl);
void object_iterate(ObjectClosure* cl);
void safe_object_iterate(ObjectClosure* cl);
- void object_iterate_since_last_GC(ObjectClosure* cl);
Space* space_containing(const void* addr) const;
// A CollectedHeap is divided into a dense sequence of "blocks"; that is,
--- a/hotspot/src/share/vm/memory/generation.cpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/memory/generation.cpp Wed Jul 03 17:26:59 2013 -0400
@@ -811,16 +811,6 @@
blk->do_space(_the_space);
}
-void OneContigSpaceCardGeneration::object_iterate_since_last_GC(ObjectClosure* blk) {
- // Deal with delayed initialization of _the_space,
- // and lack of initialization of _last_gc.
- if (_last_gc.space() == NULL) {
- assert(the_space() != NULL, "shouldn't be NULL");
- _last_gc = the_space()->bottom_mark();
- }
- the_space()->object_iterate_from(_last_gc, blk);
-}
-
void OneContigSpaceCardGeneration::younger_refs_iterate(OopsInGenClosure* blk) {
blk->set_generation(this);
younger_refs_in_space_iterate(_the_space, blk);
--- a/hotspot/src/share/vm/memory/generation.hpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/memory/generation.hpp Wed Jul 03 17:26:59 2013 -0400
@@ -551,12 +551,6 @@
// the heap. This defaults to object_iterate() unless overridden.
virtual void safe_object_iterate(ObjectClosure* cl);
- // Iterate over all objects allocated in the generation since the last
- // collection, calling "cl.do_object" on each. The generation must have
- // been initialized properly to support this function, or else this call
- // will fail.
- virtual void object_iterate_since_last_GC(ObjectClosure* cl) = 0;
-
// Apply "cl->do_oop" to (the address of) all and only all the ref fields
// in the current generation that contain pointers to objects in younger
// generations. Objects allocated since the last "save_marks" call are
@@ -724,7 +718,6 @@
// Iteration
void object_iterate(ObjectClosure* blk);
void space_iterate(SpaceClosure* blk, bool usedOnly = false);
- void object_iterate_since_last_GC(ObjectClosure* cl);
void younger_refs_iterate(OopsInGenClosure* blk);
--- a/hotspot/src/share/vm/memory/sharedHeap.hpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/memory/sharedHeap.hpp Wed Jul 03 17:26:59 2013 -0400
@@ -166,11 +166,6 @@
// Same as above, restricted to a memory region.
virtual void oop_iterate(MemRegion mr, ExtendedOopClosure* cl) = 0;
- // Iterate over all objects allocated since the last collection, calling
- // "cl->do_object" on each. The heap must have been initialized properly
- // to support this function, or else this call will fail.
- virtual void object_iterate_since_last_GC(ObjectClosure* cl) = 0;
-
// Iterate over all spaces in use in the heap, in an undefined order.
virtual void space_iterate(SpaceClosure* cl) = 0;
--- a/hotspot/src/share/vm/memory/universe.cpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/memory/universe.cpp Wed Jul 03 17:26:59 2013 -0400
@@ -52,7 +52,6 @@
#include "oops/oop.inline.hpp"
#include "oops/typeArrayKlass.hpp"
#include "prims/jvmtiRedefineClassesTrace.hpp"
-#include "runtime/aprofiler.hpp"
#include "runtime/arguments.hpp"
#include "runtime/deoptimization.hpp"
#include "runtime/fprofiler.hpp"
--- a/hotspot/src/share/vm/oops/arrayKlass.cpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/oops/arrayKlass.cpp Wed Jul 03 17:26:59 2013 -0400
@@ -71,7 +71,6 @@
}
ArrayKlass::ArrayKlass(Symbol* name) {
- set_alloc_size(0);
set_name(name);
set_super(Universe::is_bootstrapping() ? (Klass*)NULL : SystemDictionary::Object_klass());
@@ -161,12 +160,6 @@
}
}
-
-void ArrayKlass::with_array_klasses_do(void f(Klass* k)) {
- array_klasses_do(f);
-}
-
-
// GC support
void ArrayKlass::oops_do(OopClosure* cl) {
--- a/hotspot/src/share/vm/oops/arrayKlass.hpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/oops/arrayKlass.hpp Wed Jul 03 17:26:59 2013 -0400
@@ -39,7 +39,6 @@
Klass* volatile _higher_dimension; // Refers the (n+1)'th-dimensional array (if present).
Klass* volatile _lower_dimension; // Refers the (n-1)'th-dimensional array (if present).
int _vtable_len; // size of vtable for this klass
- juint _alloc_size; // allocation profiling support
oop _component_mirror; // component type, as a java/lang/Class
protected:
@@ -65,10 +64,6 @@
void set_lower_dimension(Klass* k) { _lower_dimension = k; }
Klass** adr_lower_dimension() { return (Klass**)&this->_lower_dimension;}
- // Allocation profiling support
- juint alloc_size() const { return _alloc_size; }
- void set_alloc_size(juint n) { _alloc_size = n; }
-
// offset of first element, including any padding for the sake of alignment
int array_header_in_bytes() const { return layout_helper_header_size(layout_helper()); }
int log2_element_size() const { return layout_helper_log2_element_size(layout_helper()); }
@@ -126,7 +121,6 @@
// Iterators
void array_klasses_do(void f(Klass* k));
void array_klasses_do(void f(Klass* k, TRAPS), TRAPS);
- void with_array_klasses_do(void f(Klass* k));
// GC support
virtual void oops_do(OopClosure* cl);
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp Wed Jul 03 17:26:59 2013 -0400
@@ -1321,12 +1321,6 @@
ArrayKlass::cast(array_klasses())->array_klasses_do(f);
}
-
-void InstanceKlass::with_array_klasses_do(void f(Klass* k)) {
- f(this);
- array_klasses_do(f);
-}
-
#ifdef ASSERT
static int linear_search(Array<Method*>* methods, Symbol* name, Symbol* signature) {
int len = methods->length();
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp Wed Jul 03 17:26:59 2013 -0400
@@ -794,7 +794,6 @@
void methods_do(void f(Method* method));
void array_klasses_do(void f(Klass* k));
void array_klasses_do(void f(Klass* k, TRAPS), TRAPS);
- void with_array_klasses_do(void f(Klass* k));
bool super_types_do(SuperTypeClosure* blk);
// Casting from Klass*
@@ -874,10 +873,6 @@
}
}
- // Allocation profiling support
- juint alloc_size() const { return _alloc_count * size_helper(); }
- void set_alloc_size(juint n) {}
-
// Use this to return the size of an instance in heap words:
int size_helper() const {
return layout_helper_to_size_helper(layout_helper());
--- a/hotspot/src/share/vm/oops/klass.cpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/oops/klass.cpp Wed Jul 03 17:26:59 2013 -0400
@@ -168,7 +168,6 @@
set_subklass(NULL);
set_next_sibling(NULL);
set_next_link(NULL);
- set_alloc_count(0);
TRACE_INIT_ID(this);
set_prototype_header(markOopDesc::prototype());
@@ -543,12 +542,6 @@
return NULL;
}
-
-void Klass::with_array_klasses_do(void f(Klass* k)) {
- f(this);
-}
-
-
oop Klass::class_loader() const { return class_loader_data()->class_loader(); }
const char* Klass::external_name() const {
--- a/hotspot/src/share/vm/oops/klass.hpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/oops/klass.hpp Wed Jul 03 17:26:59 2013 -0400
@@ -79,7 +79,6 @@
// [last_biased_lock_bulk_revocation_time] (64 bits)
// [prototype_header]
// [biased_lock_revocation_count]
-// [alloc_count ]
// [_modified_oops]
// [_accumulated_modified_oops]
// [trace_id]
@@ -171,8 +170,6 @@
markOop _prototype_header; // Used when biased locking is both enabled and disabled for this type
jint _biased_lock_revocation_count;
- juint _alloc_count; // allocation profiling support
-
TRACE_DEFINE_KLASS_TRACE_ID;
// Remembered sets support for the oops in the klasses.
@@ -290,11 +287,6 @@
void set_next_sibling(Klass* s);
public:
- // Allocation profiling support
- juint alloc_count() const { return _alloc_count; }
- void set_alloc_count(juint n) { _alloc_count = n; }
- virtual juint alloc_size() const = 0;
- virtual void set_alloc_size(juint n) = 0;
// Compiler support
static ByteSize super_offset() { return in_ByteSize(offset_of(Klass, _super)); }
@@ -677,7 +669,6 @@
#endif // INCLUDE_ALL_GCS
virtual void array_klasses_do(void f(Klass* k)) {}
- virtual void with_array_klasses_do(void f(Klass* k));
// Return self, except for abstract classes with exactly 1
// implementor. Then return the 1 concrete implementation.
--- a/hotspot/src/share/vm/runtime/aprofiler.cpp Tue Jul 02 16:54:24 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*
- * 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
- * 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/systemDictionary.hpp"
-#include "gc_interface/collectedHeap.inline.hpp"
-#include "memory/resourceArea.hpp"
-#include "memory/space.hpp"
-#include "oops/oop.inline.hpp"
-#include "oops/oop.inline2.hpp"
-#include "runtime/aprofiler.hpp"
-
-
-bool AllocationProfiler::_active = false;
-GrowableArray<Klass*>* AllocationProfiler::_print_array = NULL;
-
-
-class AllocProfClosure : public ObjectClosure {
- public:
- void do_object(oop obj) {
- Klass* k = obj->klass();
- k->set_alloc_count(k->alloc_count() + 1);
- k->set_alloc_size(k->alloc_size() + obj->size());
- }
-};
-
-
-void AllocationProfiler::iterate_since_last_gc() {
- if (is_active()) {
- AllocProfClosure blk;
- GenCollectedHeap* heap = GenCollectedHeap::heap();
- heap->object_iterate_since_last_GC(&blk);
- }
-}
-
-
-void AllocationProfiler::engage() {
- _active = true;
-}
-
-
-void AllocationProfiler::disengage() {
- _active = false;
-}
-
-
-void AllocationProfiler::add_class_to_array(Klass* k) {
- _print_array->append(k);
-}
-
-
-void AllocationProfiler::add_classes_to_array(Klass* k) {
- // Iterate over klass and all array klasses for klass
- k->with_array_klasses_do(&AllocationProfiler::add_class_to_array);
-}
-
-
-int AllocationProfiler::compare_classes(Klass** k1, Klass** k2) {
- // Sort by total allocation size
- return (*k2)->alloc_size() - (*k1)->alloc_size();
-}
-
-
-int AllocationProfiler::average(size_t alloc_size, int alloc_count) {
- return (int) ((double) (alloc_size * BytesPerWord) / MAX2(alloc_count, 1) + 0.5);
-}
-
-
-void AllocationProfiler::sort_and_print_array(size_t cutoff) {
- _print_array->sort(&AllocationProfiler::compare_classes);
- tty->print_cr("________________Size"
- "__Instances"
- "__Average"
- "__Class________________");
- size_t total_alloc_size = 0;
- int total_alloc_count = 0;
- for (int index = 0; index < _print_array->length(); index++) {
- Klass* k = _print_array->at(index);
- size_t alloc_size = k->alloc_size();
- if (alloc_size > cutoff) {
- int alloc_count = k->alloc_count();
-#ifdef PRODUCT
- const char* name = k->external_name();
-#else
- const char* name = k->internal_name();
-#endif
- tty->print_cr("%20u %10u %8u %s",
- alloc_size * BytesPerWord,
- alloc_count,
- average(alloc_size, alloc_count),
- name);
- total_alloc_size += alloc_size;
- total_alloc_count += alloc_count;
- }
- k->set_alloc_count(0);
- k->set_alloc_size(0);
- }
- tty->print_cr("%20u %10u %8u --total--",
- total_alloc_size * BytesPerWord,
- total_alloc_count,
- average(total_alloc_size, total_alloc_count));
- tty->cr();
-}
-
-
-void AllocationProfiler::print(size_t cutoff) {
- ResourceMark rm;
- assert(!is_active(), "AllocationProfiler cannot be active while printing profile");
-
- tty->cr();
- tty->print_cr("Allocation profile (sizes in bytes, cutoff = " SIZE_FORMAT " bytes):", cutoff * BytesPerWord);
- tty->cr();
-
- // Print regular instance klasses and basic type array klasses
- _print_array = new GrowableArray<Klass*>(SystemDictionary::number_of_classes()*2);
- SystemDictionary::classes_do(&add_classes_to_array);
- Universe::basic_type_classes_do(&add_classes_to_array);
- sort_and_print_array(cutoff);
-
- // This used to print metadata in the permgen but since there isn't a permgen
- // anymore, it is not yet implemented.
-}
--- a/hotspot/src/share/vm/runtime/aprofiler.hpp Tue Jul 02 16:54:24 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, 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_RUNTIME_APROFILER_HPP
-#define SHARE_VM_RUNTIME_APROFILER_HPP
-
-#include "memory/allocation.hpp"
-#include "memory/universe.hpp"
-#include "oops/klass.hpp"
-#include "utilities/top.hpp"
-
-// A simple allocation profiler for Java. The profiler collects and prints
-// the number and total size of instances allocated per class, including
-// array classes.
-//
-// The profiler is currently global for all threads. It can be changed to a
-// per threads profiler by keeping a more elaborate data structure and calling
-// iterate_since_last_scavenge at thread switches.
-
-
-class AllocationProfiler: AllStatic {
- friend class GenCollectedHeap;
- friend class G1CollectedHeap;
- friend class MarkSweep;
- private:
- static bool _active; // tells whether profiler is active
- static GrowableArray<Klass*>* _print_array; // temporary array for printing
-
- // Utility printing functions
- static void add_class_to_array(Klass* k);
- static void add_classes_to_array(Klass* k);
- static int compare_classes(Klass** k1, Klass** k2);
- static int average(size_t alloc_size, int alloc_count);
- static void sort_and_print_array(size_t cutoff);
-
- // Call for collecting allocation information. Called at scavenge, mark-sweep and disengage.
- static void iterate_since_last_gc();
-
- public:
- // Start profiler
- static void engage();
- // Stop profiler
- static void disengage();
- // Tells whether profiler is active
- static bool is_active() { return _active; }
- // Print profile
- static void print(size_t cutoff); // Cutoff in total allocation size (in words)
-};
-
-#endif // SHARE_VM_RUNTIME_APROFILER_HPP
--- a/hotspot/src/share/vm/runtime/arguments.cpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Wed Jul 03 17:26:59 2013 -0400
@@ -68,7 +68,6 @@
SystemProperty* Arguments::_system_properties = NULL;
const char* Arguments::_gc_log_filename = NULL;
bool Arguments::_has_profile = false;
-bool Arguments::_has_alloc_profile = false;
uintx Arguments::_min_heap_size = 0;
Arguments::Mode Arguments::_mode = _mixed;
bool Arguments::_java_compiler = false;
@@ -1976,23 +1975,6 @@
status = status && check_gc_consistency();
status = status && check_stack_pages();
- if (_has_alloc_profile) {
- if (UseParallelGC || UseParallelOldGC) {
- jio_fprintf(defaultStream::error_stream(),
- "error: invalid argument combination.\n"
- "Allocation profiling (-Xaprof) cannot be used together with "
- "Parallel GC (-XX:+UseParallelGC or -XX:+UseParallelOldGC).\n");
- status = false;
- }
- if (UseConcMarkSweepGC) {
- jio_fprintf(defaultStream::error_stream(),
- "error: invalid argument combination.\n"
- "Allocation profiling (-Xaprof) cannot be used together with "
- "the CMS collector (-XX:+UseConcMarkSweepGC).\n");
- status = false;
- }
- }
-
if (CMSIncrementalMode) {
if (!UseConcMarkSweepGC) {
jio_fprintf(defaultStream::error_stream(),
@@ -2667,9 +2649,6 @@
"Flat profiling is not supported in this VM.\n");
return JNI_ERR;
#endif // INCLUDE_FPROF
- // -Xaprof
- } else if (match_option(option, "-Xaprof", &tail)) {
- _has_alloc_profile = true;
// -Xconcurrentio
} else if (match_option(option, "-Xconcurrentio", &tail)) {
FLAG_SET_CMDLINE(bool, UseLWPSynchronization, true);
--- a/hotspot/src/share/vm/runtime/arguments.hpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/runtime/arguments.hpp Wed Jul 03 17:26:59 2013 -0400
@@ -262,7 +262,6 @@
// Option flags
static bool _has_profile;
- static bool _has_alloc_profile;
static const char* _gc_log_filename;
static uintx _min_heap_size;
@@ -464,9 +463,8 @@
// -Xloggc:<file>, if not specified will be NULL
static const char* gc_log_filename() { return _gc_log_filename; }
- // -Xprof/-Xaprof
+ // -Xprof
static bool has_profile() { return _has_profile; }
- static bool has_alloc_profile() { return _has_alloc_profile; }
// -Xms, -Xmx
static uintx min_heap_size() { return _min_heap_size; }
--- a/hotspot/src/share/vm/runtime/java.cpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/runtime/java.cpp Wed Jul 03 17:26:59 2013 -0400
@@ -42,7 +42,6 @@
#include "oops/oop.inline.hpp"
#include "oops/symbol.hpp"
#include "prims/jvmtiExport.hpp"
-#include "runtime/aprofiler.hpp"
#include "runtime/arguments.hpp"
#include "runtime/biasedLocking.hpp"
#include "runtime/compilationPolicy.hpp"
@@ -509,16 +508,6 @@
}
}
-
- if (Arguments::has_alloc_profile()) {
- HandleMark hm;
- // Do one last collection to enumerate all the objects
- // allocated since the last one.
- Universe::heap()->collect(GCCause::_allocation_profiler);
- AllocationProfiler::disengage();
- AllocationProfiler::print(0);
- }
-
if (PrintBytecodeHistogram) {
BytecodeHistogram::print();
}
--- a/hotspot/src/share/vm/runtime/thread.cpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/runtime/thread.cpp Wed Jul 03 17:26:59 2013 -0400
@@ -45,7 +45,6 @@
#include "prims/jvmtiExport.hpp"
#include "prims/jvmtiThreadState.hpp"
#include "prims/privilegedStack.hpp"
-#include "runtime/aprofiler.hpp"
#include "runtime/arguments.hpp"
#include "runtime/biasedLocking.hpp"
#include "runtime/deoptimization.hpp"
@@ -3677,7 +3676,6 @@
}
if (Arguments::has_profile()) FlatProfiler::engage(main_thread, true);
- if (Arguments::has_alloc_profile()) AllocationProfiler::engage();
if (MemProfiling) MemProfiler::engage();
StatSampler::engage();
if (CheckJNICalls) JniPeriodicChecker::engage();
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp Tue Jul 02 16:54:24 2013 +0200
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp Wed Jul 03 17:26:59 2013 -0400
@@ -263,7 +263,7 @@
unchecked_c2_static_field) \
\
/******************************************************************/ \
- /* OopDesc and Klass hierarchies (NOTE: MethodData* incomplete) */ \
+ /* OopDesc and Klass hierarchies (NOTE: MethodData* incomplete) */ \
/******************************************************************/ \
\
volatile_nonstatic_field(oopDesc, _mark, markOop) \
@@ -274,21 +274,20 @@
volatile_nonstatic_field(ArrayKlass, _higher_dimension, Klass*) \
volatile_nonstatic_field(ArrayKlass, _lower_dimension, Klass*) \
nonstatic_field(ArrayKlass, _vtable_len, int) \
- nonstatic_field(ArrayKlass, _alloc_size, juint) \
nonstatic_field(ArrayKlass, _component_mirror, oop) \
- nonstatic_field(CompiledICHolder, _holder_method, Method*) \
+ nonstatic_field(CompiledICHolder, _holder_method, Method*) \
nonstatic_field(CompiledICHolder, _holder_klass, Klass*) \
nonstatic_field(ConstantPool, _tags, Array<u1>*) \
- nonstatic_field(ConstantPool, _cache, ConstantPoolCache*) \
+ nonstatic_field(ConstantPool, _cache, ConstantPoolCache*) \
nonstatic_field(ConstantPool, _pool_holder, InstanceKlass*) \
nonstatic_field(ConstantPool, _operands, Array<u2>*) \
nonstatic_field(ConstantPool, _length, int) \
nonstatic_field(ConstantPool, _resolved_references, jobject) \
nonstatic_field(ConstantPool, _reference_map, Array<u2>*) \
nonstatic_field(ConstantPoolCache, _length, int) \
- nonstatic_field(ConstantPoolCache, _constant_pool, ConstantPool*) \
+ nonstatic_field(ConstantPoolCache, _constant_pool, ConstantPool*) \
nonstatic_field(InstanceKlass, _array_klasses, Klass*) \
- nonstatic_field(InstanceKlass, _methods, Array<Method*>*) \
+ nonstatic_field(InstanceKlass, _methods, Array<Method*>*) \
nonstatic_field(InstanceKlass, _local_interfaces, Array<Klass*>*) \
nonstatic_field(InstanceKlass, _transitive_interfaces, Array<Klass*>*) \
nonstatic_field(InstanceKlass, _fields, Array<u2>*) \
@@ -336,9 +335,8 @@
nonstatic_field(Klass, _access_flags, AccessFlags) \
nonstatic_field(Klass, _subklass, Klass*) \
nonstatic_field(Klass, _next_sibling, Klass*) \
- nonstatic_field(Klass, _alloc_count, juint) \
nonstatic_field(MethodData, _size, int) \
- nonstatic_field(MethodData, _method, Method*) \
+ nonstatic_field(MethodData, _method, Method*) \
nonstatic_field(MethodData, _data_size, int) \
nonstatic_field(MethodData, _data[0], intptr_t) \
nonstatic_field(MethodData, _nof_decompiles, uint) \