annotate agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1HeapRegionTable.java @ 20456:64156d22e49d

8032247: SA: Constantpool lookup for invokedynamic is not implemented Summary: implement constant pool lookup for invokedynamic Reviewed-by: sla, sspitsyn
author dsamersoff
date Thu, 11 Sep 2014 11:55:30 -0700
parents 6701abbc4441
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12904
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
1 /*
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
4 *
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
7 * published by the Free Software Foundation.
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
8 *
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
13 * accompanied this code).
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
14 *
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
18 *
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
21 * questions.
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
22 *
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
23 */
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
24
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
25 package sun.jvm.hotspot.gc_implementation.g1;
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
26
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
27 import java.util.Iterator;
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
28 import java.util.Observable;
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
29 import java.util.Observer;
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
30
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
31 import sun.jvm.hotspot.debugger.Address;
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
32 import sun.jvm.hotspot.runtime.VM;
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
33 import sun.jvm.hotspot.runtime.VMObject;
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
34 import sun.jvm.hotspot.runtime.VMObjectFactory;
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
35 import sun.jvm.hotspot.types.AddressField;
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
36 import sun.jvm.hotspot.types.CIntegerField;
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
37 import sun.jvm.hotspot.types.Type;
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
38 import sun.jvm.hotspot.types.TypeDataBase;
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
39
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
40 // Mirror class for G1HeapRegionTable. It's essentially an index -> HeapRegion map.
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
41
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
42 public class G1HeapRegionTable extends VMObject {
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
43 // HeapRegion** _base;
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
44 static private AddressField baseField;
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
45 // uint _length;
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
46 static private CIntegerField lengthField;
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
47 // HeapRegion** _biased_base
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
48 static private AddressField biasedBaseField;
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
49 // size_t _bias
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
50 static private CIntegerField biasField;
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
51 // uint _shift_by
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
52 static private CIntegerField shiftByField;
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
53
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
54 static {
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
55 VM.registerVMInitializedObserver(new Observer() {
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
56 public void update(Observable o, Object data) {
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
57 initialize(VM.getVM().getTypeDataBase());
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
58 }
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
59 });
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
60 }
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
61
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
62 static private synchronized void initialize(TypeDataBase db) {
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
63 Type type = db.lookupType("G1HeapRegionTable");
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
64
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
65 baseField = type.getAddressField("_base");
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
66 lengthField = type.getCIntegerField("_length");
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
67 biasedBaseField = type.getAddressField("_biased_base");
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
68 biasField = type.getCIntegerField("_bias");
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
69 shiftByField = type.getCIntegerField("_shift_by");
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
70 }
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
71
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
72 private HeapRegion at(long index) {
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
73 Address arrayAddr = baseField.getValue(addr);
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
74 // Offset of &_base[index]
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
75 long offset = index * VM.getVM().getAddressSize();
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
76 Address regionAddr = arrayAddr.getAddressAt(offset);
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
77 return (HeapRegion) VMObjectFactory.newObject(HeapRegion.class,
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
78 regionAddr);
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
79 }
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
80
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
81 public long length() {
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
82 return lengthField.getValue(addr);
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
83 }
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
84
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
85 public long bias() {
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
86 return biasField.getValue(addr);
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
87 }
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
88
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
89 public long shiftBy() {
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
90 return shiftByField.getValue(addr);
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
91 }
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
92
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
93 private class HeapRegionIterator implements Iterator<HeapRegion> {
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
94 private long index;
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
95 private long length;
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
96 private HeapRegion next;
12904
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
97
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
98 public HeapRegion positionToNext() {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
99 HeapRegion result = next;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
100 while (index < length && at(index) == null) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
101 index++;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
102 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
103 if (index < length) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
104 next = at(index);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
105 index++; // restart search at next element
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
106 } else {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
107 next = null;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
108 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
109 return result;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
110 }
12904
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
111
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
112 @Override
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
113 public boolean hasNext() { return next != null; }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
114
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
115 @Override
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
116 public HeapRegion next() { return positionToNext(); }
12904
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
117
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
118 @Override
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
119 public void remove() { /* not supported */ }
12904
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
120
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
121 HeapRegionIterator(long totalLength) {
12904
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
122 index = 0;
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
123 length = totalLength;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 13419
diff changeset
124 positionToNext();
12904
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
125 }
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
126 }
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
127
13419
50287b659eb8 8029329: tmtools tests fail with NPE (in the tool) when run with G1 and FlightRecorder
sjohanss
parents: 12904
diff changeset
128 public Iterator<HeapRegion> heapRegionIterator(long committedLength) {
50287b659eb8 8029329: tmtools tests fail with NPE (in the tool) when run with G1 and FlightRecorder
sjohanss
parents: 12904
diff changeset
129 return new HeapRegionIterator(committedLength);
12904
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
130 }
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
131
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
132 public G1HeapRegionTable(Address addr) {
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
133 super(addr);
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
134 }
9e5fadad7fdf 8025925: jmap fails with "field _length not found in type HeapRegionSeq"
tschatzl
parents:
diff changeset
135 }