Mercurial > hg > truffle
comparison agent/src/share/classes/sun/jvm/hotspot/tools/PermStat.java @ 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 | e3e363b2bf19 |
children |
comparison
equal
deleted
inserted
replaced
6724:36d1d483d5d6 | 6725:da91efe96a93 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2003, 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. |
199 out.print('\t'); | 199 out.print('\t'); |
200 Klass loaderKlass = loader.getKlass(); | 200 Klass loaderKlass = loader.getKlass(); |
201 if (loaderKlass != null) { | 201 if (loaderKlass != null) { |
202 out.print(loaderKlass.getName().asString()); | 202 out.print(loaderKlass.getName().asString()); |
203 out.print('@'); | 203 out.print('@'); |
204 out.print(loader.getKlass().getHandle()); | 204 out.print(loader.getKlass().getAddress()); |
205 } else { | 205 } else { |
206 out.print(" null! "); | 206 out.print(" null! "); |
207 } | 207 } |
208 out.println(); | 208 out.println(); |
209 } | 209 } |
231 private static long objectSize(Oop oop) { | 231 private static long objectSize(Oop oop) { |
232 return oop == null ? 0L : oop.getObjectSize(); | 232 return oop == null ? 0L : oop.getObjectSize(); |
233 } | 233 } |
234 | 234 |
235 // Don't count the shared empty arrays | 235 // Don't count the shared empty arrays |
236 private static long arraySize(Array arr) { | 236 private static long arraySize(GenericArray arr) { |
237 return arr.getLength() != 0L ? arr.getObjectSize() : 0L; | 237 return arr.getLength() != 0L ? arr.getSize() : 0L; |
238 } | 238 } |
239 | 239 |
240 private long computeSize(InstanceKlass k) { | 240 private long computeSize(InstanceKlass k) { |
241 long size = 0L; | 241 long size = 0L; |
242 // the InstanceKlass object itself | 242 // the InstanceKlass object itself |
243 size += k.getObjectSize(); | 243 size += k.getSize(); |
244 | 244 |
245 // Constant pool | 245 // Constant pool |
246 ConstantPool cp = k.getConstants(); | 246 ConstantPool cp = k.getConstants(); |
247 size += cp.getObjectSize(); | 247 size += cp.getSize(); |
248 size += objectSize(cp.getCache()); | 248 if (cp.getCache() != null) { |
249 size += objectSize(cp.getTags()); | 249 size += cp.getCache().getSize(); |
250 } | |
251 size += arraySize(cp.getTags()); | |
250 | 252 |
251 // Interfaces | 253 // Interfaces |
252 size += arraySize(k.getLocalInterfaces()); | 254 size += arraySize(k.getLocalInterfaces()); |
253 size += arraySize(k.getTransitiveInterfaces()); | 255 size += arraySize(k.getTransitiveInterfaces()); |
254 | 256 |
255 // Inner classes | 257 // Inner classes |
256 size += objectSize(k.getInnerClasses()); | 258 size += arraySize(k.getInnerClasses()); |
257 | 259 |
258 // Fields | 260 // Fields |
259 size += objectSize(k.getFields()); | 261 size += arraySize(k.getFields()); |
260 | 262 |
261 // Methods | 263 // Methods |
262 ObjArray methods = k.getMethods(); | 264 MethodArray methods = k.getMethods(); |
263 int nmethods = (int) methods.getLength(); | 265 int nmethods = (int) methods.getLength(); |
264 if (nmethods != 0L) { | 266 if (nmethods != 0L) { |
265 size += methods.getObjectSize(); | 267 size += methods.getSize(); |
266 for (int i = 0; i < nmethods; ++i) { | 268 for (int i = 0; i < nmethods; ++i) { |
267 Method m = (Method) methods.getObjAt(i); | 269 Method m = methods.at(i); |
268 size += m.getObjectSize(); | 270 size += m.getSize(); |
269 size += objectSize(m.getConstMethod()); | 271 size += m.getConstMethod().getSize(); |
270 } | 272 } |
271 } | 273 } |
272 | 274 |
273 // MethodOrdering - an int array that records the original | |
274 // ordering of methods in the class file | |
275 size += arraySize(k.getMethodOrdering()); | |
276 | |
277 return size; | 275 return size; |
278 } | 276 } |
279 } | 277 } |