7181 verify_FPU(0, "FPU stack must be clean on entry"); 7182 } 7183 #endif 7184 7185 #ifdef ASSERT 7186 if (VerifyStackAtCalls) { 7187 Label L; 7188 push(rax); 7189 mov(rax, rsp); 7190 andptr(rax, StackAlignmentInBytes-1); 7191 cmpptr(rax, StackAlignmentInBytes-wordSize); 7192 pop(rax); 7193 jcc(Assembler::equal, L); 7194 STOP("Stack is not properly aligned!"); 7195 bind(L); 7196 } 7197 #endif 7198 7199 } 7200 7201 void MacroAssembler::clear_mem(Register base, Register cnt, Register tmp) { 7202 // cnt - number of qwords (8-byte words). 7203 // base - start address, qword aligned. 7204 assert(base==rdi, "base register must be edi for rep stos"); 7205 assert(tmp==rax, "tmp register must be eax for rep stos"); 7206 assert(cnt==rcx, "cnt register must be ecx for rep stos"); 7207 7208 xorptr(tmp, tmp); 7209 if (UseFastStosb) { 7210 shlptr(cnt,3); // convert to number of bytes 7211 rep_stosb(); 7212 } else { 7213 NOT_LP64(shlptr(cnt,1);) // convert to number of dwords for 32-bit VM 7214 rep_stos(); 7215 } 7216 } 7217 7218 #ifdef COMPILER2 7219 7220 // IndexOf for constant substrings with size >= 8 chars 7221 // which don't need to be loaded through stack. 7222 void MacroAssembler::string_indexofC8(Register str1, Register str2, 7223 Register cnt1, Register cnt2, 7224 int int_cnt2, Register result, 7225 XMMRegister vec, Register tmp, 7226 int ae) { 7227 ShortBranchVerifier sbv(this); 7228 assert(UseSSE42Intrinsics, "SSE4.2 intrinsics are required"); 7229 assert(UseSSE >= 4, "SSE4 must be enabled for SSE4.2 intrinsics to be available"); 7230 assert(ae != StrIntrinsicNode::LU, "Invalid encoding"); 7231 7232 // This method uses the pcmpestri instruction with bound registers 7233 // inputs: 7234 // xmm - substring 7235 // rax - substring length (elements count) | 7181 verify_FPU(0, "FPU stack must be clean on entry"); 7182 } 7183 #endif 7184 7185 #ifdef ASSERT 7186 if (VerifyStackAtCalls) { 7187 Label L; 7188 push(rax); 7189 mov(rax, rsp); 7190 andptr(rax, StackAlignmentInBytes-1); 7191 cmpptr(rax, StackAlignmentInBytes-wordSize); 7192 pop(rax); 7193 jcc(Assembler::equal, L); 7194 STOP("Stack is not properly aligned!"); 7195 bind(L); 7196 } 7197 #endif 7198 7199 } 7200 7201 void MacroAssembler::clear_mem(Register base, Register cnt, Register tmp, bool is_large) { 7202 // cnt - number of qwords (8-byte words). 7203 // base - start address, qword aligned. 7204 // is_large - if optimizers know cnt is larger than InitArrayShortSize 7205 assert(base==rdi, "base register must be edi for rep stos"); 7206 assert(tmp==rax, "tmp register must be eax for rep stos"); 7207 assert(cnt==rcx, "cnt register must be ecx for rep stos"); 7208 assert(InitArrayShortSize % BytesPerLong == 0, 7209 "InitArrayShortSize should be the multiple of BytesPerLong"); 7210 7211 Label SHORT, LONG, DONE; 7212 7213 if (!is_large) { 7214 cmpptr(cnt, InitArrayShortSize/BytesPerLong); 7215 jcc(Assembler::greater, LONG); 7216 7217 NOT_LP64(shlptr(cnt, 1);) // convert to number of 32-bit words for 32-bit VM 7218 7219 // Use individual pointer-sized stores for small counts: 7220 bind(SHORT); 7221 testptr(cnt, cnt); 7222 jcc(Assembler::equal, DONE); 7223 decrement(cnt); 7224 movptr(Address(base, cnt, Address::times_ptr), 0); 7225 jmp(SHORT); 7226 } 7227 7228 // Use longer rep-prefixed ops for non-small counts: 7229 bind(LONG); 7230 xorptr(tmp, tmp); 7231 if (UseFastStosb) { 7232 shlptr(cnt, 3); // convert to number of bytes 7233 rep_stosb(); 7234 } else { 7235 NOT_LP64(shlptr(cnt, 1);) // convert to number of 32-bit words for 32-bit VM 7236 rep_stos(); 7237 } 7238 7239 bind(DONE); 7240 } 7241 7242 #ifdef COMPILER2 7243 7244 // IndexOf for constant substrings with size >= 8 chars 7245 // which don't need to be loaded through stack. 7246 void MacroAssembler::string_indexofC8(Register str1, Register str2, 7247 Register cnt1, Register cnt2, 7248 int int_cnt2, Register result, 7249 XMMRegister vec, Register tmp, 7250 int ae) { 7251 ShortBranchVerifier sbv(this); 7252 assert(UseSSE42Intrinsics, "SSE4.2 intrinsics are required"); 7253 assert(UseSSE >= 4, "SSE4 must be enabled for SSE4.2 intrinsics to be available"); 7254 assert(ae != StrIntrinsicNode::LU, "Invalid encoding"); 7255 7256 // This method uses the pcmpestri instruction with bound registers 7257 // inputs: 7258 // xmm - substring 7259 // rax - substring length (elements count) |