1
0
mirror of https://github.com/golang/go synced 2024-11-21 20:54:45 -07:00

runtime: replace byte-at-a-time zeroing loop with memclr

R=golang-dev, r, r, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/4813043
This commit is contained in:
Quan Yong Zhai 2011-07-23 15:46:58 -04:00 committed by Russ Cox
parent ba134539c5
commit 47410a2490
3 changed files with 13 additions and 12 deletions

View File

@ -479,12 +479,16 @@ TEXT runtime·stackcheck(SB), 7, $0
TEXT runtime·memclr(SB),7,$0
MOVL 4(SP), DI // arg 1 addr
MOVL 8(SP), CX // arg 2 count
ADDL $3, CX
MOVL CX, BX
ANDL $3, BX
SHRL $2, CX
MOVL $0, AX
CLD
REP
STOSL
MOVL BX, CX
REP
STOSB
RET
TEXT runtime·getcallerpc(SB),7,$0

View File

@ -527,12 +527,16 @@ TEXT runtime·stackcheck(SB), 7, $0
TEXT runtime·memclr(SB),7,$0
MOVQ 8(SP), DI // arg 1 addr
MOVQ 16(SP), CX // arg 2 count
ADDQ $7, CX
MOVQ CX, BX
ANDQ $7, BX
SHRQ $3, CX
MOVQ $0, AX
CLD
REP
STOSQ
MOVQ BX, CX
REP
STOSB
RET
TEXT runtime·getcallerpc(SB),7,$0

View File

@ -381,18 +381,11 @@ memprint(uint32 s, void *a)
static void
memcopy(uint32 s, void *a, void *b)
{
byte *ba, *bb;
uint32 i;
ba = a;
bb = b;
if(bb == nil) {
for(i=0; i<s; i++)
ba[i] = 0;
if(b == nil) {
runtime·memclr(a,s);
return;
}
for(i=0; i<s; i++)
ba[i] = bb[i];
runtime·memmove(a,b,s);
}
static uint32