Tue, 11 May 2010 14:35:43 -0700
6931180: Migration to recent versions of MS Platform SDK
6951582: Build problems on win64
Summary: Changes to enable building JDK7 with Microsoft Visual Studio 2010
Reviewed-by: ohair, art, ccheung, dcubed
duke@435 | 1 | /* |
duke@435 | 2 | * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
duke@435 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@435 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
duke@435 | 21 | * have any questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | typedef enum oop_type { |
duke@435 | 26 | unknown_type, |
duke@435 | 27 | instance_type, |
duke@435 | 28 | instanceRef_type, |
duke@435 | 29 | objArray_type, |
duke@435 | 30 | symbol_type, |
duke@435 | 31 | klass_type, |
duke@435 | 32 | instanceKlass_type, |
duke@435 | 33 | method_type, |
duke@435 | 34 | constMethod_type, |
duke@435 | 35 | methodData_type, |
duke@435 | 36 | constantPool_type, |
duke@435 | 37 | constantPoolCache_type, |
duke@435 | 38 | typeArray_type, |
duke@435 | 39 | compiledICHolder_type, |
duke@435 | 40 | number_object_types |
duke@435 | 41 | } object_type; |
duke@435 | 42 | |
duke@435 | 43 | |
duke@435 | 44 | // Classify objects by type and keep counts. |
duke@435 | 45 | // Print the count and space taken for each type. |
duke@435 | 46 | |
duke@435 | 47 | |
duke@435 | 48 | class ClassifyObjectClosure : public ObjectClosure { |
duke@435 | 49 | private: |
duke@435 | 50 | |
duke@435 | 51 | static const char* object_type_name[number_object_types]; |
duke@435 | 52 | |
duke@435 | 53 | int total_object_count; |
duke@435 | 54 | size_t total_object_size; |
duke@435 | 55 | int object_count[number_object_types]; |
duke@435 | 56 | size_t object_size[number_object_types]; |
duke@435 | 57 | |
duke@435 | 58 | public: |
duke@435 | 59 | ClassifyObjectClosure() { reset(); } |
duke@435 | 60 | void reset(); |
duke@435 | 61 | void do_object(oop obj); |
duke@435 | 62 | static object_type classify_object(oop obj, bool count); |
duke@435 | 63 | size_t print(); |
duke@435 | 64 | }; |
duke@435 | 65 | |
duke@435 | 66 | |
duke@435 | 67 | // Count objects using the alloc_count field in the object's klass |
duke@435 | 68 | // object. |
duke@435 | 69 | |
duke@435 | 70 | class ClassifyInstanceKlassClosure : public ClassifyObjectClosure { |
duke@435 | 71 | private: |
duke@435 | 72 | int total_instances; |
duke@435 | 73 | public: |
duke@435 | 74 | ClassifyInstanceKlassClosure() { reset(); } |
duke@435 | 75 | void reset(); |
duke@435 | 76 | void print(); |
duke@435 | 77 | void do_object(oop obj); |
duke@435 | 78 | }; |
duke@435 | 79 | |
duke@435 | 80 | |
duke@435 | 81 | // Clear the alloc_count fields in all classes so that the count can be |
duke@435 | 82 | // restarted. |
duke@435 | 83 | |
duke@435 | 84 | class ClearAllocCountClosure : public ObjectClosure { |
duke@435 | 85 | public: |
duke@435 | 86 | void do_object(oop obj) { |
duke@435 | 87 | if (obj->is_klass()) { |
duke@435 | 88 | Klass* k = Klass::cast((klassOop)obj); |
duke@435 | 89 | k->set_alloc_count(0); |
duke@435 | 90 | } |
duke@435 | 91 | } |
duke@435 | 92 | }; |