1
0
mirror of https://github.com/golang/go synced 2024-11-19 16:54:44 -07:00

runtime: mark some C globals as having no pointers.

C globals are conservatively scanned.  This helps
avoid false retention, especially for 32 bit.

LGTM=rsc
R=golang-codereviews, khr, rsc
CC=golang-codereviews
https://golang.org/cl/102040043
This commit is contained in:
Keith Randall 2014-05-31 19:21:17 -04:00 committed by Russ Cox
parent 14d2ee1d00
commit 548b15def6
11 changed files with 16 additions and 0 deletions

View File

@ -465,6 +465,7 @@ runtime·algarray[] =
// Runtime helpers.
// used in asm_{386,amd64}.s
#pragma dataflag NOPTR
byte runtime·aeskeysched[HashRandomBytes];
void

View File

@ -17,6 +17,7 @@
#include "typekind.h"
#include "funcdata.h"
#include "zaexperiment.h"
#include "../../cmd/ld/textflag.h"
extern byte data[];
extern byte edata[];
@ -67,6 +68,7 @@ static uintptr dumpfd;
enum {
BufSize = 4096,
};
#pragma dataflag NOPTR
static byte buf[BufSize];
static uintptr nbuf;

View File

@ -19,6 +19,7 @@ package runtime
// Mark mheap as 'no pointers', it does not contain interesting pointers but occupies ~45K.
#pragma dataflag NOPTR
MHeap runtime·mheap;
#pragma dataflag NOPTR
MStats mstats;
int32 runtime·checking;

View File

@ -28,8 +28,11 @@
#include "runtime.h"
#include "arch_GOARCH.h"
#include "malloc.h"
#include "../../cmd/ld/textflag.h"
#pragma dataflag NOPTR
int32 runtime·class_to_size[NumSizeClasses];
#pragma dataflag NOPTR
int32 runtime·class_to_allocnpages[NumSizeClasses];
// The SizeToClass lookup is implemented using two arrays,
@ -41,7 +44,9 @@ int32 runtime·class_to_allocnpages[NumSizeClasses];
// size divided by 128 (rounded up). The arrays are filled in
// by InitSizes.
#pragma dataflag NOPTR
int8 runtime·size_to_class8[1024/8 + 1];
#pragma dataflag NOPTR
int8 runtime·size_to_class128[(MaxSmallSize-1024)/128 + 1];
void runtime·testdefersizes(void);

View File

@ -59,6 +59,7 @@ runtime·osinit(void)
void
runtime·get_random_data(byte **rnd, int32 *rnd_len)
{
#pragma dataflag NOPTR
static byte urandom_data[HashRandomBytes];
int32 fd;
fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0);

View File

@ -122,6 +122,7 @@ runtime·osinit(void)
void
runtime·get_random_data(byte **rnd, int32 *rnd_len)
{
#pragma dataflag NOPTR
static byte urandom_data[HashRandomBytes];
int32 fd;
fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0);

View File

@ -130,6 +130,7 @@ runtime·osinit(void)
void
runtime·get_random_data(byte **rnd, int32 *rnd_len)
{
#pragma dataflag NOPTR
static byte urandom_data[HashRandomBytes];
int32 fd;
fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0);

View File

@ -188,6 +188,7 @@ runtime·osinit(void)
void
runtime·get_random_data(byte **rnd, int32 *rnd_len)
{
#pragma dataflag NOPTR
static byte urandom_data[HashRandomBytes];
int32 fd;
fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0);

View File

@ -167,6 +167,7 @@ runtime·osinit(void)
void
runtime·get_random_data(byte **rnd, int32 *rnd_len)
{
#pragma dataflag NOPTR
static byte urandom_data[HashRandomBytes];
int32 fd;
fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0);

View File

@ -161,6 +161,7 @@ runtime·newosproc(M *mp, void *stk)
void
runtime·get_random_data(byte **rnd, int32 *rnd_len)
{
#pragma dataflag NOPTR
static byte urandom_data[HashRandomBytes];
int32 fd;
fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0);

View File

@ -2597,6 +2597,7 @@ struct Pdesc
uint32 syscalltick;
int64 syscallwhen;
};
#pragma dataflag NOPTR
static Pdesc pdesc[MaxGomaxprocs];
static uint32