Search in sources :

Example 1 with U8

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

the class GCCardTable method cleanRange.

public void cleanRange(U8Pointer lowCard, U8Pointer highCard, GCCardCleaner cardCleaner) throws CorruptDataException {
    U8Pointer thisCard = lowCard;
    U8Pointer endCard = highCard;
    while (thisCard.lt(endCard)) {
        try {
            U8 card = thisCard.at(0);
            if (!card.eq(J9ModroncoreConstants.CARD_CLEAN)) {
                VoidPointer lowAddress = cardAddrToHeapAddr(thisCard);
                VoidPointer highAddress = lowAddress.addOffset(J9ModroncoreConstants.CARD_SIZE);
                cardCleaner.clean(lowAddress, highAddress, thisCard);
            }
        } catch (CorruptDataException cde) {
            raiseCorruptDataEvent("Corrupt Card", cde, false);
        }
        thisCard = thisCard.add(1);
    }
}
Also used : U8(com.ibm.j9ddr.vm29.types.U8) VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 2 with U8

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

the class ThreadsCommand method getThreadName.

public static String getThreadName(J9VMThreadPointer thread) throws CorruptDataException {
    U8Pointer threadName = thread.omrVMThread().threadName();
    StringBuffer sb = new StringBuffer();
    if (threadName.isNull()) {
        sb.append("<NULL>");
    } else {
        while (!threadName.at(0).eq(0)) {
            U8 at = threadName.at(0);
            sb.append((char) at.intValue());
            threadName = threadName.add(1);
        }
    }
    return sb.toString();
}
Also used : U8(com.ibm.j9ddr.vm29.types.U8) U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer)

Example 3 with U8

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

the class ByteCodeDumper method _GETNEXT_U8.

private static U8 _GETNEXT_U8() throws CorruptDataException {
    U8 result = new U8(bcIndex.at(0));
    incIndex();
    return result;
}
Also used : U8(com.ibm.j9ddr.vm29.types.U8)

Example 4 with U8

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

the class J9BCUtil method dumpSourceDebugExtension.

private static void dumpSourceDebugExtension(PrintStream out, J9ROMClassPointer romClass, long flags) throws CorruptDataException {
    if (J9BuildFlags.opt_debugInfoServer) {
        U8Pointer current;
        U32 temp;
        if ((flags & J9BCTranslationData.BCT_StripDebugAttributes) == 0) {
            J9SourceDebugExtensionPointer sde = OptInfo.getSourceDebugExtensionForROMClass(romClass);
            if (!sde.isNull()) {
                temp = sde.size();
                if (!temp.eq(0)) {
                    current = U8Pointer.cast(sde.add(1));
                    out.append(String.format("  Source debug extension (%d bytes):    ", temp.longValue()));
                    out.append(nl);
                    while (!temp.eq(0)) {
                        temp = temp.sub(1);
                        U8 c = current.at(0);
                        current = current.add(1);
                        if (c.eq('\015')) {
                            if (!temp.eq(0)) {
                                if (current.at(0).eq('\012')) {
                                    current = current.add(1);
                                }
                                out.append(nl + "    ");
                            }
                        } else if (c.eq('\012')) {
                            out.append(nl + "    ");
                        } else {
                            out.append((char) c.intValue());
                        }
                    }
                }
            }
        }
    }
}
Also used : J9SourceDebugExtensionPointer(com.ibm.j9ddr.vm29.pointer.generated.J9SourceDebugExtensionPointer) U8(com.ibm.j9ddr.vm29.types.U8) U32(com.ibm.j9ddr.vm29.types.U32) U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer)

Example 5 with U8

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

the class VmCheckCommand method decodeUTF8CharN.

/**
 * Decode the UTF8 character.
 *
 * Decode the input UTF8 character and stores it into result.
 *
 * @param[in] input The UTF8 character
 * @param[out] result buffer for unicode characters
 * @param[in] bytesRemaining number of bytes remaining in input
 *
 * @return The number of UTF8 characters consumed (1,2,3) on success, 0 on
 *         failure
 * @throws CorruptDataException
 * @note Don't read more than bytesRemaining characters.
 * @note If morecharacters are required to fully decode the character,
 *       return failure
 */
U32 decodeUTF8CharN(U8Pointer input, /**
 * not used *
 */
U16 result, UDATA bytesRemaining) throws CorruptDataException {
    U8 c;
    U8Pointer cursor = input;
    if (bytesRemaining.longValue() < 1) {
        return new U32(0);
    }
    c = cursor.at(0);
    cursor = cursor.add(1);
    if (c.eq(0x0)) {
        /* illegal NUL encoding */
        return new U32(0);
    } else if ((c.bitAnd(0x80)).eq(0x0)) {
        // *result = (U_16)c;
        return new U32(1);
    } else if (c.bitAnd(0xE0).eq(0xC0)) {
        /* two byte encoding */
        U16 unicodeC;
        if (bytesRemaining.lt(2)) {
            return new U32(0);
        }
        unicodeC = new U16(c.bitAnd(0x1F).leftShift(6));
        c = cursor.at(0);
        cursor = cursor.add(1);
        unicodeC = unicodeC.add(new U16(unicodeC.add(c.bitAnd(0x3F))));
        if (!c.bitAnd(0xC0).eq(0x80)) {
            return new U32(0);
        }
        // *result = unicodeC;
        return new U32(2);
    } else if (c.bitAnd(0xF0).eq(0xE0)) {
        /* three byte encoding */
        U16 unicodeC;
        if (bytesRemaining.lt(3)) {
            return new U32(0);
        }
        unicodeC = new U16(c.bitAnd(0x0F).leftShift(12));
        c = cursor.at(0);
        cursor = cursor.add(1);
        unicodeC = unicodeC.add(new U16(c.bitAnd(0x3F).leftShift(6)));
        if (!c.bitAnd(0xC0).eq(0x80)) {
            return new U32(0);
        }
        c = cursor.at(0);
        cursor = cursor.add(1);
        unicodeC = unicodeC.add(new U16(c.bitAnd(0x3F)));
        if (!c.bitAnd(0xC0).eq(0x80)) {
            return new U32(0);
        }
        // *result = unicodeC;
        return new U32(3);
    } else {
        return new U32(0);
    }
}
Also used : U8(com.ibm.j9ddr.vm29.types.U8) U32(com.ibm.j9ddr.vm29.types.U32) U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer) U16(com.ibm.j9ddr.vm29.types.U16)

Aggregations

U8 (com.ibm.j9ddr.vm29.types.U8)8 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)6 U32 (com.ibm.j9ddr.vm29.types.U32)3 CorruptDataException (com.ibm.j9ddr.CorruptDataException)2 J9ROMMethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer)2 U16 (com.ibm.j9ddr.vm29.types.U16)2 UDATA (com.ibm.j9ddr.vm29.types.UDATA)2 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)1 SelfRelativePointer (com.ibm.j9ddr.vm29.pointer.SelfRelativePointer)1 U16Pointer (com.ibm.j9ddr.vm29.pointer.U16Pointer)1 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)1 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)1 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)1 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)1 J9ROMClassRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassRefPointer)1 J9ROMConstantPoolItemPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMConstantPoolItemPointer)1 J9ROMFieldRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMFieldRefPointer)1 J9ROMMethodRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodRefPointer)1 J9ROMNameAndSignaturePointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMNameAndSignaturePointer)1 J9ROMSingleSlotConstantRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMSingleSlotConstantRefPointer)1