LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 /* | 5 /* |
6 * basic types | 6 * basic types |
7 */ | 7 */ |
8 typedef signed char int8; | 8 typedef signed char int8; |
9 typedef unsigned char uint8; | 9 typedef unsigned char uint8; |
10 typedef signed short int16; | 10 typedef signed short int16; |
11 typedef unsigned short uint16; | 11 typedef unsigned short uint16; |
12 typedef signed int int32; | 12 typedef signed int int32; |
13 typedef unsigned int uint32; | 13 typedef unsigned int uint32; |
14 typedef signed long long int int64; | 14 typedef signed long long int int64; |
15 typedef unsigned long long int uint64; | 15 typedef unsigned long long int uint64; |
16 typedef float float32; | 16 typedef float float32; |
17 typedef double float64; | 17 typedef double float64; |
18 | 18 |
19 #ifdef _64BIT | 19 #ifdef _64BIT |
20 typedef uint64 uintptr; | 20 typedef uint64 uintptr; |
21 typedef int64 intptr; | 21 typedef int64 intptr; |
| 22 typedef int64 intgo; // Go's int |
| 23 typedef uint64 uintgo; // Go's uint |
22 #else | 24 #else |
23 typedef uint32 uintptr; | 25 typedef uint32 uintptr; |
24 typedef int32» » intptr; | 26 typedef»int32» » intptr; |
| 27 typedef»int32» » intgo; // Go's int |
| 28 typedef»uint32» » uintgo; // Go's uint |
25 #endif | 29 #endif |
26 | 30 |
27 /* | 31 /* |
28 * get rid of C types | 32 * get rid of C types |
29 * the / / / forces a syntax error immediately, | 33 * the / / / forces a syntax error immediately, |
30 * which will show "last name: XXunsigned". | 34 * which will show "last name: XXunsigned". |
31 */ | 35 */ |
32 #define unsigned XXunsigned / / / | 36 #define unsigned XXunsigned / / / |
33 #define signed XXsigned / / / | 37 #define signed XXsigned / / / |
34 #define char XXchar / / / | 38 #define char XXchar / / / |
(...skipping 17 matching lines...) Expand all Loading... |
52 typedef struct Mem Mem; | 56 typedef struct Mem Mem; |
53 typedef union Note Note; | 57 typedef union Note Note; |
54 typedef struct Slice Slice; | 58 typedef struct Slice Slice; |
55 typedef struct Stktop Stktop; | 59 typedef struct Stktop Stktop; |
56 typedef struct String String; | 60 typedef struct String String; |
57 typedef struct SigTab SigTab; | 61 typedef struct SigTab SigTab; |
58 typedef struct MCache MCache; | 62 typedef struct MCache MCache; |
59 typedef struct FixAlloc FixAlloc; | 63 typedef struct FixAlloc FixAlloc; |
60 typedef struct Iface Iface; | 64 typedef struct Iface Iface; |
61 typedef struct Itab Itab; | 65 typedef struct Itab Itab; |
| 66 typedef struct InterfaceType InterfaceType; |
62 typedef struct Eface Eface; | 67 typedef struct Eface Eface; |
63 typedef struct Type Type; | 68 typedef struct Type Type; |
64 typedef struct ChanType ChanType; | 69 typedef struct ChanType ChanType; |
65 typedef struct MapType MapType; | 70 typedef struct MapType MapType; |
66 typedef struct Defer Defer; | 71 typedef struct Defer Defer; |
67 typedef struct Panic Panic; | 72 typedef struct Panic Panic; |
68 typedef struct Hmap Hmap; | 73 typedef struct Hmap Hmap; |
69 typedef struct Hchan Hchan; | 74 typedef struct Hchan Hchan; |
70 typedef struct Complex64 Complex64; | 75 typedef struct Complex64 Complex64; |
71 typedef struct Complex128 Complex128; | 76 typedef struct Complex128 Complex128; |
72 typedef struct WinCall WinCall; | 77 typedef struct WinCall WinCall; |
73 typedef struct SEH SEH; | 78 typedef struct SEH SEH; |
74 typedef struct Timers Timers; | 79 typedef struct Timers Timers; |
75 typedef struct Timer Timer; | 80 typedef struct Timer Timer; |
76 typedef struct GCStats GCStats; | 81 typedef struct GCStats GCStats; |
77 typedef struct LFNode LFNode; | 82 typedef struct LFNode LFNode; |
78 typedef struct ParFor ParFor; | 83 typedef struct ParFor ParFor; |
79 typedef struct ParForThread ParForThread; | 84 typedef struct ParForThread ParForThread; |
80 | 85 typedef struct» CgoMal» » CgoMal; |
81 /* | 86 |
82 * per-cpu declaration. | 87 /* |
| 88 * Per-CPU declaration. |
| 89 * |
83 * "extern register" is a special storage class implemented by 6c, 8c, etc. | 90 * "extern register" is a special storage class implemented by 6c, 8c, etc. |
84 * on machines with lots of registers, it allocates a register that will not be | 91 * On the ARM, it is an actual register; elsewhere it is a slot in thread- |
85 * used in generated code. on the x86, it allocates a slot indexed by a | 92 * local storage indexed by a segment register. See zasmhdr in |
86 * segment register. | 93 * src/cmd/dist/buildruntime.c for details, and be aware that the linker may |
| 94 * make further OS-specific changes to the compiler's output. For example, |
| 95 * 6l/linux rewrites 0(GS) as -16(FS). |
87 * | 96 * |
88 * amd64: allocated downwards from R15 | 97 * Every C file linked into a Go program must include runtime.h so that the |
89 * x86: allocated upwards from 0(GS) | 98 * C compiler (6c, 8c, etc.) knows to avoid other uses of these dedicated |
90 * arm: allocated downwards from R10 | 99 * registers. The Go compiler (6g, 8g, etc.) knows to avoid them. |
91 * | |
92 * every C file linked into a Go program must include runtime.h | |
93 * so that the C compiler knows to avoid other uses of these registers. | |
94 * the Go compilers know to avoid them. | |
95 */ | 100 */ |
96 extern register G* g; | 101 extern register G* g; |
97 extern register M* m; | 102 extern register M* m; |
98 | 103 |
99 /* | 104 /* |
100 * defined constants | 105 * defined constants |
101 */ | 106 */ |
102 enum | 107 enum |
103 { | 108 { |
104 // G status | 109 // G status |
(...skipping 15 matching lines...) Expand all Loading... |
120 Pbusy, | 125 Pbusy, |
121 Psyscall, | 126 Psyscall, |
122 Plocked, | 127 Plocked, |
123 Pdead, | 128 Pdead, |
124 }; | 129 }; |
125 enum | 130 enum |
126 { | 131 { |
127 true = 1, | 132 true = 1, |
128 false = 0, | 133 false = 0, |
129 }; | 134 }; |
| 135 enum |
| 136 { |
| 137 PtrSize = sizeof(void*), |
| 138 }; |
130 | 139 |
131 /* | 140 /* |
132 * structures | 141 * structures |
133 */ | 142 */ |
134 union Lock | 143 union Lock |
135 { | 144 { |
136 uint32 key; // futex-based impl | 145 uint32 key; // futex-based impl |
137 M* waitm; // linked list of waiting M's (sema-based impl) | 146 M* waitm; // linked list of waiting M's (sema-based impl) |
138 }; | 147 }; |
139 union Note | 148 union Note |
140 { | 149 { |
141 uint32 key; // futex-based impl | 150 uint32 key; // futex-based impl |
142 M* waitm; // waiting M (sema-based impl) | 151 M* waitm; // waiting M (sema-based impl) |
143 }; | 152 }; |
144 struct String | 153 struct String |
145 { | 154 { |
146 byte* str; | 155 byte* str; |
147 » int32» len; | 156 » intgo» len; |
148 }; | 157 }; |
149 struct Iface | 158 struct Iface |
150 { | 159 { |
151 Itab* tab; | 160 Itab* tab; |
152 void* data; | 161 void* data; |
153 }; | 162 }; |
154 struct Eface | 163 struct Eface |
155 { | 164 { |
156 Type* type; | 165 Type* type; |
157 void* data; | 166 void* data; |
158 }; | 167 }; |
159 struct Complex64 | 168 struct Complex64 |
160 { | 169 { |
161 float32 real; | 170 float32 real; |
162 float32 imag; | 171 float32 imag; |
163 }; | 172 }; |
164 struct Complex128 | 173 struct Complex128 |
165 { | 174 { |
166 float64 real; | 175 float64 real; |
167 float64 imag; | 176 float64 imag; |
168 }; | 177 }; |
169 | 178 |
170 struct Slice | 179 struct Slice |
171 { // must not move anything | 180 { // must not move anything |
172 byte* array; // actual data | 181 byte* array; // actual data |
173 » uint32» len;» » // number of elements | 182 » uintgo» len;» » // number of elements |
174 » uint32» cap;» » // allocated number of elements | 183 » uintgo» cap;» » // allocated number of elements |
175 }; | 184 }; |
176 struct Gobuf | 185 struct Gobuf |
177 { | 186 { |
178 // The offsets of these fields are known to (hard-coded in) libmach. | 187 // The offsets of these fields are known to (hard-coded in) libmach. |
179 uintptr sp; | 188 uintptr sp; |
180 byte* pc; | 189 byte* pc; |
181 G* g; | 190 G* g; |
182 }; | 191 }; |
183 struct GCStats | 192 struct GCStats |
184 { | 193 { |
185 // the struct must consist of only uint64's, | 194 // the struct must consist of only uint64's, |
186 // because it is casted to uint64[]. | 195 // because it is casted to uint64[]. |
187 uint64 nhandoff; | 196 uint64 nhandoff; |
188 uint64 nhandoffcnt; | 197 uint64 nhandoffcnt; |
189 uint64 nprocyield; | 198 uint64 nprocyield; |
190 uint64 nosyield; | 199 uint64 nosyield; |
191 uint64 nsleep; | 200 uint64 nsleep; |
192 }; | 201 }; |
193 struct SchedStats | |
194 { | |
195 uint64 nm; | |
196 uint64 sysexitfast; | |
197 uint64 sysexitmed; | |
198 uint64 sysexitslow; | |
199 uint64 stealempty; | |
200 uint64 stealn; | |
201 uint64 stealcnt; | |
202 uint64 gstart; | |
203 uint64 gend; | |
204 uint64 gfput; | |
205 uint64 gfget; | |
206 uint64 galloc; | |
207 }; | |
208 typedef struct SchedStats SchedStats; | |
209 struct G | 202 struct G |
210 { | 203 { |
211 uintptr stackguard; // cannot move - also known to linker, libmach,
runtime/cgo | 204 uintptr stackguard; // cannot move - also known to linker, libmach,
runtime/cgo |
212 uintptr stackbase; // cannot move - also known to libmach, runtime/
cgo | 205 uintptr stackbase; // cannot move - also known to libmach, runtime/
cgo |
213 Defer* defer; | 206 Defer* defer; |
214 Panic* panic; | 207 Panic* panic; |
215 Gobuf sched; | 208 Gobuf sched; |
216 uintptr gcstack; // if status==Gsyscall, gcstack = stackb
ase to use during gc | 209 uintptr gcstack; // if status==Gsyscall, gcstack = stackb
ase to use during gc |
217 uintptr gcsp; // if status==Gsyscall, gcsp = sched.sp to use d
uring gc | 210 uintptr gcsp; // if status==Gsyscall, gcsp = sched.sp to use d
uring gc |
218 uintptr gcguard; // if status==Gsyscall, gcguard = stackg
uard to use during gc | 211 uintptr gcguard; // if status==Gsyscall, gcguard = stackg
uard to use during gc |
219 uintptr stack0; | 212 uintptr stack0; |
220 byte* entry; // initial function | 213 byte* entry; // initial function |
221 G* alllink; // on allg | 214 G* alllink; // on allg |
222 void* param; // passed parameter on wakeup | 215 void* param; // passed parameter on wakeup |
223 int16 status; | 216 int16 status; |
| 217 int64 goid; |
224 uint32 selgen; // valid sudog pointer | 218 uint32 selgen; // valid sudog pointer |
225 int8* waitreason; // if status==Gwaiting | 219 int8* waitreason; // if status==Gwaiting |
226 G* schedlink; | 220 G* schedlink; |
227 bool ispanic; | 221 bool ispanic; |
| 222 int8 raceignore; // ignore race detection events |
228 M* m; // for debuggers, but offset not hard-coded | 223 M* m; // for debuggers, but offset not hard-coded |
229 M* lockedm; | 224 M* lockedm; |
230 int32 sig; | 225 int32 sig; |
231 int32 writenbuf; | 226 int32 writenbuf; |
232 byte* writebuf; | 227 byte* writebuf; |
233 uintptr sigcode0; | 228 uintptr sigcode0; |
234 uintptr sigcode1; | 229 uintptr sigcode1; |
235 uintptr sigpc; | 230 uintptr sigpc; |
236 uintptr gopc; // pc of go statement that created this goroutine | 231 uintptr gopc; // pc of go statement that created this goroutine |
237 uintptr end[]; | 232 uintptr end[]; |
(...skipping 16 matching lines...) Expand all Loading... |
254 G* curg; // current running goroutine | 249 G* curg; // current running goroutine |
255 P* p; // attached P for executing Go code (nil
if not executing Go code) | 250 P* p; // attached P for executing Go code (nil
if not executing Go code) |
256 int32 id; | 251 int32 id; |
257 int32 mallocing; | 252 int32 mallocing; |
258 int32 gcing; | 253 int32 gcing; |
259 int32 locks; | 254 int32 locks; |
260 int32 nomemprof; | 255 int32 nomemprof; |
261 int32 dying; | 256 int32 dying; |
262 int32 profilehz; | 257 int32 profilehz; |
263 int32 helpgc; | 258 int32 helpgc; |
| 259 bool blockingsyscall; |
264 uint32 fastrand; | 260 uint32 fastrand; |
265 » uint64» ncgocall; | 261 » uint64» ncgocall;» // number of cgo calls in total |
| 262 » int32» ncgo;» » // number of cgo calls currently in progress |
| 263 » CgoMal*»cgomal; |
266 Note park; | 264 Note park; |
267 M* alllink; // on allm | 265 M* alllink; // on allm |
268 M* schedlink; | 266 M* schedlink; |
269 uint32 machport; // Return address for Mach IPC (OS X) | 267 uint32 machport; // Return address for Mach IPC (OS X) |
270 MCache *mcache; | 268 MCache *mcache; |
271 FixAlloc *stackalloc; | 269 FixAlloc *stackalloc; |
272 G* lockedg; | 270 G* lockedg; |
273 uintptr createstack[32]; // Stack that created this thread. | 271 uintptr createstack[32]; // Stack that created this thread. |
274 uint32 freglo[16]; // D[i] lsb and F[i] | 272 uint32 freglo[16]; // D[i] lsb and F[i] |
275 uint32 freghi[16]; // D[i] msb and F[i+16] | 273 uint32 freghi[16]; // D[i] msb and F[i+16] |
276 uint32 fflag; // floating point compare flags | 274 uint32 fflag; // floating point compare flags |
277 M* nextwaitm; // next M waiting for lock | 275 M* nextwaitm; // next M waiting for lock |
278 uintptr waitsema; // semaphore for parking on locks | 276 uintptr waitsema; // semaphore for parking on locks |
279 uint32 waitsemacount; | 277 uint32 waitsemacount; |
280 uint32 waitsemalock; | 278 uint32 waitsemalock; |
281 GCStats gcstats; | 279 GCStats gcstats; |
282 » SchedStats» schedstats; | 280 » bool» racecall; |
283 » void» *waitlock; | 281 » void*» racepc; |
284 » void» (*waitunlockf)(void*); | 282 » void» (*waitunlockf)(Lock*); |
| 283 » Lock*» waitlock; |
285 G g0buf; | 284 G g0buf; |
| 285 |
| 286 uintptr settype_buf[1024]; |
| 287 uintptr settype_bufsize; |
286 | 288 |
287 #ifdef GOOS_windows | 289 #ifdef GOOS_windows |
288 void* thread; // thread handle | 290 void* thread; // thread handle |
289 #endif | 291 #endif |
290 SEH* seh; | 292 SEH* seh; |
291 uintptr end[]; | 293 uintptr end[]; |
292 }; | 294 }; |
293 | 295 |
294 struct P | 296 struct P |
295 { | 297 { |
296 Lock; | 298 Lock; |
297 uint32 status; | 299 uint32 status; |
298 P* link; | 300 P* link; |
299 uint32 tick; | 301 uint32 tick; |
300 M* m; // back-link to associated M (nil if idle) | 302 M* m; // back-link to associated M (nil if idle) |
301 MCache* mcache; | 303 MCache* mcache; |
302 | |
303 G* allg; | |
304 | 304 |
305 // Queue of runnable goroutines. | 305 // Queue of runnable goroutines. |
306 G** runq; | 306 G** runq; |
307 int32 runqhead; | 307 int32 runqhead; |
308 int32 runqtail; | 308 int32 runqtail; |
309 int32 runqsize; | 309 int32 runqsize; |
310 | 310 |
311 G* gfree; // available g's (status == Gdead) | 311 G* gfree; // available g's (status == Gdead) |
312 int32 gfreecnt; | 312 int32 gfreecnt; |
313 | 313 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 String name; | 347 String name; |
348 String type; // go type string | 348 String type; // go type string |
349 String src; // src file name | 349 String src; // src file name |
350 Slice pcln; // pc/ln tab for this func | 350 Slice pcln; // pc/ln tab for this func |
351 uintptr entry; // entry pc | 351 uintptr entry; // entry pc |
352 uintptr pc0; // starting pc, ln for table | 352 uintptr pc0; // starting pc, ln for table |
353 int32 ln0; | 353 int32 ln0; |
354 int32 frame; // stack frame size | 354 int32 frame; // stack frame size |
355 int32 args; // number of 32-bit in/out args | 355 int32 args; // number of 32-bit in/out args |
356 int32 locals; // number of 32-bit locals | 356 int32 locals; // number of 32-bit locals |
| 357 }; |
| 358 |
| 359 // layout of Itab known to compilers |
| 360 struct Itab |
| 361 { |
| 362 InterfaceType* inter; |
| 363 Type* type; |
| 364 Itab* link; |
| 365 int32 bad; |
| 366 int32 unused; |
| 367 void (*fun[])(void); |
357 }; | 368 }; |
358 | 369 |
359 struct WinCall | 370 struct WinCall |
360 { | 371 { |
361 void (*fn)(void*); | 372 void (*fn)(void*); |
362 uintptr n; // number of parameters | 373 uintptr n; // number of parameters |
363 void* args; // parameters | 374 void* args; // parameters |
364 uintptr r1; // return values | 375 uintptr r1; // return values |
365 uintptr r2; | 376 uintptr r2; |
366 uintptr err; // error number | 377 uintptr err; // error number |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 void *ctx; // arbitrary user context | 438 void *ctx; // arbitrary user context |
428 bool wait; // if true, wait while all threads finis
h processing, | 439 bool wait; // if true, wait while all threads finis
h processing, |
429 // otherwise parfor may return while oth
er threads are still working | 440 // otherwise parfor may return while oth
er threads are still working |
430 ParForThread *thr; // array of thread descriptors | 441 ParForThread *thr; // array of thread descriptors |
431 // stats | 442 // stats |
432 uint64 nsteal; | 443 uint64 nsteal; |
433 uint64 nstealcnt; | 444 uint64 nstealcnt; |
434 uint64 nprocyield; | 445 uint64 nprocyield; |
435 uint64 nosyield; | 446 uint64 nosyield; |
436 uint64 nsleep; | 447 uint64 nsleep; |
| 448 }; |
| 449 |
| 450 // Track memory allocated by code not written in Go during a cgo call, |
| 451 // so that the garbage collector can see them. |
| 452 struct CgoMal |
| 453 { |
| 454 CgoMal *next; |
| 455 byte *alloc; |
437 }; | 456 }; |
438 | 457 |
439 /* | 458 /* |
440 * defined macros | 459 * defined macros |
441 * you need super-gopher-guru privilege | 460 * you need super-gopher-guru privilege |
442 * to add this list. | 461 * to add this list. |
443 */ | 462 */ |
444 #define nelem(x) (sizeof(x)/sizeof((x)[0])) | 463 #define nelem(x) (sizeof(x)/sizeof((x)[0])) |
445 #define nil ((void*)0) | 464 #define nil ((void*)0) |
446 #define offsetof(s,m) (uint32)(&(((s*)0)->m)) | 465 #define offsetof(s,m) (uint32)(&(((s*)0)->m)) |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 Eface arg; // argument to panic | 563 Eface arg; // argument to panic |
545 byte* stackbase; // g->stackbase in panic | 564 byte* stackbase; // g->stackbase in panic |
546 Panic* link; // link to earlier panic | 565 Panic* link; // link to earlier panic |
547 bool recovered; // whether this panic is over | 566 bool recovered; // whether this panic is over |
548 }; | 567 }; |
549 | 568 |
550 /* | 569 /* |
551 * external data | 570 * external data |
552 */ | 571 */ |
553 extern String runtime·emptystring; | 572 extern String runtime·emptystring; |
| 573 extern uintptr runtime·zerobase; |
| 574 G* runtime·allg; |
| 575 G* runtime·lastg; |
554 M* runtime·allm; | 576 M* runtime·allm; |
555 P** runtime·allp; | 577 P** runtime·allp; |
556 extern int32 runtime·gomaxprocs; | 578 extern int32 runtime·gomaxprocs; |
557 extern bool runtime·singleproc; | 579 extern bool runtime·singleproc; |
558 extern uint32 runtime·panicking; | 580 extern uint32 runtime·panicking; |
559 extern int32 runtime·gcwaiting; // gc is waiting to run | 581 extern int32 runtime·gcwaiting; // gc is waiting to run |
560 int8* runtime·goos; | 582 int8* runtime·goos; |
561 int32 runtime·ncpu; | 583 int32 runtime·ncpu; |
562 int32 runtime·gsignalstk; | 584 int32 runtime·gsignalstk; |
563 extern bool runtime·iscgo; | 585 extern bool runtime·iscgo; |
| 586 extern void (*runtime·sysargs)(int32, uint8**); |
| 587 extern uint32 runtime·maxstring; |
564 | 588 |
565 /* | 589 /* |
566 * common functions and data | 590 * common functions and data |
567 */ | 591 */ |
568 int32 runtime·strcmp(byte*, byte*); | 592 int32 runtime·strcmp(byte*, byte*); |
569 byte* runtime·strstr(byte*, byte*); | 593 byte* runtime·strstr(byte*, byte*); |
570 int32 runtime·findnull(byte*); | 594 int32 runtime·findnull(byte*); |
571 int32 runtime·findnullw(uint16*); | 595 int32 runtime·findnullw(uint16*); |
572 void runtime·dump(byte*, int32); | 596 void runtime·dump(byte*, int32); |
573 int32 runtime·runetochar(byte*, int32); | 597 int32 runtime·runetochar(byte*, int32); |
574 int32 runtime·charntorune(int32*, uint8*, int32); | 598 int32 runtime·charntorune(int32*, uint8*, int32); |
575 | 599 |
576 /* | 600 /* |
577 * very low level c-called | 601 * very low level c-called |
578 */ | 602 */ |
579 #define FLUSH(x) USED(x) | 603 #define FLUSH(x) USED(x) |
580 | 604 |
581 void runtime·gogo(Gobuf*, uintptr); | 605 void runtime·gogo(Gobuf*, uintptr); |
582 void runtime·gogocall(Gobuf*, void(*)(void)); | 606 void runtime·gogocall(Gobuf*, void(*)(void)); |
583 void runtime·gosave(Gobuf*); | 607 void runtime·gosave(Gobuf*); |
584 void runtime·lessstack(void); | 608 void runtime·lessstack(void); |
585 void runtime·goargs(void); | 609 void runtime·goargs(void); |
586 void runtime·goenvs(void); | 610 void runtime·goenvs(void); |
587 void runtime·goenvs_unix(void); | 611 void runtime·goenvs_unix(void); |
588 void* runtime·getu(void); | 612 void* runtime·getu(void); |
589 void runtime·throw(int8*); | 613 void runtime·throw(int8*); |
| 614 void runtime·dumpcurrentstack(void); |
590 void runtime·panicstring(int8*); | 615 void runtime·panicstring(int8*); |
591 void runtime·prints(int8*); | 616 void runtime·prints(int8*); |
592 void runtime·printf(int8*, ...); | 617 void runtime·printf(int8*, ...); |
593 byte* runtime·mchr(byte*, byte, byte*); | 618 byte* runtime·mchr(byte*, byte, byte*); |
594 int32 runtime·mcmp(byte*, byte*, uint32); | 619 int32 runtime·mcmp(byte*, byte*, uint32); |
595 void runtime·memmove(void*, void*, uint32); | 620 void runtime·memmove(void*, void*, uint32); |
596 void* runtime·mal(uintptr); | 621 void* runtime·mal(uintptr); |
597 String runtime·catstring(String, String); | 622 String runtime·catstring(String, String); |
598 String runtime·gostring(byte*); | 623 String runtime·gostring(byte*); |
599 String runtime·gostringn(byte*, int32); | 624 String runtime·gostringn(byte*, intgo); |
600 Slice» runtime·gobytes(byte*, int32); | 625 Slice» runtime·gobytes(byte*, intgo); |
601 String runtime·gostringnocopy(byte*); | 626 String runtime·gostringnocopy(byte*); |
602 String runtime·gostringw(uint16*); | 627 String runtime·gostringw(uint16*); |
603 void runtime·initsig(void); | 628 void runtime·initsig(void); |
604 void runtime·sigenable(uint32 sig); | 629 void runtime·sigenable(uint32 sig); |
605 int32 runtime·gotraceback(void); | 630 int32 runtime·gotraceback(void); |
606 void runtime·goroutineheader(G*); | 631 void runtime·goroutineheader(G*); |
607 void runtime·traceback(uint8 *pc, uint8 *sp, uint8 *lr, G* gp); | 632 void runtime·traceback(uint8 *pc, uint8 *sp, uint8 *lr, G* gp); |
608 void runtime·tracebackothers(G*); | 633 void runtime·tracebackothers(G*); |
609 int32 runtime·write(int32, void*, int32); | 634 int32 runtime·write(int32, void*, int32); |
610 int32 runtime·mincore(void*, uintptr, byte*); | 635 int32 runtime·mincore(void*, uintptr, byte*); |
(...skipping 28 matching lines...) Expand all Loading... |
639 void runtime·stackfree(void*, uintptr); | 664 void runtime·stackfree(void*, uintptr); |
640 MCache* runtime·allocmcache(void); | 665 MCache* runtime·allocmcache(void); |
641 void runtime·freemcache(MCache*); | 666 void runtime·freemcache(MCache*); |
642 void runtime·mallocinit(void); | 667 void runtime·mallocinit(void); |
643 bool runtime·ifaceeq_c(Iface, Iface); | 668 bool runtime·ifaceeq_c(Iface, Iface); |
644 bool runtime·efaceeq_c(Eface, Eface); | 669 bool runtime·efaceeq_c(Eface, Eface); |
645 uintptr runtime·ifacehash(Iface); | 670 uintptr runtime·ifacehash(Iface); |
646 uintptr runtime·efacehash(Eface); | 671 uintptr runtime·efacehash(Eface); |
647 void* runtime·malloc(uintptr size); | 672 void* runtime·malloc(uintptr size); |
648 void runtime·free(void *v); | 673 void runtime·free(void *v); |
649 bool» runtime·addfinalizer(void*, void(*fn)(void*), int32); | 674 bool» runtime·addfinalizer(void*, void(*fn)(void*), uintptr); |
650 void runtime·runpanic(Panic*); | 675 void runtime·runpanic(Panic*); |
651 void* runtime·getcallersp(void*); | 676 void* runtime·getcallersp(void*); |
652 int32 runtime·mcount(void); | 677 int32 runtime·mcount(void); |
653 int32 runtime·gcount(void); | 678 int32 runtime·gcount(void); |
654 void runtime·mcall(void(*)(G*)); | 679 void runtime·mcall(void(*)(G*)); |
655 uint32 runtime·fastrand1(void); | 680 uint32 runtime·fastrand1(void); |
656 | 681 |
657 void runtime·exit(int32); | 682 void runtime·exit(int32); |
658 void runtime·breakpoint(void); | 683 void runtime·breakpoint(void); |
659 void runtime·gosched(void); | 684 void runtime·gosched(void); |
660 void» runtime·park(void*, void(*)(void*), int8*); | 685 void» runtime·park(void(*)(Lock*), Lock*, int8*); |
661 void runtime·tsleep(int64, int8*); | 686 void runtime·tsleep(int64, int8*); |
| 687 M* runtime·newm(void); |
662 void runtime·goexit(void); | 688 void runtime·goexit(void); |
663 void runtime·asmcgocall(void (*fn)(void*), void*); | 689 void runtime·asmcgocall(void (*fn)(void*), void*); |
664 void runtime·entersyscall(void); | 690 void runtime·entersyscall(void); |
| 691 void runtime·entersyscallblock(void); |
665 void runtime·exitsyscall(void); | 692 void runtime·exitsyscall(void); |
666 G* runtime·newproc1(byte*, byte*, int32, int32, void*); | 693 G* runtime·newproc1(byte*, byte*, int32, int32, void*); |
667 bool runtime·sigsend(int32 sig); | 694 bool runtime·sigsend(int32 sig); |
668 int32 runtime·callers(int32, uintptr*, int32); | 695 int32 runtime·callers(int32, uintptr*, int32); |
669 int32 runtime·gentraceback(byte*, byte*, byte*, G*, int32, uintptr*, int32); | 696 int32 runtime·gentraceback(byte*, byte*, byte*, G*, int32, uintptr*, int32); |
670 int64 runtime·nanotime(void); | 697 int64 runtime·nanotime(void); |
671 void runtime·dopanic(int32); | 698 void runtime·dopanic(int32); |
672 void runtime·startpanic(void); | 699 void runtime·startpanic(void); |
673 void runtime·unwindstack(G*, byte*); | 700 void runtime·unwindstack(G*, byte*); |
674 void runtime·sigprof(uint8 *pc, uint8 *sp, uint8 *lr, G *gp); | 701 void runtime·sigprof(uint8 *pc, uint8 *sp, uint8 *lr, G *gp); |
675 void runtime·resetcpuprofiler(int32); | 702 void runtime·resetcpuprofiler(int32); |
676 void runtime·setcpuprofilerate(void(*)(uintptr*, int32), int32); | 703 void runtime·setcpuprofilerate(void(*)(uintptr*, int32), int32); |
677 void runtime·usleep(uint32); | 704 void runtime·usleep(uint32); |
678 int64 runtime·cputicks(void); | 705 int64 runtime·cputicks(void); |
679 G*» » runtime·netwait(uint32); | 706 G*» runtime·netwait(uint32, uint32); |
| 707 bool» runtime·addtimer(Timer*); |
| 708 bool» runtime·deltimer(Timer*); |
| 709 int64» runtime·tickspersecond(void); |
| 710 void» runtime·blockevent(int64, int32); |
| 711 extern int64 runtime·blockprofilerate; |
680 | 712 |
681 #pragma varargck argpos runtime·printf 1 | 713 #pragma varargck argpos runtime·printf 1 |
682 #pragma varargck type "d" int32 | 714 #pragma varargck type "d" int32 |
683 #pragma varargck type "d" uint32 | 715 #pragma varargck type "d" uint32 |
684 #pragma varargck type "D" int64 | 716 #pragma varargck type "D" int64 |
685 #pragma varargck type "D" uint64 | 717 #pragma varargck type "D" uint64 |
686 #pragma varargck type "x" int32 | 718 #pragma varargck type "x" int32 |
687 #pragma varargck type "x" uint32 | 719 #pragma varargck type "x" uint32 |
688 #pragma varargck type "X" int64 | 720 #pragma varargck type "X" int64 |
689 #pragma varargck type "X" uint64 | 721 #pragma varargck type "X" uint64 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 /* | 796 /* |
765 * This is consistent across Linux and BSD. | 797 * This is consistent across Linux and BSD. |
766 * If a new OS is added that is different, move this to | 798 * If a new OS is added that is different, move this to |
767 * $GOOS/$GOARCH/defs.h. | 799 * $GOOS/$GOARCH/defs.h. |
768 */ | 800 */ |
769 #define EACCES 13 | 801 #define EACCES 13 |
770 | 802 |
771 /* | 803 /* |
772 * low level C-called | 804 * low level C-called |
773 */ | 805 */ |
| 806 // for mmap, we only pass the lower 32 bits of file offset to the· |
| 807 // assembly routine; the higher bits (if required), should be provided |
| 808 // by the assembly routine as 0. |
774 uint8* runtime·mmap(byte*, uintptr, int32, int32, int32, uint32); | 809 uint8* runtime·mmap(byte*, uintptr, int32, int32, int32, uint32); |
775 void runtime·munmap(byte*, uintptr); | 810 void runtime·munmap(byte*, uintptr); |
776 void runtime·madvise(byte*, uintptr, int32); | 811 void runtime·madvise(byte*, uintptr, int32); |
777 void runtime·memclr(byte*, uintptr); | 812 void runtime·memclr(byte*, uintptr); |
778 void runtime·setcallerpc(void*, void*); | 813 void runtime·setcallerpc(void*, void*); |
779 void* runtime·getcallerpc(void*); | 814 void* runtime·getcallerpc(void*); |
780 | 815 |
781 /* | 816 /* |
782 * runtime go-called | 817 * runtime go-called |
783 */ | 818 */ |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 void runtime·UnlockOSThread(void); | 873 void runtime·UnlockOSThread(void); |
839 | 874 |
840 void runtime·mapassign(MapType*, Hmap*, byte*, byte*); | 875 void runtime·mapassign(MapType*, Hmap*, byte*, byte*); |
841 void runtime·mapaccess(MapType*, Hmap*, byte*, byte*, bool*); | 876 void runtime·mapaccess(MapType*, Hmap*, byte*, byte*, bool*); |
842 void runtime·mapiternext(struct hash_iter*); | 877 void runtime·mapiternext(struct hash_iter*); |
843 bool runtime·mapiterkey(struct hash_iter*, void*); | 878 bool runtime·mapiterkey(struct hash_iter*, void*); |
844 void runtime·mapiterkeyvalue(struct hash_iter*, void*, void*); | 879 void runtime·mapiterkeyvalue(struct hash_iter*, void*, void*); |
845 Hmap* runtime·makemap_c(MapType*, int64); | 880 Hmap* runtime·makemap_c(MapType*, int64); |
846 | 881 |
847 Hchan* runtime·makechan_c(ChanType*, int64); | 882 Hchan* runtime·makechan_c(ChanType*, int64); |
848 void» runtime·chansend(ChanType*, Hchan*, byte*, bool*); | 883 void» runtime·chansend(ChanType*, Hchan*, byte*, bool*, void*); |
849 void runtime·chanrecv(ChanType*, Hchan*, byte*, bool*, bool*); | 884 void runtime·chanrecv(ChanType*, Hchan*, byte*, bool*, bool*); |
850 int32 runtime·chanlen(Hchan*); | |
851 int32 runtime·chancap(Hchan*); | |
852 bool runtime·showframe(Func*); | 885 bool runtime·showframe(Func*); |
853 | 886 |
854 void» runtime·ifaceE2I(struct InterfaceType*, Eface, Iface*); | 887 void» runtime·ifaceE2I(InterfaceType*, Eface, Iface*); |
855 | 888 |
856 uintptr runtime·memlimit(void); | 889 uintptr runtime·memlimit(void); |
857 | 890 |
858 // If appropriate, ask the operating system to control whether this | 891 // If appropriate, ask the operating system to control whether this |
859 // thread should receive profiling signals. This is only necessary on OS X. | 892 // thread should receive profiling signals. This is only necessary on OS X. |
860 // An operating system should not deliver a profiling signal to a | 893 // An operating system should not deliver a profiling signal to a |
861 // thread that is not actually executing (what good is that?), but that's | 894 // thread that is not actually executing (what good is that?), but that's |
862 // what OS X prefers to do. When profiling is turned on, we mask | 895 // what OS X prefers to do. When profiling is turned on, we mask |
863 // away the profiling signal when threads go to sleep, so that OS X | 896 // away the profiling signal when threads go to sleep, so that OS X |
864 // is forced to deliver the signal to a thread that's actually running. | 897 // is forced to deliver the signal to a thread that's actually running. |
865 // This is a no-op on other systems. | 898 // This is a no-op on other systems. |
866 void runtime·setprof(bool); | 899 void runtime·setprof(bool); |
867 | 900 |
868 // float.c | 901 // float.c |
869 extern float64 runtime·nan; | 902 extern float64 runtime·nan; |
870 extern float64 runtime·posinf; | 903 extern float64 runtime·posinf; |
871 extern float64 runtime·neginf; | 904 extern float64 runtime·neginf; |
872 extern uint64 ·nan; | 905 extern uint64 ·nan; |
873 extern uint64 ·posinf; | 906 extern uint64 ·posinf; |
874 extern uint64 ·neginf; | 907 extern uint64 ·neginf; |
875 #define ISNAN(f) ((f) != (f)) | 908 #define ISNAN(f) ((f) != (f)) |
| 909 |
| 910 enum |
| 911 { |
| 912 UseSpanType = 1, |
| 913 }; |
LEFT | RIGHT |