Search in sources :

Example 51 with J9JavaVMPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer in project openj9 by eclipse.

the class MonitorTableList method initializeCaches.

private static synchronized void initializeCaches() throws CorruptDataException {
    if (!initialized) {
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        PointerPointer cursor = vm.monitorTables();
        int count = vm.monitorTableCount().intValue();
        monitorTables = new MonitorTable[count];
        for (int i = 0; i < count; i++) {
            J9MonitorTableListEntryPointer entries = vm.monitorTableList();
            while (entries.notNull()) {
                if (entries.monitorTable().eq(cursor.at(i))) {
                    monitorTables[i] = MonitorTable.from(entries);
                    break;
                }
                entries = entries.next();
            }
        }
        initialized = true;
    }
}
Also used : PointerPointer(com.ibm.j9ddr.vm29.pointer.PointerPointer) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) J9MonitorTableListEntryPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MonitorTableListEntryPointer)

Example 52 with J9JavaVMPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer in project openj9 by eclipse.

the class GCCardTable method from.

public static GCCardTable from() throws CorruptDataException {
    J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
    MM_GCExtensionsPointer extensions = GCExtensions.getGCExtensionsPointer();
    MM_CardTablePointer cardTable = extensions.cardTable();
    return new GCCardTable(cardTable);
}
Also used : MM_CardTablePointer(com.ibm.j9ddr.vm29.pointer.generated.MM_CardTablePointer) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) MM_GCExtensionsPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_GCExtensionsPointer)

Example 53 with J9JavaVMPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer in project openj9 by eclipse.

the class HeapWalker method initializeFlatLockedMonitors.

private static void initializeFlatLockedMonitors() throws CorruptDataException {
    J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
    MM_GCExtensionsPointer gcext = GCExtensions.getGCExtensionsPointer();
    MM_HeapRegionManagerPointer hrm = gcext.heapRegionManager();
    flatLockedMonitors = new TreeSet<ObjectMonitor>();
    GCHeapRegionIterator regions = GCHeapRegionIterator.fromMMHeapRegionManager(hrm, true, true);
    while (regions.hasNext()) {
        GCHeapRegionDescriptor region = regions.next();
        if (!flatLockedMonitorsByRegion.containsKey(region)) {
            runFlatLockMonitorRegionWalk(vm, region);
        }
        /* Running the walk should have populated the flatLockedMonitors map */
        assert (flatLockedMonitorsByRegion.containsKey(region));
        flatLockedMonitors.addAll(flatLockedMonitorsByRegion.get(region));
    }
}
Also used : GCHeapRegionDescriptor(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor) MM_HeapRegionManagerPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionManagerPointer) GCHeapRegionIterator(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) MM_GCExtensionsPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_GCExtensionsPointer) ObjectMonitor(com.ibm.j9ddr.vm29.j9.ObjectMonitor)

Example 54 with J9JavaVMPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer in project openj9 by eclipse.

the class J9JavaVMHelper method getMethodFromPC.

/*
	 * Returns a program space pointer to the matching J9Method for the
	 * specified PC.
	 */
public static J9MethodPointer getMethodFromPC(J9JavaVMPointer vmPtr, U8Pointer pc) throws CorruptDataException {
    GCClassLoaderIterator it = GCClassLoaderIterator.from();
    while (it.hasNext()) {
        J9ClassLoaderPointer loader = it.next();
        Iterator<J9ClassPointer> classIt = ClassIterator.fromJ9Classloader(loader);
        while (classIt.hasNext()) {
            J9ClassPointer clazz = classIt.next();
            J9MethodPointer result = J9ClassHelper.getMethodFromPCAndClass(clazz, pc);
            if (!result.isNull()) {
                return result;
            }
        }
    }
    return J9MethodPointer.NULL;
}
Also used : J9MethodPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer) J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) GCClassLoaderIterator(com.ibm.j9ddr.vm29.j9.gc.GCClassLoaderIterator) J9ClassLoaderPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer)

Example 55 with J9JavaVMPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer in project openj9 by eclipse.

the class J9ClassHelper method size.

