Skip to content

Commit

Permalink
cmd/compile: teach Haspointer about TSSA and TTUPLE
Browse files Browse the repository at this point in the history
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 <austin@google.com>
Reviewed-by: David Chase <drchase@google.com>
  • Loading branch information
aclements committed Apr 20, 2018
1 parent 8871c93 commit 568d6f9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cmd/compile/internal/types/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 568d6f9

Please sign in to comment.