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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 package sun.jvm.hotspot.gc.z;
26
27 import java.io.PrintStream;
28
29 import sun.jvm.hotspot.debugger.Address;
30 import sun.jvm.hotspot.debugger.OopHandle;
31 import sun.jvm.hotspot.gc.shared.CollectedHeap;
32 import sun.jvm.hotspot.gc.shared.CollectedHeapName;
33 import sun.jvm.hotspot.runtime.VM;
34 import sun.jvm.hotspot.runtime.VMObjectFactory;
35 import sun.jvm.hotspot.types.Type;
36 import sun.jvm.hotspot.types.TypeDataBase;
37 import sun.jvm.hotspot.utilities.BitMapInterface;
38
39 // Mirror class for ZCollectedHeap.
40
41 public class ZCollectedHeap extends CollectedHeap {
42
43 private static long zHeapFieldOffset;
44
45 static {
46 VM.registerVMInitializedObserver((o, d) -> initialize(VM.getVM().getTypeDataBase()));
47 }
48
49 private static synchronized void initialize(TypeDataBase db) {
50 Type type = db.lookupType("ZCollectedHeap");
51
52 zHeapFieldOffset = type.getAddressField("_heap").getOffset();
53 }
54
55 public ZHeap heap() {
56 Address heapAddr = addr.addOffsetTo(zHeapFieldOffset);
57 return (ZHeap)VMObjectFactory.newObject(ZHeap.class, heapAddr);
58 }
59
60 @Override
61 public CollectedHeapName kind() {
62 return CollectedHeapName.Z;
99 Address oopAddress = handle.getAddressAt(offset);
100
101 return oop_load_barrier(oopAddress);
102 }
103
104 // addr can be either in heap or in native
105 @Override
106 public OopHandle oop_load_in_native(Address addr) {
107 Address oopAddress = addr.getAddressAt(0);
108
109 return oop_load_barrier(oopAddress);
110 }
111
112 public String oopAddressDescription(OopHandle handle) {
113 Address origOop = ZOop.to_address(handle);
114 Address loadBarrieredOop = ZBarrier.weak_barrier(origOop);
115 if (!origOop.equals(loadBarrieredOop)) {
116 return origOop + " (" + loadBarrieredOop.toString() + ")";
117 } else {
118 return handle.toString();
119 }
120 }
121
122 @Override
123 public BitMapInterface createBitMap(long size) {
124 // Ignores the size
125 return new ZExternalBitMap(this);
126 }
127 }
|
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 package sun.jvm.hotspot.gc.z;
26
27 import java.io.PrintStream;
28 import java.util.Iterator;
29
30 import sun.jvm.hotspot.debugger.Address;
31 import sun.jvm.hotspot.debugger.OopHandle;
32 import sun.jvm.hotspot.gc.shared.CollectedHeap;
33 import sun.jvm.hotspot.gc.shared.CollectedHeapName;
34 import sun.jvm.hotspot.gc.shared.LiveRegionsClosure;
35 import sun.jvm.hotspot.runtime.VM;
36 import sun.jvm.hotspot.runtime.VMObjectFactory;
37 import sun.jvm.hotspot.types.Type;
38 import sun.jvm.hotspot.types.TypeDataBase;
39 import sun.jvm.hotspot.utilities.BitMapInterface;
40
41 // Mirror class for ZCollectedHeap.
42
43 public class ZCollectedHeap extends CollectedHeap {
44 private static long zHeapFieldOffset;
45
46 static {
47 VM.registerVMInitializedObserver((o, d) -> initialize(VM.getVM().getTypeDataBase()));
48 }
49
50 private static synchronized void initialize(TypeDataBase db) {
51 Type type = db.lookupType("ZCollectedHeap");
52
53 zHeapFieldOffset = type.getAddressField("_heap").getOffset();
54 }
55
56 public ZHeap heap() {
57 Address heapAddr = addr.addOffsetTo(zHeapFieldOffset);
58 return (ZHeap)VMObjectFactory.newObject(ZHeap.class, heapAddr);
59 }
60
61 @Override
62 public CollectedHeapName kind() {
63 return CollectedHeapName.Z;
100 Address oopAddress = handle.getAddressAt(offset);
101
102 return oop_load_barrier(oopAddress);
103 }
104
105 // addr can be either in heap or in native
106 @Override
107 public OopHandle oop_load_in_native(Address addr) {
108 Address oopAddress = addr.getAddressAt(0);
109
110 return oop_load_barrier(oopAddress);
111 }
112
113 public String oopAddressDescription(OopHandle handle) {
114 Address origOop = ZOop.to_address(handle);
115 Address loadBarrieredOop = ZBarrier.weak_barrier(origOop);
116 if (!origOop.equals(loadBarrieredOop)) {
117 return origOop + " (" + loadBarrieredOop.toString() + ")";
118 } else {
119 return handle.toString();
120 }
121 }
122
123 @Override
124 public void liveRegionsIterate(LiveRegionsClosure closure) {
125 Iterator<ZPage> iter = heap().pageTable().activePagesIterator();
126 while (iter.hasNext()) {
127 ZPage page = iter.next();
128 closure.doLiveRegions(page);
129 }
130 }
131
132 @Override
133 public BitMapInterface createBitMap(long size) {
134 // Ignores the size
135 return new ZExternalBitMap(this);
136 }
137 }
|