Commit bf9c778f authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

gc: pass FlagNoPointers to runtime.new

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5151043
parent cd5f144f
char *runtimeimport =
"package runtime\n"
"import runtime \"runtime\"\n"
"func @\"\".new (? int32) *any\n"
"func @\"\".new (typ *uint8) *any\n"
"func @\"\".panicindex ()\n"
"func @\"\".panicslice ()\n"
"func @\"\".throwreturn ()\n"
......
......@@ -10,7 +10,7 @@ package PACKAGE
// emitted by compiler, not referred to by go programs
func new(int32) *any
func new(typ *byte) *any
func panicindex()
func panicslice()
func throwreturn()
......
......@@ -1686,7 +1686,7 @@ callnew(Type *t)
dowidth(t);
fn = syslook("new", 1);
argtype(fn, t);
return mkcall1(fn, ptrto(t), nil, nodintconst(t->width));
return mkcall1(fn, ptrto(t), nil, typename(t));
}
static Node*
......
......@@ -393,8 +393,10 @@ runtime·mal(uintptr n)
return runtime·mallocgc(n, 0, 1, 1);
}
func new(n uint32) (ret *uint8) {
ret = runtime·mal(n);
func new(typ *Type) (ret *uint8) {
uint32 flag = typ->kind&KindNoPointers ? FlagNoPointers : 0;
ret = runtime·mallocgc(typ->size, flag, 1, 1);
FLUSH(&ret);
}
void*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment