use of com.ibm.j9ddr.vm29.pointer.generated.J9MonitorTableListEntryPointer in project openj9 by eclipse.
the class MonitorsCommand method tableCommand.
/**
* See {@link MonitorsCommand#helpCommand(String[], PrintStream)} for
* function documentation
*
* @param args
* command args
* @param out
* the output stream
* @throws DDRInteractiveCommandException
*/
private void tableCommand(String[] args, PrintStream out) throws DDRInteractiveCommandException {
FilterOptions filter = FilterOptions.defaultOption();
if (args.length > 2) {
filter = FilterOptions.parseOption(args[2]);
} else if (args.length == 2) {
out.println("No filter specified, defaulting to 'active' monitors.");
} else if (args.length < 2) {
out.println("This command takes one address argument: \"!monitors table <address>\"");
return;
}
try {
StringBuilder builder = new StringBuilder();
long address = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
VoidPointer ptr = VoidPointer.cast(address);
MonitorTableListIterator iterator = new MonitorTableListIterator();
boolean foundTable = false;
while (iterator.hasNext()) {
J9ObjectMonitorPointer objectMonitorPointer = iterator.next();
MonitorTable currentMonitorTable = iterator.currentMonitorTable();
if (currentMonitorTable.getMonitorTableListEntryPointer().equals(ptr)) {
tablePrintHelper(filter, builder, objectMonitorPointer);
foundTable = true;
}
}
out.append(builder);
if (false == foundTable) {
out.append(String.format("Could not find any J9MonitorTableListEntryPointer at address %s\n", ptr.getHexAddress()));
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9MonitorTableListEntryPointer 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;
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9MonitorTableListEntryPointer in project openj9 by eclipse.
the class MonitorTableListIterator method hasNext.
/**
* @see SlotIterator
*/
public boolean hasNext() {
while (true) {
if (localIterator.hasNext()) {
return true;
} else {
J9MonitorTableListEntryPointer entry = currentMonitorTable.getMonitorTableListEntryPointer();
try {
entry = entry.next();
if (entry.notNull()) {
currentMonitorTable = MonitorTable.from(entry);
localIterator = currentMonitorTable.iterator();
} else {
return false;
}
} catch (CorruptDataException e) {
e.printStackTrace();
return false;
}
}
}
}
Aggregations