// refer to JvmtiEnv::GetObjectMonitorUsage
private void computeMonitorInfo() {
monitorInfoCached = true;
Mark mark = saObject.getMark();
ObjectMonitor mon = null;
Address owner = null;
// check for heavyweight monitor
if (! mark.hasMonitor()) {
// check for lightweight monitor
if (mark.hasLocker()) {
owner = mark.locker().getAddress(); // save the address of the Lock word
}
// implied else: no owner
} else {
// this object has a heavyweight monitor
mon = mark.monitor();
// The owner field of a heavyweight monitor may be NULL for no
// owner, a JavaThread * or it may still be the address of the
// Lock word in a JavaThread's stack. A monitor can be inflated
// by a non-owning JavaThread, but only the owning JavaThread
// can change the owner field from the Lock word to the
// JavaThread * and it may not have done that yet.
owner = mon.owner();
}
// find the owning thread
if (owner != null) {
owningThread = vm.threadMirror(owningThreadFromMonitor(owner));