]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/gc: add tracing support to debug type checking
authorRobert Griesemer <gri@golang.org>
Thu, 1 Nov 2018 20:46:50 +0000 (13:46 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 2 Nov 2018 22:17:47 +0000 (22:17 +0000)
commite25823edcea364df70b8db7462f53e7dac2b8fca
treed448d1e9abf3358569e02ac7ca8d128e25a7ae82
parentc21ba09bcd83e58e862b1acc676dc36f31444022
cmd/compile/internal/gc: add tracing support to debug type checking

The compiler must first be built with the constant enableTrace set
to true (typecheck.go). After that, the -t flag becomes available
which enables tracing output of type-checking functions.

With enableTrace == false, the tracing code becomes dead code
and won't affect the compiler.

Typical output might look like this:

path/y.go:4:6: typecheck 0xc00033e180 DCLTYPE <node DCLTYPE> tc=0
path/y.go:4:6: . typecheck1 0xc00033e180 DCLTYPE <node DCLTYPE> tc=2
path/y.go:4:6: . . typecheck 0xc000331a40 TYPE T tc=1
path/y.go:4:6: . . . typecheck1 0xc000331a40 TYPE T tc=2
path/y.go:4:6: . . . . typecheckdef 0xc000331a40 TYPE T tc=2
path/y.go:4:6: . . . . => 0xc000331a40 TYPE T tc=2 type=*T
path/y.go:4:6: . . . => 0xc000331a40 TYPE T tc=2 type=*T
path/y.go:4:6: . . => 0xc000331a40 TYPE T tc=1 type=*T
path/y.go:4:6: . => 0xc00033e180 DCLTYPE <node DCLTYPE> tc=2 type=<T>
path/y.go:4:6: => 0xc00033e180 DCLTYPE <node DCLTYPE> tc=1 type=<T>

Disabled by default.

Change-Id: Ifd8385290d1cf0d3fc5e8468b2f4ab84e8eff338
Reviewed-on: https://go-review.googlesource.com/c/146782
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/gc/typecheck.go