Mercurial > hg > truffle
diff src/cpu/x86/vm/macroAssembler_x86.cpp @ 7474:00af3a3a8df4
8005522: use fast-string instructions on x86 for zeroing
Summary: use 'rep stosb' instead of 'rep stosq' when fast-string operations are available.
Reviewed-by: twisti, roland
author | kvn |
---|---|
date | Thu, 03 Jan 2013 15:09:55 -0800 |
parents | d02120b7a34f |
children | e2e6bf86682c |
line wrap: on
line diff
--- a/src/cpu/x86/vm/macroAssembler_x86.cpp Sun Dec 23 17:08:22 2012 +0100 +++ b/src/cpu/x86/vm/macroAssembler_x86.cpp Thu Jan 03 15:09:55 2013 -0800 @@ -5224,6 +5224,22 @@ } +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.