]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: remove noescape hacks from gcWork
authorAustin Clements <austin@google.com>
Tue, 9 Feb 2016 23:37:41 +0000 (18:37 -0500)
committerAustin Clements <austin@google.com>
Thu, 25 Feb 2016 23:37:22 +0000 (23:37 +0000)
When gcWork was first introduced, the compiler's escape analysis
wasn't good enough to detect that that method receiver didn't escape,
so we had to hack around this.

Now that the compiler can figure out this for itself, remove these
hacks.

Change-Id: I9f73fab721e272410b8b6905b564e7abc03c0dfe
Reviewed-on: https://go-review.googlesource.com/19634
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/runtime/mgcwork.go

index 340604fb36d77eee4aed075809f10b509f2e16a5..e97039bed6745c630e602483e7671d65e6bcb113 100644 (file)
@@ -105,9 +105,7 @@ func (w *gcWork) init() {
 // put enqueues a pointer for the garbage collector to trace.
 // obj must point to the beginning of a heap object.
 //go:nowritebarrier
-func (ww *gcWork) put(obj uintptr) {
-       w := (*gcWork)(noescape(unsafe.Pointer(ww))) // TODO: remove when escape analysis is fixed
-
+func (w *gcWork) put(obj uintptr) {
        wbuf := w.wbuf1.ptr()
        if wbuf == nil {
                w.init()
@@ -133,9 +131,7 @@ func (ww *gcWork) put(obj uintptr) {
 // queue, tryGet returns 0.  Note that there may still be pointers in
 // other gcWork instances or other caches.
 //go:nowritebarrier
-func (ww *gcWork) tryGet() uintptr {
-       w := (*gcWork)(noescape(unsafe.Pointer(ww))) // TODO: remove when escape analysis is fixed
-
+func (w *gcWork) tryGet() uintptr {
        wbuf := w.wbuf1.ptr()
        if wbuf == nil {
                w.init()
@@ -164,9 +160,7 @@ func (ww *gcWork) tryGet() uintptr {
 // if necessary to ensure all pointers from all queues and caches have
 // been retrieved.  get returns 0 if there are no pointers remaining.
 //go:nowritebarrier
-func (ww *gcWork) get() uintptr {
-       w := (*gcWork)(noescape(unsafe.Pointer(ww))) // TODO: remove when escape analysis is fixed
-
+func (w *gcWork) get() uintptr {
        wbuf := w.wbuf1.ptr()
        if wbuf == nil {
                w.init()