aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mgc.go
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2021-06-03 18:29:05 -0400
committerCherry Mui <cherryyz@google.com>2021-06-04 17:00:32 +0000
commit3298c749acc32eca0460f52866d169441eb0e076 (patch)
treeecceb1da69972419db97285f477eaf1fdf5c9cca /src/runtime/mgc.go
parent46beeed0ac4cd409554167c315861eaf8ae68c4a (diff)
downloadgo-3298c749acc32eca0460f52866d169441eb0e076.tar.gz
go-3298c749acc32eca0460f52866d169441eb0e076.zip
[dev.typeparams] runtime: undo go'd closure argument workaround
In CL 298669 we added defer/go wrapping, and, as it is not allowed for closures to escape when compiling runtime, we worked around it by rewriting go'd closures to argumentless non-capturing closures, so it is not a real closure and so not needed to escape. Previous CL removes the restriction. Now we can undo the workaround. Updates #40724. Change-Id: Ic7bf129da4aee7b7fdb7157414eca943a6a27264 Reviewed-on: https://go-review.googlesource.com/c/go/+/325110 Trust: Cherry Mui <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/runtime/mgc.go')
-rw-r--r--src/runtime/mgc.go15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go
index 4585663535..c239fa0f63 100644
--- a/src/runtime/mgc.go
+++ b/src/runtime/mgc.go
@@ -167,22 +167,17 @@ func gcinit() {
lockInit(&work.wbufSpans.lock, lockRankWbufSpans)
}
-// Temporary in order to enable register ABI work.
-// TODO(register args): convert back to local chan in gcenabled, passed to "go" stmts.
-var gcenable_setup chan int
-
// gcenable is called after the bulk of the runtime initialization,
// just before we're about to start letting user code run.
// It kicks off the background sweeper goroutine, the background
// scavenger goroutine, and enables GC.
func gcenable() {
// Kick off sweeping and scavenging.
- gcenable_setup = make(chan int, 2)
- go bgsweep()
- go bgscavenge()
- <-gcenable_setup
- <-gcenable_setup
- gcenable_setup = nil
+ c := make(chan int, 2)
+ go bgsweep(c)
+ go bgscavenge(c)
+ <-c
+ <-c
memstats.enablegc = true // now that runtime is initialized, GC is okay
}