- Loading...
...
ObjectMonitor T-deflate
T-enter +-----------------------+ --------------------------------------------
------------------------------- | owner=DEFLATER_MARKER | deflate_monitor_using_JT() {
owner contended | contentions=-max_jint | cmpxchg(DEFLATER_MARKER, &owner, NULL)
atomic inc contentions +-----------------------+ :
if (contentions <= 0 && owner prev = cmpxchg(-max_jint, &contentions, 0)
owner == DEFLATER_MARKER) { if (prev == 0 &&
restore obj header header owner == DEFLATER_MARKER) {
retry enter restore obj header
} finish the deflation
}
ObjectMonitor T-deflate
T-enter +-----------------------+ --------------------------------------------
---------------------- --------- | owner=DEFLATER_MARKER | deflate_monitor_using_JT() {
owner contended | contentions=1 | cmpxchg(DEFLATER_MARKER, &owner, NULL)
atomic inc contentions +-----------------------+ :
if (contentions ><= 0) && prev = cmpxchg(-max_jint, &contentions, 0)
do contended owner == DEFLATER_MARKER) { if (prev if (prev == 0 &&
} else { enter work owner == DEFLATER_MARKER) {
do contended } else {
enter work cmpxchg(NULL, &owner, DEFLATER_MARKER)
...
ObjectMonitor T-deflate
T-enter +-------------------------+ ------------------------------------------
------------------------------------------ | owner=DEFLATER_MARKER | deflate_monitor_using_JT() {
owner contended | contentions=1 | cmpxchg(DEFLATER_MARKER, &owner, NULL)
atomic inc contentions +-------------------------+ 1> :
1> if (contentions ><= 0) && || 2> : <thread_stalls>
EnterI() owner == DEFLATER_MARKER) { \/ :
} else { \/ :
cmpxchg(Self, &owner, DEFLATER_MARKER) +-------------------------+ :
atomicEnterI() dec contentions | owner=Self/T-enter | :
2> }| owner=Self/T-enter | :
cmpxchg(Self, &owner, DEFLATER_MARKER) | contentions=0 | : <thread_resumes>
// finished withatomic enterdec contentions +-------------------------+ prev = cmpxchg(-max_jint, &contentions, 0)
3> : <does app work>2> } || if (prev == 0 &&
exit() monitor // finished with enter \/ owner == DEFLATER_MARKER) {
3> : <does app owner =work> NULL +-------------------------+ } else {
exit() monitor | owner=Self/T-enter|NULL | cmpxchg(NULL, &owner, DEFLATER_MARKER)
owner = NULL | contentions=0 | atomic add max_jint to contentions
+-------------------------+ 3> bailout on deflation
}
...