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 = char *runtimeimport =
"package runtime\n" "package runtime\n"
"import runtime \"runtime\"\n" "import runtime \"runtime\"\n"
"func @\"\".new (? int32) *any\n" "func @\"\".new (typ *uint8) *any\n"
"func @\"\".panicindex ()\n" "func @\"\".panicindex ()\n"
"func @\"\".panicslice ()\n" "func @\"\".panicslice ()\n"
"func @\"\".throwreturn ()\n" "func @\"\".throwreturn ()\n"
......
...@@ -10,7 +10,7 @@ package PACKAGE ...@@ -10,7 +10,7 @@ package PACKAGE
// emitted by compiler, not referred to by go programs // emitted by compiler, not referred to by go programs
func new(int32) *any func new(typ *byte) *any
func panicindex() func panicindex()
func panicslice() func panicslice()
func throwreturn() func throwreturn()
......
...@@ -1686,7 +1686,7 @@ callnew(Type *t) ...@@ -1686,7 +1686,7 @@ callnew(Type *t)
dowidth(t); dowidth(t);
fn = syslook("new", 1); fn = syslook("new", 1);
argtype(fn, t); argtype(fn, t);
return mkcall1(fn, ptrto(t), nil, nodintconst(t->width)); return mkcall1(fn, ptrto(t), nil, typename(t));
} }
static Node* static Node*
......
...@@ -393,8 +393,10 @@ runtime·mal(uintptr n) ...@@ -393,8 +393,10 @@ runtime·mal(uintptr n)
return runtime·mallocgc(n, 0, 1, 1); return runtime·mallocgc(n, 0, 1, 1);
} }
func new(n uint32) (ret *uint8) { func new(typ *Type) (ret *uint8) {
ret = runtime·mal(n); uint32 flag = typ->kind&KindNoPointers ? FlagNoPointers : 0;
ret = runtime·mallocgc(typ->size, flag, 1, 1);
FLUSH(&ret);
} }
void* 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