use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.
the class GCVMThreadMonitorRecordSlotIterator method next.
public J9ObjectPointer next() {
if (hasNext()) {
try {
J9ObjectPointer next;
if (monitorRecord.notNull()) {
next = monitorRecord.object();
monitorRecord = monitorRecord.next();
} else {
next = jniMonitorRecord.object();
jniMonitorRecord = jniMonitorRecord.next();
}
return next;
} catch (CorruptDataException e) {
// can try to recover from this
raiseCorruptDataEvent("Error getting next item", e, false);
return null;
}
} else {
throw new NoSuchElementException("There are no more items available through this iterator");
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.
the class MonitorIterator method threadPoolHasNext.
private boolean threadPoolHasNext() throws CorruptDataException {
while ((current == null) && pool.notNull()) {
while (index < poolSize) {
J9ThreadMonitorPointer monitor = J9ThreadMonitorPointer.cast(poolEntries.add(index));
index++;
if (freeTag != monitor.count().longValue()) {
J9ThreadAbstractMonitorPointer lock = J9ThreadAbstractMonitorPointer.cast(monitor);
if (lock.flags().allBitsIn(J9ThreadAbstractMonitor.J9THREAD_MONITOR_OBJECT)) {
if (!lock.userData().eq(0)) {
// this is an object monitor in the system monitor table
J9ObjectPointer obj = J9ObjectPointer.cast(lock.userData());
ObjectMonitor objmon = ObjectAccessBarrier.getMonitor(obj);
// This check is to exclude flat object monitors. Flat object monitors are accounted for during the heap walk
if ((objmon == null) || !objmon.isInflated()) {
continue;
}
// return an object monitor
current = objmon;
}
} else {
// return a system monitor
current = monitor;
}
if (log.isLoggable(Level.FINE)) {
log.fine(String.format("Found monitor @ 0x%016x : %s", monitor.getAddress(), monitor.name().getCStringAtOffset(0)));
}
return true;
}
}
pool = pool.next();
if (pool.notNull()) {
index = 0;
poolEntries = pool.entriesEA();
}
}
return pool.notNull();
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.
the class J9IndexableObjectHelper method getDataAsString.
public static String getDataAsString(J9IndexableObjectPointer array, int dumpLimit, int characterDumpLimit) throws CorruptDataException {
StringWriter buf = new StringWriter();
J9ClassPointer clazz = J9ObjectHelper.clazz(J9ObjectPointer.cast(array));
char typeChar = J9ClassHelper.getName(clazz).charAt(1);
int length = J9IndexableObjectHelper.size(array).intValue();
int limit = 0;
if (typeChar != 'C') {
limit = dumpLimit;
} else {
limit = characterDumpLimit;
}
buf.write("{ ");
int i;
for (i = 0; i < Math.min(length, limit); i++) {
Object data = J9IndexableObjectHelper.getData(array);
switch(typeChar) {
case 'B':
buf.write("0x");
buf.write(Integer.toHexString(((byte[]) data)[i]));
break;
case 'C':
char ch = ((char[]) data)[i];
if (ch > 31 && ch < 127) {
buf.write(ch);
} else {
buf.write('?');
}
break;
case 'D':
buf.write(Double.toString(((double[]) data)[i]));
break;
case 'F':
buf.write(Float.toString(((float[]) data)[i]));
break;
case 'I':
buf.write("0x");
buf.write(Integer.toHexString(((int[]) data)[i]));
break;
case 'J':
buf.write("0x");
buf.write(Long.toHexString(((long[]) data)[i]));
break;
case 'S':
buf.write("0x");
buf.write(Integer.toHexString(((short[]) data)[i]));
break;
case 'Z':
buf.write(((boolean[]) data)[i] ? "true" : "false");
break;
case 'L':
case '[':
{
J9ObjectPointer item = ((J9ObjectPointer[]) data)[i];
if (null == item) {
buf.write("null");
} else {
buf.write("0x");
buf.write(Long.toHexString(item.longValue()));
}
break;
}
default:
buf.write("?");
}
if (typeChar != 'C' && (i != length - 1)) {
/* We aren't printing out a character and we aren't the last element */
buf.write(", ");
}
}
if (i != length) {
/* We hit the limit */
buf.write("... ");
}
buf.write(" }");
return buf.toString();
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.
the class J9ObjectHelper method getFieldOffset.
private static J9ObjectFieldOffset getFieldOffset(J9ObjectPointer objPointer, String name, String signature) throws CorruptDataException {
J9ObjectFieldOffset result = J9ClassHelper.checkFieldOffsetCache(J9ObjectHelper.clazz(objPointer), name, signature);
if (result == null) {
result = readFieldOffset(objPointer, name, signature);
J9ClassHelper.setFieldOffsetCache(J9ObjectHelper.clazz(objPointer), result, name, signature);
}
return result;
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.
the class J9ObjectHelper method readFieldOffset.
// FIXME: Probably want to cache the entire class hierarchy the 1st time through for any field
private static J9ObjectFieldOffset readFieldOffset(J9ObjectPointer objPointer, String name, String signature) throws CorruptDataException {
J9ClassPointer currentClass = J9ObjectHelper.clazz(objPointer);
while (currentClass.notNull()) {
Iterator<J9ObjectFieldOffset> fields = J9ClassHelper.getFieldOffsets(currentClass);
while (fields.hasNext()) {
J9ObjectFieldOffset field = (J9ObjectFieldOffset) fields.next();
if (field.getName().equals(name) && field.getSignature().equals(signature)) {
return field;
}
}
currentClass = J9ClassHelper.superclass(currentClass);
}
throw new NoSuchElementException(String.format("No field named %s with signature %s in %s", name, signature, J9ObjectHelper.getClassName(objPointer)));
}
Aggregations