diff options
| author | Russ Cox <rsc@golang.org> | 2014-04-08 22:35:41 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2014-04-08 22:35:41 -0400 |
| commit | 5556bfa9c736f63ae18ec0ab8ef9b6a986e32ef3 (patch) | |
| tree | db94514c23e3f92f702bfd5471c828018d5c0457 /src/pkg/runtime/proc.c | |
| parent | b3a33a654d2f640f3b6c7856ea742c23f6c49d1c (diff) | |
| download | go-5556bfa9c736f63ae18ec0ab8ef9b6a986e32ef3.tar.xz | |
runtime: cache gotraceback setting
On Plan 9 gotraceback calls getenv calls malloc, and we gotraceback
on every call to gentraceback, which happens during garbage collection.
Honestly I don't even know how this works on Plan 9.
I suspect it does not, and that we are getting by because
no one has tried to run with $GOTRACEBACK set at all.
This will speed up all the other systems by epsilon, since they
won't call getenv and atoi repeatedly.
LGTM=bradfitz
R=golang-codereviews, bradfitz, 0intro
CC=golang-codereviews
https://golang.org/cl/85430046
Diffstat (limited to 'src/pkg/runtime/proc.c')
| -rw-r--r-- | src/pkg/runtime/proc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index 2ab54be70c..6b5c031c87 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -155,6 +155,10 @@ runtime·schedinit(void) // in a fault during a garbage collection, it will not // need to allocated memory. runtime·newErrorCString(0, &i); + + // Initialize the cached gotraceback value, since + // gotraceback calls getenv, which mallocs on Plan 9. + runtime·gotraceback(nil); runtime·goargs(); runtime·goenvs(); |
