src/cpu/x86/vm/c1_MacroAssembler_x86.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
8086053-search Cdiff src/cpu/x86/vm/c1_MacroAssembler_x86.cpp
src/cpu/x86/vm/c1_MacroAssembler_x86.cpp
Print this page
*** 180,237 ****
}
// preserves obj, destroys len_in_bytes
void C1_MacroAssembler::initialize_body(Register obj, Register len_in_bytes, int hdr_size_in_bytes, Register t1) {
Label done;
- assert(obj != len_in_bytes && obj != t1 && t1 != len_in_bytes, "registers must be different");
- assert((hdr_size_in_bytes & (BytesPerWord - 1)) == 0, "header size is not a multiple of BytesPerWord");
- Register index = len_in_bytes;
- // index is positive and ptr sized
- subptr(index, hdr_size_in_bytes);
- jcc(Assembler::zero, done);
- // initialize topmost word, divide index by 2, check if odd and test if zero
- // note: for the remaining code to work, index must be a multiple of BytesPerWord
- #ifdef ASSERT
- { Label L;
- testptr(index, BytesPerWord - 1);
- jcc(Assembler::zero, L);
- stop("index is not a multiple of BytesPerWord");
- bind(L);
- }
- #endif
- xorptr(t1, t1); // use _zero reg to clear memory (shorter code)
- if (UseIncDec) {
- shrptr(index, 3); // divide by 8/16 and set carry flag if bit 2 was set
- } else {
- shrptr(index, 2); // use 2 instructions to avoid partial flag stall
- shrptr(index, 1);
- }
- #ifndef _LP64
- // index could have been not a multiple of 8 (i.e., bit 2 was set)
- { Label even;
- // note: if index was a multiple of 8, than it cannot
- // be 0 now otherwise it must have been 0 before
- // => if it is even, we don't need to check for 0 again
- jcc(Assembler::carryClear, even);
- // clear topmost word (no jump needed if conditional assignment would work here)
- movptr(Address(obj, index, Address::times_8, hdr_size_in_bytes - 0*BytesPerWord), t1);
- // index could be 0 now, need to check again
- jcc(Assembler::zero, done);
- bind(even);
- }
- #endif // !_LP64
- // initialize remaining object fields: rdx is a multiple of 2 now
- { Label loop;
- bind(loop);
- movptr(Address(obj, index, Address::times_8, hdr_size_in_bytes - 1*BytesPerWord), t1);
- NOT_LP64(movptr(Address(obj, index, Address::times_8, hdr_size_in_bytes - 2*BytesPerWord), t1);)
- decrement(index);
- jcc(Assembler::notZero, loop);
- }
! // done
bind(done);
}
void C1_MacroAssembler::allocate_object(Register obj, Register t1, Register t2, int header_size, int object_size, Register klass, Label& slow_case) {
--- 180,196 ----
}
// preserves obj, destroys len_in_bytes
void C1_MacroAssembler::initialize_body(Register obj, Register len_in_bytes, int hdr_size_in_bytes, Register t1) {
+ assert(hdr_size_in_bytes >= 0, "header size must be positive or 0");
Label done;
! // len_in_bytes is positive and ptr sized
! subptr(len_in_bytes, hdr_size_in_bytes);
! jcc(Assembler::zero, done);
! zero_memory(obj, len_in_bytes, hdr_size_in_bytes, t1);
bind(done);
}
void C1_MacroAssembler::allocate_object(Register obj, Register t1, Register t2, int header_size, int object_size, Register klass, Label& slow_case) {
*** 239,258 ****
assert_different_registers(obj, t1, t2); // XXX really?
assert(header_size >= 0 && object_size >= header_size, "illegal sizes");
try_allocate(obj, noreg, object_size * BytesPerWord, t1, t2, slow_case);
! initialize_object(obj, klass, noreg, object_size * HeapWordSize, t1, t2);
}
! void C1_MacroAssembler::initialize_object(Register obj, Register klass, Register var_size_in_bytes, int con_size_in_bytes, Register t1, Register t2) {
assert((con_size_in_bytes & MinObjAlignmentInBytesMask) == 0,
"con_size_in_bytes is not multiple of alignment");
const int hdr_size_in_bytes = instanceOopDesc::header_size() * HeapWordSize;
initialize_header(obj, klass, noreg, t1, t2);
// clear rest of allocated space
const Register t1_zero = t1;
const Register index = t2;
const int threshold = 6 * BytesPerWord; // approximate break even point for code size (see comments below)
if (var_size_in_bytes != noreg) {
--- 198,218 ----
assert_different_registers(obj, t1, t2); // XXX really?
assert(header_size >= 0 && object_size >= header_size, "illegal sizes");
try_allocate(obj, noreg, object_size * BytesPerWord, t1, t2, slow_case);
! initialize_object(obj, klass, noreg, object_size * HeapWordSize, t1, t2, UseTLAB);
}
! void C1_MacroAssembler::initialize_object(Register obj, Register klass, Register var_size_in_bytes, int con_size_in_bytes, Register t1, Register t2, bool is_tlab_allocated) {
assert((con_size_in_bytes & MinObjAlignmentInBytesMask) == 0,
"con_size_in_bytes is not multiple of alignment");
const int hdr_size_in_bytes = instanceOopDesc::header_size() * HeapWordSize;
initialize_header(obj, klass, noreg, t1, t2);
+ if (!(UseTLAB && ZeroTLAB && is_tlab_allocated)) {
// clear rest of allocated space
const Register t1_zero = t1;
const Register index = t2;
const int threshold = 6 * BytesPerWord; // approximate break even point for code size (see comments below)
if (var_size_in_bytes != noreg) {
*** 282,291 ****
--- 242,252 ----
t1_zero);)
decrement(index);
jcc(Assembler::notZero, loop);
}
}
+ }
if (CURRENT_ENV->dtrace_alloc_probes()) {
assert(obj == rax, "must be");
call(RuntimeAddress(Runtime1::entry_for(Runtime1::dtrace_object_alloc_id)));
}
src/cpu/x86/vm/c1_MacroAssembler_x86.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File