use of com.ibm.j9ddr.vm29.pointer.VoidPointer in project openj9 by eclipse.
the class J9MemTagHelper method j9mem_get_footer_padding.
/**
* Given the address of the headerEyecatcher for the memory block, return
* the address of the footer padding.
*
* Note that there not be any padding, in which case this returns the same
* as @ref j9mem_get_footer_tag(), the address of the footer tag.
*
* @throws CorruptDataException
*/
public static VoidPointer j9mem_get_footer_padding(J9MemTagPointer headerEyeCatcherAddress) throws CorruptDataException {
UDATA cursor = UDATA.cast(U8Pointer.cast(headerEyeCatcherAddress).add(J9MemTag.SIZEOF));
U8Pointer padding = U8Pointer.cast(cursor.add(headerEyeCatcherAddress.allocSize()));
return VoidPointer.cast(padding);
}
use of com.ibm.j9ddr.vm29.pointer.VoidPointer in project openj9 by eclipse.
the class LinearDumper method getRegionDetailString.
private static Object getRegionDetailString(J9ClassRegion region) throws CorruptDataException {
VoidPointer srp;
long slotAddress;
String returnValue = "";
switch(region.getType()) {
case J9_SECTION_START:
returnValue = String.format(" %5d bytes", region.getLength());
break;
case J9_RAM_UTF8:
UDATAPointer slotPtr = UDATAPointer.cast(region.getSlotPtr());
if (slotPtr.at(0).longValue() != 0) {
returnValue = J9ObjectHelper.stringValue(J9ObjectPointer.cast(slotPtr.at(0)));
}
break;
case J9_UTF8:
case J9_ROM_UTF8:
returnValue = J9UTF8Helper.stringValue(J9UTF8Pointer.cast(region.getSlotPtr()));
break;
case J9_iTableMethod:
/*
* This case is special for the iTableMethod, because their pointers
* are related to the beginning of the class and are not absolute
*/
AbstractPointer classOffset = region.getSlotPtr().subOffset(region.offset);
slotAddress = region.getSlotPtr().at(0).longValue();
classOffset = classOffset.addOffset(slotAddress);
returnValue = region.additionalInfo + " " + classOffset.getHexAddress();
break;
case J9_SRP:
srp = SelfRelativePointer.cast(region.getSlotPtr()).get();
if (srp.notNull()) {
returnValue = " -> " + srp.getHexAddress();
}
break;
case J9_WSRP:
srp = WideSelfRelativePointer.cast(region.getSlotPtr()).get();
if (srp.notNull()) {
returnValue = " -> " + srp.getHexAddress();
}
break;
case J9_SRP_TO_STRING:
srp = SelfRelativePointer.cast(region.getSlotPtr()).get();
if (srp.notNull()) {
returnValue = " -> " + srp.getHexAddress();
returnValue += " " + J9UTF8Helper.stringValue(J9UTF8Pointer.cast(srp));
}
break;
case J9_Padding:
returnValue = region.length + " byte(s)";
break;
case J9_IntermediateClassData:
returnValue = region.length + " byte(s) " + region.additionalInfo;
break;
default:
String detail = "";
slotAddress = region.getSlotPtr().at(0).longValue();
long slotAddressOriginal = slotAddress;
if ((null != region.additionalInfo) && (region.additionalInfo.length() != 0)) {
if ("classAndFlags".equals(region.name) && (UDATA.MASK != slotAddress)) {
slotAddress = slotAddress & ~J9JavaAccessFlags.J9StaticFieldRefFlagBits;
}
detail += region.additionalInfo + (String.format(" 0x%08X", slotAddress));
/* For special debug extension, more information is shown */
if ((0 != slotAddress) && (region.additionalInfo.equals("!j9class"))) {
try {
detail += " - " + J9UTF8Helper.stringValue(J9ClassPointer.cast(slotAddress).romClass().className());
if ("classAndFlags".equals(region.name)) {
String flags = "";
if (0 != (J9JavaAccessFlags.J9StaticFieldRefBaseType & slotAddressOriginal)) {
flags += "J9StaticFieldRefBaseType, ";
}
if (0 != (J9JavaAccessFlags.J9StaticFieldRefDouble & slotAddressOriginal)) {
flags += "J9StaticFieldRefDouble, ";
}
if (0 != (J9JavaAccessFlags.J9StaticFieldRefVolatile & slotAddressOriginal)) {
flags += "J9StaticFieldRefVolatile, ";
}
/* Check there is any flag or not */
if (0 < flags.length()) {
/*remove last two chars = ", " */
flags = flags.substring(0, flags.length() - 2);
detail += "\t Flag(s) = " + flags;
}
}
} catch (Exception e) {
/* This is only for information purpose, it is ok if an exception was thrown */
}
}
}
returnValue = detail;
}
return returnValue;
}
use of com.ibm.j9ddr.vm29.pointer.VoidPointer in project openj9 by eclipse.
the class MM_HeapRegionDescriptorHelper method getWalkableHighAddress.
public static VoidPointer getWalkableHighAddress(MM_HeapRegionDescriptorPointer region) throws CorruptDataException {
VoidPointer top = null;
long regionType = region._regionType();
if ((MM_HeapRegionDescriptor$RegionType.BUMP_ALLOCATED == regionType) || (MM_HeapRegionDescriptor$RegionType.BUMP_ALLOCATED_MARKED == regionType)) {
top = MM_MemoryPoolBumpPointerPointer.cast(region._memoryPool())._allocatePointer();
} else {
top = getHighAddress(region);
}
return top;
}
use of com.ibm.j9ddr.vm29.pointer.VoidPointer in project openj9 by eclipse.
the class RuntimeTypeResolutionHelper method findRuntimeType.
// Design 42819
// Discover runtime type based on identifier field.
public static String findRuntimeType(String type, Pointer ptr, Context context) {
StructureDescriptor fieldOwner = null;
FieldDescriptor typeIdField = null;
String classType = null;
// not just as the top of the hierarchy, so we have to look at each level.
try {
if (ptr.notNull()) {
// Skip the "!"
classType = StructureCommandUtil.typeToCommand(type).substring(1);
do {
fieldOwner = StructureCommandUtil.getStructureDescriptor(classType, context);
if (null != fieldOwner) {
for (FieldDescriptor aField : fieldOwner.getFields()) {
if (aField.getDeclaredName().equals("_typeId")) {
typeIdField = aField;
break;
}
}
if (null == typeIdField) {
classType = fieldOwner.getSuperName();
}
}
} while ((null == typeIdField) && (null != classType) && (null != fieldOwner) && (classType.length() > 0));
}
if (null != typeIdField) {
VoidPointer untypedStrPtr = PointerPointer.cast(ptr).addOffset(typeIdField.getOffset()).at(0);
if (untypedStrPtr.notNull()) {
U8Pointer typeStrPtr = U8Pointer.cast(untypedStrPtr);
type = typeStrPtr.getCStringAtOffset(0).toLowerCase();
}
}
} catch (CorruptDataException e) {
// Do nothing.
}
return RuntimeTypeResolutionUtils.cleanTypeStr(type);
}
use of com.ibm.j9ddr.vm29.pointer.VoidPointer in project openj9 by eclipse.
the class CompressedRefMappingCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
if (args.length == 0) {
printHelp(out);
return;
}
long address = CommandUtils.parsePointer(args[0], J9BuildFlags.env_data64);
VoidPointer ptr = VoidPointer.cast(address);
if (command.startsWith("!fj9object")) {
J9ObjectPointer mappedValue;
if (J9BuildFlags.gc_compressedPointers) {
mappedValue = ObjectAccessBarrier.convertPointerFromToken(ptr.getAddress());
} else {
mappedValue = J9ObjectPointer.cast(ptr);
}
if (command.startsWith("!fj9objecttoj9object")) {
out.println(String.format("!fj9object %s -> !j9object %s", ptr.getHexAddress(), mappedValue.getHexAddress()));
} else {
context.execute("!j9object", new String[] { mappedValue.getHexAddress() }, out);
}
} else {
long tokenValue;
if (J9BuildFlags.gc_compressedPointers) {
tokenValue = ObjectAccessBarrier.convertTokenFromPointer(J9ObjectPointer.cast(ptr));
} else {
tokenValue = ptr.getAddress();
}
out.println(String.format("!j9object %s -> !fj9object 0x%s\n", ptr.getHexAddress(), Long.toHexString(tokenValue)));
}
}
Aggregations