From 7c13860cd08352e785002cb97bd3baafd370e8bc Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Mon, 30 Jun 2014 18:59:24 -0700 Subject: runtime: stack allocator, separate from mallocgc In order to move malloc to Go, we need to have a separate stack allocator. If we run out of stack during malloc, malloc will not be available to allocate a new stack. Stacks are the last remaining FlagNoGC objects in the GC heap. Once they are out, we can get rid of the distinction between the allocated/blockboundary bits. (This will be in a separate change.) Fixes #7468 Fixes #7424 LGTM=rsc, dvyukov R=golang-codereviews, dvyukov, khr, dave, rsc CC=golang-codereviews https://golang.org/cl/104200047 --- src/pkg/runtime/runtime.h | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src/pkg/runtime/runtime.h') diff --git a/src/pkg/runtime/runtime.h b/src/pkg/runtime/runtime.h index 0f630abbf2..4350f280d7 100644 --- a/src/pkg/runtime/runtime.h +++ b/src/pkg/runtime/runtime.h @@ -146,13 +146,6 @@ enum { PtrSize = sizeof(void*), }; -enum -{ - // Per-M stack segment cache size. - StackCacheSize = 32, - // Global <-> per-M stack segment cache transfer batch size. - StackCacheBatch = 16, -}; /* * structures */ @@ -326,10 +319,6 @@ struct M M* schedlink; uint32 machport; // Return address for Mach IPC (OS X) MCache* mcache; - int32 stackinuse; - uint32 stackcachepos; - uint32 stackcachecnt; - void* stackcache[StackCacheSize]; G* lockedg; uintptr createstack[32];// Stack that created this thread. uint32 freglo[16]; // D[i] lsb and F[i] @@ -346,6 +335,8 @@ struct M bool (*waitunlockf)(G*, void*); void* waitlock; uintptr forkstackguard; + uintptr scalararg[4]; // scalar argument/return for mcall + void* ptrarg[4]; // pointer argument/return for mcall #ifdef GOOS_windows void* thread; // thread handle // these are here because they are too large to be on the stack @@ -428,7 +419,6 @@ struct Stktop uint8* argp; // pointer to arguments in old frame bool panic; // is this frame the top of a panic? - bool malloced; }; struct SigTab { @@ -866,6 +856,7 @@ int32 runtime·funcarglen(Func*, uintptr); int32 runtime·funcspdelta(Func*, uintptr); int8* runtime·funcname(Func*); int32 runtime·pcdatavalue(Func*, int32, uintptr); +void runtime·stackinit(void); void* runtime·stackalloc(G*, uint32); void runtime·stackfree(G*, void*, Stktop*); void runtime·shrinkstack(G*); -- cgit v1.3