]> Cypherpunks repositories - gostls13.git/commit
cmd/gc: generate simpler names for closures
authorDmitry Vyukov <dvyukov@google.com>
Thu, 5 Feb 2015 13:08:29 +0000 (16:08 +0300)
committerDmitry Vyukov <dvyukov@google.com>
Wed, 18 Feb 2015 07:09:50 +0000 (07:09 +0000)
commit3a0fbfab57b133f4703cc7693a2af745570785ba
tree25e2b2438dce12f6b8fc4470492e125b57589281
parent3ad906b20874f28a4bc48ef767d2138be1b53f28
cmd/gc: generate simpler names for closures

Fixes #8291

There were several complaints about closure names in the issue tracker.
The first problem is that you see names like net/http.funcĀ·001
in profiles, traces, etc. And there is no way to figure out what
is that function.
Another issue is non-US-ascii symbols. All programs out there
should accept UTF-8. But unfortunately it is not true in reality.
For example, less does not render middle dot properly.

This change prepends outer function name to closure name and
replaces middle dot with dot. Now names look like:

main.glob.func1
main.glob.func2
main.glob.func2.1
main.init.1
main.init.1.func1
main.init.1.func1.1
main.main.func1
main.main.func1.1

Change-Id: I725726af88f2ad3ced2e3450f0f06bf459fd91c0
Reviewed-on: https://go-review.googlesource.com/3964
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/gc/closure.c
src/cmd/gc/go.h
src/cmd/gc/init.c
src/cmd/gc/pgen.c