aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/malloc.go
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2016-08-26 15:41:51 -0400
committerCherry Zhang <cherryyz@google.com>2016-08-30 23:10:43 +0000
commitb2e0e9688a512970ea8d270238c8ff3bbf85cbe1 (patch)
treef153e7dba60b7069192c98c98383485858af40ee /src/runtime/malloc.go
parent842b05832fb5088a212e30962f58c95a38296d32 (diff)
downloadgo-b2e0e9688a512970ea8d270238c8ff3bbf85cbe1.tar.xz
cmd/compile: remove Zero and NilCheck for newobject
Recognize runtime.newobject and don't Zero or NilCheck it. Fixes #15914 (?) Updates #15390. TBD: add test Change-Id: Ia3bfa5c2ddbe2c27c92d9f68534a713b5ce95934 Reviewed-on: https://go-review.googlesource.com/27930 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/runtime/malloc.go')
-rw-r--r--src/runtime/malloc.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go
index 38c7a3b847..7d7f9e11d3 100644
--- a/src/runtime/malloc.go
+++ b/src/runtime/malloc.go
@@ -781,6 +781,8 @@ func largeAlloc(size uintptr, needzero bool) *mspan {
}
// implementation of new builtin
+// compiler (both frontend and SSA backend) knows the signature
+// of this function
func newobject(typ *_type) unsafe.Pointer {
return mallocgc(typ.size, typ, true)
}