< prev index next > src/hotspot/cpu/riscv/c1_MacroAssembler_riscv.cpp
Print this page
lwu(hdr, Address(hdr, Klass::access_flags_offset()));
test_bit(temp, hdr, exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS));
bnez(temp, slow_case, true /* is_far */);
}
- // Load object header
- ld(hdr, Address(obj, hdr_offset));
-
if (LockingMode == LM_LIGHTWEIGHT) {
lightweight_lock(obj, hdr, temp, t1, slow_case);
} else if (LockingMode == LM_LEGACY) {
Label done;
// and mark it as unlocked
ori(hdr, hdr, markWord::unlocked_value);
// save unlocked object header into the displaced header location on the stack
sd(hdr, Address(disp_hdr, 0));
// test if object header is still the same (i.e. unlocked), and if so, store the
lwu(hdr, Address(hdr, Klass::access_flags_offset()));
test_bit(temp, hdr, exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS));
bnez(temp, slow_case, true /* is_far */);
}
if (LockingMode == LM_LIGHTWEIGHT) {
lightweight_lock(obj, hdr, temp, t1, slow_case);
} else if (LockingMode == LM_LEGACY) {
Label done;
+ // Load object header
+ ld(hdr, Address(obj, hdr_offset));
// and mark it as unlocked
ori(hdr, hdr, markWord::unlocked_value);
// save unlocked object header into the displaced header location on the stack
sd(hdr, Address(disp_hdr, 0));
// test if object header is still the same (i.e. unlocked), and if so, store the
// load object
ld(obj, Address(disp_hdr, BasicObjectLock::obj_offset()));
verify_oop(obj);
if (LockingMode == LM_LIGHTWEIGHT) {
- ld(hdr, Address(obj, oopDesc::mark_offset_in_bytes()));
- test_bit(temp, hdr, exact_log2(markWord::monitor_value));
- bnez(temp, slow_case, /* is_far */ true);
lightweight_unlock(obj, hdr, temp, t1, slow_case);
} else if (LockingMode == LM_LEGACY) {
// test if object header is pointing to the displaced header, and if so, restore
// the displaced header in the object - if the object header is not pointing to
// the displaced header, get the object header instead
sd(klass, Address(obj, oopDesc::klass_offset_in_bytes()));
}
if (len->is_valid()) {
sw(len, Address(obj, arrayOopDesc::length_offset_in_bytes()));
+ if (!is_aligned(arrayOopDesc::header_size_in_bytes(), BytesPerWord)) {
+ assert(is_aligned(arrayOopDesc::header_size_in_bytes(), BytesPerInt), "must be 4-byte aligned");
+ sw(zr, Address(obj, arrayOopDesc::header_size_in_bytes()));
+ }
} else if (UseCompressedClassPointers) {
store_klass_gap(obj, zr);
}
}
}
verify_oop(obj);
}
! void C1_MacroAssembler::allocate_array(Register obj, Register len, Register tmp1, Register tmp2, int header_size, int f, Register klass, Label& slow_case) {
assert_different_registers(obj, len, tmp1, tmp2, klass);
// determine alignment mask
assert(!(BytesPerWord & 1), "must be multiple of 2 for masking code to work");
}
verify_oop(obj);
}
! void C1_MacroAssembler::allocate_array(Register obj, Register len, Register tmp1, Register tmp2, int base_offset_in_bytes, int f, Register klass, Label& slow_case) {
assert_different_registers(obj, len, tmp1, tmp2, klass);
// determine alignment mask
assert(!(BytesPerWord & 1), "must be multiple of 2 for masking code to work");
mv(t0, (int32_t)max_array_allocation_length);
bgeu(len, t0, slow_case, /* is_far */ true);
const Register arr_size = tmp2; // okay to be the same
// align object end
! mv(arr_size, (int32_t)header_size * BytesPerWord + MinObjAlignmentInBytesMask);
shadd(arr_size, len, arr_size, t0, f);
andi(arr_size, arr_size, ~(uint)MinObjAlignmentInBytesMask);
try_allocate(obj, arr_size, 0, tmp1, tmp2, slow_case);
initialize_header(obj, klass, len, tmp1, tmp2);
// clear rest of allocated space
const Register len_zero = len;
! initialize_body(obj, arr_size, header_size * BytesPerWord, len_zero);
membar(MacroAssembler::StoreStore);
if (CURRENT_ENV->dtrace_alloc_probes()) {
assert(obj == x10, "must be");
mv(t0, (int32_t)max_array_allocation_length);
bgeu(len, t0, slow_case, /* is_far */ true);
const Register arr_size = tmp2; // okay to be the same
// align object end
! mv(arr_size, (int32_t)base_offset_in_bytes + MinObjAlignmentInBytesMask);
shadd(arr_size, len, arr_size, t0, f);
andi(arr_size, arr_size, ~(uint)MinObjAlignmentInBytesMask);
try_allocate(obj, arr_size, 0, tmp1, tmp2, slow_case);
initialize_header(obj, klass, len, tmp1, tmp2);
// clear rest of allocated space
const Register len_zero = len;
! // We align-up the header size to word-size, because we clear the
+ // possible alignment gap in initialize_header().
+ int hdr_size = align_up(base_offset_in_bytes, BytesPerWord);
+ initialize_body(obj, arr_size, hdr_size, len_zero);
membar(MacroAssembler::StoreStore);
if (CURRENT_ENV->dtrace_alloc_probes()) {
assert(obj == x10, "must be");
< prev index next >