Commit 47410a24 authored by Quan Yong Zhai's avatar Quan Yong Zhai Committed by Russ Cox

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
parent ba134539
......@@ -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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment