-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlinks.go
251 lines (199 loc) · 6.69 KB
/
links.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
// Package runtimer provides you unsafe way to use runtime internals
package runtimer
import (
"unsafe" // #nosec required to use go:linkname
)
func Or8(ptr *uint8, val uint8) {
or8(ptr, val)
}
//go:noescape
//go:linkname or8 runtime.internal.atomic.Or8
func or8(ptr *uint8, val uint8)
//go:linkname PtrSize runtime.internal.sys.PtrSize
const PtrSize = 4 << (^uintptr(0) >> 63) // unsafe.Sizeof(uintptr(0)) but an ideal const
func Cas(ptr *uint32, old, new uint32) bool {
return cas(ptr, old, new)
}
//go:noescape
//go:linkname cas runtime.internal.atomic.Cas
func cas(ptr *uint32, old, new uint32) bool
func Casp1(ptr *unsafe.Pointer, old, new unsafe.Pointer) bool {
return casp1(ptr, old, new)
}
// NO go:noescape annotation; see atomic_pointer.go.
//go:linkname casp1 runtime.internal.atomic.Casp1
func casp1(ptr *unsafe.Pointer, old, new unsafe.Pointer) bool
func Casuintptr(ptr *uintptr, old, new uintptr) bool {
return casuintptr(ptr, old, new)
}
//go:noescape
//go:linkname casuintptr runtime.internal.atomic.Casuintptr
func casuintptr(ptr *uintptr, old, new uintptr) bool
func Storeuintptr(ptr *uintptr, new uintptr) {
storeuintptr(ptr, new)
}
//go:noescape
//go:linkname storeuintptr runtime.internal.atomic.Storeuintptr
func storeuintptr(ptr *uintptr, new uintptr)
func Loaduintptr(ptr *uintptr) uintptr {
return loaduintptr(ptr)
}
//go:noescape
//go:linkname loaduintptr runtime.internal.atomic.Loaduintptr
func loaduintptr(ptr *uintptr) uintptr
func Loaduint(ptr *uint) uint {
return loaduint(ptr)
}
//go:noescape
//go:linkname loaduint runtime.internal.atomic.Loaduint
func loaduint(ptr *uint) uint
func Loadint64(ptr *int64) int64 {
return loadint64(ptr)
}
//go:noescape
//go:linkname loadint64 runtime.internal.atomic.Loadint64
func loadint64(ptr *int64) int64
func Fastrand() uint32 {
return fastrand()
}
//go:linkname fastrand runtime.fastrand
func fastrand() uint32
func Throw(s string) {
throw(s)
}
//go:linkname throw runtime.throw
func throw(s string)
func Newarray(typ *Type, n int) unsafe.Pointer {
return newarray(typ, n)
}
//go:linkname newarray runtime.newarray
func newarray(typ *Type, n int) unsafe.Pointer
func Newobject(typ *Type) unsafe.Pointer {
return mallocgc(typ.Size, typ, true)
}
//go:linkname mallocgc runtime.mallocgc
func mallocgc(size uintptr, typ *Type, needzero bool) unsafe.Pointer
func Typedmemmove(typ *Type, dst, src unsafe.Pointer) {
typedmemmove(typ, dst, src)
}
//go:linkname typedmemmove runtime.typedmemmove
func typedmemmove(typ *Type, dst, src unsafe.Pointer)
func Typedmemclr(typ *Type, ptr unsafe.Pointer) {
typedmemclr(typ, ptr)
}
//go:linkname typedmemclr runtime.typedmemclr
func typedmemclr(typ *Type, ptr unsafe.Pointer)
func Lock(l *Mutex) {
lock(l)
}
//go:linkname lock runtime.lock
func lock(l *Mutex)
func Unlock(l *Mutex) {
unlock(l)
}
//go:linkname unlock runtime.unlock
func unlock(l *Mutex)
func Msanread(addr unsafe.Pointer, sz uintptr) {
msanread(addr, sz)
}
//go:linkname msanread runtime.msanread
func msanread(addr unsafe.Pointer, sz uintptr)
func MemclrHasPointers(ptr unsafe.Pointer, n uintptr) {
memclrHasPointers(ptr, n)
}
//go:linkname memclrHasPointers runtime.memclrHasPointers
func memclrHasPointers(ptr unsafe.Pointer, n uintptr)
//go:linkname Hex runtime.hex
type Hex uint64
func MemclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) {
memclrNoHeapPointers(ptr, n)
}
//go:linkname memclrNoHeapPointers runtime.memclrNoHeapPointers
func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
func Noescape(p unsafe.Pointer) unsafe.Pointer {
return noescape(p)
}
//go:linkname noescape runtime.noescape
func noescape(p unsafe.Pointer) unsafe.Pointer
func Xaddint64(ptr *int64, delta int64) int64 {
return xaddint64(ptr, delta)
}
//go:noescape
//go:linkname xaddint64 runtime.internal.atomic.Xaddint64
func xaddint64(ptr *int64, delta int64) int64
func Encoderune(p []byte, r rune) int {
return encoderune(p, r)
}
//go:linkname encoderune runtime.encoderune
func encoderune(p []byte, r rune) int
func Rawstring(size int) (s string, b []byte) {
return rawstring(size)
}
//go:linkname rawstring runtime.rawstring
func rawstring(size int) (s string, b []byte)
const (
//go:linkname GOOS runtime.internal.sys.GOOS
GOOS = `unknown`
//go:linkname GoosAndroid runtime.internal.sys.GoosAndroid
GoosAndroid uint = 0
//go:linkname GoosDarwin runtime.internal.sys.GoosDarwin
GoosDarwin uint = 0
//go:linkname GoosDragonfly runtime.internal.sys.GoosDragonfly
GoosDragonfly uint = 0
//go:linkname GoosFreebsd runtime.internal.sys.GoosFreebsd
GoosFreebsd uint = 0
//go:linkname GoosLinux runtime.internal.sys.GoosLinux
GoosLinux uint = 0
//go:linkname GoosNacl runtime.internal.sys.GoosNacl
GoosNacl uint = 0
//go:linkname GoosNetbsd runtime.internal.sys.GoosNetbsd
GoosNetbsd uint = 0
//go:linkname GoosOpenbsd runtime.internal.sys.GoosOpenbsd
GoosOpenbsd uint = 0
//go:linkname GoosPlan9 runtime.internal.sys.GoosPlan9
GoosPlan9 uint = 0
//go:linkname GoosSolaris runtime.internal.sys.GoosSolaris
GoosSolaris uint = 0
//go:linkname GoosWindows runtime.internal.sys.GoosWindows
GoosWindows uint = 0
//go:linkname Goarch386 runtime.internal.sys.Goarch386
Goarch386 uint = 0
//go:linkname GoarchAmd64 runtime.internal.sys.GoarchAmd64
GoarchAmd64 uint = 0
//go:linkname GoarchAmd64p32 runtime.internal.sys.GoarchAmd64p32
GoarchAmd64p32 uint = 0
//go:linkname GoarchArm runtime.internal.sys.GoarchArm
GoarchArm uint = 0
//go:linkname GoarchArmbe runtime.internal.sys.GoarchArmbe
GoarchArmbe uint = 0
//go:linkname GoarchArm64 runtime.internal.sys.GoarchArm64
GoarchArm64 uint = 0
//go:linkname GoarchArm64be runtime.internal.sys.GoarchArm64be
GoarchArm64be uint = 0
//go:linkname GoarchPpc64 runtime.internal.sys.GoarchPpc64
GoarchPpc64 uint = 0
//go:linkname GoarchPpc64le runtime.internal.sys.GoarchPpc64le
GoarchPpc64le uint = 0
//go:linkname GoarchMips runtime.internal.sys.GoarchMips
GoarchMips uint = 0
//go:linkname GoarchMipsle runtime.internal.sys.GoarchMipsle
GoarchMipsle uint = 0
//go:linkname GoarchMips64 runtime.internal.sys.GoarchMips64
GoarchMips64 uint = 0
//go:linkname GoarchMips64le runtime.internal.sys.GoarchMips64le
GoarchMips64le uint = 0
//go:linkname GoarchMips64p32 runtime.internal.sys.GoarchMips64p32
GoarchMips64p32 uint = 0
//go:linkname GoarchMips64p32le runtime.internal.sys.GoarchMips64p32le
GoarchMips64p32le uint = 0
//go:linkname GoarchPpc runtime.internal.sys.GoarchPpc
GoarchPpc uint = 0
//go:linkname GoarchS390 runtime.internal.sys.GoarchS390
GoarchS390 uint = 0
//go:linkname GoarchS390x runtime.internal.sys.GoarchS390x
GoarchS390x uint = 0
//go:linkname GoarchSparc runtime.internal.sys.GoarchSparc
GoarchSparc uint = 0
//go:linkname GoarchSparc64 runtime.internal.sys.GoarchSparc64
GoarchSparc64 uint = 0
)