diff options
| author | Leonard Wang <wangdeyu0907@gmail.com> | 2021-09-11 20:53:24 +0800 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2021-09-28 18:43:19 +0000 |
| commit | 84ba117fd7446030f93ab679d5c819dc028ad881 (patch) | |
| tree | 79e38a589b42d1468bc875c0895af5baea6b3c98 /src/runtime/malloc.go | |
| parent | 8cf0a087c00db2e9ba24f763db903adcbffaade4 (diff) | |
| download | go-84ba117fd7446030f93ab679d5c819dc028ad881.tar.xz | |
runtime: add mp parameter for getMCache
Since all callers of getMCache appear to have mp available,
we pass the mp to getMCache, and reduce one call to getg.
And after modification, getMCache is also inlined.
Change-Id: Ib7880c118336acc026ecd7c60c5a88722c3ddfc7
Reviewed-on: https://go-review.googlesource.com/c/go/+/349329
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
Trust: Carlos Amedee <carlos@golang.org>
Diffstat (limited to 'src/runtime/malloc.go')
| -rw-r--r-- | src/runtime/malloc.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index f8d5d48a28..7affe244a2 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -972,7 +972,7 @@ func mallocgc(size uintptr, typ *_type, needzero bool) unsafe.Pointer { shouldhelpgc := false dataSize := size - c := getMCache() + c := getMCache(mp) if c == nil { throw("mallocgc called without a P or outside bootstrapping") } @@ -1247,7 +1247,7 @@ func reflect_unsafe_NewArray(typ *_type, n int) unsafe.Pointer { } func profilealloc(mp *m, x unsafe.Pointer, size uintptr) { - c := getMCache() + c := getMCache(mp) if c == nil { throw("profilealloc called without a P or outside bootstrapping") } |
