Search in sources :

Example 26 with UDATA

use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.

the class MM_HeapRegionDescriptorHelper method getHighAddress.

public static VoidPointer getHighAddress(MM_HeapRegionDescriptorPointer region) throws CorruptDataException {
    VoidPointer result = VoidPointer.NULL;
    long regionsInSpan = region._regionsInSpan().longValue();
    if (regionsInSpan == 0) {
        result = region._highAddress();
    } else {
        UDATA low = UDATA.cast(region._lowAddress());
        UDATA high = UDATA.cast(region._highAddress());
        UDATA delta = high.sub(low);
        UDATA spanningSize = delta.mult((int) regionsInSpan);
        result = VoidPointer.cast(low.add(spanningSize));
    }
    return result;
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer)

Example 27 with UDATA

use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.

the class RamClassWalker method allSlotsInRAMStaticsDo.

private void allSlotsInRAMStaticsDo() throws CorruptDataException {
    if (ramClass.ramStatics().isNull()) {
        return;
    }
    Iterator<?> ofoIterator = J9ObjectFieldOffsetIterator.J9ObjectFieldOffsetIteratorFor(ramClass, J9ClassHelper.superclass(ramClass), new U32(J9ROMFieldOffsetWalkState.J9VM_FIELD_OFFSET_WALK_INCLUDE_STATIC));
    J9ObjectFieldOffset fields = null;
    while (ofoIterator.hasNext()) {
        fields = (J9ObjectFieldOffset) ofoIterator.next();
        J9ROMFieldShapePointer field = fields.getField();
        String info = fields.getName();
        U32 modifiers = field.modifiers();
        UDATAPointer fieldAddress = ramClass.ramStatics().addOffset(fields.getOffsetOrAddress());
        String additionalInfo = modifiers.anyBitsIn(J9FieldFlagObject) ? "!j9object" : "";
        if (modifiers.anyBitsIn(J9FieldSizeDouble)) {
            classWalkerCallback.addSlot(clazz, SlotType.J9_I64, I64Pointer.cast(fieldAddress), info, additionalInfo);
        } else {
            classWalkerCallback.addSlot(clazz, SlotType.J9_UDATA, fieldAddress, info, additionalInfo);
        }
    }
    U32 staticSlotCount = ramClass.romClass().objectStaticCount().add(ramClass.romClass().singleScalarStaticCount());
    if (J9BuildFlags.env_data64) {
        staticSlotCount = staticSlotCount.add(ramClass.romClass().doubleScalarStaticCount());
    } else {
        staticSlotCount = staticSlotCount.add(1).bitAnd(~1L).add(ramClass.romClass().doubleScalarStaticCount().mult(2));
    }
    UDATA size = Scalar.convertSlotsToBytes(new UDATA(staticSlotCount));
    classWalkerCallback.addSection(clazz, ramClass.ramStatics(), size.longValue(), "Ram static", false);
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) U32(com.ibm.j9ddr.vm29.types.U32) J9_CP_DESCRIPTIONS_PER_U32(com.ibm.j9ddr.vm29.structure.J9ConstantPool.J9_CP_DESCRIPTIONS_PER_U32) UDATAPointer(com.ibm.j9ddr.vm29.pointer.UDATAPointer) J9ROMFieldShapePointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMFieldShapePointer) J9ObjectFieldOffset(com.ibm.j9ddr.vm29.j9.J9ObjectFieldOffset)

Example 28 with UDATA

use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.

the class ClassloadersSummaryCommand method getStat.

