8005522: use fast-string instructions on x86 for zeroing

Use 'rep stosb' instead of 'rep stosq' when fast-string operations are available.

Reviewed-by: twisti, roland
This commit is contained in:
Vladimir Kozlov 2013-01-03 15:09:55 -08:00
parent 73d6d417be
commit cfcd28fd9d
10 changed files with 95 additions and 22 deletions

View file

@ -5224,6 +5224,22 @@ void MacroAssembler::verified_entry(int framesize, bool stack_bang, bool fp_mode
}
void MacroAssembler::clear_mem(Register base, Register cnt, Register tmp) {
// cnt - number of qwords (8-byte words).
// base - start address, qword aligned.
assert(base==rdi, "base register must be edi for rep stos");
assert(tmp==rax, "tmp register must be eax for rep stos");
assert(cnt==rcx, "cnt register must be ecx for rep stos");
xorptr(tmp, tmp);
if (UseFastStosb) {
shlptr(cnt,3); // convert to number of bytes
rep_stosb();
} else {
NOT_LP64(shlptr(cnt,1);) // convert to number of dwords for 32-bit VM
rep_stos();
}
}
// IndexOf for constant substrings with size >= 8 chars
// which don't need to be loaded through stack.