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.gc.shared.LiveRegionsClosure;
34 import sun.jvm.hotspot.runtime.VM;
35 import sun.jvm.hotspot.runtime.VMObjectFactory;
36 import sun.jvm.hotspot.types.Type;
37 import sun.jvm.hotspot.types.TypeDataBase;
38 import sun.jvm.hotspot.utilities.BitMapInterface;
39
40 // Mirror class for ZCollectedHeap.
41
42 public class ZCollectedHeap extends CollectedHeap {
43 private static long zHeapFieldOffset;
44
45 static {
46 VM.registerVMInitializedObserver((o, d) -> initialize(VM.getVM().getTypeDataBase()));
47 }
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 void liveRegionsIterate(LiveRegionsClosure closure) {
124 // Operation (currently) not supported with ZGC. Print
125 // a warning and leave the list of live regions empty.
126 System.err.println("Warning: Operation not supported with ZGC");
127 }
128
129 @Override
130 public BitMapInterface createBitMap(long size) {
131 // Ignores the size
132 return new ZExternalBitMap(this);
133 }
134 }
|
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 }
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 }
|