]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: move type kinds into a separate file
authorJan Ziak <0xe2.0x9a.0x9b@gmail.com>
Wed, 6 Jun 2012 21:20:02 +0000 (17:20 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 6 Jun 2012 21:20:02 +0000 (17:20 -0400)
R=rsc
CC=golang-dev
https://golang.org/cl/6285047

src/pkg/runtime/iface.c
src/pkg/runtime/malloc.goc
src/pkg/runtime/slice.c
src/pkg/runtime/type.h
src/pkg/runtime/typekind.h [new file with mode: 0644]

index b7eb2c18d17920ce25610e338d9b32db8713245e..358cdcbbb65cd015eb4b5d9081bebad9240bc2f7 100644 (file)
@@ -5,6 +5,7 @@
 #include "runtime.h"
 #include "arch_GOARCH.h"
 #include "type.h"
+#include "typekind.h"
 #include "malloc.h"
 
 void
index c2727bf2b4fa7c23252cd3ec005750344632ab4a..44b68a728d15f221593ebb3d0ddf2c3d661ab49b 100644 (file)
@@ -13,6 +13,7 @@ package runtime
 #include "malloc.h"
 #include "defs_GOOS_GOARCH.h"
 #include "type.h"
+#include "typekind.h"
 
 #pragma dataflag 16 /* mark mheap as 'no pointers', hiding from garbage collector */
 MHeap runtime·mheap;
index 3c7c8be0e9a45888171bf56bc05c5398ac48ce77..9cb1ccb78822670a4dcdbeebc3289c3257cc5505 100644 (file)
@@ -5,6 +5,7 @@
 #include "runtime.h"
 #include "arch_GOARCH.h"
 #include "type.h"
+#include "typekind.h"
 #include "malloc.h"
 
 static int32   debug   = 0;
index ca81e84657e9d233d8971cc220095618dab22b92..ec2299692db94f5b00d217bbcf5ef582ad5b48a8 100644 (file)
@@ -19,6 +19,7 @@ typedef struct IMethod IMethod;
 typedef struct SliceType SliceType;
 typedef struct FuncType FuncType;
 
+// Needs to be in sync with typekind.h/CommonSize
 struct CommonType
 {
        uintptr size;
@@ -34,37 +35,6 @@ struct CommonType
        Type *ptrto;
 };
 
-enum {
-       KindBool = 1,
-       KindInt,
-       KindInt8,
-       KindInt16,
-       KindInt32,
-       KindInt64,
-       KindUint,
-       KindUint8,
-       KindUint16,
-       KindUint32,
-       KindUint64,
-       KindUintptr,
-       KindFloat32,
-       KindFloat64,
-       KindComplex64,
-       KindComplex128,
-       KindArray,
-       KindChan,
-       KindFunc,
-       KindInterface,
-       KindMap,
-       KindPtr,
-       KindSlice,
-       KindString,
-       KindStruct,
-       KindUnsafePointer,
-       
-       KindNoPointers = 1<<7,
-};
-
 struct Method
 {
        String *name;
diff --git a/src/pkg/runtime/typekind.h b/src/pkg/runtime/typekind.h
new file mode 100644 (file)
index 0000000..8c58872
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+enum {
+       KindBool = 1,
+       KindInt,
+       KindInt8,
+       KindInt16,
+       KindInt32,
+       KindInt64,
+       KindUint,
+       KindUint8,
+       KindUint16,
+       KindUint32,
+       KindUint64,
+       KindUintptr,
+       KindFloat32,
+       KindFloat64,
+       KindComplex64,
+       KindComplex128,
+       KindArray,
+       KindChan,
+       KindFunc,
+       KindInterface,
+       KindMap,
+       KindPtr,
+       KindSlice,
+       KindString,
+       KindStruct,
+       KindUnsafePointer,
+
+       KindNoPointers = 1<<7,
+
+       // size of Type interface header + CommonType structure.
+       CommonSize = 2*sizeof(void*) + 6*sizeof(void*) + 8,
+};
+