]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: do not inline functions marked cgo_unsafe_args
authorDavid Lazar <lazard@golang.org>
Wed, 30 Nov 2016 22:09:07 +0000 (17:09 -0500)
committerDavid Lazar <lazard@golang.org>
Thu, 1 Dec 2016 18:59:59 +0000 (18:59 +0000)
Now the net tests pass with -gcflags '-l=4'.

Fixes #18125.

Change-Id: I4e3a46eb0cb3a93b203e74f5bc99c5822331f535
Reviewed-on: https://go-review.googlesource.com/33722
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/inl.go

index d8f1f2453645c8e69be2cd9d6def382d127359ae..7b2fcf89ba46049e342e2ec59f158f3c70f4f07b 100644 (file)
@@ -107,6 +107,12 @@ func caninl(fn *Node) {
                return
        }
 
+       // If marked "go:cgo_unsafe_args", don't inline
+       if fn.Func.Pragma&CgoUnsafeArgs != 0 {
+               reason = "marked go:cgo_unsafe_args"
+               return
+       }
+
        // If fn has no body (is defined outside of Go), cannot inline it.
        if fn.Nbody.Len() == 0 {
                reason = "no function body"