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"
// emitted by compiler, not referred to by go programs
-func new(int32) *any
+func new(typ *byte) *any
func panicindex()
func panicslice()
func throwreturn()
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*
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*