aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/proc.c
diff options
context:
space:
mode:
authorJan Ziak <0xe2.0x9a.0x9b@gmail.com>2012-10-21 17:41:32 -0400
committerRuss Cox <rsc@golang.org>2012-10-21 17:41:32 -0400
commit4a191c2c1b3fe1325ab8617472aef628fd494076 (patch)
treef257db791881a8690e69ae85100f4d8b01a4f161 /src/pkg/runtime/proc.c
parent4545dc6a6953b2be6d0d50719ad165d46278d9bf (diff)
downloadgo-4a191c2c1b3fe1325ab8617472aef628fd494076.tar.xz
runtime: store types of allocated objects
R=rsc CC=golang-dev https://golang.org/cl/6569057
Diffstat (limited to 'src/pkg/runtime/proc.c')
-rw-r--r--src/pkg/runtime/proc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c
index 1cb8bf5864..5fecf05589 100644
--- a/src/pkg/runtime/proc.c
+++ b/src/pkg/runtime/proc.c
@@ -9,6 +9,7 @@
#include "os_GOOS.h"
#include "stack.h"
#include "race.h"
+#include "type.h"
bool runtime·iscgo;
@@ -833,8 +834,15 @@ M*
runtime·newm(void)
{
M *mp;
+ static Type *mtype; // The Go type M
- mp = runtime·malloc(sizeof(M));
+ if(mtype == nil) {
+ Eface e;
+ runtime·gc_m_ptr(&e);
+ mtype = ((PtrType*)e.type)->elem;
+ }
+
+ mp = runtime·cnew(mtype);
mcommoninit(mp);
if(runtime·iscgo) {