Mercurial > hg > truffle
annotate agent/src/share/classes/sun/jvm/hotspot/memory/CompactingPermGenGen.java @ 2177:3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
Summary: move symbols from permgen into C heap and reference count them
Reviewed-by: never, acorn, jmasa, stefank
author | coleenp |
---|---|
date | Thu, 27 Jan 2011 16:11:27 -0800 |
parents | c18cbe5936b8 |
children |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
2 * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
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 | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 package sun.jvm.hotspot.memory; | |
26 | |
27 import java.io.*; | |
28 import java.util.*; | |
29 | |
30 import sun.jvm.hotspot.debugger.*; | |
31 import sun.jvm.hotspot.runtime.*; | |
32 import sun.jvm.hotspot.types.*; | |
33 | |
34 /** This is the "generation" view of a CompactingPermGen. */ | |
35 public class CompactingPermGenGen extends OneContigSpaceCardGeneration { | |
36 private static AddressField unsharedBottomField; | |
37 private static AddressField unsharedEndField; | |
38 private static AddressField sharedBottomField; | |
39 private static AddressField sharedEndField; | |
40 private static AddressField readOnlyBottomField; | |
41 private static AddressField readOnlyEndField; | |
42 private static AddressField readWriteBottomField; | |
43 private static AddressField readWriteEndField; | |
44 private static AddressField roSpaceField; | |
45 private static AddressField rwSpaceField; | |
46 | |
47 static { | |
48 VM.registerVMInitializedObserver(new Observer() { | |
49 public void update(Observable o, Object data) { | |
50 initialize(VM.getVM().getTypeDataBase()); | |
51 } | |
52 }); | |
53 } | |
54 | |
55 private static synchronized void initialize(TypeDataBase db) { | |
56 Type type = db.lookupType("CompactingPermGenGen"); | |
57 unsharedBottomField = type.getAddressField("unshared_bottom"); | |
58 unsharedEndField = type.getAddressField("unshared_end"); | |
59 sharedBottomField = type.getAddressField("shared_bottom"); | |
60 sharedEndField = type.getAddressField("shared_end"); | |
61 readOnlyBottomField = type.getAddressField("readonly_bottom"); | |
62 readOnlyEndField = type.getAddressField("readonly_end"); | |
63 readWriteBottomField = type.getAddressField("readwrite_bottom"); | |
64 readWriteEndField = type.getAddressField("readwrite_end"); | |
65 roSpaceField = type.getAddressField("_ro_space"); | |
66 rwSpaceField = type.getAddressField("_rw_space"); | |
67 } | |
68 | |
69 public boolean isSharingEnabled() { | |
70 return VM.getVM().isSharingEnabled(); | |
71 } | |
72 | |
73 // NEEDS_CLEANUP | |
74 public CompactingPermGenGen(Address addr) { | |
75 super(addr); | |
76 } | |
77 | |
78 public OffsetTableContigSpace roSpace() { | |
79 return newOffsetTableContigSpace(roSpaceField.getValue(addr)); | |
80 } | |
81 | |
82 public OffsetTableContigSpace rwSpace() { | |
83 return newOffsetTableContigSpace(rwSpaceField.getValue(addr)); | |
84 } | |
85 | |
86 public String name() { | |
87 return "compacting permanent generation"; | |
88 } | |
89 | |
90 public static Address unsharedBottom() { | |
91 return unsharedBottomField.getValue(); | |
92 } | |
93 | |
94 public static Address unsharedEnd() { | |
95 return unsharedEndField.getValue(); | |
96 } | |
97 | |
98 public static Address sharedBottom() { | |
99 return sharedBottomField.getValue(); | |
100 } | |
101 | |
102 public static Address sharedEnd() { | |
103 return sharedEndField.getValue(); | |
104 } | |
105 | |
106 public static Address readOnlyBottom() { | |
107 return readOnlyBottomField.getValue(); | |
108 } | |
109 | |
110 public static Address readOnlyEnd() { | |
111 return readOnlyEndField.getValue(); | |
112 } | |
113 | |
114 public static Address readWriteBottom() { | |
115 return readWriteBottomField.getValue(); | |
116 } | |
117 | |
118 public static Address readWriteEnd() { | |
119 return readWriteEndField.getValue(); | |
120 } | |
121 | |
122 public static boolean isShared(Address p) { | |
123 return sharedBottom().lessThanOrEqual(p) && sharedEnd().greaterThan(p); | |
124 } | |
125 | |
126 public static boolean isSharedReadOnly(Address p) { | |
127 return readOnlyBottom().lessThanOrEqual(p) && readOnlyEnd().greaterThan(p); | |
128 } | |
129 | |
130 public static boolean isSharedReadWrite(Address p) { | |
131 return readWriteBottom().lessThanOrEqual(p) && readWriteEnd().greaterThan(p); | |
132 } | |
133 | |
134 public boolean isIn(Address p) { | |
135 return unsharedBottom().lessThanOrEqual(p) && sharedEnd().greaterThan(p); | |
136 } | |
137 | |
138 public void spaceIterate(SpaceClosure blk, boolean usedOnly) { | |
139 super.spaceIterate(blk, usedOnly); | |
140 if (isSharingEnabled()) { | |
141 blk.doSpace(roSpace()); | |
142 blk.doSpace(rwSpace()); | |
143 } | |
144 } | |
145 | |
146 public void printOn(PrintStream tty) { | |
147 tty.print(" perm"); | |
148 theSpace().printOn(tty); | |
149 if (isSharingEnabled()) { | |
150 tty.print(" ro space: "); | |
151 roSpace().printOn(tty); | |
152 tty.print(", rw space: "); | |
153 rwSpace().printOn(tty); | |
154 } | |
155 } | |
156 | |
157 private OffsetTableContigSpace newOffsetTableContigSpace(Address addr) { | |
158 return (OffsetTableContigSpace) VMObjectFactory.newObject( | |
159 OffsetTableContigSpace.class, addr); | |
160 } | |
161 } |