]> Cypherpunks repositories - gostls13.git/commit
cmd/compile, syscall: add //go:uintptrescapes comment, and use it
authorIan Lance Taylor <iant@golang.org>
Tue, 28 Jun 2016 21:19:27 +0000 (14:19 -0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 6 Jul 2016 20:48:41 +0000 (20:48 +0000)
commitbbe5da42600d5ab26cd58ffac3d6427994f08fb2
tree5b78e647cf80941548cf767021e96e2ae3fcf2bd
parent820e30f5b0289d5df22ab604f2d831470f748dca
cmd/compile, syscall: add //go:uintptrescapes comment, and use it

This new comment can be used to declare that the uintptr arguments to a
function may be converted from pointers, and that those pointers should
be considered to escape. This is used for the Call methods in
dll_windows.go that take uintptr arguments, because they call Syscall.

We can't treat these functions as we do syscall.Syscall, because unlike
Syscall they may cause the stack to grow. For Syscall we can assume that
stack arguments can remain on the stack, but for these functions we need
them to escape.

Fixes #16035.

Change-Id: Ia0e5b4068c04f8d303d95ab9ea394939f1f57454
Reviewed-on: https://go-review.googlesource.com/24551
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/compile/internal/gc/esc.go
src/cmd/compile/internal/gc/lex.go
src/cmd/compile/internal/gc/order.go
src/syscall/dll_windows.go
test/uintptrescapes.dir/a.go [new file with mode: 0644]
test/uintptrescapes.dir/main.go [new file with mode: 0644]
test/uintptrescapes.go [new file with mode: 0644]
test/uintptrescapes2.go [new file with mode: 0644]