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);
}
}
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();
}
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;
}
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());
}
}
}
}
}
}
}
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);
}
}
Aggregations