author | iklam |
Wed, 13 Nov 2019 16:36:54 -0800 | |
changeset 59070 | 22ee476cc664 |
parent 51477 | e77d7687c831 |
permissions | -rw-r--r-- |
49896
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
1 |
/* |
59070
22ee476cc664
8231610: Relocate the CDS archive if it cannot be mapped to the requested address
iklam
parents:
51477
diff
changeset
|
2 |
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. |
49896
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
4 |
* |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
8 |
* |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
13 |
* accompanied this code). |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
14 |
* |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
18 |
* |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
21 |
* questions. |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
22 |
* |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
23 |
*/ |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
24 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
25 |
package sun.jvm.hotspot.memory; |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
26 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
27 |
import java.util.*; |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
28 |
import sun.jvm.hotspot.debugger.Address; |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
29 |
import sun.jvm.hotspot.runtime.VM; |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
30 |
import sun.jvm.hotspot.runtime.VMObject; |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
31 |
import sun.jvm.hotspot.runtime.VMObjectFactory; |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
32 |
import sun.jvm.hotspot.types.*; |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
33 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
34 |
public class FileMapInfo { |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
35 |
private static FileMapHeader header; |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
36 |
private static Address headerValue; |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
37 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
38 |
// Fields for class FileMapHeader |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
39 |
private static Address mdSpaceValue; |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
40 |
private static Address mdRegionBaseAddress; |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
41 |
private static Address mdRegionEndAddress; |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
42 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
43 |
// HashMap created by mapping the vTable addresses in the md region with |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
44 |
// the corresponding metadata type. |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
45 |
private static Map<Address, Type> vTableTypeMap; |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
46 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
47 |
private static Type metadataTypeArray[]; |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
48 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
49 |
static { |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
50 |
VM.registerVMInitializedObserver(new Observer() { |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
51 |
public void update(Observable o, Object data) { |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
52 |
initialize(VM.getVM().getTypeDataBase()); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
53 |
} |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
54 |
}); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
55 |
} |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
56 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
57 |
private static void initialize(TypeDataBase db) { |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
58 |
// FileMapInfo |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
59 |
Type type = db.lookupType("FileMapInfo"); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
60 |
AddressField currentInfoField = type.getAddressField("_current_info"); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
61 |
long headerFieldOffset = type.getField("_header").getOffset(); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
62 |
Address headerAddress = currentInfoField.getValue().addOffsetTo(headerFieldOffset); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
63 |
headerValue = headerAddress.getAddressAt(0); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
64 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
65 |
// FileMapHeader |
51477
e77d7687c831
8209657: Refactor filemap.hpp to simplify integration with Serviceability Agent
iklam
parents:
49896
diff
changeset
|
66 |
type = db.lookupType("FileMapHeader"); |
49896
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
67 |
AddressField spaceField = type.getAddressField("_space[0]"); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
68 |
Address spaceValue = headerValue.addOffsetTo(type.getField("_space[0]").getOffset()); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
69 |
mdSpaceValue = spaceValue.addOffsetTo(3 * spaceField.getSize()); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
70 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
71 |
// SpaceInfo |
51477
e77d7687c831
8209657: Refactor filemap.hpp to simplify integration with Serviceability Agent
iklam
parents:
49896
diff
changeset
|
72 |
type = db.lookupType("CDSFileMapRegion"); |
59070
22ee476cc664
8231610: Relocate the CDS archive if it cannot be mapped to the requested address
iklam
parents:
51477
diff
changeset
|
73 |
long mdRegionBaseAddressOffset = type.getField("_mapped_base").getOffset(); |
49896
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
74 |
mdRegionBaseAddress = (mdSpaceValue.addOffsetTo(mdRegionBaseAddressOffset)).getAddressAt(0); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
75 |
long mdRegionSizeOffset = type.getField("_used").getOffset(); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
76 |
long mdRegionSize = (mdSpaceValue.addOffsetTo(mdRegionSizeOffset)).getAddressAt(0).asLongValue(); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
77 |
mdRegionEndAddress = mdRegionBaseAddress.addOffsetTo(mdRegionSize); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
78 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
79 |
populateMetadataTypeArray(db); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
80 |
} |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
81 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
82 |
private static void populateMetadataTypeArray(TypeDataBase db) { |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
83 |
metadataTypeArray = new Type[8]; |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
84 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
85 |
metadataTypeArray[0] = db.lookupType("ConstantPool"); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
86 |
metadataTypeArray[1] = db.lookupType("InstanceKlass"); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
87 |
metadataTypeArray[2] = db.lookupType("InstanceClassLoaderKlass"); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
88 |
metadataTypeArray[3] = db.lookupType("InstanceMirrorKlass"); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
89 |
metadataTypeArray[4] = db.lookupType("InstanceRefKlass"); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
90 |
metadataTypeArray[5] = db.lookupType("Method"); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
91 |
metadataTypeArray[6] = db.lookupType("ObjArrayKlass"); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
92 |
metadataTypeArray[7] = db.lookupType("TypeArrayKlass"); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
93 |
} |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
94 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
95 |
public FileMapHeader getHeader() { |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
96 |
if (header == null) { |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
97 |
header = (FileMapHeader) VMObjectFactory.newObject(FileMapInfo.FileMapHeader.class, headerValue); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
98 |
} |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
99 |
return header; |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
100 |
} |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
101 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
102 |
public boolean inCopiedVtableSpace(Address vptrAddress) { |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
103 |
FileMapHeader fmHeader = getHeader(); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
104 |
return fmHeader.inCopiedVtableSpace(vptrAddress); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
105 |
} |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
106 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
107 |
public Type getTypeForVptrAddress(Address vptrAddress) { |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
108 |
if (vTableTypeMap == null) { |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
109 |
getHeader().createVtableTypeMapping(); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
110 |
} |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
111 |
return vTableTypeMap.get(vptrAddress); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
112 |
} |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
113 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
114 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
115 |
//------------------------------------------------------------------------------------------ |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
116 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
117 |
public static class FileMapHeader extends VMObject { |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
118 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
119 |
public FileMapHeader(Address addr) { |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
120 |
super(addr); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
121 |
} |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
122 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
123 |
public boolean inCopiedVtableSpace(Address vptrAddress) { |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
124 |
if (vptrAddress.greaterThan(mdRegionBaseAddress) && |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
125 |
vptrAddress.lessThanOrEqual(mdRegionEndAddress)) { |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
126 |
return true; |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
127 |
} |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
128 |
return false; |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
129 |
} |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
130 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
131 |
public void createVtableTypeMapping() { |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
132 |
vTableTypeMap = new HashMap<Address, Type>(); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
133 |
long metadataVTableSize = 0; |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
134 |
long addressSize = VM.getVM().getAddressSize(); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
135 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
136 |
Address copiedVtableAddress = mdRegionBaseAddress; |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
137 |
for (int i=0; i < metadataTypeArray.length; i++) { |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
138 |
// The first entry denotes the vtable size. |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
139 |
metadataVTableSize = copiedVtableAddress.getAddressAt(0).asLongValue(); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
140 |
vTableTypeMap.put(copiedVtableAddress.addOffsetTo(addressSize), metadataTypeArray[i]); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
141 |
|
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
142 |
// The '+ 1' below is to skip the entry containing the size of this metadata's vtable. |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
143 |
copiedVtableAddress = |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
144 |
copiedVtableAddress.addOffsetTo((metadataVTableSize + 1) * addressSize); |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
145 |
} |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
146 |
} |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
147 |
} |
ec2dd30adbc1
8174994: SA: clhsdb printmdo throws WrongTypeException when attached to a process with CDS
jgeorge
parents:
diff
changeset
|
148 |
} |