< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/FileMapInfo.java

Print this page

 98     // char* mapped_base_address = header->_mapped_base_address
 99     // size_t cloned_vtable_offset = header->_cloned_vtable_offset
100     // CppVtableInfo** vtablesIndex = mapped_base_address + cloned_vtable_offset;
101     Address mapped_base_address = get_AddressField(FileMapHeader_type, header, "_mapped_base_address");
102     long cloned_vtable_offset = get_CIntegerField(FileMapHeader_type, header, "_cloned_vtables_offset");
103     vtablesIndex = mapped_base_address.addOffsetTo(cloned_vtable_offset);
104 
105     // CDSFileMapRegion* rw_region = &header->_region[rw];
106     // char* rwRegionBaseAddress = rw_region->_mapped_base;
107     // size_t used = rw_region->_used;
108     // char* rwRegionEndAddress = rwRegionBaseAddress + used;
109     Address rw_region = get_CDSFileMapRegion(FileMapHeader_type, header, 0);
110     rwRegionBaseAddress = get_AddressField(CDSFileMapRegion_type, rw_region, "_mapped_base");
111     long used = get_CIntegerField(CDSFileMapRegion_type, rw_region, "_used");
112     rwRegionEndAddress = rwRegionBaseAddress.addOffsetTo(used);
113 
114     populateMetadataTypeArray(db);
115   }
116 
117   private static void populateMetadataTypeArray(TypeDataBase db) {
118     metadataTypeArray = new Type[9];
119 
120     metadataTypeArray[0] = db.lookupType("ConstantPool");
121     metadataTypeArray[1] = db.lookupType("InstanceKlass");
122     metadataTypeArray[2] = db.lookupType("InstanceClassLoaderKlass");
123     metadataTypeArray[3] = db.lookupType("InstanceMirrorKlass");
124     metadataTypeArray[4] = db.lookupType("InstanceRefKlass");
125     metadataTypeArray[5] = db.lookupType("InstanceStackChunkKlass");
126     metadataTypeArray[6] = db.lookupType("Method");
127     metadataTypeArray[7] = db.lookupType("ObjArrayKlass");
128     metadataTypeArray[8] = db.lookupType("TypeArrayKlass");


129   }
130 
131   public FileMapHeader getHeader() {
132     return headerObj;
133   }
134 
135   public boolean inCopiedVtableSpace(Address vptrAddress) {
136     FileMapHeader fmHeader = getHeader();
137     return fmHeader.inCopiedVtableSpace(vptrAddress);
138   }
139 
140   public Type getTypeForVptrAddress(Address vptrAddress) {
141     if (vTableTypeMap == null) {
142       getHeader().createVtableTypeMapping();
143     }
144     return vTableTypeMap.get(vptrAddress);
145   }
146 
147 
148   //------------------------------------------------------------------------------------------

 98     // char* mapped_base_address = header->_mapped_base_address
 99     // size_t cloned_vtable_offset = header->_cloned_vtable_offset
100     // CppVtableInfo** vtablesIndex = mapped_base_address + cloned_vtable_offset;
101     Address mapped_base_address = get_AddressField(FileMapHeader_type, header, "_mapped_base_address");
102     long cloned_vtable_offset = get_CIntegerField(FileMapHeader_type, header, "_cloned_vtables_offset");
103     vtablesIndex = mapped_base_address.addOffsetTo(cloned_vtable_offset);
104 
105     // CDSFileMapRegion* rw_region = &header->_region[rw];
106     // char* rwRegionBaseAddress = rw_region->_mapped_base;
107     // size_t used = rw_region->_used;
108     // char* rwRegionEndAddress = rwRegionBaseAddress + used;
109     Address rw_region = get_CDSFileMapRegion(FileMapHeader_type, header, 0);
110     rwRegionBaseAddress = get_AddressField(CDSFileMapRegion_type, rw_region, "_mapped_base");
111     long used = get_CIntegerField(CDSFileMapRegion_type, rw_region, "_used");
112     rwRegionEndAddress = rwRegionBaseAddress.addOffsetTo(used);
113 
114     populateMetadataTypeArray(db);
115   }
116 
117   private static void populateMetadataTypeArray(TypeDataBase db) {
118     metadataTypeArray = new Type[11];
119     // The order needs to match up with CPP_VTABLE_TYPES_DO in src/hotspot/share/cds/cppVtables.cpp
120     metadataTypeArray[0] = db.lookupType("ConstantPool");
121     metadataTypeArray[1] = db.lookupType("InstanceKlass");
122     metadataTypeArray[2] = db.lookupType("InstanceClassLoaderKlass");
123     metadataTypeArray[3] = db.lookupType("InstanceMirrorKlass");
124     metadataTypeArray[4] = db.lookupType("InstanceRefKlass");
125     metadataTypeArray[5] = db.lookupType("InstanceStackChunkKlass");
126     metadataTypeArray[6] = db.lookupType("Method");
127     metadataTypeArray[9] = db.lookupType("MethodData");
128     metadataTypeArray[8] = db.lookupType("MethodCounters");
129     metadataTypeArray[9] = db.lookupType("ObjArrayKlass");
130     metadataTypeArray[10] = db.lookupType("TypeArrayKlass");
131   }
132 
133   public FileMapHeader getHeader() {
134     return headerObj;
135   }
136 
137   public boolean inCopiedVtableSpace(Address vptrAddress) {
138     FileMapHeader fmHeader = getHeader();
139     return fmHeader.inCopiedVtableSpace(vptrAddress);
140   }
141 
142   public Type getTypeForVptrAddress(Address vptrAddress) {
143     if (vTableTypeMap == null) {
144       getHeader().createVtableTypeMapping();
145     }
146     return vTableTypeMap.get(vptrAddress);
147   }
148 
149 
150   //------------------------------------------------------------------------------------------
< prev index next >