mirror of https://github.com/golang/go.git
all: move //go: function directives directly above functions
These directives affect the next declaration, so the existing form is valid, but can be confusing because it is easy to miss. Move then directly above the declaration for improved readability. CL 69120 previously moved the Gosched nosplit away to hide it from documentation. Since CL 224737, directives are automatically excluded from documentation. Change-Id: I8ebf2d47fbb5e77c6f40ed8afdf79eaa4f4e335e Reviewed-on: https://go-review.googlesource.com/c/go/+/472957 Run-TryBot: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
parent
6f4d986a5a
commit
79d4e894ed
|
|
@ -9,5 +9,4 @@
|
|||
package notsha256
|
||||
|
||||
//go:noescape
|
||||
|
||||
func block(dig *digest, p []byte)
|
||||
|
|
|
|||
|
|
@ -9,5 +9,4 @@ package md5
|
|||
const haveAsm = true
|
||||
|
||||
//go:noescape
|
||||
|
||||
func block(dig *digest, p []byte)
|
||||
|
|
|
|||
|
|
@ -7,5 +7,4 @@
|
|||
package sha1
|
||||
|
||||
//go:noescape
|
||||
|
||||
func block(dig *digest, p []byte)
|
||||
|
|
|
|||
|
|
@ -7,5 +7,4 @@
|
|||
package sha256
|
||||
|
||||
//go:noescape
|
||||
|
||||
func block(dig *digest, p []byte)
|
||||
|
|
|
|||
|
|
@ -7,5 +7,4 @@
|
|||
package sha512
|
||||
|
||||
//go:noescape
|
||||
|
||||
func block(dig *digest, p []byte)
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@
|
|||
|
||||
package bytealg
|
||||
|
||||
//go:noescape
|
||||
|
||||
// Index returns the index of the first instance of b in a, or -1 if b is not present in a.
|
||||
// Requires 2 <= len(b) <= MaxLen.
|
||||
func Index(a, b []byte) int
|
||||
|
||||
//
|
||||
//go:noescape
|
||||
func Index(a, b []byte) int
|
||||
|
||||
// IndexString returns the index of the first instance of b in a, or -1 if b is not present in a.
|
||||
// Requires 2 <= len(b) <= MaxLen.
|
||||
//
|
||||
//go:noescape
|
||||
func IndexString(a, b string) int
|
||||
|
|
|
|||
|
|
@ -67,10 +67,10 @@ func sysvicall1(fn *libcFunc, a1 uintptr) uintptr {
|
|||
return r1
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
|
||||
// sysvicall1Err returns both the system call result and the errno value.
|
||||
// This is used by sysvicall1 and pipe.
|
||||
//
|
||||
//go:nosplit
|
||||
func sysvicall1Err(fn *libcFunc, a1 uintptr) (r1, err uintptr) {
|
||||
// Leave caller's PC/SP around for traceback.
|
||||
gp := getg()
|
||||
|
|
|
|||
|
|
@ -312,10 +312,10 @@ func forcegchelper() {
|
|||
}
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
|
||||
// Gosched yields the processor, allowing other goroutines to run. It does not
|
||||
// suspend the current goroutine, so execution resumes automatically.
|
||||
//
|
||||
//go:nosplit
|
||||
func Gosched() {
|
||||
checkTimeouts()
|
||||
mcall(gosched_m)
|
||||
|
|
@ -4516,8 +4516,6 @@ func dolockOSThread() {
|
|||
gp.lockedm.set(gp.m)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
|
||||
// LockOSThread wires the calling goroutine to its current operating system thread.
|
||||
// The calling goroutine will always execute in that thread,
|
||||
// and no other goroutine will execute in it,
|
||||
|
|
@ -4532,6 +4530,8 @@ func dolockOSThread() {
|
|||
//
|
||||
// A goroutine should call LockOSThread before calling OS services or
|
||||
// non-Go library functions that depend on per-thread state.
|
||||
//
|
||||
//go:nosplit
|
||||
func LockOSThread() {
|
||||
if atomic.Load(&newmHandoff.haveTemplateThread) == 0 && GOOS != "plan9" {
|
||||
// If we need to start a new thread from the locked
|
||||
|
|
@ -4571,8 +4571,6 @@ func dounlockOSThread() {
|
|||
gp.lockedm = 0
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
|
||||
// UnlockOSThread undoes an earlier call to LockOSThread.
|
||||
// If this drops the number of active LockOSThread calls on the
|
||||
// calling goroutine to zero, it unwires the calling goroutine from
|
||||
|
|
@ -4585,6 +4583,8 @@ func dounlockOSThread() {
|
|||
// other goroutines, it should not call this function and thus leave
|
||||
// the goroutine locked to the OS thread until the goroutine (and
|
||||
// hence the thread) exits.
|
||||
//
|
||||
//go:nosplit
|
||||
func UnlockOSThread() {
|
||||
gp := getg()
|
||||
if gp.m.lockedExt == 0 {
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ func RaceErrors() int {
|
|||
return int(n)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
|
||||
// RaceAcquire/RaceRelease/RaceReleaseMerge establish happens-before relations
|
||||
// between goroutines. These inform the race detector about actual synchronization
|
||||
// that it can't see for some reason (e.g. synchronization within RaceDisable/RaceEnable
|
||||
|
|
@ -34,38 +32,40 @@ func RaceErrors() int {
|
|||
// RaceReleaseMerge on addr up to and including the last RaceRelease on addr.
|
||||
// In terms of the C memory model (C11 §5.1.2.4, §7.17.3),
|
||||
// RaceAcquire is equivalent to atomic_load(memory_order_acquire).
|
||||
//
|
||||
//go:nosplit
|
||||
func RaceAcquire(addr unsafe.Pointer) {
|
||||
raceacquire(addr)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
|
||||
// RaceRelease performs a release operation on addr that
|
||||
// can synchronize with a later RaceAcquire on addr.
|
||||
//
|
||||
// In terms of the C memory model, RaceRelease is equivalent to
|
||||
// atomic_store(memory_order_release).
|
||||
//
|
||||
//go:nosplit
|
||||
func RaceRelease(addr unsafe.Pointer) {
|
||||
racerelease(addr)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
|
||||
// RaceReleaseMerge is like RaceRelease, but also establishes a happens-before
|
||||
// relation with the preceding RaceRelease or RaceReleaseMerge on addr.
|
||||
//
|
||||
// In terms of the C memory model, RaceReleaseMerge is equivalent to
|
||||
// atomic_exchange(memory_order_release).
|
||||
//
|
||||
//go:nosplit
|
||||
func RaceReleaseMerge(addr unsafe.Pointer) {
|
||||
racereleasemerge(addr)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
|
||||
// RaceDisable disables handling of race synchronization events in the current goroutine.
|
||||
// Handling is re-enabled with RaceEnable. RaceDisable/RaceEnable can be nested.
|
||||
// Non-synchronization events (memory accesses, function entry/exit) still affect
|
||||
// the race detector.
|
||||
//
|
||||
//go:nosplit
|
||||
func RaceDisable() {
|
||||
gp := getg()
|
||||
if gp.raceignore == 0 {
|
||||
|
|
@ -74,9 +74,9 @@ func RaceDisable() {
|
|||
gp.raceignore++
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
|
||||
// RaceEnable re-enables handling of race events in the current goroutine.
|
||||
//
|
||||
//go:nosplit
|
||||
func RaceEnable() {
|
||||
gp := getg()
|
||||
gp.raceignore--
|
||||
|
|
|
|||
|
|
@ -146,8 +146,6 @@ func (p *Proc) Addr() uintptr {
|
|||
return p.addr
|
||||
}
|
||||
|
||||
//go:uintptrescapes
|
||||
|
||||
// Call executes procedure p with arguments a.
|
||||
//
|
||||
// The returned error is always non-nil, constructed from the result of GetLastError.
|
||||
|
|
@ -162,6 +160,8 @@ func (p *Proc) Addr() uintptr {
|
|||
// values are returned in r2. The return value for C type "float" is
|
||||
// math.Float32frombits(uint32(r2)). For C type "double", it is
|
||||
// math.Float64frombits(uint64(r2)).
|
||||
//
|
||||
//go:uintptrescapes
|
||||
func (p *Proc) Call(a ...uintptr) (uintptr, uintptr, error) {
|
||||
return SyscallN(p.Addr(), a...)
|
||||
}
|
||||
|
|
@ -277,10 +277,10 @@ func (p *LazyProc) Addr() uintptr {
|
|||
return p.proc.Addr()
|
||||
}
|
||||
|
||||
//go:uintptrescapes
|
||||
|
||||
// Call executes procedure p with arguments a. See the documentation of
|
||||
// Proc.Call for more information.
|
||||
//
|
||||
//go:uintptrescapes
|
||||
func (p *LazyProc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) {
|
||||
p.mustFind()
|
||||
return p.proc.Call(a...)
|
||||
|
|
|
|||
Loading…
Reference in New Issue