Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(13)

Delta Between Two Patch Sets: src/runtime/runtime.h

Issue 152570049: [dev.power64] code review 152570049: all: merge default into dev.power64 (Closed)
Left Patch Set: Created 10 years, 4 months ago
Right Patch Set: diff -r 36f7fc9495481ed67a159eea0eb2fac35b7c46a5 https://code.google.com/p/go Created 10 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/runtime/rt0_windows_amd64.s ('k') | src/runtime/runtime.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 */ 53 */
54 typedef uint8 bool; 54 typedef uint8 bool;
55 typedef uint8 byte; 55 typedef uint8 byte;
56 typedef struct Func Func; 56 typedef struct Func Func;
57 typedef struct G G; 57 typedef struct G G;
58 typedef struct Gobuf Gobuf; 58 typedef struct Gobuf Gobuf;
59 typedef struct SudoG SudoG; 59 typedef struct SudoG SudoG;
60 typedef struct Mutex Mutex; 60 typedef struct Mutex Mutex;
61 typedef struct M M; 61 typedef struct M M;
62 typedef struct P P; 62 typedef struct P P;
63 typedef struct SchedT SchedT;
63 typedef struct Note Note; 64 typedef struct Note Note;
64 typedef struct Slice Slice; 65 typedef struct Slice Slice;
65 typedef struct Stktop Stktop;
66 typedef struct String String; 66 typedef struct String String;
67 typedef struct FuncVal FuncVal; 67 typedef struct FuncVal FuncVal;
68 typedef struct SigTab SigTab; 68 typedef struct SigTab SigTab;
69 typedef struct MCache MCache; 69 typedef struct MCache MCache;
70 typedef struct FixAlloc FixAlloc; 70 typedef struct FixAlloc FixAlloc;
71 typedef struct Iface Iface; 71 typedef struct Iface Iface;
72 typedef struct Itab Itab; 72 typedef struct Itab Itab;
73 typedef struct InterfaceType InterfaceType; 73 typedef struct InterfaceType InterfaceType;
74 typedef struct Eface Eface; 74 typedef struct Eface Eface;
75 typedef struct Type Type; 75 typedef struct Type Type;
76 typedef struct PtrType PtrType; 76 typedef struct PtrType PtrType;
77 typedef»struct» ChanType» » ChanType; 77 typedef»struct» ChanType» ChanType;
78 typedef struct MapType MapType; 78 typedef struct MapType MapType;
79 typedef struct Defer Defer; 79 typedef struct Defer Defer;
80 typedef struct Panic Panic; 80 typedef struct Panic Panic;
81 typedef struct Hmap Hmap; 81 typedef struct Hmap Hmap;
82 typedef»struct» Hiter» » » Hiter; 82 typedef»struct» Hiter» » Hiter;
83 typedef struct Hchan Hchan; 83 typedef struct Hchan Hchan;
84 typedef struct Complex64 Complex64; 84 typedef struct Complex64 Complex64;
85 typedef struct Complex128 Complex128; 85 typedef struct Complex128 Complex128;
86 typedef struct LibCall LibCall; 86 typedef struct LibCall LibCall;
87 typedef struct WinCallbackContext WinCallbackContext; 87 typedef struct WinCallbackContext WinCallbackContext;
88 typedef struct GCStats GCStats; 88 typedef struct GCStats GCStats;
89 typedef struct LFNode LFNode; 89 typedef struct LFNode LFNode;
90 typedef struct ParFor ParFor; 90 typedef struct ParFor ParFor;
91 typedef struct ParForThread ParForThread; 91 typedef struct ParForThread ParForThread;
92 typedef struct CgoMal CgoMal; 92 typedef struct CgoMal CgoMal;
93 typedef struct PollDesc PollDesc; 93 typedef struct PollDesc PollDesc;
94 typedef struct DebugVars DebugVars; 94 typedef struct DebugVars DebugVars;
95 typedef struct» ForceGCState» ForceGCState; 95 typedef»struct» ForceGCState» ForceGCState;
96 typedef»struct» Stack» » Stack;
96 97
97 /* 98 /*
98 * Per-CPU declaration. 99 * Per-CPU declaration.
99 * 100 *
100 * "extern register" is a special storage class implemented by 6c, 8c, etc. 101 * "extern register" is a special storage class implemented by 6c, 8c, etc.
101 * On the ARM, it is an actual register; elsewhere it is a slot in thread- 102 * On the ARM, it is an actual register; elsewhere it is a slot in thread-
102 * local storage indexed by a pseudo-register TLS. See zasmhdr in 103 * local storage indexed by a pseudo-register TLS. See zasmhdr in
103 * src/cmd/dist/buildruntime.c for details, and be aware that the linker may 104 * src/cmd/dist/buildruntime.c for details, and be aware that the linker may
104 * make further OS-specific changes to the compiler's output. For example, 105 * make further OS-specific changes to the compiler's output. For example,
105 * 6l/linux rewrites 0(TLS) as -8(FS). 106 * 6l/linux rewrites 0(TLS) as -8(FS).
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 // because it is casted to uint64[]. 242 // because it is casted to uint64[].
242 uint64 nhandoff; 243 uint64 nhandoff;
243 uint64 nhandoffcnt; 244 uint64 nhandoffcnt;
244 uint64 nprocyield; 245 uint64 nprocyield;
245 uint64 nosyield; 246 uint64 nosyield;
246 uint64 nsleep; 247 uint64 nsleep;
247 }; 248 };
248 249
249 struct LibCall 250 struct LibCall
250 { 251 {
251 » void*» fn; 252 » uintptr»fn;
252 uintptr n; // number of parameters 253 uintptr n; // number of parameters
253 » void*» args;» // parameters 254 » uintptr»args;» // parameters
254 uintptr r1; // return values 255 uintptr r1; // return values
255 uintptr r2; 256 uintptr r2;
256 uintptr err; // error number 257 uintptr err; // error number
257 }; 258 };
258 259
259 // describes how to handle callback 260 // describes how to handle callback
260 struct WinCallbackContext 261 struct WinCallbackContext
261 { 262 {
262 void* gobody; // Go function to call 263 void* gobody; // Go function to call
263 uintptr argsize; // callback arguments size (in bytes) 264 uintptr argsize; // callback arguments size (in bytes)
264 uintptr restorestack; // adjust stack on return by (in bytes) (386 onl y) 265 uintptr restorestack; // adjust stack on return by (in bytes) (386 onl y)
265 bool cleanstack; 266 bool cleanstack;
266 }; 267 };
267 268
269 // Stack describes a Go execution stack.
270 // The bounds of the stack are exactly [lo, hi),
271 // with no implicit data structures on either side.
272 struct Stack
273 {
274 uintptr lo;
275 uintptr hi;
276 };
277
268 struct G 278 struct G
269 { 279 {
270 » // stackguard0 can be set to StackPreempt as opposed to stackguard 280 » // Stack parameters.
271 » uintptr»stackguard0;» // cannot move - also known to liblink, libmach, runtime/cgo 281 » // stack describes the actual stack memory: [stack.lo, stack.hi).
272 » uintptr»stackbase;» // cannot move - also known to libmach, runtime/ cgo 282 » // stackguard0 is the stack pointer compared in the Go stack growth prol ogue.
273 » Panic*» panic;» // cannot move - also known to liblink 283 » // It is stack.lo+StackGuard normally, but can be StackPreempt to trigge r a preemption.
274 » Defer*» defer; 284 » // stackguard1 is the stack pointer compared in the C stack growth prolo gue.
285 » // It is stack.lo+StackGuard on g0 and gsignal stacks.
286 » // It is ~0 on other goroutine stacks, to trigger a call to morestackc ( and crash).
287 » Stack» stack;» // offset known to runtime/cgo
288 » uintptr»stackguard0;» // offset known to liblink
289 » uintptr»stackguard1;» // offset known to liblink
290
291 » Panic*» panic;» // innermost panic - offset known to liblink
292 » Defer*» defer;» // innermost defer
275 Gobuf sched; 293 Gobuf sched;
276 uintptr syscallstack; // if status==Gsyscall, syscallstack = stackbase to use during gc
277 uintptr syscallsp; // if status==Gsyscall, syscallsp = sched.sp to use during gc 294 uintptr syscallsp; // if status==Gsyscall, syscallsp = sched.sp to use during gc
278 uintptr syscallpc; // if status==Gsyscall, syscallpc = sched.pc to use during gc 295 uintptr syscallpc; // if status==Gsyscall, syscallpc = sched.pc to use during gc
279 uintptr syscallguard; // if status==Gsyscall, syscallguard = stackguar d to use during gc
280 uintptr stackguard; // same as stackguard0, but not set to StackPree mpt
281 uintptr stack0;
282 uintptr stacksize;
283 void* param; // passed parameter on wakeup 296 void* param; // passed parameter on wakeup
284 uint32 atomicstatus; 297 uint32 atomicstatus;
285 int64 goid; 298 int64 goid;
286 int64 waitsince; // approx time when the G become blocked 299 int64 waitsince; // approx time when the G become blocked
287 String waitreason; // if status==Gwaiting 300 String waitreason; // if status==Gwaiting
288 G* schedlink; 301 G* schedlink;
289 bool issystem; // do not output in stack dump, ignore in deadlo ck detector 302 bool issystem; // do not output in stack dump, ignore in deadlo ck detector
290 bool preempt; // preemption signal, duplicates stackguard0 = S tackPreempt 303 bool preempt; // preemption signal, duplicates stackguard0 = S tackPreempt
291 bool paniconfault; // panic (instead of crash) on unexpected fault address 304 bool paniconfault; // panic (instead of crash) on unexpected fault address
292 » bool preemptscan; // preempted g does scan for GC 305 » bool» preemptscan; // preempted g does scan for GC
293 » bool gcworkdone; // debug: cleared at begining of gc work phase c ycle, set by gcphasework, tested at end of cycle 306 » bool» gcworkdone; // debug: cleared at begining of gc work phase c ycle, set by gcphasework, tested at end of cycle
294 bool throwsplit; // must not split stack 307 bool throwsplit; // must not split stack
295 int8 raceignore; // ignore race detection events 308 int8 raceignore; // ignore race detection events
296 M* m; // for debuggers, but offset not hard-coded 309 M* m; // for debuggers, but offset not hard-coded
297 M* lockedm; 310 M* lockedm;
298 int32 sig; 311 int32 sig;
299 int32 writenbuf;
300 Slice writebuf; 312 Slice writebuf;
301 uintptr sigcode0; 313 uintptr sigcode0;
302 uintptr sigcode1; 314 uintptr sigcode1;
303 uintptr sigpc; 315 uintptr sigpc;
304 uintptr gopc; // pc of go statement that created this goroutin e 316 uintptr gopc; // pc of go statement that created this goroutin e
305 uintptr racectx; 317 uintptr racectx;
306 » SudoG *waiting;» // sudog structures this G is waiting on (that h ave a valid elem ptr) 318 » SudoG*» waiting;» // sudog structures this G is waiting on (that h ave a valid elem ptr)
307 uintptr end[]; 319 uintptr end[];
308 }; 320 };
309 321
310 struct M 322 struct M
311 { 323 {
312 G* g0; // goroutine with scheduling stack 324 G* g0; // goroutine with scheduling stack
313 void* moreargp; // argument pointer for more stack
314 Gobuf morebuf; // gobuf arg to morestack 325 Gobuf morebuf; // gobuf arg to morestack
315 326
316 // Fields not known to debuggers. 327 // Fields not known to debuggers.
317 uint32 moreframesize; // size arguments to morestack
318 uint32 moreargsize; // known by amd64 asm to follow moreframesize
319 uintreg cret; // return value from C
320 uint64 procid; // for debuggers, but offset not hard-coded 328 uint64 procid; // for debuggers, but offset not hard-coded
321 G* gsignal; // signal-handling G 329 G* gsignal; // signal-handling G
322 uintptr tls[4]; // thread-local storage (for x86 extern register ) 330 uintptr tls[4]; // thread-local storage (for x86 extern register )
323 void (*mstartfn)(void); 331 void (*mstartfn)(void);
324 G* curg; // current running goroutine 332 G* curg; // current running goroutine
325 G* caughtsig; // goroutine running during fatal signal 333 G* caughtsig; // goroutine running during fatal signal
326 P* p; // attached P for executing Go code (nil if not executing Go code) 334 P* p; // attached P for executing Go code (nil if not executing Go code)
327 P* nextp; 335 P* nextp;
328 int32 id; 336 int32 id;
329 int32 mallocing; 337 int32 mallocing;
(...skipping 23 matching lines...) Expand all
353 uint32 locked; // tracking for LockOSThread 361 uint32 locked; // tracking for LockOSThread
354 M* nextwaitm; // next M waiting for lock 362 M* nextwaitm; // next M waiting for lock
355 uintptr waitsema; // semaphore for parking on locks 363 uintptr waitsema; // semaphore for parking on locks
356 uint32 waitsemacount; 364 uint32 waitsemacount;
357 uint32 waitsemalock; 365 uint32 waitsemalock;
358 GCStats gcstats; 366 GCStats gcstats;
359 bool needextram; 367 bool needextram;
360 uint8 traceback; 368 uint8 traceback;
361 bool (*waitunlockf)(G*, void*); 369 bool (*waitunlockf)(G*, void*);
362 void* waitlock; 370 void* waitlock;
363 uintptr forkstackguard;
364 uintptr scalararg[4]; // scalar argument/return for mcall 371 uintptr scalararg[4]; // scalar argument/return for mcall
365 void* ptrarg[4]; // pointer argument/return for mcall 372 void* ptrarg[4]; // pointer argument/return for mcall
366 #ifdef GOOS_windows 373 #ifdef GOOS_windows
367 » void*» thread;»» // thread handle 374 » uintptr»thread;»» // thread handle
368 // these are here because they are too large to be on the stack 375 // these are here because they are too large to be on the stack
369 // of low-level NOSPLIT functions. 376 // of low-level NOSPLIT functions.
370 LibCall libcall; 377 LibCall libcall;
371 uintptr libcallpc; // for cpu profiler 378 uintptr libcallpc; // for cpu profiler
372 uintptr libcallsp; 379 uintptr libcallsp;
373 G* libcallg; 380 G* libcallg;
374 #endif 381 #endif
375 #ifdef GOOS_solaris 382 #ifdef GOOS_solaris
376 int32* perrno; // pointer to TLS errno 383 int32* perrno; // pointer to TLS errno
377 // these are here because they are too large to be on the stack 384 // these are here because they are too large to be on the stack
378 // of low-level NOSPLIT functions. 385 // of low-level NOSPLIT functions.
379 LibCall libcall; 386 LibCall libcall;
380 » struct { 387 » struct MTs {
381 int64 tv_sec; 388 int64 tv_sec;
382 int64 tv_nsec; 389 int64 tv_nsec;
383 } ts; 390 } ts;
384 » struct { 391 » struct MScratch {
385 uintptr v[6]; 392 uintptr v[6];
386 } scratch; 393 } scratch;
387 #endif 394 #endif
388 #ifdef GOOS_plan9 395 #ifdef GOOS_plan9
389 int8* notesig; 396 int8* notesig;
390 byte* errstr; 397 byte* errstr;
391 #endif 398 #endif
392 uintptr end[]; 399 uintptr end[];
393 }; 400 };
394 401
(...skipping 25 matching lines...) Expand all
420 427
421 byte pad[64]; 428 byte pad[64];
422 }; 429 };
423 430
424 enum { 431 enum {
425 // The max value of GOMAXPROCS. 432 // The max value of GOMAXPROCS.
426 // There are no fundamental restrictions on the value. 433 // There are no fundamental restrictions on the value.
427 MaxGomaxprocs = 1<<8, 434 MaxGomaxprocs = 1<<8,
428 }; 435 };
429 436
437 struct SchedT
438 {
439 Mutex lock;
440
441 uint64 goidgen;
442
443 M* midle; // idle m's waiting for work
444 int32 nmidle; // number of idle m's waiting for work
445 int32 nmidlelocked; // number of locked m's waiting for work
446 int32 mcount; // number of m's that have been created
447 int32 maxmcount; // maximum number of m's allowed (or die)
448
449 P* pidle; // idle P's
450 uint32 npidle;
451 uint32 nmspinning;
452
453 // Global runnable queue.
454 G* runqhead;
455 G* runqtail;
456 int32 runqsize;
457
458 // Global cache of dead G's.
459 Mutex gflock;
460 G* gfree;
461 int32 ngfree;
462
463 uint32 gcwaiting; // gc is waiting to run
464 int32 stopwait;
465 Note stopnote;
466 uint32 sysmonwait;
467 Note sysmonnote;
468 uint64 lastpoll;
469
470 int32 profilehz; // cpu profiling rate
471 };
472
430 // The m->locked word holds two pieces of state counting active calls to LockOST hread/lockOSThread. 473 // The m->locked word holds two pieces of state counting active calls to LockOST hread/lockOSThread.
431 // The low bit (LockExternal) is a boolean reporting whether any LockOSThread ca ll is active. 474 // The low bit (LockExternal) is a boolean reporting whether any LockOSThread ca ll is active.
432 // External locks are not recursive; a second lock is silently ignored. 475 // External locks are not recursive; a second lock is silently ignored.
433 // The upper bits of m->lockedcount record the nesting depth of calls to lockOST hread 476 // The upper bits of m->lockedcount record the nesting depth of calls to lockOST hread
434 // (counting up by LockInternal), popped by unlockOSThread (counting down by Loc kInternal). 477 // (counting up by LockInternal), popped by unlockOSThread (counting down by Loc kInternal).
435 // Internal locks can be recursive. For instance, a lock for cgo can occur while the main 478 // Internal locks can be recursive. For instance, a lock for cgo can occur while the main
436 // goroutine is holding the lock during the initialization phase. 479 // goroutine is holding the lock during the initialization phase.
437 enum 480 enum
438 { 481 {
439 LockExternal = 1, 482 LockExternal = 1,
440 LockInternal = 2, 483 LockInternal = 2,
441 }; 484 };
442 485
443 struct Stktop
444 {
445 // The offsets of these fields are known to (hard-coded in) libmach.
446 uintptr stackguard;
447 uintptr stackbase;
448 Gobuf gobuf;
449 uint32 argsize;
450
451 uint8* argp; // pointer to arguments in old frame
452 };
453 struct SigTab 486 struct SigTab
454 { 487 {
455 int32 flags; 488 int32 flags;
456 int8 *name; 489 int8 *name;
457 }; 490 };
458 enum 491 enum
459 { 492 {
460 SigNotify = 1<<0, // let signal.Notify have signal, even if from k ernel 493 SigNotify = 1<<0, // let signal.Notify have signal, even if from k ernel
461 SigKill = 1<<1, // if signal.Notify doesn't take it, exit quietl y 494 SigKill = 1<<1, // if signal.Notify doesn't take it, exit quietl y
462 SigThrow = 1<<2, // if signal.Notify doesn't take it, exit loudly 495 SigThrow = 1<<2, // if signal.Notify doesn't take it, exit loudly
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 Windows = 0 550 Windows = 0
518 }; 551 };
519 #endif 552 #endif
520 #ifdef GOOS_solaris 553 #ifdef GOOS_solaris
521 enum { 554 enum {
522 Solaris = 1 555 Solaris = 1
523 }; 556 };
524 #else 557 #else
525 enum { 558 enum {
526 Solaris = 0 559 Solaris = 0
560 };
561 #endif
562 #ifdef GOOS_plan9
563 enum {
564 Plan9 = 1
565 };
566 #else
567 enum {
568 Plan9 = 0
527 }; 569 };
528 #endif 570 #endif
529 571
530 // Lock-free stack node. 572 // Lock-free stack node.
531 struct LFNode 573 struct LFNode
532 { 574 {
533 LFNode *next; 575 LFNode *next;
534 uintptr pushcnt; 576 uintptr pushcnt;
535 }; 577 };
536 578
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 }; 629 };
588 630
589 struct ForceGCState 631 struct ForceGCState
590 { 632 {
591 Mutex lock; 633 Mutex lock;
592 G* g; 634 G* g;
593 uint32 idle; 635 uint32 idle;
594 }; 636 };
595 637
596 extern uint32 runtime·gcphase; 638 extern uint32 runtime·gcphase;
597 extern bool runtime·precisestack;
598 extern bool runtime·copystack;
599 639
600 /* 640 /*
601 * defined macros 641 * defined macros
602 * you need super-gopher-guru privilege 642 * you need super-gopher-guru privilege
603 * to add this list. 643 * to add this list.
604 */ 644 */
605 #define nelem(x) (sizeof(x)/sizeof((x)[0])) 645 #define nelem(x) (sizeof(x)/sizeof((x)[0]))
606 #define nil ((void*)0) 646 #define nil ((void*)0)
607 #define offsetof(s,m) (uint32)(&(((s*)0)->m)) 647 #define offsetof(s,m) (uint32)(&(((s*)0)->m))
608 #define ROUND(x, n) (((x)+(n)-1)&~(uintptr)((n)-1)) /* all-caps to mark as m acro: it evaluates n twice */ 648 #define ROUND(x, n) (((x)+(n)-1)&~(uintptr)((n)-1)) /* all-caps to mark as m acro: it evaluates n twice */
(...skipping 19 matching lines...) Expand all
628 bool runtime·stopg(G*); 668 bool runtime·stopg(G*);
629 void runtime·restartg(G*); 669 void runtime·restartg(G*);
630 void runtime·gcphasework(G*); 670 void runtime·gcphasework(G*);
631 671
632 /* 672 /*
633 * deferred subroutine calls 673 * deferred subroutine calls
634 */ 674 */
635 struct Defer 675 struct Defer
636 { 676 {
637 int32 siz; 677 int32 siz;
638 » bool» special;» // not part of defer frame 678 » bool» started;
639 uintptr argp; // where args were copied from 679 uintptr argp; // where args were copied from
640 uintptr pc; 680 uintptr pc;
641 FuncVal* fn; 681 FuncVal* fn;
682 Panic* panic; // panic that is running defer
642 Defer* link; 683 Defer* link;
643 void* args[1]; // padded to actual size
644 }; 684 };
645 685
646 // argp used in Defer structs when there is no argp. 686 // argp used in Defer structs when there is no argp.
647 #define NoArgs ((uintptr)-1) 687 #define NoArgs ((uintptr)-1)
648 688
649 /* 689 /*
650 * panics 690 * panics
651 */ 691 */
652 struct Panic 692 struct Panic
653 { 693 {
654 » uintptr»argp;» // pointer to arguments of deferred call run during pani c; cannot move - known to liblink 694 » void*» argp;» // pointer to arguments of deferred call run during pani c; cannot move - known to liblink
655 Eface arg; // argument to panic 695 Eface arg; // argument to panic
656 Panic* link; // link to earlier panic 696 Panic* link; // link to earlier panic
657 Defer* defer; // current executing defer
658 bool recovered; // whether this panic is over 697 bool recovered; // whether this panic is over
659 bool aborted; // the panic was aborted 698 bool aborted; // the panic was aborted
660 }; 699 };
661 700
662 /* 701 /*
663 * stack traces 702 * stack traces
664 */ 703 */
665 typedef struct Stkframe Stkframe; 704 typedef struct Stkframe Stkframe;
705 typedef struct BitVector BitVector;
666 struct Stkframe 706 struct Stkframe
667 { 707 {
668 Func* fn; // function being run 708 Func* fn; // function being run
669 uintptr pc; // program counter within fn 709 uintptr pc; // program counter within fn
670 uintptr continpc; // program counter where execution can continue, or 0 if not 710 uintptr continpc; // program counter where execution can continue, or 0 if not
671 uintptr lr; // program counter at caller aka link register 711 uintptr lr; // program counter at caller aka link register
672 uintptr sp; // stack pointer at pc 712 uintptr sp; // stack pointer at pc
673 uintptr fp; // stack pointer at caller aka frame pointer 713 uintptr fp; // stack pointer at caller aka frame pointer
674 uintptr varp; // top of local variables 714 uintptr varp; // top of local variables
675 uintptr argp; // pointer to function arguments 715 uintptr argp; // pointer to function arguments
676 uintptr arglen; // number of bytes at argp 716 uintptr arglen; // number of bytes at argp
717 BitVector* argmap; // force use of this argmap
677 }; 718 };
678 719
679 intgo runtime·gentraceback(uintptr, uintptr, uintptr, G*, intgo, uintptr*, int go, bool(**)(Stkframe*, void*), void*, bool); 720 intgo runtime·gentraceback(uintptr, uintptr, uintptr, G*, intgo, uintptr*, int go, bool(**)(Stkframe*, void*), void*, bool);
721 void runtime·tracebackdefers(G*, bool(**)(Stkframe*, void*), void*);
680 void runtime·traceback(uintptr pc, uintptr sp, uintptr lr, G* gp); 722 void runtime·traceback(uintptr pc, uintptr sp, uintptr lr, G* gp);
681 void runtime·tracebackothers(G*); 723 void runtime·tracebackothers(G*);
682 bool runtime·haszeroargs(uintptr pc); 724 bool runtime·haszeroargs(uintptr pc);
683 bool runtime·topofstack(Func*); 725 bool runtime·topofstack(Func*);
684 enum 726 enum
685 { 727 {
686 // The maximum number of frames we print for a traceback 728 // The maximum number of frames we print for a traceback
687 TracebackMaxFrames = 100, 729 TracebackMaxFrames = 100,
688 }; 730 };
689 731
690 /* 732 /*
691 * external data 733 * external data
692 */ 734 */
693 extern String runtime·emptystring; 735 extern String runtime·emptystring;
694 extern uintptr runtime·zerobase;
695 extern G** runtime·allg; 736 extern G** runtime·allg;
696 extern Slice runtime·allgs; // []*G 737 extern Slice runtime·allgs; // []*G
697 extern uintptr runtime·allglen; 738 extern uintptr runtime·allglen;
698 extern G* runtime·lastg; 739 extern G* runtime·lastg;
699 extern M* runtime·allm; 740 extern M* runtime·allm;
700 extern P* runtime·allp[MaxGomaxprocs+1]; 741 extern P* runtime·allp[MaxGomaxprocs+1];
701 extern int32 runtime·gomaxprocs; 742 extern int32 runtime·gomaxprocs;
702 extern uint32 runtime·needextram; 743 extern uint32 runtime·needextram;
703 extern uint32 runtime·panicking; 744 extern uint32 runtime·panicking;
704 extern int8* runtime·goos; 745 extern int8* runtime·goos;
705 extern int32 runtime·ncpu; 746 extern int32 runtime·ncpu;
706 extern bool runtime·iscgo; 747 extern bool runtime·iscgo;
707 extern void (*runtime·sysargs)(int32, uint8**); 748 extern void (*runtime·sysargs)(int32, uint8**);
708 extern uintptr runtime·maxstring; 749 extern uintptr runtime·maxstring;
709 extern uint32 runtime·cpuid_ecx; 750 extern uint32 runtime·cpuid_ecx;
710 extern uint32 runtime·cpuid_edx; 751 extern uint32 runtime·cpuid_edx;
711 extern DebugVars runtime·debug; 752 extern DebugVars runtime·debug;
712 extern uintptr runtime·maxstacksize; 753 extern uintptr runtime·maxstacksize;
713 extern Note runtime·signote; 754 extern Note runtime·signote;
714 extern ForceGCState runtime·forcegc; 755 extern ForceGCState runtime·forcegc;
756 extern SchedT runtime·sched;
757 extern int32 runtime·newprocs;
715 758
716 /* 759 /*
717 * common functions and data 760 * common functions and data
718 */ 761 */
719 int32 runtime·strcmp(byte*, byte*); 762 int32 runtime·strcmp(byte*, byte*);
720 int32 runtime·strncmp(byte*, byte*, uintptr); 763 int32 runtime·strncmp(byte*, byte*, uintptr);
721 byte* runtime·strstr(byte*, byte*); 764 byte* runtime·strstr(byte*, byte*);
722 intgo runtime·findnull(byte*); 765 intgo runtime·findnull(byte*);
723 intgo runtime·findnullw(uint16*); 766 intgo runtime·findnullw(uint16*);
724 void runtime·dump(byte*, int32); 767 void runtime·dump(byte*, int32);
(...skipping 24 matching lines...) Expand all
749 * GoOutput is a type with the same alignment requirements as the 792 * GoOutput is a type with the same alignment requirements as the
750 * initial output argument from a Go function. Only for use in cases 793 * initial output argument from a Go function. Only for use in cases
751 * where using goc2c is not possible. See comment on FLUSH above. 794 * where using goc2c is not possible. See comment on FLUSH above.
752 */ 795 */
753 typedef uint64 GoOutput; 796 typedef uint64 GoOutput;
754 797
755 void runtime·gogo(Gobuf*); 798 void runtime·gogo(Gobuf*);
756 void runtime·gostartcall(Gobuf*, void(*)(void), void*); 799 void runtime·gostartcall(Gobuf*, void(*)(void), void*);
757 void runtime·gostartcallfn(Gobuf*, FuncVal*); 800 void runtime·gostartcallfn(Gobuf*, FuncVal*);
758 void runtime·gosave(Gobuf*); 801 void runtime·gosave(Gobuf*);
759 void runtime·lessstack(void);
760 void runtime·goargs(void); 802 void runtime·goargs(void);
761 void runtime·goenvs(void); 803 void runtime·goenvs(void);
762 void runtime·goenvs_unix(void); 804 void runtime·goenvs_unix(void);
763 void* runtime·getu(void); 805 void* runtime·getu(void);
764 void runtime·throw(int8*); 806 void runtime·throw(int8*);
765 void runtime·panicstring(int8*);
766 bool runtime·canpanic(G*); 807 bool runtime·canpanic(G*);
767 void runtime·prints(int8*); 808 void runtime·prints(int8*);
768 void runtime·printf(int8*, ...); 809 void runtime·printf(int8*, ...);
769 void runtime·snprintf(byte*, int32, int8*, ...); 810 void runtime·snprintf(byte*, int32, int8*, ...);
770 byte* runtime·mchr(byte*, byte, byte*); 811 byte* runtime·mchr(byte*, byte, byte*);
771 int32 runtime·mcmp(byte*, byte*, uintptr); 812 int32 runtime·mcmp(byte*, byte*, uintptr);
772 void runtime·memmove(void*, void*, uintptr); 813 void runtime·memmove(void*, void*, uintptr);
773 String runtime·catstring(String, String); 814 String runtime·catstring(String, String);
774 String runtime·gostring(byte*); 815 String runtime·gostring(byte*);
816 Slice runtime·makeStringSlice(intgo);
775 String runtime·gostringn(byte*, intgo); 817 String runtime·gostringn(byte*, intgo);
776 Slice runtime·gobytes(byte*, intgo); 818 Slice runtime·gobytes(byte*, intgo);
777 String runtime·gostringnocopy(byte*); 819 String runtime·gostringnocopy(byte*);
778 String runtime·gostringw(uint16*); 820 String runtime·gostringw(uint16*);
779 void runtime·initsig(void); 821 void runtime·initsig(void);
780 void runtime·sigenable(uint32 sig); 822 void runtime·sigenable(uint32 sig);
781 void runtime·sigdisable(uint32 sig); 823 void runtime·sigdisable(uint32 sig);
782 int32 runtime·gotraceback(bool *crash); 824 int32 runtime·gotraceback(bool *crash);
783 void runtime·goroutineheader(G*); 825 void runtime·goroutineheader(G*);
784 int32 runtime·open(int8*, int32, int32); 826 int32 runtime·open(int8*, int32, int32);
785 int32 runtime·read(int32, void*, int32); 827 int32 runtime·read(int32, void*, int32);
786 int32 runtime·write(uintptr, void*, int32); // use uintptr to accommodate wind ows. 828 int32 runtime·write(uintptr, void*, int32); // use uintptr to accommodate wind ows.
787 int32 runtime·close(int32); 829 int32 runtime·close(int32);
788 int32 runtime·mincore(void*, uintptr, byte*); 830 int32 runtime·mincore(void*, uintptr, byte*);
789 void runtime·jmpdefer(FuncVal*, uintptr); 831 void runtime·jmpdefer(FuncVal*, uintptr);
790 void runtime·exit1(int32); 832 void runtime·exit1(int32);
791 void runtime·ready(G*); 833 void runtime·ready(G*);
792 byte* runtime·getenv(int8*); 834 byte* runtime·getenv(int8*);
793 int32 runtime·atoi(byte*); 835 int32 runtime·atoi(byte*);
794 void runtime·newosproc(M *mp, void *stk); 836 void runtime·newosproc(M *mp, void *stk);
795 void runtime·mstart(void); 837 void runtime·mstart(void);
796 G* runtime·malg(int32); 838 G* runtime·malg(int32);
797 void runtime·asminit(void); 839 void runtime·asminit(void);
798 void runtime·mpreinit(M*); 840 void runtime·mpreinit(M*);
799 void runtime·minit(void); 841 void runtime·minit(void);
800 void runtime·unminit(void); 842 void runtime·unminit(void);
801 void runtime·signalstack(byte*, int32); 843 void runtime·signalstack(byte*, int32);
844 void runtime·tracebackinit(void);
802 void runtime·symtabinit(void); 845 void runtime·symtabinit(void);
803 Func* runtime·findfunc(uintptr); 846 Func* runtime·findfunc(uintptr);
804 int32 runtime·funcline(Func*, uintptr, String*); 847 int32 runtime·funcline(Func*, uintptr, String*);
805 int32 runtime·funcarglen(Func*, uintptr);
806 int32 runtime·funcspdelta(Func*, uintptr); 848 int32 runtime·funcspdelta(Func*, uintptr);
807 int8* runtime·funcname(Func*); 849 int8* runtime·funcname(Func*);
808 int32 runtime·pcdatavalue(Func*, int32, uintptr); 850 int32 runtime·pcdatavalue(Func*, int32, uintptr);
809 void runtime·stackinit(void); 851 void runtime·stackinit(void);
810 void*» runtime·stackalloc(G*, uint32); 852 Stack» runtime·stackalloc(uint32);
811 void» runtime·stackfree(G*, void*, Stktop*); 853 void» runtime·stackfree(Stack);
812 void runtime·shrinkstack(G*); 854 void runtime·shrinkstack(G*);
855 void runtime·shrinkfinish(void);
813 MCache* runtime·allocmcache(void); 856 MCache* runtime·allocmcache(void);
814 void runtime·freemcache(MCache*); 857 void runtime·freemcache(MCache*);
815 void runtime·mallocinit(void); 858 void runtime·mallocinit(void);
816 void runtime·gcinit(void); 859 void runtime·gcinit(void);
817 void* runtime·mallocgc(uintptr size, Type* typ, uint32 flag); 860 void* runtime·mallocgc(uintptr size, Type* typ, uint32 flag);
818 void runtime·runpanic(Panic*); 861 void runtime·runpanic(Panic*);
819 uintptr runtime·getcallersp(void*); 862 uintptr runtime·getcallersp(void*);
820 int32 runtime·mcount(void); 863 int32 runtime·mcount(void);
821 int32 runtime·gcount(void); 864 int32 runtime·gcount(void);
822 void runtime·mcall(void(**)(G*)); 865 void runtime·mcall(void(**)(G*));
823 void runtime·onM(void(**)(void)); 866 void runtime·onM(void(**)(void));
867 void runtime·onMsignal(void(**)(void));
824 uint32 runtime·fastrand1(void); 868 uint32 runtime·fastrand1(void);
825 void runtime·rewindmorestack(Gobuf*); 869 void runtime·rewindmorestack(Gobuf*);
826 int32 runtime·timediv(int64, int32, int32*); 870 int32 runtime·timediv(int64, int32, int32*);
827 int32 runtime·round2(int32 x); // round x up to a power of 2. 871 int32 runtime·round2(int32 x); // round x up to a power of 2.
828 872
829 // atomic operations 873 // atomic operations
830 bool runtime·cas(uint32*, uint32, uint32); 874 bool runtime·cas(uint32*, uint32, uint32);
831 bool runtime·cas64(uint64*, uint64, uint64); 875 bool runtime·cas64(uint64*, uint64, uint64);
832 bool runtime·casp(void**, void*, void*); 876 bool runtime·casp(void**, void*, void*);
833 // Don't confuse with XADD x86 instruction, 877 // Don't confuse with XADD x86 instruction,
834 // this one is actually 'addx', that is, add-and-fetch. 878 // this one is actually 'addx', that is, add-and-fetch.
835 uint32 runtime·xadd(uint32 volatile*, int32); 879 uint32 runtime·xadd(uint32 volatile*, int32);
836 uint64 runtime·xadd64(uint64 volatile*, int64); 880 uint64 runtime·xadd64(uint64 volatile*, int64);
837 uint32 runtime·xchg(uint32 volatile*, uint32); 881 uint32 runtime·xchg(uint32 volatile*, uint32);
838 uint64 runtime·xchg64(uint64 volatile*, uint64); 882 uint64 runtime·xchg64(uint64 volatile*, uint64);
839 void* runtime·xchgp(void* volatile*, void*); 883 void* runtime·xchgp(void* volatile*, void*);
840 uint32 runtime·atomicload(uint32 volatile*); 884 uint32 runtime·atomicload(uint32 volatile*);
841 void runtime·atomicstore(uint32 volatile*, uint32); 885 void runtime·atomicstore(uint32 volatile*, uint32);
842 void runtime·atomicstore64(uint64 volatile*, uint64); 886 void runtime·atomicstore64(uint64 volatile*, uint64);
843 uint64 runtime·atomicload64(uint64 volatile*); 887 uint64 runtime·atomicload64(uint64 volatile*);
844 void* runtime·atomicloadp(void* volatile*); 888 void* runtime·atomicloadp(void* volatile*);
889 uintptr runtime·atomicloaduintptr(uintptr volatile*);
845 void runtime·atomicstorep(void* volatile*, void*); 890 void runtime·atomicstorep(void* volatile*, void*);
891 void runtime·atomicstoreuintptr(uintptr volatile*, uintptr);
846 void runtime·atomicor8(byte volatile*, byte); 892 void runtime·atomicor8(byte volatile*, byte);
847 893
848 void runtime·setg(G*); 894 void runtime·setg(G*);
849 void runtime·newextram(void); 895 void runtime·newextram(void);
850 void runtime·exit(int32); 896 void runtime·exit(int32);
851 void runtime·breakpoint(void); 897 void runtime·breakpoint(void);
852 void runtime·gosched(void);
853 void runtime·gosched_m(G*); 898 void runtime·gosched_m(G*);
854 void runtime·schedtrace(bool); 899 void runtime·schedtrace(bool);
855 void runtime·park(bool(*)(G*, void*), void*, String); 900 void runtime·park(bool(*)(G*, void*), void*, String);
856 void runtime·parkunlock(Mutex*, String); 901 void runtime·parkunlock(Mutex*, String);
857 void runtime·tsleep(int64, String); 902 void runtime·tsleep(int64, String);
858 M* runtime·newm(void); 903 M* runtime·newm(void);
859 void runtime·goexit(void); 904 void runtime·goexit(void);
860 void runtime·asmcgocall(void (*fn)(void*), void*); 905 void runtime·asmcgocall(void (*fn)(void*), void*);
861 int32 runtime·asmcgocall_errno(void (*fn)(void*), void*); 906 int32 runtime·asmcgocall_errno(void (*fn)(void*), void*);
862 void runtime·entersyscall(void); 907 void runtime·entersyscall(void);
908 void runtime·reentersyscall(uintptr, uintptr);
863 void runtime·entersyscallblock(void); 909 void runtime·entersyscallblock(void);
864 void runtime·exitsyscall(void); 910 void runtime·exitsyscall(void);
865 G* runtime·newproc1(FuncVal*, byte*, int32, int32, void*); 911 G* runtime·newproc1(FuncVal*, byte*, int32, int32, void*);
866 bool runtime·sigsend(int32 sig); 912 bool runtime·sigsend(int32 sig);
867 intgo runtime·callers(intgo, uintptr*, intgo); 913 intgo runtime·callers(intgo, uintptr*, intgo);
868 intgo runtime·gcallers(G*, intgo, uintptr*, intgo); 914 intgo runtime·gcallers(G*, intgo, uintptr*, intgo);
869 int64 runtime·nanotime(void); // monotonic time 915 int64 runtime·nanotime(void); // monotonic time
870 int64 runtime·unixnanotime(void); // real time, can skip 916 int64 runtime·unixnanotime(void); // real time, can skip
871 void runtime·dopanic(int32); 917 void runtime·dopanic(int32);
872 void runtime·startpanic(void); 918 void runtime·startpanic(void);
873 void runtime·freezetheworld(void); 919 void runtime·freezetheworld(void);
874 void runtime·unwindstack(G*, byte*);
875 void runtime·sigprof(uint8 *pc, uint8 *sp, uint8 *lr, G *gp, M *mp); 920 void runtime·sigprof(uint8 *pc, uint8 *sp, uint8 *lr, G *gp, M *mp);
876 void runtime·resetcpuprofiler(int32); 921 void runtime·resetcpuprofiler(int32);
877 void runtime·setcpuprofilerate(int32); 922 void runtime·setcpuprofilerate(int32);
878 void runtime·usleep(uint32); 923 void runtime·usleep(uint32);
879 int64 runtime·cputicks(void); 924 int64 runtime·cputicks(void);
880 int64 runtime·tickspersecond(void); 925 int64 runtime·tickspersecond(void);
881 void runtime·blockevent(int64, intgo); 926 void runtime·blockevent(int64, intgo);
882 G* runtime·netpoll(bool); 927 G* runtime·netpoll(bool);
883 void runtime·netpollready(G**, PollDesc*, int32); 928 void runtime·netpollready(G**, PollDesc*, int32);
884 uintptr runtime·netpollfd(PollDesc*); 929 uintptr runtime·netpollfd(PollDesc*);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 void runtime·gopanic(Eface); 1060 void runtime·gopanic(Eface);
1016 void runtime·panicindex(void); 1061 void runtime·panicindex(void);
1017 void runtime·panicslice(void); 1062 void runtime·panicslice(void);
1018 void runtime·panicdivide(void); 1063 void runtime·panicdivide(void);
1019 1064
1020 /* 1065 /*
1021 * runtime c-called (but written in Go) 1066 * runtime c-called (but written in Go)
1022 */ 1067 */
1023 void runtime·printany(Eface); 1068 void runtime·printany(Eface);
1024 void runtime·newTypeAssertionError(String*, String*, String*, String*, Eface* ); 1069 void runtime·newTypeAssertionError(String*, String*, String*, String*, Eface* );
1025 void runtime·newErrorString(String, Eface*);
1026 void runtime·newErrorCString(int8*, Eface*);
1027 void runtime·fadd64c(uint64, uint64, uint64*); 1070 void runtime·fadd64c(uint64, uint64, uint64*);
1028 void runtime·fsub64c(uint64, uint64, uint64*); 1071 void runtime·fsub64c(uint64, uint64, uint64*);
1029 void runtime·fmul64c(uint64, uint64, uint64*); 1072 void runtime·fmul64c(uint64, uint64, uint64*);
1030 void runtime·fdiv64c(uint64, uint64, uint64*); 1073 void runtime·fdiv64c(uint64, uint64, uint64*);
1031 void runtime·fneg64c(uint64, uint64*); 1074 void runtime·fneg64c(uint64, uint64*);
1032 void runtime·f32to64c(uint32, uint64*); 1075 void runtime·f32to64c(uint32, uint64*);
1033 void runtime·f64to32c(uint64, uint32*); 1076 void runtime·f64to32c(uint64, uint32*);
1034 void runtime·fcmp64c(uint64, uint64, int32*, bool*); 1077 void runtime·fcmp64c(uint64, uint64, int32*, bool*);
1035 void runtime·fintto64c(int64, uint64*); 1078 void runtime·fintto64c(int64, uint64*);
1036 void runtime·f64tointc(uint64, int64*, bool*); 1079 void runtime·f64tointc(uint64, int64*, bool*);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 extern float64 runtime·neginf; 1113 extern float64 runtime·neginf;
1071 extern uint64 ·nan; 1114 extern uint64 ·nan;
1072 extern uint64 ·posinf; 1115 extern uint64 ·posinf;
1073 extern uint64 ·neginf; 1116 extern uint64 ·neginf;
1074 #define ISNAN(f) ((f) != (f)) 1117 #define ISNAN(f) ((f) != (f))
1075 1118
1076 enum 1119 enum
1077 { 1120 {
1078 UseSpanType = 1, 1121 UseSpanType = 1,
1079 }; 1122 };
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b