use of com.ibm.j9ddr.vm29.pointer.Pointer in project openj9 by eclipse.
the class GCHeapLinkedFreeHeader_V1 method getNext.
@Override
public GCHeapLinkedFreeHeader getNext() throws CorruptDataException {
UDATA next = getNextImpl();
if (!next.anyBitsIn(J9Consts.J9_GC_OBJ_HEAP_HOLE_MASK)) {
throw new AddressedCorruptDataException(heapLinkedFreeHeaderPointer.getAddress(), "Next pointer not tagged");
}
next = next.bitAnd(~J9Consts.J9_GC_OBJ_HEAP_HOLE_MASK);
// Presumably code within a version implementation does not need to look up the required version
return new GCHeapLinkedFreeHeader_V1(next);
}
use of com.ibm.j9ddr.vm29.pointer.Pointer in project openj9 by eclipse.
the class GCHeapLinkedFreeHeader_V1 method getNextImpl.
private UDATA getNextImpl() throws CorruptDataException {
Pointer nextEA = heapLinkedFreeHeaderPointer._nextEA();
if (J9BuildFlags.interp_compressedObjectHeader) {
U32Pointer nextPointer = U32Pointer.cast(nextEA);
U32 lowBits = nextPointer.at(0);
U32 highBits = nextPointer.at(1);
return new UDATA(highBits).leftShift(32).bitOr(lowBits);
} else {
return UDATAPointer.cast(nextEA).at(0);
}
}
use of com.ibm.j9ddr.vm29.pointer.Pointer in project openj9 by eclipse.
the class GCMarkMapStandard method queryRange.
@Override
public MarkedObject[] queryRange(J9ObjectPointer base, J9ObjectPointer top) throws CorruptDataException {
/* Naive implementation; should work but slow -- ever more than the super.
* Add handling for compacted records in the mark map. */
ArrayList<MarkedObject> results = new ArrayList<MarkedObject>();
if (base.lt(_heapBase)) {
base = J9ObjectPointer.cast(_heapBase);
}
if (top.gt(_heapTop)) {
top = J9ObjectPointer.cast(_heapTop);
}
if (base.gt(top)) {
base = top;
}
J9ObjectPointer cursor = base;
while (cursor.lt(top)) {
UDATA heapBaseOffset = UDATA.cast(cursor).sub(UDATA.cast(_heapBase));
// pairs of UDATA, so *2
UDATA pageIndex = heapBaseOffset.div(MM_CompactScheme.sizeof_page).mult(2);
UDATA compactTableEntry_addr = _heapMapBits.at(pageIndex);
UDATA compactTableEntry_bits = _heapMapBits.at(pageIndex.add(1));
// Horribly inefficient -- recomputing relocations every single time!
if (compactTableEntry_addr.allBitsIn(3)) {
// Object has been compacted -- assuming that the pointer was the pre-compacted one
J9ObjectPointer newObject = J9ObjectPointer.cast(compactTableEntry_addr.bitAnd(~3));
UDATA bits = compactTableEntry_bits;
UDATA offset = heapBaseOffset.mod(MM_CompactScheme.sizeof_page).div(2 * MM_HeapMap.J9MODRON_HEAP_SLOTS_PER_HEAPMAP_BIT * UDATA.SIZEOF);
UDATA bitMask = new UDATA(1).leftShift(offset);
if (bits.bitAnd(bitMask).eq(bitMask)) {
long mask = 1;
int ordinal = 0;
for (int i = offset.intValue(); i > 0; i--) {
if (bits.allBitsIn(mask)) {
ordinal += 1;
}
mask <<= 1;
}
for (int i = 0; i < ordinal; i++) {
UDATA objectSize = ObjectModel.getConsumedSizeInBytesWithHeader(newObject);
newObject = newObject.addOffset(objectSize);
}
results.add(new MarkedObject(cursor, _heapMapBits.add(pageIndex), newObject));
}
cursor = cursor.addOffset(getObjectGrain() * 2);
} else {
/* Same as super */
UDATA[] indexAndMask = getSlotIndexAndMask(cursor);
UDATAPointer slot = _heapMapBits.add(indexAndMask[0]);
if (slot.at(0).bitAnd(indexAndMask[1]).gt(0)) {
results.add(new MarkedObject(cursor, slot));
}
cursor = cursor.addOffset(getObjectGrain());
}
}
return results.toArray(new MarkedObject[results.size()]);
}
use of com.ibm.j9ddr.vm29.pointer.Pointer in project openj9 by eclipse.
the class J9ClassHelper method getMethodFromPCAndClass.
/*
* Returns a program space pointer to the matching J9Method for the
* specified class and PC.
*/
public static J9MethodPointer getMethodFromPCAndClass(J9ClassPointer localClass, U8Pointer pc) throws CorruptDataException {
J9ROMClassPointer localROMClass = localClass.romClass();
for (int i = 0; i < localROMClass.romMethodCount().longValue(); i++) {
J9MethodPointer localMethod = localClass.ramMethods().add(i);
J9ROMMethodPointer romMethod = J9MethodHelper.romMethod(localMethod);
boolean a = pc.gte(U8Pointer.cast(romMethod));
boolean b = pc.lte(J9ROMMethodHelper.bytecodeEnd(romMethod).subOffset(1));
if (a && b) {
return localMethod;
}
}
return J9MethodPointer.NULL;
}
use of com.ibm.j9ddr.vm29.pointer.Pointer in project openj9 by eclipse.
the class FindVMTask method run.
/* (non-Javadoc)
* @see com.ibm.j9ddr.IBootstrapRunnable#run(com.ibm.j9ddr.IVMData, java.lang.Object[])
*/
public void run(IVMData vmData, Object[] userData) {
long[] passBackArray = (long[]) userData[0];
String vmAddressString = System.getProperty(J9VM_ADDRESS_PROPERTY);
if (vmAddressString != null) {
long address = 0;
try {
if (vmAddressString.startsWith("0x")) {
address = Long.parseLong(vmAddressString.substring(2), 16);
} else {
address = Long.parseLong(vmAddressString);
}
} catch (NumberFormatException nfe) {
logger.warning("System property " + J9VM_ADDRESS_PROPERTY + " does not contain a valid pointer address, found: " + vmAddressString);
throw nfe;
}
logger.warning("FindVMTask forcing J9JavaVMPointer to address from system property " + J9VM_ADDRESS_PROPERTY + " : " + vmAddressString);
// Override the cached version from J9RASHelper as well.
J9JavaVMPointer vm = J9JavaVMPointer.cast(address);
J9RASHelper.setCachedVM(vm);
passBackArray[0] = vm.getAddress();
} else {
try {
passBackArray[0] = DataType.getJ9RASPointer().vm().longValue();
} catch (CorruptDataException e) {
throw new RuntimeException(e);
}
}
logger.fine("FindVMTask passing back J9JavaVMPointer: 0x" + Long.toHexString(passBackArray[0]));
}
Aggregations