< prev index next >

src/hotspot/cpu/s390/macroAssembler_s390.cpp

Print this page

3249     // result zero: owner is self -> recursive lock. Indicate that by storing 0 in the box.
3250     // result not-zero: attempt failed. We don't hold the lock -> go for slow case.
3251 
3252     z_stg(currentHeader/*==0 or not 0*/, BasicLock::displaced_header_offset_in_bytes(), box);
3253 
3254     z_bru(done);
3255   } else {
3256     assert(LockingMode == LM_LIGHTWEIGHT, "must be");
3257     lightweight_lock(oop, displacedHeader, temp, done);
3258     z_bru(done);
3259   }
3260 
3261   bind(object_has_monitor);
3262 
3263   Register zero = temp;
3264   Register monitor_tagged = displacedHeader; // Tagged with markWord::monitor_value.
3265   // The object's monitor m is unlocked iff m->owner is null,
3266   // otherwise m->owner may contain a thread or a stack address.
3267 
3268   // Try to CAS m->owner from null to current thread.
3269   // If m->owner is null, then csg succeeds and sets m->owner=THREAD and CR=EQ.
3270   // Otherwise, register zero is filled with the current owner.
3271   z_lghi(zero, 0);

3272   z_csg(zero, Z_thread, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), monitor_tagged);
3273   if (LockingMode != LM_LIGHTWEIGHT) {
3274     // Store a non-null value into the box.
3275     z_stg(box, BasicLock::displaced_header_offset_in_bytes(), box);
3276   }
3277 
3278   z_bre(done); // acquired the lock for the first time.
3279 
3280   BLOCK_COMMENT("fast_path_recursive_lock {");
3281   // Check if we are already the owner (recursive lock)
3282   z_cgr(Z_thread, zero); // owner is stored in zero by "z_csg" above
3283   z_brne(done); // not a recursive lock
3284 
3285   // Current thread already owns the lock. Just increment recursion count.
3286   z_agsi(Address(monitor_tagged, OM_OFFSET_NO_MONITOR_VALUE_TAG(recursions)), 1ll);
3287   z_cgr(zero, zero); // set the CC to EQUAL
3288   BLOCK_COMMENT("} fast_path_recursive_lock");
3289   bind(done);
3290 
3291   BLOCK_COMMENT("} compiler_fast_lock_object");

3249     // result zero: owner is self -> recursive lock. Indicate that by storing 0 in the box.
3250     // result not-zero: attempt failed. We don't hold the lock -> go for slow case.
3251 
3252     z_stg(currentHeader/*==0 or not 0*/, BasicLock::displaced_header_offset_in_bytes(), box);
3253 
3254     z_bru(done);
3255   } else {
3256     assert(LockingMode == LM_LIGHTWEIGHT, "must be");
3257     lightweight_lock(oop, displacedHeader, temp, done);
3258     z_bru(done);
3259   }
3260 
3261   bind(object_has_monitor);
3262 
3263   Register zero = temp;
3264   Register monitor_tagged = displacedHeader; // Tagged with markWord::monitor_value.
3265   // The object's monitor m is unlocked iff m->owner is null,
3266   // otherwise m->owner may contain a thread or a stack address.
3267 
3268   // Try to CAS m->owner from null to current thread.
3269   // If m->owner is null, then csg succeeds and sets m->owner=THREAD_ID and CR=EQ.
3270   // Otherwise, register zero is filled with the current owner.
3271   z_lghi(zero, 0);
3272   z_csg(zero, Z_R1_scratch, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), monitor_tagged);
3273   z_csg(zero, Z_thread, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), monitor_tagged);
3274   if (LockingMode != LM_LIGHTWEIGHT) {
3275     // Store a non-null value into the box.
3276     z_stg(box, BasicLock::displaced_header_offset_in_bytes(), box);
3277   }
3278 
3279   z_bre(done); // acquired the lock for the first time.
3280 
3281   BLOCK_COMMENT("fast_path_recursive_lock {");
3282   // Check if we are already the owner (recursive lock)
3283   z_cgr(Z_thread, zero); // owner is stored in zero by "z_csg" above
3284   z_brne(done); // not a recursive lock
3285 
3286   // Current thread already owns the lock. Just increment recursion count.
3287   z_agsi(Address(monitor_tagged, OM_OFFSET_NO_MONITOR_VALUE_TAG(recursions)), 1ll);
3288   z_cgr(zero, zero); // set the CC to EQUAL
3289   BLOCK_COMMENT("} fast_path_recursive_lock");
3290   bind(done);
3291 
3292   BLOCK_COMMENT("} compiler_fast_lock_object");
< prev index next >