2017-04-28 Hristian Kirtchev <kirtchev@adacore.com>
[official-gcc.git] / libgo / runtime / go-new.c
blobda44074a5d5428f4ccf13602114e91992198f437
1 /* go-new.c -- the generic go new() function.
3 Copyright 2009 The Go Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style
5 license that can be found in the LICENSE file. */
7 #include "runtime.h"
8 #include "arch.h"
9 #include "malloc.h"
10 #include "go-type.h"
12 void *
13 __go_new (const struct __go_type_descriptor *td, uintptr_t size)
15 return runtime_mallocgc (size,
16 (uintptr) td | TypeInfo_SingleObject,
17 td->__code & GO_NO_POINTERS ? FlagNoScan : 0);