aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/malloc.goc
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2012-09-24 14:58:34 -0400
committerRuss Cox <rsc@golang.org>2012-09-24 14:58:34 -0400
commit0b08c9483f5f447083616b7b5e6ddf04edffc379 (patch)
tree84860615deb2e8ec6854c15632b2e879deb25cf4 /src/pkg/runtime/malloc.goc
parent5e3fb887a3a9faf6fac1cd227d4b6b66bef9225a (diff)
downloadgo-0b08c9483f5f447083616b7b5e6ddf04edffc379.tar.xz
runtime: prepare for 64-bit ints
This CL makes the runtime understand that the type of the len or cap of a map, slice, or string is 'int', not 'int32', and it is also careful to distinguish between function arguments and results of type 'int' vs type 'int32'. In the runtime, the new typedefs 'intgo' and 'uintgo' refer to Go int and uint. The C types int and uint continue to be unavailable (cause intentional compile errors). This CL does not change the meaning of int, but it should make the eventual change of the meaning of int on amd64 a bit smoother. Update #2188. R=iant, r, dave, remyoudompheng CC=golang-dev https://golang.org/cl/6551067
Diffstat (limited to 'src/pkg/runtime/malloc.goc')
-rw-r--r--src/pkg/runtime/malloc.goc10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/pkg/runtime/malloc.goc b/src/pkg/runtime/malloc.goc
index babe4d2f4c..294dad8f34 100644
--- a/src/pkg/runtime/malloc.goc
+++ b/src/pkg/runtime/malloc.goc
@@ -20,7 +20,7 @@ MHeap runtime·mheap;
extern MStats mstats; // defined in extern.go
-extern volatile int32 runtime·MemProfileRate;
+extern volatile intgo runtime·MemProfileRate;
// Allocate an object of at least size bytes.
// Small objects are allocated from the per-thread cache's free lists.
@@ -28,7 +28,8 @@ extern volatile int32 runtime·MemProfileRate;
void*
runtime·mallocgc(uintptr size, uint32 flag, int32 dogc, int32 zeroed)
{
- int32 sizeclass, rate;
+ int32 sizeclass;
+ intgo rate;
MCache *c;
uintptr npages;
MSpan *s;
@@ -226,7 +227,7 @@ runtime·mlookup(void *v, byte **base, uintptr *size, MSpan **sp)
MCache*
runtime·allocmcache(void)
{
- int32 rate;
+ intgo rate;
MCache *c;
runtime·lock(&runtime·mheap);
@@ -507,7 +508,8 @@ func SetFinalizer(obj Eface, finalizer Eface) {
byte *base;
uintptr size;
FuncType *ft;
- int32 i, nret;
+ int32 i;
+ uintptr nret;
Type *t;
if(obj.type == nil) {