]> Cypherpunks repositories - gostls13.git/commit
cmd/link: don't mark a symbol's Gotype reachable
authorCherry Zhang <cherryyz@google.com>
Fri, 1 May 2020 03:10:35 +0000 (23:10 -0400)
committerCherry Zhang <cherryyz@google.com>
Fri, 1 May 2020 18:04:59 +0000 (18:04 +0000)
commit44d22869a8df6419f894317b10c9f8329706467a
treeb3eeeda8f062d887939bafd9b3deeae9bd1dc750
parent3cec330fab5455c4dd00f1f6c228e146edd915d3
cmd/link: don't mark a symbol's Gotype reachable

A symbol being reachable doesn't imply its type descriptor is
needed. Don't mark it.

If the type is converted to interface somewhere in the program,
there will be an explicit use of the type descriptor, which
will make it marked.

A println("hello") program before and after

-rwxr-xr-x  1 cherryyz  primarygroup  1259824 Apr 30 23:00 hello
-rwxr-xr-x  1 cherryyz  primarygroup  1169680 Apr 30 23:10 hello

Updates #38782.
Updates #6853.

Change-Id: I88884c126ce75ba073f1ba059c4b892c87d2ac96
Reviewed-on: https://go-review.googlesource.com/c/go/+/231397
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/link/internal/ld/deadcode.go
src/cmd/link/internal/ld/deadcode_test.go
src/cmd/link/internal/ld/testdata/deadcode/reflectcall.go [new file with mode: 0644]
src/cmd/link/internal/ld/testdata/deadcode/typedesc.go [new file with mode: 0644]