github.com/better-concurrent/guc@v0.0.0-20190520022744-eb29266403a1/extern.go (about) 1 package guc 2 3 import ( 4 "unsafe" 5 ) 6 7 // Active spinning runtime support. 8 // runtime_canSpin returns true is spinning makes sense at the moment. 9 //go:linkname SyncRuntimeCanSpin sync.runtime_canSpin 10 func SyncRuntimeCanSpin(i int) bool 11 12 // runtime_doSpin does active spinning. 13 //go:linkname SyncRuntimeDoSpin sync.runtime_doSpin 14 func SyncRuntimeDoSpin() 15 16 // nanotime 17 //go:linkname SyncRuntimeNanoTime sync.runtime_nanotime 18 func SyncRuntimeNanoTime() int64 19 20 // Semacquire waits until *s > 0 and then atomically decrements it. 21 // It is intended as a simple sleep primitive for use by the synchronization 22 // library and should not be used directly. 23 //go:linkname SyncRuntimeSemacquire sync.runtime_Semacquire 24 func SyncRuntimeSemacquire(s *uint32) 25 26 // SemacquireMutex is like Semacquire, but for profiling contended Mutexes. 27 // If lifo is true, queue waiter at the head of wait queue. 28 //go:linkname SyncRuntimeSemacquireMutex sync.runtime_SemacquireMutex 29 func SyncRuntimeSemacquireMutex(s *uint32, lifo bool) 30 31 // Semrelease atomically increments *s and notifies a waiting goroutine 32 // if one is blocked in Semacquire. 33 // It is intended as a simple wakeup primitive for use by the synchronization 34 // library and should not be used directly. 35 // If handoff is true, pass count directly to the first waiter. 36 //go:linkname SyncRuntimeSemrelease sync.runtime_Semrelease 37 func SyncRuntimeSemrelease(s *uint32, handoff bool) 38 39 // ====== hash func ======== 40 // var algarray = [alg_max]typeAlg{ 41 // alg_NOEQ: {nil, nil}, 42 // alg_MEM0: {memhash0, memequal0}, 43 // alg_MEM8: {memhash8, memequal8}, 44 // alg_MEM16: {memhash16, memequal16}, 45 // alg_MEM32: {memhash32, memequal32}, 46 // alg_MEM64: {memhash64, memequal64}, 47 // alg_MEM128: {memhash128, memequal128}, 48 // alg_STRING: {strhash, strequal}, 49 // alg_INTER: {interhash, interequal}, 50 // alg_NILINTER: {nilinterhash, nilinterequal}, 51 // alg_FLOAT32: {f32hash, f32equal}, 52 // alg_FLOAT64: {f64hash, f64equal}, 53 // alg_CPLX64: {c64hash, c64equal}, 54 // alg_CPLX128: {c128hash, c128equal}, 55 //} 56 57 //go:linkname Memhash0 runtime.memhash0 58 func Memhash0(p unsafe.Pointer, h uintptr) uintptr 59 60 //go:linkname Memhash8 runtime.memhash8 61 func Memhash8(p unsafe.Pointer, h uintptr) uintptr 62 63 //go:linkname Memhash16 runtime.memhash16 64 func Memhash16(p unsafe.Pointer, h uintptr) uintptr 65 66 //go:linkname Memhash32 runtime.memhash32 67 func Memhash32(p unsafe.Pointer, seed uintptr) uintptr 68 69 //go:linkname Memhash64 runtime.memhash64 70 func Memhash64(p unsafe.Pointer, seed uintptr) uintptr 71 72 //go:linkname Memhash128 runtime.memhash128 73 func Memhash128(p unsafe.Pointer, h uintptr) uintptr 74 75 //go:linkname Strhash runtime.strhash 76 func Strhash(a unsafe.Pointer, h uintptr) uintptr 77 78 //go:linkname Interhash runtime.interhash 79 func Interhash(p unsafe.Pointer, h uintptr) uintptr 80 81 //go:linkname Nilinterhash runtime.nilinterhash 82 func Nilinterhash(p unsafe.Pointer, h uintptr) uintptr 83 84 //go:linkname F32hash runtime.f32hash 85 func F32hash(p unsafe.Pointer, h uintptr) uintptr 86 87 //go:linkname F64hash runtime.f64hash 88 func F64hash(p unsafe.Pointer, h uintptr) uintptr 89 90 //go:linkname C64hash runtime.c64hash 91 func C64hash(p unsafe.Pointer, h uintptr) uintptr 92 93 //go:linkname C128hash runtime.c128hash 94 func C128hash(p unsafe.Pointer, h uintptr) uintptr 95 96 //go:linkname Memequal0 runtime.memequal0 97 func Memequal0(p, q unsafe.Pointer) bool 98 99 //go:linkname Memequal8 runtime.memequal8 100 func Memequal8(p, q unsafe.Pointer) bool 101 102 //go:linkname Memequal16 runtime.memequal16 103 func Memequal16(p, q unsafe.Pointer) bool 104 105 //go:linkname Memequal32 runtime.memequal32 106 func Memequal32(p, q unsafe.Pointer) bool 107 108 //go:linkname Memequal64 runtime.memequal64 109 func Memequal64(p, q unsafe.Pointer) bool 110 111 //go:linkname Memequal128 runtime.memequal128 112 func Memequal128(p, q unsafe.Pointer) bool 113 114 //go:linkname Strequal runtime.strequal 115 func Strequal(p, q unsafe.Pointer) bool 116 117 //go:linkname Interequal runtime.interequal 118 func Interequal(p, q unsafe.Pointer) bool 119 120 //go:linkname Nilinterequal runtime.nilinterequal 121 func Nilinterequal(p, q unsafe.Pointer) bool 122 123 //go:linkname F32equal runtime.f32equal 124 func F32equal(p, q unsafe.Pointer) bool 125 126 //go:linkname F64equal runtime.f64equal 127 func F64equal(p, q unsafe.Pointer) bool 128 129 //go:linkname C64equal runtime.c64equal 130 func C64equal(p, q unsafe.Pointer) bool 131 132 //go:linkname C128equal runtime.c128equal 133 func C128equal(p, q unsafe.Pointer) bool 134 135 //go:linkname Fastrand runtime.fastrand 136 func Fastrand() uint32