3034 Register temp2_reg, |
3034 Register temp2_reg, |
3035 Label* L_success, |
3035 Label* L_success, |
3036 Label* L_failure, |
3036 Label* L_failure, |
3037 Label* L_slow_path, |
3037 Label* L_slow_path, |
3038 RegisterOrConstant super_check_offset) { |
3038 RegisterOrConstant super_check_offset) { |
3039 int sc_offset = (klassOopDesc::header_size() * HeapWordSize + |
3039 int sc_offset = in_bytes(Klass::secondary_super_cache_offset()); |
3040 Klass::secondary_super_cache_offset_in_bytes()); |
3040 int sco_offset = in_bytes(Klass::super_check_offset_offset()); |
3041 int sco_offset = (klassOopDesc::header_size() * HeapWordSize + |
|
3042 Klass::super_check_offset_offset_in_bytes()); |
|
3043 |
3041 |
3044 bool must_load_sco = (super_check_offset.constant_or_zero() == -1); |
3042 bool must_load_sco = (super_check_offset.constant_or_zero() == -1); |
3045 bool need_slow_path = (must_load_sco || |
3043 bool need_slow_path = (must_load_sco || |
3046 super_check_offset.constant_or_zero() == sco_offset); |
3044 super_check_offset.constant_or_zero() == sco_offset); |
3047 |
3045 |
3157 if (L_success == NULL) { L_success = &L_fallthrough; label_nulls++; } |
3155 if (L_success == NULL) { L_success = &L_fallthrough; label_nulls++; } |
3158 if (L_failure == NULL) { L_failure = &L_fallthrough; label_nulls++; } |
3156 if (L_failure == NULL) { L_failure = &L_fallthrough; label_nulls++; } |
3159 assert(label_nulls <= 1, "at most one NULL in the batch"); |
3157 assert(label_nulls <= 1, "at most one NULL in the batch"); |
3160 |
3158 |
3161 // a couple of useful fields in sub_klass: |
3159 // a couple of useful fields in sub_klass: |
3162 int ss_offset = (klassOopDesc::header_size() * HeapWordSize + |
3160 int ss_offset = in_bytes(Klass::secondary_supers_offset()); |
3163 Klass::secondary_supers_offset_in_bytes()); |
3161 int sc_offset = in_bytes(Klass::secondary_super_cache_offset()); |
3164 int sc_offset = (klassOopDesc::header_size() * HeapWordSize + |
|
3165 Klass::secondary_super_cache_offset_in_bytes()); |
|
3166 |
3162 |
3167 // Do a linear scan of the secondary super-klass chain. |
3163 // Do a linear scan of the secondary super-klass chain. |
3168 // This code is rarely used, so simplicity is a virtue here. |
3164 // This code is rarely used, so simplicity is a virtue here. |
3169 |
3165 |
3170 #ifndef PRODUCT |
3166 #ifndef PRODUCT |
3334 assert(markOopDesc::age_shift == markOopDesc::lock_bits + markOopDesc::biased_lock_bits, "biased locking makes assumptions about bit layout"); |
3330 assert(markOopDesc::age_shift == markOopDesc::lock_bits + markOopDesc::biased_lock_bits, "biased locking makes assumptions about bit layout"); |
3335 and3(mark_reg, markOopDesc::biased_lock_mask_in_place, temp_reg); |
3331 and3(mark_reg, markOopDesc::biased_lock_mask_in_place, temp_reg); |
3336 cmp_and_brx_short(temp_reg, markOopDesc::biased_lock_pattern, Assembler::notEqual, Assembler::pn, cas_label); |
3332 cmp_and_brx_short(temp_reg, markOopDesc::biased_lock_pattern, Assembler::notEqual, Assembler::pn, cas_label); |
3337 |
3333 |
3338 load_klass(obj_reg, temp_reg); |
3334 load_klass(obj_reg, temp_reg); |
3339 ld_ptr(Address(temp_reg, Klass::prototype_header_offset_in_bytes() + klassOopDesc::klass_part_offset_in_bytes()), temp_reg); |
3335 ld_ptr(Address(temp_reg, Klass::prototype_header_offset()), temp_reg); |
3340 or3(G2_thread, temp_reg, temp_reg); |
3336 or3(G2_thread, temp_reg, temp_reg); |
3341 xor3(mark_reg, temp_reg, temp_reg); |
3337 xor3(mark_reg, temp_reg, temp_reg); |
3342 andcc(temp_reg, ~((int) markOopDesc::age_mask_in_place), temp_reg); |
3338 andcc(temp_reg, ~((int) markOopDesc::age_mask_in_place), temp_reg); |
3343 if (counters != NULL) { |
3339 if (counters != NULL) { |
3344 cond_inc(Assembler::equal, (address) counters->biased_lock_entry_count_addr(), mark_reg, temp_reg); |
3340 cond_inc(Assembler::equal, (address) counters->biased_lock_entry_count_addr(), mark_reg, temp_reg); |
3411 // the bias from one thread to another directly in this situation. |
3407 // the bias from one thread to another directly in this situation. |
3412 // |
3408 // |
3413 // FIXME: due to a lack of registers we currently blow away the age |
3409 // FIXME: due to a lack of registers we currently blow away the age |
3414 // bits in this situation. Should attempt to preserve them. |
3410 // bits in this situation. Should attempt to preserve them. |
3415 load_klass(obj_reg, temp_reg); |
3411 load_klass(obj_reg, temp_reg); |
3416 ld_ptr(Address(temp_reg, Klass::prototype_header_offset_in_bytes() + klassOopDesc::klass_part_offset_in_bytes()), temp_reg); |
3412 ld_ptr(Address(temp_reg, Klass::prototype_header_offset()), temp_reg); |
3417 or3(G2_thread, temp_reg, temp_reg); |
3413 or3(G2_thread, temp_reg, temp_reg); |
3418 casn(mark_addr.base(), mark_reg, temp_reg); |
3414 casn(mark_addr.base(), mark_reg, temp_reg); |
3419 // If the biasing toward our thread failed, this means that |
3415 // If the biasing toward our thread failed, this means that |
3420 // another thread succeeded in biasing it toward itself and we |
3416 // another thread succeeded in biasing it toward itself and we |
3421 // need to revoke that bias. The revocation will occur in the |
3417 // need to revoke that bias. The revocation will occur in the |
3441 // normal locking code. |
3437 // normal locking code. |
3442 // |
3438 // |
3443 // FIXME: due to a lack of registers we currently blow away the age |
3439 // FIXME: due to a lack of registers we currently blow away the age |
3444 // bits in this situation. Should attempt to preserve them. |
3440 // bits in this situation. Should attempt to preserve them. |
3445 load_klass(obj_reg, temp_reg); |
3441 load_klass(obj_reg, temp_reg); |
3446 ld_ptr(Address(temp_reg, Klass::prototype_header_offset_in_bytes() + klassOopDesc::klass_part_offset_in_bytes()), temp_reg); |
3442 ld_ptr(Address(temp_reg, Klass::prototype_header_offset()), temp_reg); |
3447 casn(mark_addr.base(), mark_reg, temp_reg); |
3443 casn(mark_addr.base(), mark_reg, temp_reg); |
3448 // Fall through to the normal CAS-based lock, because no matter what |
3444 // Fall through to the normal CAS-based lock, because no matter what |
3449 // the result of the above CAS, some thread must have succeeded in |
3445 // the result of the above CAS, some thread must have succeeded in |
3450 // removing the bias bit from the object's header. |
3446 // removing the bias bit from the object's header. |
3451 if (counters != NULL) { |
3447 if (counters != NULL) { |