aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/noder
diff options
context:
space:
mode:
authorDan Scales <danscales@google.com>2021-11-08 18:10:30 -0800
committerDan Scales <danscales@google.com>2021-11-09 16:38:42 +0000
commit47e3c4bc74f5f260cbc9c5e6d1ababde0a114a97 (patch)
tree1d9dff2c96ad19120544d5aa5346b21c7933884a /src/cmd/compile/internal/noder
parent2ade8ae325e6410f9696f431e6c50479216e63ae (diff)
downloadgo-47e3c4bc74f5f260cbc9c5e6d1ababde0a114a97.tar.xz
cmd/compile: disable doubleCheck and remove unused checkDictionary
In stencil.go, change doubleCheck to false, which will turn off some double-checking code which isn't needed generally, now that we have lots of tests of end-to-end runs. Also, removed checkDictionary() which is unused and is unlikely to be useful in the future. Change-Id: I4e5acceab80f4904b174422bae21ca82cf04f943 Reviewed-on: https://go-review.googlesource.com/c/go/+/361923 Trust: Dan Scales <danscales@google.com> Run-TryBot: Dan Scales <danscales@google.com> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/noder')
-rw-r--r--src/cmd/compile/internal/noder/stencil.go50
1 files changed, 1 insertions, 49 deletions
diff --git a/src/cmd/compile/internal/noder/stencil.go b/src/cmd/compile/internal/noder/stencil.go
index 4ebd607c16..cfbbee3ceb 100644
--- a/src/cmd/compile/internal/noder/stencil.go
+++ b/src/cmd/compile/internal/noder/stencil.go
@@ -22,7 +22,7 @@ import (
)
// Enable extra consistency checks.
-const doubleCheck = true
+const doubleCheck = false
func assert(p bool) {
base.Assert(p)
@@ -802,11 +802,6 @@ func (g *genInst) genericSubst(newsym *types.Sym, nameNode *ir.Name, shapes []*t
// Make sure name/type of newf is set before substituting the body.
newf.Body = subst.list(gf.Body)
- // Add code to check that the dictionary is correct.
- // TODO: must be adjusted to deal with shapes, but will go away soon when we move
- // to many->1 shape to concrete mapping.
- // newf.Body.Prepend(subst.checkDictionary(dictionaryName, shapes)...)
-
if len(subst.defnMap) > 0 {
base.Fatalf("defnMap is not empty")
}
@@ -859,49 +854,6 @@ func (subst *subster) localvar(name *ir.Name) *ir.Name {
return m
}
-// checkDictionary returns code that does runtime consistency checks
-// between the dictionary and the types it should contain.
-func (subst *subster) checkDictionary(name *ir.Name, targs []*types.Type) (code []ir.Node) {
- if false {
- return // checking turned off
- }
- // TODO: when moving to GCshape, this test will become harder. Call into
- // runtime to check the expected shape is correct?
- pos := name.Pos()
- // Convert dictionary to *[N]uintptr
- d := ir.NewConvExpr(pos, ir.OCONVNOP, types.Types[types.TUNSAFEPTR], name)
- d.SetTypecheck(1)
- d = ir.NewConvExpr(pos, ir.OCONVNOP, types.NewArray(types.Types[types.TUINTPTR], int64(len(targs))).PtrTo(), d)
- d.SetTypecheck(1)
- types.CheckSize(d.Type().Elem())
-
- // Check that each type entry in the dictionary is correct.
- for i, t := range targs {
- if t.HasShape() {
- // Check the concrete type, not the shape type.
- base.Fatalf("shape type in dictionary %s %+v\n", name.Sym().Name, t)
- }
- want := reflectdata.TypePtr(t)
- typed(types.Types[types.TUINTPTR], want)
- deref := ir.NewStarExpr(pos, d)
- typed(d.Type().Elem(), deref)
- idx := ir.NewConstExpr(constant.MakeUint64(uint64(i)), name) // TODO: what to set orig to?
- typed(types.Types[types.TUINTPTR], idx)
- got := ir.NewIndexExpr(pos, deref, idx)
- typed(types.Types[types.TUINTPTR], got)
- cond := ir.NewBinaryExpr(pos, ir.ONE, want, got)
- typed(types.Types[types.TBOOL], cond)
- panicArg := ir.NewNilExpr(pos)
- typed(types.NewInterface(types.LocalPkg, nil, false), panicArg)
- then := ir.NewUnaryExpr(pos, ir.OPANIC, panicArg)
- then.SetTypecheck(1)
- x := ir.NewIfStmt(pos, cond, []ir.Node{then}, nil)
- x.SetTypecheck(1)
- code = append(code, x)
- }
- return
-}
-
// getDictionaryEntry gets the i'th entry in the dictionary dict.
func getDictionaryEntry(pos src.XPos, dict *ir.Name, i int, size int) ir.Node {
// Convert dictionary to *[N]uintptr