20 lines
520 B
C
Raw Normal View History

2012-03-28 01:13:14 +02:00
/* go-new.c -- the generic go new() function.
Copyright 2009 The Go Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file. */
#include "go-alloc.h"
#include "runtime.h"
#include "arch.h"
#include "malloc.h"
2017-04-10 13:32:00 +02:00
#include "go-type.h"
2012-03-28 01:13:14 +02:00
void *
2015-08-28 17:33:40 +02:00
__go_new (const struct __go_type_descriptor *td, uintptr_t size)
2012-03-28 01:13:14 +02:00
{
2015-08-28 17:33:40 +02:00
return runtime_mallocgc (size,
(uintptr) td | TypeInfo_SingleObject,
2017-04-10 13:32:00 +02:00
td->__code & GO_NO_POINTERS ? FlagNoScan : 0);
2012-03-28 01:13:14 +02:00
}