6995781: Native Memory Tracking (Phase 1)

7151532: DCmd for hotspot native memory tracking

Implementation of native memory tracking phase 1, which tracks VM native memory usage, and related DCmd

Reviewed-by: acorn, coleenp, fparain
This commit is contained in:
Zhengyu Gu 2012-06-28 17:03:16 -04:00
parent 8e42425c92
commit a39b17624a
315 changed files with 7245 additions and 1477 deletions

View file

@ -144,7 +144,7 @@ void CodeBlob::set_oop_maps(OopMapSet* p) {
// chunk of memory, its your job to free it.
if (p != NULL) {
// We need to allocate a chunk big enough to hold the OopMapSet and all of its OopMaps
_oop_maps = (OopMapSet* )NEW_C_HEAP_ARRAY(unsigned char, p->heap_size());
_oop_maps = (OopMapSet* )NEW_C_HEAP_ARRAY(unsigned char, p->heap_size(), mtCode);
p->copy_to((address)_oop_maps);
} else {
_oop_maps = NULL;
@ -180,7 +180,7 @@ void CodeBlob::trace_new_stub(CodeBlob* stub, const char* name1, const char* nam
void CodeBlob::flush() {
if (_oop_maps) {
FREE_C_HEAP_ARRAY(unsigned char, _oop_maps);
FREE_C_HEAP_ARRAY(unsigned char, _oop_maps, mtCode);
_oop_maps = NULL;
}
_comments.free();

View file

@ -856,7 +856,7 @@ void CodeCache::print_internals() {
int bucketSize = 512;
int bucketLimit = maxCodeSize / bucketSize + 1;
int *buckets = NEW_C_HEAP_ARRAY(int, bucketLimit);
int *buckets = NEW_C_HEAP_ARRAY(int, bucketLimit, mtCode);
memset(buckets,0,sizeof(int) * bucketLimit);
for (cb = first(); cb != NULL; cb = next(cb)) {
@ -893,7 +893,7 @@ void CodeCache::print_internals() {
}
}
FREE_C_HEAP_ARRAY(int, buckets);
FREE_C_HEAP_ARRAY(int, buckets, mtCode);
}
void CodeCache::print() {

View file

@ -88,6 +88,9 @@ class CodeCache : AllStatic {
// Lookup that does not fail if you lookup a zombie method (if you call this, be sure to know
// what you are doing)
static CodeBlob* find_blob_unsafe(void* start) {
// NMT can walk the stack before code cache is created
if (_heap == NULL) return NULL;
CodeBlob* result = (CodeBlob*)_heap->find_start(start);
// this assert is too strong because the heap code will return the
// heapblock containing start. That block can often be larger than

View file

@ -31,7 +31,7 @@
// This class is used internally by nmethods, to cache
// exception/pc/handler information.
class ExceptionCache : public CHeapObj {
class ExceptionCache : public CHeapObj<mtCode> {
friend class VMStructs;
private:
enum { cache_size = 16 };

View file

@ -101,7 +101,7 @@ class Stub VALUE_OBJ_CLASS_SPEC {
// of the concrete stub (see also macro below). There's exactly
// one stub interface instance required per stub queue.
class StubInterface: public CHeapObj {
class StubInterface: public CHeapObj<mtCode> {
public:
// Initialization/finalization
virtual void initialize(Stub* self, int size) = 0; // called after creation (called twice if allocated via (request, commit))
@ -152,7 +152,7 @@ class StubInterface: public CHeapObj {
// A StubQueue maintains a queue of stubs.
// Note: All sizes (spaces) are given in bytes.
class StubQueue: public CHeapObj {
class StubQueue: public CHeapObj<mtCode> {
friend class VMStructs;
private:
StubInterface* _stub_interface; // the interface prototype