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