Mercurial > hg > truffle
comparison agent/src/share/classes/sun/jvm/hotspot/ci/ciObjectFactory.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 | f6f3bb0ee072 |
children | 79f492f184d0 |
comparison
equal
deleted
inserted
replaced
6724:36d1d483d5d6 | 6725:da91efe96a93 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2011, 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. |
42 } | 42 } |
43 | 43 |
44 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { | 44 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { |
45 Type type = db.lookupType("ciObjectFactory"); | 45 Type type = db.lookupType("ciObjectFactory"); |
46 unloadedMethodsField = type.getAddressField("_unloaded_methods"); | 46 unloadedMethodsField = type.getAddressField("_unloaded_methods"); |
47 ciObjectsField = type.getAddressField("_ci_objects"); | 47 ciMetadataField = type.getAddressField("_ci_metadata"); |
48 symbolsField = type.getAddressField("_symbols"); | 48 symbolsField = type.getAddressField("_symbols"); |
49 | 49 |
50 ciObjectConstructor = new VirtualBaseConstructor<ciObject>(db, db.lookupType("ciObject"), "sun.jvm.hotspot.ci", ciObject.class); | 50 ciObjectConstructor = new VirtualBaseConstructor<ciObject>(db, db.lookupType("ciObject"), "sun.jvm.hotspot.ci", ciObject.class); |
51 ciMetadataConstructor = new VirtualBaseConstructor<ciMetadata>(db, db.lookupType("ciMetadata"), "sun.jvm.hotspot.ci", ciMetadata.class); | |
51 ciSymbolConstructor = new VirtualBaseConstructor<ciSymbol>(db, db.lookupType("ciSymbol"), "sun.jvm.hotspot.ci", ciSymbol.class); | 52 ciSymbolConstructor = new VirtualBaseConstructor<ciSymbol>(db, db.lookupType("ciSymbol"), "sun.jvm.hotspot.ci", ciSymbol.class); |
52 } | 53 } |
53 | 54 |
54 private static AddressField unloadedMethodsField; | 55 private static AddressField unloadedMethodsField; |
55 private static AddressField ciObjectsField; | 56 private static AddressField ciMetadataField; |
56 private static AddressField symbolsField; | 57 private static AddressField symbolsField; |
57 | 58 |
58 private static VirtualBaseConstructor<ciObject> ciObjectConstructor; | 59 private static VirtualBaseConstructor<ciObject> ciObjectConstructor; |
60 private static VirtualBaseConstructor<ciMetadata> ciMetadataConstructor; | |
59 private static VirtualBaseConstructor<ciSymbol> ciSymbolConstructor; | 61 private static VirtualBaseConstructor<ciSymbol> ciSymbolConstructor; |
60 | 62 |
61 public static ciObject get(Address addr) { | 63 public static ciObject get(Address addr) { |
62 if (addr == null) return null; | 64 if (addr == null) return null; |
63 | 65 |
64 return (ciObject)ciObjectConstructor.instantiateWrapperFor(addr); | 66 return (ciObject)ciObjectConstructor.instantiateWrapperFor(addr); |
65 } | 67 } |
66 | 68 |
67 public GrowableArray<ciObject> objects() { | 69 public static ciMetadata getMetadata(Address addr) { |
68 return GrowableArray.create(ciObjectsField.getValue(getAddress()), ciObjectConstructor); | 70 if (addr == null) return null; |
71 | |
72 return (ciMetadata)ciMetadataConstructor.instantiateWrapperFor(addr); | |
73 } | |
74 | |
75 public GrowableArray<ciMetadata> objects() { | |
76 return GrowableArray.create(ciMetadataField.getValue(getAddress()), ciMetadataConstructor); | |
69 } | 77 } |
70 | 78 |
71 public GrowableArray<ciSymbol> symbols() { | 79 public GrowableArray<ciSymbol> symbols() { |
72 return GrowableArray.create(symbolsField.getValue(getAddress()), ciSymbolConstructor); | 80 return GrowableArray.create(symbolsField.getValue(getAddress()), ciSymbolConstructor); |
73 } | 81 } |