use of com.ibm.dtfj.image.ImageSection in project openj9 by eclipse.
the class ImageSectionComparator method testEquals.
// getBaseAddress()
// getName()
// getSize()
// isExecutable()
// isReadOnly()
// isShared()
public void testEquals(Object ddrObject, Object jextractObject, int members) {
ImageSection ddrImageSection = (ImageSection) ddrObject;
ImageSection jextractImageSection = (ImageSection) jextractObject;
// getBaseAddress
if ((BASE_ADDRESS & members) != 0)
new ImagePointerComparator().testComparatorEquals(ddrImageSection, jextractImageSection, "getBaseAddress");
// getName()
if ((NAME & members) != 0)
testJavaEquals(ddrImageSection, jextractImageSection, "getName");
// getSize()
if ((SIZE & members) != 0)
testJavaEquals(ddrImageSection, jextractImageSection, "getSize");
// isExecutable()
if ((IS_EXECUTABLE & members) != 0)
testJavaEquals(ddrImageSection, jextractImageSection, "isExecutable");
// isShared()
if ((IS_SHARED & members) != 0)
testJavaEquals(ddrImageSection, jextractImageSection, "isShared");
// isReadOnly()
if ((IS_READONLY & members) != 0)
testJavaEquals(ddrImageSection, jextractImageSection, "isReadOnly");
}
use of com.ibm.dtfj.image.ImageSection in project openj9 by eclipse.
the class JavaHeap method setRegions.
public void setRegions(Vector regions) {
// store the regions
_heapRegions = regions;
// now make the sorted index of the subsections within all the regions for faster look-up, later on
Iterator outer = regions.iterator();
Vector heapSubRegionSections = new Vector();
while (outer.hasNext()) {
JavaHeapRegion region = (JavaHeapRegion) outer.next();
Iterator sections = region.getSections();
while (sections.hasNext()) {
ImageSection section = (ImageSection) sections.next();
heapSubRegionSections.add(new HeapSubRegionSection(region, section));
}
}
// now sort the sub-regions
_allSortedRegionSections = (HeapSubRegionSection[]) heapSubRegionSections.toArray(new HeapSubRegionSection[heapSubRegionSections.size()]);
Arrays.sort(_allSortedRegionSections, new Comparator() {
public int compare(Object arg0, Object arg1) {
HeapSubRegionSection one = (HeapSubRegionSection) arg0;
HeapSubRegionSection two = (HeapSubRegionSection) arg1;
long delta = one.base() - two.base();
int result = 0;
if (delta < 0) {
result = -1;
} else if (delta > 0) {
result = 1;
}
return result;
}
});
}
use of com.ibm.dtfj.image.ImageSection in project openj9 by eclipse.
the class ImageAddressSpaceBuilder method addImageSection.
public ImageSection addImageSection(String name, long base, long size) {
ImagePointer basePointer = fImageAddressSpace.getPointer(base);
ImageSection section = new JCImageSection(name, basePointer, size);
fImageAddressSpace.addImageSection(section);
return section;
}
use of com.ibm.dtfj.image.ImageSection in project openj9 by eclipse.
the class PHDJavaHeap method getSections.
public Iterator<ImageSection> getSections() {
List<ImageSection> c = new ArrayList<ImageSection>();
// This is the start of the last object
long last = runtime.maxAddress;
if (runtime.minAddress <= runtime.maxAddress) {
ImagePointer objPointer = space.getPointer(last);
JavaObject lastObj = null;
try {
lastObj = getLastObject(objPointer, runtime.maxObjClass, runtime.maxObjLen);
} catch (IOException e1) {
// allow to fall through so that jo is null
}
try {
// Find the end of the last object
if (lastObj != null)
last += lastObj.getSize();
ImageSection s = new PHDImageSection(getName(), space.getPointer(runtime.minAddress), last - runtime.minAddress);
c.add(s);
} catch (CorruptDataException e) {
ImageSection s = new PHDImageSection(getName(), space.getPointer(runtime.minAddress), last - runtime.minAddress);
c.add(s);
// The object will take some space
s = new PHDCorruptImageSection("Corrupt " + getName(), objPointer, 8);
c.add(s);
}
}
if (runtime.minClassAddress <= runtime.maxClassAddress) {
// Space in heap for class objects
long last2 = runtime.maxClassAddress;
ImagePointer objPointer = space.getPointer(last2);
int insert = c.size();
ImageSection s;
try {
JavaClass jc = runtime.findClass(last2);
// Make sure the class takes up some room
long size = 8;
if (jc != null) {
JavaObject lastObj = jc.getObject();
if (lastObj != null && lastObj.getID().equals(jc.getID())) {
size = lastObj.getSize();
}
}
last2 += size;
} catch (CorruptDataException e) {
s = new PHDCorruptImageSection("Corrupt " + getName(), objPointer, 8);
c.add(s);
}
// Do the object and class object sections overlap, if so combine them
if (last2 < runtime.minAddress || last < runtime.minClassAddress) {
s = new PHDImageSection(getName(), space.getPointer(runtime.minClassAddress), last2 - runtime.minClassAddress);
c.add(insert, s);
} else {
long minAddr = Math.min(runtime.minAddress, runtime.minClassAddress);
long maxAddr = Math.max(last, last2);
s = new PHDImageSection(getName(), space.getPointer(minAddr), maxAddr - minAddr);
// Replace with a combined section
c.set(0, s);
}
}
return c.iterator();
}
use of com.ibm.dtfj.image.ImageSection in project openj9 by eclipse.
the class ClassOutput method printMethods.
public static void printMethods(Iterator methods, PrintStream out) {
while (methods.hasNext()) {
JavaMethod jMethod = (JavaMethod) methods.next();
try {
out.print("Bytecode range(s): ");
Iterator imageSections = jMethod.getBytecodeSections();
boolean firstSectionPassed = false;
while (imageSections.hasNext()) {
ImageSection is = (ImageSection) imageSections.next();
long baseAddress = is.getBaseAddress().getAddress();
long endAddress = baseAddress + is.getSize();
if (firstSectionPassed) {
out.print(", ");
}
out.print(Long.toHexString(baseAddress) + " -- " + Long.toHexString(endAddress));
firstSectionPassed = true;
}
out.print(": ");
String signature;
try {
out.print(Utils.getMethodModifierString(jMethod));
} catch (CorruptDataException e) {
out.print(Exceptions.getCorruptDataExceptionString());
}
try {
signature = jMethod.getSignature();
} catch (CorruptDataException e) {
out.print(Exceptions.getCorruptDataExceptionString());
signature = null;
}
if (null != signature) {
String name = Utils.getReturnValueName(signature);
if (null == name) {
out.print("<unknown>");
} else {
out.print(name);
}
}
out.print(" ");
out.print(jMethod.getName());
if (null != signature) {
String name = Utils.getMethodSignatureName(signature);
if (null == name) {
out.print("<unknown>");
} else {
out.print(name);
}
}
out.print("\n");
} catch (CorruptDataException cde) {
out.print("N/A (CorruptDataException occurred)");
}
}
}
Aggregations