compiler, runtime: don't pass size to __go_new

There is no reason to pass the size to __go_new, as the type
descriptor includes the size anyhow.  This makes the function
correspond to the Go 1.8 function runtime.newobject, which is what we
will use when we update to the Go 1.8 memory allocator.

Change-Id: I8817a5f204beaeac7b877d1e7a207a1893c1922f
Reviewed-on: https://go-review.googlesource.com/41080
Reviewed-by: Than McIntosh <thanm@google.com>
diff --git a/go/gogo.cc b/go/gogo.cc
index bea2e29..82d15c3 100644
--- a/go/gogo.cc
+++ b/go/gogo.cc
@@ -4484,9 +4484,7 @@
 Gogo::allocate_memory(Type* type, Location location)
 {
   Expression* td = Expression::make_type_descriptor(type, location);
-  Expression* size =
-    Expression::make_type_info(type, Expression::TYPE_INFO_SIZE);
-  return Runtime::make_call(Runtime::NEW, location, 2, td, size);
+  return Runtime::make_call(Runtime::NEW, location, 1, td);
 }
 
 // Traversal class used to check for return statements.
diff --git a/go/runtime.def b/go/runtime.def
index 512f638..a2f2e3a 100644
--- a/go/runtime.def
+++ b/go/runtime.def
@@ -224,7 +224,7 @@
 
 
 // Allocate memory.
-DEF_GO_RUNTIME(NEW, "__go_new", P2(TYPE, UINTPTR), R1(POINTER))
+DEF_GO_RUNTIME(NEW, "__go_new", P1(TYPE), R1(POINTER))
 
 // Start a new goroutine.
 DEF_GO_RUNTIME(GO, "__go_go", P2(FUNC_PTR, POINTER), R0())
diff --git a/libgo/runtime/go-new.c b/libgo/runtime/go-new.c
index da44074..bc5c567 100644
--- a/libgo/runtime/go-new.c
+++ b/libgo/runtime/go-new.c
@@ -10,9 +10,9 @@
 #include "go-type.h"
 
 void *
-__go_new (const struct __go_type_descriptor *td, uintptr_t size)
+__go_new (const struct __go_type_descriptor *td)
 {
-  return runtime_mallocgc (size,
+  return runtime_mallocgc (td->__size,
 			   (uintptr) td | TypeInfo_SingleObject,
 			   td->__code & GO_NO_POINTERS ? FlagNoScan : 0);
 }