comparison 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
comparison
equal deleted inserted replaced
7473:d092d1b31229 7474:00af3a3a8df4
5222 } 5222 }
5223 #endif 5223 #endif
5224 5224
5225 } 5225 }
5226 5226
5227 void MacroAssembler::clear_mem(Register base, Register cnt, Register tmp) {
5228 // cnt - number of qwords (8-byte words).
5229 // base - start address, qword aligned.
5230 assert(base==rdi, "base register must be edi for rep stos");
5231 assert(tmp==rax, "tmp register must be eax for rep stos");
5232 assert(cnt==rcx, "cnt register must be ecx for rep stos");
5233
5234 xorptr(tmp, tmp);
5235 if (UseFastStosb) {
5236 shlptr(cnt,3); // convert to number of bytes
5237 rep_stosb();
5238 } else {
5239 NOT_LP64(shlptr(cnt,1);) // convert to number of dwords for 32-bit VM
5240 rep_stos();
5241 }
5242 }
5227 5243
5228 // IndexOf for constant substrings with size >= 8 chars 5244 // IndexOf for constant substrings with size >= 8 chars
5229 // which don't need to be loaded through stack. 5245 // which don't need to be loaded through stack.
5230 void MacroAssembler::string_indexofC8(Register str1, Register str2, 5246 void MacroAssembler::string_indexofC8(Register str1, Register str2,
5231 Register cnt1, Register cnt2, 5247 Register cnt1, Register cnt2,