mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
7059037: Use BIS for zeroing on T4
Use BIS for zeroing new allocated big (2Kb and more) objects and arrays. Reviewed-by: never, twisti, ysr
This commit is contained in:
parent
19f7fb98b8
commit
6446205688
14 changed files with 232 additions and 35 deletions
|
@ -4973,3 +4973,65 @@ void MacroAssembler::char_arrays_equals(Register ary1, Register ary2,
|
|||
// Caller should set it:
|
||||
// add(G0, 1, result); // equals
|
||||
}
|
||||
|
||||
// Use BIS for zeroing (count is in bytes).
|
||||
void MacroAssembler::bis_zeroing(Register to, Register count, Register temp, Label& Ldone) {
|
||||
assert(UseBlockZeroing && VM_Version::has_block_zeroing(), "only works with BIS zeroing");
|
||||
Register end = count;
|
||||
int cache_line_size = VM_Version::prefetch_data_size();
|
||||
// Minimum count when BIS zeroing can be used since
|
||||
// it needs membar which is expensive.
|
||||
int block_zero_size = MAX2(cache_line_size*3, (int)BlockZeroingLowLimit);
|
||||
|
||||
Label small_loop;
|
||||
// Check if count is negative (dead code) or zero.
|
||||
// Note, count uses 64bit in 64 bit VM.
|
||||
cmp_and_brx_short(count, 0, Assembler::lessEqual, Assembler::pn, Ldone);
|
||||
|
||||
// Use BIS zeroing only for big arrays since it requires membar.
|
||||
if (Assembler::is_simm13(block_zero_size)) { // < 4096
|
||||
cmp(count, block_zero_size);
|
||||
} else {
|
||||
set(block_zero_size, temp);
|
||||
cmp(count, temp);
|
||||
}
|
||||
br(Assembler::lessUnsigned, false, Assembler::pt, small_loop);
|
||||
delayed()->add(to, count, end);
|
||||
|
||||
// Note: size is >= three (32 bytes) cache lines.
|
||||
|
||||
// Clean the beginning of space up to next cache line.
|
||||
for (int offs = 0; offs < cache_line_size; offs += 8) {
|
||||
stx(G0, to, offs);
|
||||
}
|
||||
|
||||
// align to next cache line
|
||||
add(to, cache_line_size, to);
|
||||
and3(to, -cache_line_size, to);
|
||||
|
||||
// Note: size left >= two (32 bytes) cache lines.
|
||||
|
||||
// BIS should not be used to zero tail (64 bytes)
|
||||
// to avoid zeroing a header of the following object.
|
||||
sub(end, (cache_line_size*2)-8, end);
|
||||
|
||||
Label bis_loop;
|
||||
bind(bis_loop);
|
||||
stxa(G0, to, G0, Assembler::ASI_ST_BLKINIT_PRIMARY);
|
||||
add(to, cache_line_size, to);
|
||||
cmp_and_brx_short(to, end, Assembler::lessUnsigned, Assembler::pt, bis_loop);
|
||||
|
||||
// BIS needs membar.
|
||||
membar(Assembler::StoreLoad);
|
||||
|
||||
add(end, (cache_line_size*2)-8, end); // restore end
|
||||
cmp_and_brx_short(to, end, Assembler::greaterEqualUnsigned, Assembler::pn, Ldone);
|
||||
|
||||
// Clean the tail.
|
||||
bind(small_loop);
|
||||
stx(G0, to, 0);
|
||||
add(to, 8, to);
|
||||
cmp_and_brx_short(to, end, Assembler::lessUnsigned, Assembler::pt, small_loop);
|
||||
nop(); // Separate short branches
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue