]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/gc: better handling of self-assignments in esc.go
authorIskander Sharipov <iskander.sharipov@intel.com>
Fri, 27 Jul 2018 16:32:17 +0000 (19:32 +0300)
committerIskander Sharipov <iskander.sharipov@intel.com>
Mon, 3 Sep 2018 14:28:51 +0000 (14:28 +0000)
commitff468a43be1740890a0f3b64a6ab920ea92c2c17
tree2675b9edeecf9bb8180fb3b67761fe098e83930d
parentb794ca64d29f3e584cbdf49bde7141d3c12dd2ab
cmd/compile/internal/gc: better handling of self-assignments in esc.go

Teach escape analysis to recognize these assignment patterns
as not causing the src to leak:

val.x = val.y
val.x[i] = val.y[j]
val.x1.x2 = val.x1.y2
... etc

Helps to avoid "leaking param" with assignments showed above.
The implementation is based on somewhat similiar xs=xs[a:b]
special case that is ignored by the escape analysis.

We may figure out more generalized version of this,
but this one looks like a safe step into that direction.

Updates #14858

Change-Id: I6fe5bfedec9c03bdc1d7624883324a523bd11fde
Reviewed-on: https://go-review.googlesource.com/126395
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/gc/esc.go
test/escape_param.go