Skip to content

Commit

Permalink
Revert "cmd/compile: strengthen SetFields/Width safety guarantee"
Browse files Browse the repository at this point in the history
This reverts commit b1b4f67.

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>
  • Loading branch information
josharian committed Mar 23, 2017
1 parent b1b4f67 commit 536a225
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
4 changes: 4 additions & 0 deletions src/cmd/compile/internal/gc/closure.go
Expand Up @@ -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 {
Expand Down
9 changes: 0 additions & 9 deletions src/cmd/compile/internal/gc/type.go
Expand Up @@ -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
Expand Down

0 comments on commit 536a225

Please sign in to comment.