]> Cypherpunks repositories - gostls13.git/commit
runtime: add helper for getting an mcache in allocation contexts
authorMichael Anthony Knyszek <mknyszek@google.com>
Mon, 3 Aug 2020 20:08:25 +0000 (20:08 +0000)
committerMichael Knyszek <mknyszek@google.com>
Mon, 26 Oct 2020 18:25:20 +0000 (18:25 +0000)
commitc02134abb01e019683daf051029d66b15dd11213
treef3ead5fa70bf6c0114db1ea67bce94a4fd4c9743
parentae585ee52c2437bfd0e955ad6fc8911bf292f51d
runtime: add helper for getting an mcache in allocation contexts

This change adds a function getMCache which returns the current P's
mcache if it's available, and otherwise tries to get mcache0 if we're
bootstrapping. This function will come in handy as we need to replicate
this behavior in multiple places in future changes.

Change-Id: I536073d6f6dc6c6390269e613ead9f8bcb6e7f98
Reviewed-on: https://go-review.googlesource.com/c/go/+/246976
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/runtime/malloc.go
src/runtime/mcache.go