github.com/megatontech/mynoteforgo@v0.0.0-20200507084910-5d0c6ea6e890/源码/runtime/memclr_amd64p32.s (about)

     1  // Copyright 2009 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  #include "textflag.h"
     6  
     7  // func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
     8  TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT,$0-8
     9  	MOVL	ptr+0(FP), DI
    10  	MOVL	n+4(FP), CX
    11  	MOVQ	CX, BX
    12  	ANDQ	$3, BX
    13  	SHRQ	$2, CX
    14  	MOVQ	$0, AX
    15  	CLD
    16  	REP
    17  	STOSL
    18  	MOVQ	BX, CX
    19  	REP
    20  	STOSB
    21  	// Note: we zero only 4 bytes at a time so that the tail is at most
    22  	// 3 bytes. That guarantees that we aren't zeroing pointers with STOSB.
    23  	// See issue 13160.
    24  	RET