use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class CheckEngine method checkJ9Class.
private int checkJ9Class(J9ClassPointer clazz, J9MemorySegmentPointer segment, int checkFlags) throws CorruptDataException {
if (clazz.isNull()) {
return J9MODRON_GCCHK_RC_OK;
}
if (clazz.anyBitsIn(J9MODRON_GCCHK_J9CLASS_ALIGNMENT_MASK)) {
return J9MODRON_GCCHK_RC_CLASS_POINTER_UNALIGNED;
}
/* Check that the class header containes the expected values */
int ret = checkJ9ClassHeader(clazz);
if (J9MODRON_GCCHK_RC_OK != ret) {
return ret;
}
/* Check that class is not unloaded */
ret = checkJ9ClassIsNotUnloaded(clazz);
if (J9MODRON_GCCHK_RC_OK != ret) {
return ret;
}
if ((checkFlags & J9MODRON_GCCHK_VERIFY_RANGE) != J9MODRON_GCCHK_VERIFY_RANGE) {
UDATA delta = UDATA.cast(segment.heapAlloc()).sub(UDATA.cast(clazz));
/* Basic check that there is enough room for the object header */
if (delta.lt(J9Class.SIZEOF)) {
return J9MODRON_GCCHK_RC_CLASS_INVALID_RANGE;
}
}
return J9MODRON_GCCHK_RC_OK;
}
use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class CheckEngine method checkIndexableFlag.
private boolean checkIndexableFlag(J9ObjectPointer object) throws CorruptDataException {
UDATA classShape = ObjectModel.getClassShape(J9ObjectHelper.clazz(object));
boolean isIndexable = ObjectModel.isIndexable(object);
if (classShape.eq(OBJECT_HEADER_SHAPE_POINTERS)) {
return isIndexable;
}
if (classShape.eq(OBJECT_HEADER_SHAPE_BYTES)) {
return isIndexable;
}
if (classShape.eq(OBJECT_HEADER_SHAPE_WORDS)) {
return isIndexable;
}
if (classShape.eq(OBJECT_HEADER_SHAPE_LONGS)) {
return isIndexable;
}
if (classShape.eq(OBJECT_HEADER_SHAPE_DOUBLES)) {
return isIndexable;
}
return !isIndexable;
}
use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class J9ObjectStructureFormatter method printObjectField.
public void printObjectField(PrintStream out, int tabLevel, J9ClassPointer localClazz, U8Pointer dataStart, J9ClassPointer fromClass, J9ObjectFieldOffset objectFieldOffset) throws CorruptDataException {
J9ROMFieldShapePointer fieldShape = objectFieldOffset.getField();
UDATA fieldOffset = objectFieldOffset.getOffsetOrAddress();
boolean isHiddenField = objectFieldOffset.isHidden();
String className = J9UTF8Helper.stringValue(fromClass.romClass().className());
String fieldName = J9UTF8Helper.stringValue(fieldShape.nameAndSignature().name());
String fieldSignature = J9UTF8Helper.stringValue(fieldShape.nameAndSignature().signature());
U8Pointer valuePtr = dataStart;
valuePtr = valuePtr.add(fieldOffset);
padding(out, tabLevel);
out.print(String.format("%s %s = ", fieldSignature, fieldName));
if (fieldShape.modifiers().anyBitsIn(J9FieldSizeDouble)) {
out.print(U64Pointer.cast(valuePtr).at(0).getHexValue());
} else if (fieldShape.modifiers().anyBitsIn(J9FieldFlagObject)) {
AbstractPointer ptr = J9BuildFlags.gc_compressedPointers ? U32Pointer.cast(valuePtr) : UDATAPointer.cast(valuePtr);
out.print(String.format("!fj9object 0x%x", ptr.at(0).longValue()));
} else {
out.print(I32Pointer.cast(valuePtr).at(0).getHexValue());
}
out.print(String.format(" (offset=%d) (%s)", fieldOffset.longValue(), className));
if (isHiddenField) {
out.print(" <hidden>");
}
}
use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class DTFJJavaMethod method getBytecodeSections.
@SuppressWarnings("rawtypes")
public Iterator getBytecodeSections() {
if (byteCodeSections == null) {
byteCodeSections = new ArrayList<Object>();
try {
J9ROMMethodPointer originalRomMethod = ROMHelp.getOriginalROMMethod(j9ramMethod);
if (!originalRomMethod.modifiers().anyBitsIn(J9JavaAccessFlags.J9AccNative)) {
U8Pointer bcStart = ROMHelp.J9_BYTECODE_START_FROM_ROM_METHOD(originalRomMethod);
UDATA bcSize = ROMHelp.J9_BYTECODE_SIZE_FROM_ROM_METHOD(originalRomMethod);
J9DDRImageSection is = DTFJContext.getImageSection(bcStart.getAddress(), "bytecode section at " + j9ramMethod.bytecodes().getAddress());
is.setSize(bcSize.longValue());
byteCodeSections.add(is);
if (!j9romMethod.equals(originalRomMethod)) {
is = DTFJContext.getImageSection(j9ramMethod.bytecodes().getAddress(), "bytecode section at " + j9ramMethod.bytecodes().getAddress());
is.setSize(bcSize.longValue());
byteCodeSections.add(is);
}
}
} catch (Throwable t) {
CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
byteCodeSections.add(cd);
}
}
return byteCodeSections.iterator();
}
use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class J9ObjectFieldOffsetIterator_V1 method nextField.
private void nextField() throws CorruptDataException {
boolean walkHiddenFields = false;
isHidden = false;
field = null;
/*
* Walk regular ROM fields until we run out of them. Then switch
* to hidden instance fields if the caller wants them.
*/
if (hiddenInstanceFieldWalkIndex == -1) {
fieldOffsetsFindNext();
if (field == null && walkFlags.anyBitsIn(J9VM_FIELD_OFFSET_WALK_INCLUDE_HIDDEN)) {
walkHiddenFields = true;
/* Start the walk over the hidden fields array in reverse order. */
hiddenInstanceFieldWalkIndex = hiddenInstanceFieldList.size();
}
} else {
walkHiddenFields = true;
}
if (walkHiddenFields && hiddenInstanceFieldWalkIndex != 0) {
/* Note: hiddenInstanceFieldWalkIndex is the index of the last hidden instance field that was returned. */
HiddenInstanceField hiddenField = hiddenInstanceFieldList.get(--hiddenInstanceFieldWalkIndex);
field = hiddenField.shape();
isHidden = true;
/*
* This function returns offsets relative to the end of the object header,
* whereas fieldOffset is relative to the start of the header.
*/
offset = new UDATA(hiddenField.fieldOffset().intValue() - J9Object.SIZEOF);
/* Hidden fields do not have a valid JVMTI index. */
index = new UDATA(-1);
}
}
Aggregations