comparison src/share/vm/compiler/compileLog.cpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents d2a62e0f25eb
children 9191895df19d
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
1 /* 1 /*
2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
24 24
25 #include "precompiled.hpp" 25 #include "precompiled.hpp"
26 #include "ci/ciMethod.hpp" 26 #include "ci/ciMethod.hpp"
27 #include "compiler/compileLog.hpp" 27 #include "compiler/compileLog.hpp"
28 #include "memory/allocation.inline.hpp" 28 #include "memory/allocation.inline.hpp"
29 #include "oops/methodOop.hpp" 29 #include "oops/method.hpp"
30 #include "runtime/mutexLocker.hpp" 30 #include "runtime/mutexLocker.hpp"
31 #include "runtime/os.hpp" 31 #include "runtime/os.hpp"
32 32
33 CompileLog* CompileLog::_first = NULL; 33 CompileLog* CompileLog::_first = NULL;
34 34
97 } 97 }
98 98
99 99
100 // ------------------------------------------------------------------ 100 // ------------------------------------------------------------------
101 // CompileLog::identify 101 // CompileLog::identify
102 int CompileLog::identify(ciObject* obj) { 102 int CompileLog::identify(ciBaseObject* obj) {
103 if (obj == NULL) return 0; 103 if (obj == NULL) return 0;
104 int id = obj->ident(); 104 int id = obj->ident();
105 if (id < 0) return id; 105 if (id < 0) return id;
106 // If it has already been identified, just return the id. 106 // If it has already been identified, just return the id.
107 if (id < _identities_limit && _identities[id] != 0) return id; 107 if (id < _identities_limit && _identities[id] != 0) return id;
119 // Mark this id as processed. 119 // Mark this id as processed.
120 // (Be sure to do this before any recursive calls to identify.) 120 // (Be sure to do this before any recursive calls to identify.)
121 _identities[id] = 1; // mark 121 _identities[id] = 1; // mark
122 122
123 // Now, print the object's identity once, in detail. 123 // Now, print the object's identity once, in detail.
124 if (obj->is_klass()) { 124 if (obj->is_metadata()) {
125 ciKlass* klass = obj->as_klass(); 125 ciMetadata* mobj = obj->as_metadata();
126 if (mobj->is_klass()) {
127 ciKlass* klass = mobj->as_klass();
126 begin_elem("klass id='%d'", id); 128 begin_elem("klass id='%d'", id);
127 name(klass->name()); 129 name(klass->name());
128 if (!klass->is_loaded()) { 130 if (!klass->is_loaded()) {
129 print(" unloaded='1'"); 131 print(" unloaded='1'");
130 } else { 132 } else {
131 print(" flags='%d'", klass->modifier_flags()); 133 print(" flags='%d'", klass->modifier_flags());
132 } 134 }
133 end_elem(); 135 end_elem();
134 } else if (obj->is_method()) { 136 } else if (mobj->is_method()) {
135 ciMethod* method = obj->as_method(); 137 ciMethod* method = mobj->as_method();
136 ciSignature* sig = method->signature(); 138 ciSignature* sig = method->signature();
137 // Pre-identify items that we will need! 139 // Pre-identify items that we will need!
138 identify(sig->return_type()); 140 identify(sig->return_type());
139 for (int i = 0; i < sig->count(); i++) { 141 for (int i = 0; i < sig->count(); i++) {
140 identify(sig->type_at(i)); 142 identify(sig->type_at(i));
161 //int bec = method->backedge_count(); 163 //int bec = method->backedge_count();
162 //if (bec != 0) print(" backedge_count='%d'", bec); 164 //if (bec != 0) print(" backedge_count='%d'", bec);
163 print(" iicount='%d'", method->interpreter_invocation_count()); 165 print(" iicount='%d'", method->interpreter_invocation_count());
164 } 166 }
165 end_elem(); 167 end_elem();
168 } else if (mobj->is_type()) {
169 BasicType type = mobj->as_type()->basic_type();
170 elem("type id='%d' name='%s'", id, type2name(type));
171 } else {
172 // Should not happen.
173 elem("unknown id='%d'", id);
174 ShouldNotReachHere();
175 }
166 } else if (obj->is_symbol()) { 176 } else if (obj->is_symbol()) {
167 begin_elem("symbol id='%d'", id); 177 begin_elem("symbol id='%d'", id);
168 name(obj->as_symbol()); 178 name(obj->as_symbol());
169 end_elem(); 179 end_elem();
170 } else if (obj->is_null_object()) {
171 elem("null_object id='%d'", id);
172 } else if (obj->is_type()) {
173 BasicType type = obj->as_type()->basic_type();
174 elem("type id='%d' name='%s'", id, type2name(type));
175 } else { 180 } else {
176 // Should not happen. 181 // Should not happen.
177 elem("unknown id='%d'", id); 182 elem("unknown id='%d'", id);
178 } 183 }
179 return id; 184 return id;