diff options
author | Austin Clements <austin@google.com> | 2017-11-02 12:37:25 -0400 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2017-11-06 21:07:57 +0000 |
commit | 3a446d865226f2141208deb21ea2d829609c3cf6 (patch) | |
tree | 2f5924da5e7b77efa62b189ae0f23190098da09a /src/cmd/compile/internal/types/type.go | |
parent | 0838c0f2f9fd45f527c4be8e27589eed22e0e559 (diff) | |
download | go-3a446d865226f2141208deb21ea2d829609c3cf6.tar.gz go-3a446d865226f2141208deb21ea2d829609c3cf6.zip |
cmd/compile: []T where T is go:notinheap does not need write barriers
Currently, assigning a []T where T is a go:notinheap type generates an
unnecessary write barrier for storing the slice pointer.
This fixes this by teaching HasHeapPointer that this type does not
have a heap pointer, and tweaking the lowering of slice assignments so
the pointer store retains the correct type rather than simply lowering
it to a *uint8 store.
Change-Id: I8bf7c66e64a7fefdd14f2bd0de8a5a3596340bab
Reviewed-on: https://go-review.googlesource.com/76027
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/types/type.go')
-rw-r--r-- | src/cmd/compile/internal/types/type.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/types/type.go b/src/cmd/compile/internal/types/type.go index 82829a1179..44cdabcb30 100644 --- a/src/cmd/compile/internal/types/type.go +++ b/src/cmd/compile/internal/types/type.go @@ -1391,7 +1391,7 @@ func Haspointers1(t *Type, ignoreNotInHeap bool) bool { } return false - case TPTR32, TPTR64: + case TPTR32, TPTR64, TSLICE: return !(ignoreNotInHeap && t.Elem().NotInHeap()) } |