]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: escape "go" wrapper closure everywhere
authorCherry Zhang <cherryyz@google.com>
Fri, 23 Apr 2021 00:36:05 +0000 (20:36 -0400)
committerCherry Zhang <cherryyz@google.com>
Fri, 23 Apr 2021 02:29:37 +0000 (02:29 +0000)
commit1b0a0316802b8048d69da49dc23c5a5ab08e8ae8
tree97fc6e0d291a6f9e01128a2e4b6350be67c624e7
parentcfac62a1cc021cae55c9c5e373ebe9c408b75a5d
cmd/compile: escape "go" wrapper closure everywhere

For go statement, the wrapper closure needs to esacpe because it
runs asynchronously. Currently, it is not allowed for closures to
escape in the runtime. We have worked around this in the runtime,
so it doesn't "go" any function with arguments and so doesn't
need wrapping. If it ever does, it is not that we can have the
closure not escape, which may lead to miscompilation. Instead,
make the closure escape (which will fail the compilation). In the
future we may allow go'd closure to escape in the runtime.

Change-Id: I5bbe47b524371d2270c242f6c275013cd52abfc1
Reviewed-on: https://go-review.googlesource.com/c/go/+/312889
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/compile/internal/walk/order.go