public Collection<ClassloadersSummaryNode> getStat() throws CorruptDataException {
    Map<J9ClassLoaderPointer, Counter> classloadersCount = new HashMap<J9ClassLoaderPointer, Counter>();
    J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
    GCClassLoaderIterator iterator = GCClassLoaderIterator.from();
    while (iterator.hasNext()) {
        J9ClassLoaderPointer classLoader = iterator.next();
        classloadersCount.put(classLoader, new Counter(0));
    }
    /* Iterate through all classes and count how many were loaded by each classLoader */
    ClassSegmentIterator classSegmentIterator = new ClassSegmentIterator(vm.classMemorySegments());
    while (classSegmentIterator.hasNext()) {
        J9ClassPointer classPointer = (J9ClassPointer) classSegmentIterator.next();
        Counter counter = classloadersCount.get(classPointer.classLoader());
        if (counter != null) {
            counter.addOne();
        } else {
            classloadersCount.put(classPointer.classLoader(), new Counter(1));
        }
    }
    J9ObjectPointer sys = vm.systemClassLoader().classLoaderObject();
    final UDATA valueROM = new UDATA(J9MemorySegment.MEMORY_TYPE_ROM_CLASS);
    final UDATA valueRAM = new UDATA(J9MemorySegment.MEMORY_TYPE_RAM_CLASS);
    Map<String, ClassloadersSummaryNode> classloaders = new LinkedHashMap<String, ClassloadersSummaryNode>();
    for (Map.Entry<J9ClassLoaderPointer, Counter> entry : classloadersCount.entrySet()) {
        J9ObjectPointer classLoaderObject = entry.getKey().classLoaderObject();
        boolean isSystem = classLoaderObject.equals(sys);
        String loader = isSystem ? "*System*" : J9ObjectHelper.getClassName(classLoaderObject);
        /*	For each classloader, iterate through each associated memory segment and identify whether it is  
			 * 	a ROM or a RAM type memory segment  */
        long romSegmentCount = 0;
        long ramSegmentCount = 0;
        long romSegmentAllocatedMem = 0;
        long ramSegmentAllocatedMem = 0;
        J9MemorySegmentPointer segment = entry.getKey().classSegments();
        while (segment.notNull()) {
            if ((segment.type().bitAnd(valueROM)).equals(valueROM)) {
                romSegmentCount += 1;
                romSegmentAllocatedMem += segment.size().longValue();
            } else if ((segment.type().bitAnd(valueRAM)).equals(valueRAM)) {
                ramSegmentCount += 1;
                ramSegmentAllocatedMem += segment.size().longValue();
            }
            segment = segment.nextSegmentInClassLoader();
        }
        ClassloadersSummaryNode cpentry = classloaders.get(loader);
        if (cpentry == null) {
            // If the classLoader is not in the list, add it with "# Classloaders = 1" and "# Loaded Classes = classesLoaded"
            classloaders.put(loader, new ClassloadersSummaryNode(loader, 1L, entry.getValue().getCount(), ramSegmentCount, romSegmentCount, romSegmentAllocatedMem, ramSegmentAllocatedMem));
        } else {
            // If the classLoader is in the list, increment "# Classloaders" by 1 and increment "# Loaded Classes" by classesLoaded
            cpentry.numClassloaders += 1;
            cpentry.numLoadedClasses += entry.getValue().getCount();
            cpentry.ramSegmentCounter += ramSegmentCount;
            cpentry.romSegmentCounter += romSegmentCount;
            cpentry.totalROMSegmentAllocatedMemory += romSegmentAllocatedMem;
            cpentry.totalRAMSegmentAllocatedMemory += ramSegmentAllocatedMem;
        }
    }
    return classloaders.values();
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) J9ClassLoaderPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer) GCClassLoaderIterator(com.ibm.j9ddr.vm29.j9.gc.GCClassLoaderIterator) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer) LinkedHashMap(java.util.LinkedHashMap) ClassSegmentIterator(com.ibm.j9ddr.vm29.j9.walkers.ClassSegmentIterator) UDATA(com.ibm.j9ddr.vm29.types.UDATA) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) J9MemorySegmentPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) TreeMap(java.util.TreeMap) Map(java.util.Map)

Example 29 with UDATA

use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.

the class WhatIsCommand method checkPointer.

private boolean checkPointer(SearchStack searchStack, AbstractPointer ptr) {
    UDATA cmpValue = UDATA.cast(ptr);
    if (searchValue.eq(cmpValue)) {
        if (++foundCount > skipCount) {
            out.print("Found " + searchValue.getHexValue() + " as " + ptr.formatShortInteractive() + ": ");
            searchStack.dump(out);
            out.println();
            return true;
        }
    } else {
        updateClosest(searchStack, cmpValue);
    }
    return false;
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA)

Example 30 with UDATA

use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.

the class WhatIsCommand method checkScalar.

private boolean checkScalar(SearchStack searchStack, Scalar s) {
    UDATA cmpValue = new UDATA(s);
    if (searchValue.eq(s)) {
        if (++foundCount > skipCount) {
            out.print("Found " + searchValue.getHexValue() + " as " + s + ": ");
            searchStack.dump(out);
            out.println();
            return true;
        }
    } else {
        updateClosest(searchStack, cmpValue);
    }
    return false;
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA)

Aggregations

UDATA (com.ibm.j9ddr.vm29.types.UDATA)86 CorruptDataException (com.ibm.j9ddr.CorruptDataException)22 U32 (com.ibm.j9ddr.vm29.types.U32)16 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)14 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)10 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)10 UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)9 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)8 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)8 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)7 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)6 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)5 J9ROMMethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer)4 U16 (com.ibm.j9ddr.vm29.types.U16)4 J9ObjectFieldOffset (com.ibm.j9ddr.vm29.j9.J9ObjectFieldOffset)3 GCHeapRegionDescriptor (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor)3 J9ArrayClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ArrayClassPointer)3 J9JITExceptionTablePointer (com.ibm.j9ddr.vm29.pointer.generated.J9JITExceptionTablePointer)3 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)3 IDATA (com.ibm.j9ddr.vm29.types.IDATA)3