- Loading...
...
If In this T-hash wins the race, then the ref_count will cause T-deflate to bail out on deflating the monitor. Note: header is not mentioned in any of the previous sections for simplicityscenario, the need for the "ref_count == 0" check in the third phase of the protocol is illustrated.
T-hash ObjectMonitor T-deflate
------------------------ +-----------------------+ ------------------------------------------
save_om_ptr() { | header=dmw_no_hash | deflate_monitor_using_JT() {
atomic inc ref_count | owner=DEFLATER_MARKER | cmpxchg(DEFLATER_MARKER, &owner, NULL)
if (owner == | contentions=0 | if (waiters != 0 || ref_count != 0) {
DEFLATER_MARKER && | ref_count=1 | }
contentions <= 0) { +-----------------------+ 1> prev = cmpxchg(-max_jint, &contentions, 0)
} || 2> if (prev == 0 &&
1> if (object no longer \/ owner == DEFLATER_MARKER &&
has a monitor or +-----------------------+ ref_count == 0) {
is a different | header=dmw_no_hash | cmpxchg(NULL, &owner, DEFLATER_MARKER)
monitor) { | owner=DEFLATER_MARKER | atomic add max_jint to contentions
atomic dec ref_count | contentions=-max_jint | 3> bailout on deflation
return false to | ref_count=1 | }
cause a retry +-----------------------+
} ||
2> save om_ptr in the \/
ObjectMonitorHandle +-----------------------+
} | header=dmw_hash |
if save_om_ptr() { | owner=NULL |
if no hash | contentions=0 |
gen hash & merge | ref_count=1 |
hash = hash(header) +-----------------------+
}
3> atomic dec ref_count
return hash
...