| 1 |
// Copyright 2022 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
// This file lives in the runtime package |
| 6 |
// so we can get access to the runtime guts. |
| 7 |
// The rest of the implementation of this test is in align_test.go. |
| 8 |
|
| 9 |
package runtime |
| 10 |
|
| 11 |
import "unsafe" |
| 12 |
|
| 13 |
// AtomicFields is the set of fields on which we perform 64-bit atomic |
| 14 |
// operations (all the *64 operations in internal/runtime/atomic). |
| 15 |
var AtomicFields = []uintptr{ |
| 16 |
unsafe.Offsetof(m{}.procid), |
| 17 |
unsafe.Offsetof(profBuf{}.overflow), |
| 18 |
unsafe.Offsetof(profBuf{}.overflowTime), |
| 19 |
unsafe.Offsetof(heapStatsDelta{}.tinyAllocCount), |
| 20 |
unsafe.Offsetof(heapStatsDelta{}.smallAllocCount), |
| 21 |
unsafe.Offsetof(heapStatsDelta{}.smallFreeCount), |
| 22 |
unsafe.Offsetof(heapStatsDelta{}.largeAlloc), |
| 23 |
unsafe.Offsetof(heapStatsDelta{}.largeAllocCount), |
| 24 |
unsafe.Offsetof(heapStatsDelta{}.largeFree), |
| 25 |
unsafe.Offsetof(heapStatsDelta{}.largeFreeCount), |
| 26 |
unsafe.Offsetof(heapStatsDelta{}.committed), |
| 27 |
unsafe.Offsetof(heapStatsDelta{}.released), |
| 28 |
unsafe.Offsetof(heapStatsDelta{}.inHeap), |
| 29 |
unsafe.Offsetof(heapStatsDelta{}.inStacks), |
| 30 |
unsafe.Offsetof(heapStatsDelta{}.inWorkBufs), |
| 31 |
unsafe.Offsetof(lfnode{}.next), |
| 32 |
unsafe.Offsetof(mstats{}.last_gc_nanotime), |
| 33 |
unsafe.Offsetof(mstats{}.last_gc_unix), |
| 34 |
unsafe.Offsetof(workType{}.bytesMarked), |
| 35 |
} |
| 36 |
|
| 37 |
// AtomicVariables is the set of global variables on which we perform |
| 38 |
// 64-bit atomic operations. |
| 39 |
var AtomicVariables = []unsafe.Pointer{ |
| 40 |
unsafe.Pointer(&ncgocall), |
| 41 |
unsafe.Pointer(&test_z64), |
| 42 |
unsafe.Pointer(&blockprofilerate), |
| 43 |
unsafe.Pointer(&mutexprofilerate), |
| 44 |
unsafe.Pointer(&gcController), |
| 45 |
unsafe.Pointer(&memstats), |
| 46 |
unsafe.Pointer(&sched), |
| 47 |
unsafe.Pointer(&ticks), |
| 48 |
unsafe.Pointer(&work), |
| 49 |
} |