public static UDATA size(J9ClassPointer clazz, J9JavaVMPointer vm) throws CorruptDataException {
    /*
		 * Size includes up to 7 fragments:
		 * 		0. RAM class header = J9Class struct + vTable + JIT vTable
		 * 		1. RAM methods + extended method block
		 * 		2. Superclasses
		 * 		3. Instance description
		 * 		4. iTable
		 * 		5. Static slots
		 * 		6. Constant pool
		 * 
		 * Array classes omit 1, 3, 5 and 6.
		 */
    // Fragment 0. RAM class header = J9Class struct + vTable + JIT vTable
    UDATA size = new UDATA(J9Class.SIZEOF);
    UDATA vTableSlotCount = vTable(clazz).at(0);
    size = size.add(Scalar.convertSlotsToBytes(vTableSlotCount));
    if (vm.jitConfig().notNull()) {
        UDATA jitVTableSlotCount = vTableSlotCount.sub(1);
        size = size.add(Scalar.convertSlotsToBytes(jitVTableSlotCount));
    }
    if (!J9ROMClassHelper.isArray(clazz.romClass())) {
        // Fragment 1. RAM methods + extended method block
        U32 ramMethodsSize = clazz.romClass().romMethodCount().mult((int) J9Method.SIZEOF);
        size = size.add(ramMethodsSize);
        if (vm.runtimeFlags().allBitsIn(J9Consts.J9_RUNTIME_EXTENDED_METHOD_BLOCK)) {
            UDATA extendedMethodBlockSize = Scalar.roundToSizeofUDATA(new UDATA(clazz.romClass().romMethodCount()));
            size = size.add(extendedMethodBlockSize);
        }
        // Fragment 3. Instance description
        if (!clazz.instanceDescription().anyBitsIn(1)) {
            UDATA highestBitInSlot = new UDATA(UDATA.SIZEOF * 8 - 1);
            UDATA instanceDescriptionSize = clazz.totalInstanceSize().rightShift((int) (ObjectReferencePointer.SIZEOF >> 2) + 1);
            instanceDescriptionSize = instanceDescriptionSize.add(highestBitInSlot).bitAnd(highestBitInSlot.bitNot());
            if (J9BuildFlags.gc_leafBits) {
                instanceDescriptionSize = instanceDescriptionSize.mult(2);
            }
            size = size.add(instanceDescriptionSize);
        }
        // Fragment 5. Static slots
        U32 staticSlotCount = clazz.romClass().objectStaticCount().add(clazz.romClass().singleScalarStaticCount());
        if (J9BuildFlags.env_data64) {
            staticSlotCount = staticSlotCount.add(clazz.romClass().doubleScalarStaticCount());
        } else {
            staticSlotCount = staticSlotCount.add(1).bitAnd(~1L).add(clazz.romClass().doubleScalarStaticCount().mult(2));
        }
        size = size.add(Scalar.convertSlotsToBytes(new UDATA(staticSlotCount)));
        // Fragment 6. Constant pool
        U32 constantPoolSlotCount = clazz.romClass().ramConstantPoolCount().mult(2);
        size = size.add(Scalar.convertSlotsToBytes(new UDATA(constantPoolSlotCount)));
    }
    // Fragment 2. Superclasses
    UDATA classDepth = classDepthAndFlags(clazz).bitAnd(J9JavaAccessFlags.J9AccClassDepthMask);
    if (classDepth.eq(0)) {
        // java/lang/Object has a single slot superclasses array
        size = size.add(UDATA.SIZEOF);
    } else {
        size = size.add(Scalar.convertSlotsToBytes(classDepth));
    }
    // Fragment 4. iTable
    if (clazz.iTable().notNull()) {
        J9ClassPointer superclass = J9ClassPointer.cast(clazz.superclasses().at(classDepth.sub(1)));
        if (superclass.isNull() || !superclass.iTable().eq(clazz.iTable())) {
            J9ITablePointer iTable = J9ITablePointer.cast(clazz.iTable());
            // Scan to the last iTable belonging to classPointer
            if (superclass.isNull()) {
                while (iTable.next().notNull()) {
                    iTable = iTable.next();
                }
            } else {
                while (iTable.next().notNull() && !iTable.next().eq(superclass.iTable())) {
                    iTable = iTable.next();
                }
            }
            // Find the end of the last iTable
            if (clazz.romClass().modifiers().allBitsIn(J9Consts.J9_JAVA_INTERFACE)) {
                iTable = iTable.add(1);
            } else {
                iTable = iTable.add(1).addOffset(iTable.interfaceClass().romClass().romMethodCount().mult(UDATA.SIZEOF));
            }
            size = size.add(iTable.getAddress() - clazz.iTable().getAddress());
        }
    }
    return size;
}
Also used : J9ITablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9ITablePointer) UDATA(com.ibm.j9ddr.vm29.types.UDATA) U32(com.ibm.j9ddr.vm29.types.U32) J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)

Aggregations

J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)57 CorruptDataException (com.ibm.j9ddr.CorruptDataException)49 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)39 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)23 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)17 UDATA (com.ibm.j9ddr.vm29.types.UDATA)13 J9ROMClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer)10 ClassSegmentIterator (com.ibm.j9ddr.vm29.j9.walkers.ClassSegmentIterator)8 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)8 J9MemorySegmentPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer)6 PatternString (com.ibm.j9ddr.util.PatternString)5 MonitorIterator (com.ibm.j9ddr.vm29.j9.walkers.MonitorIterator)5 ROMClassesIterator (com.ibm.j9ddr.vm29.j9.walkers.ROMClassesIterator)5 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)5 J9ClassLoaderPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer)5 MM_HeapRegionManagerPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionManagerPointer)5 Table (com.ibm.j9ddr.tools.ddrinteractive.Table)4 GCHeapRegionDescriptor (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor)4 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)4 J9ThreadMonitorPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ThreadMonitorPointer)4