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; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 typedef struct String String; | 59 typedef struct String String; |
60 typedef struct FuncVal FuncVal; | 60 typedef struct FuncVal FuncVal; |
61 typedef struct SigTab SigTab; | 61 typedef struct SigTab SigTab; |
62 typedef struct MCache MCache; | 62 typedef struct MCache MCache; |
63 typedef struct FixAlloc FixAlloc; | 63 typedef struct FixAlloc FixAlloc; |
64 typedef struct Iface Iface; | 64 typedef struct Iface Iface; |
65 typedef struct Itab Itab; | 65 typedef struct Itab Itab; |
66 typedef struct InterfaceType InterfaceType; | 66 typedef struct InterfaceType InterfaceType; |
67 typedef struct Eface Eface; | 67 typedef struct Eface Eface; |
68 typedef struct Type Type; | 68 typedef struct Type Type; |
| 69 typedef struct PtrType PtrType; |
69 typedef struct ChanType ChanType; | 70 typedef struct ChanType ChanType; |
70 typedef struct MapType MapType; | 71 typedef struct MapType MapType; |
71 typedef struct Defer Defer; | 72 typedef struct Defer Defer; |
72 typedef struct DeferChunk DeferChunk; | 73 typedef struct DeferChunk DeferChunk; |
73 typedef struct Panic Panic; | 74 typedef struct Panic Panic; |
74 typedef struct Hmap Hmap; | 75 typedef struct Hmap Hmap; |
75 typedef struct Hchan Hchan; | 76 typedef struct Hchan Hchan; |
76 typedef struct Complex64 Complex64; | 77 typedef struct Complex64 Complex64; |
77 typedef struct Complex128 Complex128; | 78 typedef struct Complex128 Complex128; |
78 typedef struct LibCall LibCall; | 79 typedef struct LibCall LibCall; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 { | 237 { |
237 void* prev; | 238 void* prev; |
238 void* handler; | 239 void* handler; |
239 }; | 240 }; |
240 // describes how to handle callback | 241 // describes how to handle callback |
241 struct WinCallbackContext | 242 struct WinCallbackContext |
242 { | 243 { |
243 void* gobody; // Go function to call | 244 void* gobody; // Go function to call |
244 uintptr argsize; // callback arguments size (in bytes) | 245 uintptr argsize; // callback arguments size (in bytes) |
245 uintptr restorestack; // adjust stack on return by (in bytes) (386 onl
y) | 246 uintptr restorestack; // adjust stack on return by (in bytes) (386 onl
y) |
| 247 bool cleanstack; |
246 }; | 248 }; |
247 | 249 |
248 struct G | 250 struct G |
249 { | 251 { |
250 // stackguard0 can be set to StackPreempt as opposed to stackguard | 252 // stackguard0 can be set to StackPreempt as opposed to stackguard |
251 uintptr stackguard0; // cannot move - also known to linker, libmach,
runtime/cgo | 253 uintptr stackguard0; // cannot move - also known to linker, libmach,
runtime/cgo |
252 uintptr stackbase; // cannot move - also known to libmach, runtime/
cgo | 254 uintptr stackbase; // cannot move - also known to libmach, runtime/
cgo |
253 uint32 panicwrap; // cannot move - also known to linker | 255 uint32 panicwrap; // cannot move - also known to linker |
254 uint32 selgen; // valid sudog pointer | 256 uint32 selgen; // valid sudog pointer |
255 Defer* defer; | 257 Defer* defer; |
256 Panic* panic; | 258 Panic* panic; |
257 Gobuf sched; | 259 Gobuf sched; |
258 uintptr syscallstack; // if status==Gsyscall, syscallstack = stackbase
to use during gc | 260 uintptr syscallstack; // if status==Gsyscall, syscallstack = stackbase
to use during gc |
259 uintptr syscallsp; // if status==Gsyscall, syscallsp = sched.sp to
use during gc | 261 uintptr syscallsp; // if status==Gsyscall, syscallsp = sched.sp to
use during gc |
260 uintptr syscallpc; // if status==Gsyscall, syscallpc = sched.pc to
use during gc | 262 uintptr syscallpc; // if status==Gsyscall, syscallpc = sched.pc to
use during gc |
261 uintptr syscallguard; // if status==Gsyscall, syscallguard = stackguar
d to use during gc | 263 uintptr syscallguard; // if status==Gsyscall, syscallguard = stackguar
d to use during gc |
262 uintptr stackguard; // same as stackguard0, but not set to StackPree
mpt | 264 uintptr stackguard; // same as stackguard0, but not set to StackPree
mpt |
263 uintptr stack0; | 265 uintptr stack0; |
264 uintptr stacksize; | 266 uintptr stacksize; |
265 G* alllink; // on allg | 267 G* alllink; // on allg |
266 void* param; // passed parameter on wakeup | 268 void* param; // passed parameter on wakeup |
267 int16 status; | 269 int16 status; |
268 int64 goid; | 270 int64 goid; |
| 271 int64 waitsince; // approx time when the G become blocked |
269 int8* waitreason; // if status==Gwaiting | 272 int8* waitreason; // if status==Gwaiting |
270 G* schedlink; | 273 G* schedlink; |
271 bool ispanic; | 274 bool ispanic; |
272 bool issystem; // do not output in stack dump | 275 bool issystem; // do not output in stack dump |
273 bool isbackground; // ignore in deadlock detector | 276 bool isbackground; // ignore in deadlock detector |
274 bool preempt; // preemption signal, duplicates stackguard0 = S
tackPreempt | 277 bool preempt; // preemption signal, duplicates stackguard0 = S
tackPreempt |
275 int8 raceignore; // ignore race detection events | 278 int8 raceignore; // ignore race detection events |
276 M* m; // for debuggers, but offset not hard-coded | 279 M* m; // for debuggers, but offset not hard-coded |
277 M* lockedm; | 280 M* lockedm; |
278 int32 sig; | 281 int32 sig; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 bool racecall; | 344 bool racecall; |
342 bool needextram; | 345 bool needextram; |
343 void (*waitunlockf)(Lock*); | 346 void (*waitunlockf)(Lock*); |
344 void* waitlock; | 347 void* waitlock; |
345 | 348 |
346 uintptr settype_buf[1024]; | 349 uintptr settype_buf[1024]; |
347 uintptr settype_bufsize; | 350 uintptr settype_bufsize; |
348 | 351 |
349 #ifdef GOOS_windows | 352 #ifdef GOOS_windows |
350 void* thread; // thread handle | 353 void* thread; // thread handle |
351 » LibCall»libcall;» // put here to avoid large runtime·stdcall stack | 354 » // these are here because they are too large to be on the stack |
| 355 » // of low-level NOSPLIT functions. |
| 356 » LibCall»libcall; |
352 #endif | 357 #endif |
353 #ifdef GOOS_solaris | 358 #ifdef GOOS_solaris |
354 » void*» perrno; » // pointer to TLS errno | 359 » int32*» perrno; » // pointer to TLS errno |
355 » // there are here because they are too large to be on the stack | 360 » // these are here because they are too large to be on the stack |
356 // of low-level NOSPLIT functions. | 361 // of low-level NOSPLIT functions. |
357 LibCall libcall; | 362 LibCall libcall; |
358 struct { | 363 struct { |
359 int64 tv_sec; | 364 int64 tv_sec; |
360 int64 tv_nsec; | 365 int64 tv_nsec; |
361 } ts; | 366 } ts; |
362 struct { | 367 struct { |
363 uintptr v[6]; | 368 uintptr v[6]; |
364 } scratch; | 369 } scratch; |
365 #endif | 370 #endif |
(...skipping 11 matching lines...) Expand all Loading... |
377 | 382 |
378 int32 id; | 383 int32 id; |
379 uint32 status; // one of Pidle/Prunning/... | 384 uint32 status; // one of Pidle/Prunning/... |
380 P* link; | 385 P* link; |
381 uint32 schedtick; // incremented on every scheduler call | 386 uint32 schedtick; // incremented on every scheduler call |
382 uint32 syscalltick; // incremented on every system call | 387 uint32 syscalltick; // incremented on every system call |
383 M* m; // back-link to associated M (nil if idle) | 388 M* m; // back-link to associated M (nil if idle) |
384 MCache* mcache; | 389 MCache* mcache; |
385 | 390 |
386 // Queue of runnable goroutines. | 391 // Queue of runnable goroutines. |
387 » G**» runq; | 392 » uint32» runqhead; |
388 » int32» runqhead; | 393 » uint32» runqtail; |
389 » int32» runqtail; | 394 » G*» runq[256]; |
390 » int32» runqsize; | |
391 | 395 |
392 // Available G's (status == Gdead) | 396 // Available G's (status == Gdead) |
393 G* gfree; | 397 G* gfree; |
394 int32 gfreecnt; | 398 int32 gfreecnt; |
395 | 399 |
396 byte pad[64]; | 400 byte pad[64]; |
397 }; | 401 }; |
398 | 402 |
399 // The m->locked word holds two pieces of state counting active calls to LockOST
hread/lockOSThread. | 403 // The m->locked word holds two pieces of state counting active calls to LockOST
hread/lockOSThread. |
400 // The low bit (LockExternal) is a boolean reporting whether any LockOSThread ca
ll is active. | 404 // The low bit (LockExternal) is a boolean reporting whether any LockOSThread ca
ll is active. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 enum { | 477 enum { |
474 Windows = 1 | 478 Windows = 1 |
475 }; | 479 }; |
476 #else | 480 #else |
477 enum { | 481 enum { |
478 Windows = 0 | 482 Windows = 0 |
479 }; | 483 }; |
480 #endif | 484 #endif |
481 #ifdef GOOS_solaris | 485 #ifdef GOOS_solaris |
482 enum { | 486 enum { |
483 Sunos = 1 | 487 Solaris = 1 |
484 }; | 488 }; |
485 #else | 489 #else |
486 enum { | 490 enum { |
487 Sunos = 0 | 491 Solaris = 0 |
488 }; | 492 }; |
489 #endif | 493 #endif |
490 | 494 |
491 struct Timers | 495 struct Timers |
492 { | 496 { |
493 Lock; | 497 Lock; |
494 G *timerproc; | 498 G *timerproc; |
495 bool sleeping; | 499 bool sleeping; |
496 bool rescheduling; | 500 bool rescheduling; |
497 Note waitnote; | 501 Note waitnote; |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 int32 runtime·funcline(Func*, uintptr, String*); | 828 int32 runtime·funcline(Func*, uintptr, String*); |
825 int32 runtime·funcarglen(Func*, uintptr); | 829 int32 runtime·funcarglen(Func*, uintptr); |
826 int32 runtime·funcspdelta(Func*, uintptr); | 830 int32 runtime·funcspdelta(Func*, uintptr); |
827 int8* runtime·funcname(Func*); | 831 int8* runtime·funcname(Func*); |
828 int32 runtime·pcdatavalue(Func*, int32, uintptr); | 832 int32 runtime·pcdatavalue(Func*, int32, uintptr); |
829 void* runtime·stackalloc(uint32); | 833 void* runtime·stackalloc(uint32); |
830 void runtime·stackfree(void*, uintptr); | 834 void runtime·stackfree(void*, uintptr); |
831 MCache* runtime·allocmcache(void); | 835 MCache* runtime·allocmcache(void); |
832 void runtime·freemcache(MCache*); | 836 void runtime·freemcache(MCache*); |
833 void runtime·mallocinit(void); | 837 void runtime·mallocinit(void); |
834 void runtime·mprofinit(void); | |
835 bool runtime·ifaceeq_c(Iface, Iface); | 838 bool runtime·ifaceeq_c(Iface, Iface); |
836 bool runtime·efaceeq_c(Eface, Eface); | 839 bool runtime·efaceeq_c(Eface, Eface); |
837 uintptr runtime·ifacehash(Iface, uintptr); | 840 uintptr runtime·ifacehash(Iface, uintptr); |
838 uintptr runtime·efacehash(Eface, uintptr); | 841 uintptr runtime·efacehash(Eface, uintptr); |
839 void* runtime·malloc(uintptr size); | 842 void* runtime·malloc(uintptr size); |
840 void runtime·free(void *v); | 843 void runtime·free(void *v); |
841 void runtime·runpanic(Panic*); | 844 void runtime·runpanic(Panic*); |
842 uintptr runtime·getcallersp(void*); | 845 uintptr runtime·getcallersp(void*); |
843 int32 runtime·mcount(void); | 846 int32 runtime·mcount(void); |
844 int32 runtime·gcount(void); | 847 int32 runtime·gcount(void); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 void runtime·blockevent(int64, int32); | 882 void runtime·blockevent(int64, int32); |
880 extern int64 runtime·blockprofilerate; | 883 extern int64 runtime·blockprofilerate; |
881 void runtime·addtimer(Timer*); | 884 void runtime·addtimer(Timer*); |
882 bool runtime·deltimer(Timer*); | 885 bool runtime·deltimer(Timer*); |
883 G* runtime·netpoll(bool); | 886 G* runtime·netpoll(bool); |
884 void runtime·netpollinit(void); | 887 void runtime·netpollinit(void); |
885 int32 runtime·netpollopen(uintptr, PollDesc*); | 888 int32 runtime·netpollopen(uintptr, PollDesc*); |
886 int32 runtime·netpollclose(uintptr); | 889 int32 runtime·netpollclose(uintptr); |
887 void runtime·netpollready(G**, PollDesc*, int32); | 890 void runtime·netpollready(G**, PollDesc*, int32); |
888 uintptr runtime·netpollfd(PollDesc*); | 891 uintptr runtime·netpollfd(PollDesc*); |
| 892 void runtime·netpollarmread(uintptr fd); |
| 893 void runtime·netpollarmwrite(uintptr fd); |
889 void runtime·crash(void); | 894 void runtime·crash(void); |
890 void runtime·parsedebugvars(void); | 895 void runtime·parsedebugvars(void); |
891 void _rt0_go(void); | 896 void _rt0_go(void); |
892 void* runtime·funcdata(Func*, int32); | 897 void* runtime·funcdata(Func*, int32); |
893 | 898 |
894 #pragma varargck argpos runtime·printf 1 | 899 #pragma varargck argpos runtime·printf 1 |
895 #pragma varargck type "c" int32 | 900 #pragma varargck type "c" int32 |
896 #pragma varargck type "d" int32 | 901 #pragma varargck type "d" int32 |
897 #pragma varargck type "d" uint32 | 902 #pragma varargck type "d" uint32 |
898 #pragma varargck type "D" int64 | 903 #pragma varargck type "D" int64 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 extern float64 runtime·neginf; | 1082 extern float64 runtime·neginf; |
1078 extern uint64 ·nan; | 1083 extern uint64 ·nan; |
1079 extern uint64 ·posinf; | 1084 extern uint64 ·posinf; |
1080 extern uint64 ·neginf; | 1085 extern uint64 ·neginf; |
1081 #define ISNAN(f) ((f) != (f)) | 1086 #define ISNAN(f) ((f) != (f)) |
1082 | 1087 |
1083 enum | 1088 enum |
1084 { | 1089 { |
1085 UseSpanType = 1, | 1090 UseSpanType = 1, |
1086 }; | 1091 }; |
LEFT | RIGHT |