1.1 --- a/src/share/vm/memory/metaspace.hpp Fri May 31 10:27:12 2013 +0100 1.2 +++ b/src/share/vm/memory/metaspace.hpp Mon Jun 17 11:17:49 2013 +0100 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -127,6 +127,23 @@ 1.11 static VirtualSpaceList* space_list() { return _space_list; } 1.12 static VirtualSpaceList* class_space_list() { return _class_space_list; } 1.13 1.14 + // This is used by DumpSharedSpaces only, where only _vsm is used. So we will 1.15 + // maintain a single list for now. 1.16 + void record_allocation(void* ptr, MetaspaceObj::Type type, size_t word_size); 1.17 + 1.18 + class AllocRecord : public CHeapObj<mtClass> { 1.19 + public: 1.20 + AllocRecord(address ptr, MetaspaceObj::Type type, int byte_size) 1.21 + : _next(NULL), _ptr(ptr), _type(type), _byte_size(byte_size) {} 1.22 + AllocRecord *_next; 1.23 + address _ptr; 1.24 + MetaspaceObj::Type _type; 1.25 + int _byte_size; 1.26 + }; 1.27 + 1.28 + AllocRecord * _alloc_record_head; 1.29 + AllocRecord * _alloc_record_tail; 1.30 + 1.31 public: 1.32 1.33 Metaspace(Mutex* lock, MetaspaceType type); 1.34 @@ -148,8 +165,8 @@ 1.35 size_t used_bytes_slow(MetadataType mdtype) const; 1.36 size_t capacity_bytes_slow(MetadataType mdtype) const; 1.37 1.38 - static Metablock* allocate(ClassLoaderData* loader_data, size_t size, 1.39 - bool read_only, MetadataType mdtype, TRAPS); 1.40 + static Metablock* allocate(ClassLoaderData* loader_data, size_t word_size, 1.41 + bool read_only, MetaspaceObj::Type type, TRAPS); 1.42 void deallocate(MetaWord* ptr, size_t byte_size, bool is_class); 1.43 1.44 MetaWord* expand_and_allocate(size_t size, 1.45 @@ -166,6 +183,13 @@ 1.46 void print_on(outputStream* st) const; 1.47 // Debugging support 1.48 void verify(); 1.49 + 1.50 + class AllocRecordClosure : public StackObj { 1.51 + public: 1.52 + virtual void doit(address ptr, MetaspaceObj::Type type, int byte_size) = 0; 1.53 + }; 1.54 + 1.55 + void iterate(AllocRecordClosure *closure); 1.56 }; 1.57 1.58 class MetaspaceAux : AllStatic {