From 568d6f983172706d2f5f7f66024b7b7a544ada53 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Mon, 2 Oct 2017 17:37:19 -0400 Subject: [PATCH] cmd/compile: teach Haspointer about TSSA and TTUPLE These will appear when tracking live pointers in registers, so we need to know whether they have pointers. For #24543. Change-Id: I2edccee39ca989473db4b3e7875ff166808ac141 Reviewed-on: https://go-review.googlesource.com/108497 Run-TryBot: Austin Clements Reviewed-by: David Chase --- src/cmd/compile/internal/types/type.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cmd/compile/internal/types/type.go b/src/cmd/compile/internal/types/type.go index 55d0930ceb5..836ac4965f4 100644 --- a/src/cmd/compile/internal/types/type.go +++ b/src/cmd/compile/internal/types/type.go @@ -1403,7 +1403,7 @@ func Haspointers(t *Type) bool { func Haspointers1(t *Type, ignoreNotInHeap bool) bool { switch t.Etype { case TINT, TUINT, TINT8, TUINT8, TINT16, TUINT16, TINT32, TUINT32, TINT64, - TUINT64, TUINTPTR, TFLOAT32, TFLOAT64, TCOMPLEX64, TCOMPLEX128, TBOOL: + TUINT64, TUINTPTR, TFLOAT32, TFLOAT64, TCOMPLEX64, TCOMPLEX128, TBOOL, TSSA: return false case TARRAY: @@ -1422,6 +1422,10 @@ func Haspointers1(t *Type, ignoreNotInHeap bool) bool { case TPTR32, TPTR64, TSLICE: return !(ignoreNotInHeap && t.Elem().NotInHeap()) + + case TTUPLE: + ttup := t.Extra.(*Tuple) + return Haspointers1(ttup.first, ignoreNotInHeap) || Haspointers1(ttup.second, ignoreNotInHeap) } return true @@ -1462,6 +1466,7 @@ func FakeRecvType() *Type { } var ( + // TSSA types. Haspointers assumes these are pointer-free. TypeInvalid = newSSA("invalid") TypeMem = newSSA("mem") TypeFlags = newSSA("flags")