< prev index next >

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

Print this page

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


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

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