]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: add and enable (internal) option to only track named types
authorRobert Griesemer <gri@golang.org>
Fri, 6 May 2016 01:03:59 +0000 (18:03 -0700)
committerRobert Griesemer <gri@golang.org>
Sat, 7 May 2016 23:56:02 +0000 (23:56 +0000)
commit394ac818b037ab8a3714b8a23e06e17a1e05aace
treeb396c7f405af4e3cf0fb9017c55df0d4ec003a62
parentfa270ad98e77cd0625c97eb01ad01efe11a324e8
cmd/compile: add and enable (internal) option to only track named types

The new export format keeps track of all types that are exported.
If a type is seen that was exported before, only a reference to
that type is emitted. The importer maintains a list of all the
seen types and uses that list to resolve type references.

The existing compiler infrastructure's invariants assumes that
only named types are referred to before they are fully set up.
Referring to unnamed incomplete types causes problems. One of
the issues was #15548.

Added a new internal flag 'trackAllTypes' to enable/disable
this type tracking. With this change only named types are
tracked.

Verified that this fix also addresses #15548, even w/o the
prior fix for that issue (in fact that prior fix is turned
off if trackAllTypes is disabled because it's not needed).

The test for #15548 covers also this change.

For #15548.

Change-Id: Id0b3ff983629703d025a442823f99649fd728a56
Reviewed-on: https://go-review.googlesource.com/22839
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/bexport.go
src/cmd/compile/internal/gc/bimport.go
src/cmd/compile/internal/gc/builtin.go
src/go/internal/gcimporter/bimport.go
src/go/internal/gcimporter/gcimporter_test.go
test/fixedbugs/bug398.go