Search in sources :

Example 6 with Pointer

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);
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) AddressedCorruptDataException(com.ibm.j9ddr.AddressedCorruptDataException)

Example 7 with Pointer

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);
    }
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) U32(com.ibm.j9ddr.vm29.types.U32) MM_HeapLinkedFreeHeaderPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapLinkedFreeHeaderPointer) Pointer(com.ibm.j9ddr.vm29.pointer.Pointer) UDATAPointer(com.ibm.j9ddr.vm29.pointer.UDATAPointer) U32Pointer(com.ibm.j9ddr.vm29.pointer.U32Pointer) U32Pointer(com.ibm.j9ddr.vm29.pointer.U32Pointer)

Example 8 with Pointer

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()]);
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) UDATAPointer(com.ibm.j9ddr.vm29.pointer.UDATAPointer) ArrayList(java.util.ArrayList) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 9 with Pointer

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;
}
Also used : J9MethodPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer) J9ROMClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer) J9ROMMethodPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer)

Example 10 with Pointer

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]));
}
Also used : J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Aggregations

CorruptDataException (com.ibm.j9ddr.CorruptDataException)14 UDATA (com.ibm.j9ddr.vm29.types.UDATA)14 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)6 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)5 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)4 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)4 GCHeapRegionDescriptor (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor)3 AbstractPointer (com.ibm.j9ddr.vm29.pointer.AbstractPointer)3 J9ROMClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer)3 ImageSection (com.ibm.dtfj.image.ImageSection)2 FieldDescriptor (com.ibm.j9ddr.StructureReader.FieldDescriptor)2 StructureDescriptor (com.ibm.j9ddr.StructureReader.StructureDescriptor)2 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)2 J9DDRImageSection (com.ibm.j9ddr.view.dtfj.image.J9DDRImageSection)2 GCClassLoaderIterator (com.ibm.j9ddr.vm29.j9.gc.GCClassLoaderIterator)2 GCHeapRegionIterator (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator)2 GCScavengerForwardedHeader (com.ibm.j9ddr.vm29.j9.gc.GCScavengerForwardedHeader)2 GCVMThreadListIterator (com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator)2 U32Pointer (com.ibm.j9ddr.vm29.pointer.U32Pointer)2 UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)2