]> Cypherpunks repositories - gostls13.git/commitdiff
Revert "cmd/compile: strengthen SetFields/Width safety guarantee"
authorJosh Bleecher Snyder <josharian@gmail.com>
Thu, 23 Mar 2017 19:40:16 +0000 (19:40 +0000)
committerJosh Bleecher Snyder <josharian@gmail.com>
Thu, 23 Mar 2017 19:40:35 +0000 (19:40 +0000)
This reverts commit b1b4f67169c5ceb3c81ba900c5022722d28755ab.

Reason for revert: Broke the build.

Change-Id: I5c99779896e39137c93c77d016ce683c872a69d7
Reviewed-on: https://go-review.googlesource.com/38532
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
src/cmd/compile/internal/gc/closure.go
src/cmd/compile/internal/gc/type.go

index 9f0c073454168e08b122255672c607517b086115..41ee74b8e033218ce5df62b4ca0f9c1e2fb7f7e0 100644 (file)
@@ -362,6 +362,10 @@ func transformclosure(xfunc *Node) {
                        xfunc.Func.Dcl = append(decls, xfunc.Func.Dcl...)
                }
 
+               // Recalculate param offsets.
+               if f.Type.Width > 0 {
+                       Fatalf("transformclosure: width is already calculated")
+               }
                dowidth(f.Type)
                xfunc.Type = f.Type // update type of ODCLFUNC
        } else {
index 772894f076cc75875165fab3fcc94cc7be6982c0..49d222507bf11f9328c4e864cda3dcd7e9a98dac 100644 (file)
@@ -864,15 +864,6 @@ func (t *Type) FieldSlice() []*Field {
 
 // SetFields sets struct/interface type t's fields/methods to fields.
 func (t *Type) SetFields(fields []*Field) {
-       // If we've calculated the width of t before,
-       // then some other type such as a function signature
-       // might now have the wrong type.
-       // Rather than try to track and invalidate those,
-       // enforce that SetFields cannot be called once
-       // t's width has been calculated.
-       if t.WidthCalculated() {
-               Fatalf("SetFields of %v: width previously calculated", t)
-       }
        t.wantEtype(TSTRUCT)
        for _, f := range fields {
                // If type T contains a field F with a go:notinheap