1
0
mirror of https://github.com/golang/go synced 2024-09-24 19:30:12 -06:00

gc: pass FlagNoPointers to runtime.new

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5151043
This commit is contained in:
Dmitriy Vyukov 2011-10-13 11:06:55 +03:00
parent cd5f144fe2
commit bf9c778fe2
4 changed files with 7 additions and 5 deletions

View File

@ -1,7 +1,7 @@
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"

View File

@ -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()

View File

@ -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*

View File

@ -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*