mirror of
https://github.com/golang/go.git
synced 2026-06-27 19:30:52 +00:00
runtime: remove race and valgrind cases from specializedmalloc stubs
We disable sizespecializedmalloc if either raceenabled or valgrindenabled are true so this is dead code. For #79286 Change-Id: Ia1d7168b5c62e3f8f2dc2abd136774276a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/777800 LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
parent
b23aea0c94
commit
0a151acad8
2 changed files with 0 additions and 147 deletions
|
|
@ -159,10 +159,6 @@ func mallocgcSmallScanNoHeaderSC1(size uintptr, typ *_type, needzero bool) unsaf
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -324,10 +320,6 @@ func mallocgcSmallScanNoHeaderSC2(size uintptr, typ *_type, needzero bool) unsaf
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -489,10 +481,6 @@ func mallocgcSmallScanNoHeaderSC3(size uintptr, typ *_type, needzero bool) unsaf
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -654,10 +642,6 @@ func mallocgcSmallScanNoHeaderSC4(size uintptr, typ *_type, needzero bool) unsaf
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -819,10 +803,6 @@ func mallocgcSmallScanNoHeaderSC5(size uintptr, typ *_type, needzero bool) unsaf
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -984,10 +964,6 @@ func mallocgcSmallScanNoHeaderSC6(size uintptr, typ *_type, needzero bool) unsaf
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -1149,10 +1125,6 @@ func mallocgcSmallScanNoHeaderSC7(size uintptr, typ *_type, needzero bool) unsaf
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -1314,10 +1286,6 @@ func mallocgcSmallScanNoHeaderSC8(size uintptr, typ *_type, needzero bool) unsaf
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -1479,10 +1447,6 @@ func mallocgcSmallScanNoHeaderSC9(size uintptr, typ *_type, needzero bool) unsaf
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -1644,10 +1608,6 @@ func mallocgcSmallScanNoHeaderSC10(size uintptr, typ *_type, needzero bool) unsa
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -1724,10 +1684,6 @@ func mallocgcTinySC2(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
|
|||
const elemsize = 0
|
||||
{
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -1797,15 +1753,6 @@ func mallocgcTinySC2(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
|
|||
gcStart(t)
|
||||
}
|
||||
}
|
||||
|
||||
if raceenabled {
|
||||
|
||||
x = add(x, elemsize-size)
|
||||
}
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -1866,10 +1813,6 @@ func mallocgcSmallNoScanSC2(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -1935,10 +1878,6 @@ func mallocgcSmallNoScanSC2(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -1999,10 +1938,6 @@ func mallocgcSmallNoScanSC3(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -2068,10 +2003,6 @@ func mallocgcSmallNoScanSC3(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -2132,10 +2063,6 @@ func mallocgcSmallNoScanSC4(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -2201,10 +2128,6 @@ func mallocgcSmallNoScanSC4(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -2265,10 +2188,6 @@ func mallocgcSmallNoScanSC5(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -2334,10 +2253,6 @@ func mallocgcSmallNoScanSC5(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -2398,10 +2313,6 @@ func mallocgcSmallNoScanSC6(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -2467,10 +2378,6 @@ func mallocgcSmallNoScanSC6(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -2531,10 +2438,6 @@ func mallocgcSmallNoScanSC7(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -2600,10 +2503,6 @@ func mallocgcSmallNoScanSC7(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -2664,10 +2563,6 @@ func mallocgcSmallNoScanSC8(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -2733,10 +2628,6 @@ func mallocgcSmallNoScanSC8(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -2797,10 +2688,6 @@ func mallocgcSmallNoScanSC9(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -2866,10 +2753,6 @@ func mallocgcSmallNoScanSC9(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -2930,10 +2813,6 @@ func mallocgcSmallNoScanSC10(size uintptr, typ *_type, needzero bool) unsafe.Poi
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
@ -2999,10 +2878,6 @@ func mallocgcSmallNoScanSC10(size uintptr, typ *_type, needzero bool) unsafe.Poi
|
|||
addSecret(x, size)
|
||||
}
|
||||
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
assistG.gcAssistBytes -= int64(elemsize - size)
|
||||
|
|
|
|||
|
|
@ -105,13 +105,6 @@ func mallocStub(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
|
|||
}
|
||||
}
|
||||
|
||||
// Notify valgrind, if enabled.
|
||||
// To allow the compiler to not know about valgrind, we do valgrind instrumentation
|
||||
// unlike the other sanitizers.
|
||||
if valgrindenabled {
|
||||
valgrindMalloc(x, size)
|
||||
}
|
||||
|
||||
// Adjust our GC assist debt to account for internal fragmentation.
|
||||
if gcBlackenEnabled != 0 && elemsize != 0 {
|
||||
if assistG := getg().m.curg; assistG != nil {
|
||||
|
|
@ -505,21 +498,6 @@ func tinyStub(size uintptr, typ *_type, needzero bool) (unsafe.Pointer, uintptr)
|
|||
}
|
||||
}
|
||||
|
||||
if raceenabled {
|
||||
// Pad tinysize allocations so they are aligned with the end
|
||||
// of the tinyalloc region. This ensures that any arithmetic
|
||||
// that goes off the top end of the object will be detectable
|
||||
// by checkptr (issue 38872).
|
||||
// Note that we disable tinyalloc when raceenabled for this to work.
|
||||
// TODO: This padding is only performed when the race detector
|
||||
// is enabled. It would be nice to enable it if any package
|
||||
// was compiled with checkptr, but there's no easy way to
|
||||
// detect that (especially at compile time).
|
||||
// TODO: enable this padding for all allocations, not just
|
||||
// tinyalloc ones. It's tricky because of pointer maps.
|
||||
// Maybe just all noscan objects?
|
||||
x = add(x, elemsize-size)
|
||||
}
|
||||
return x, elemsize
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue