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

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

Issue 123700044: code review 123700044: runtime: convert timers to Go (Closed)
Left Patch Set: diff -r 42bcf6ae4aff0511890d4fe35aa15f14b7b751c8 https://dvyukov%40google.com@code.google.com/p/go/ Created 10 years, 7 months ago
Right Patch Set: diff -r 3f13ed48b37ed52cd347d23aa321f81a4ec2c44d https://dvyukov%40google.com@code.google.com/p/go/ Created 10 years, 6 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/runtime/netpoll.goc ('k') | src/pkg/runtime/thunk.s » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #define double XXdouble / / / 56 #define double XXdouble / / /
57 57
58 /* 58 /*
59 * defined types 59 * defined types
60 */ 60 */
61 typedef uint8 bool; 61 typedef uint8 bool;
62 typedef uint8 byte; 62 typedef uint8 byte;
63 typedef struct Func Func; 63 typedef struct Func Func;
64 typedef struct G G; 64 typedef struct G G;
65 typedef struct Gobuf Gobuf; 65 typedef struct Gobuf Gobuf;
66 typedef struct SudoG SudoG;
66 typedef struct Lock Lock; 67 typedef struct Lock Lock;
67 typedef struct M M; 68 typedef struct M M;
68 typedef struct P P; 69 typedef struct P P;
69 typedef struct Note Note; 70 typedef struct Note Note;
70 typedef struct Slice Slice; 71 typedef struct Slice Slice;
71 typedef struct Stktop Stktop; 72 typedef struct Stktop Stktop;
72 typedef struct String String; 73 typedef struct String String;
73 typedef struct FuncVal FuncVal; 74 typedef struct FuncVal FuncVal;
74 typedef struct SigTab SigTab; 75 typedef struct SigTab SigTab;
75 typedef struct MCache MCache; 76 typedef struct MCache MCache;
76 typedef struct FixAlloc FixAlloc; 77 typedef struct FixAlloc FixAlloc;
77 typedef struct Iface Iface; 78 typedef struct Iface Iface;
78 typedef struct Itab Itab; 79 typedef struct Itab Itab;
79 typedef struct InterfaceType InterfaceType; 80 typedef struct InterfaceType InterfaceType;
80 typedef struct Eface Eface; 81 typedef struct Eface Eface;
81 typedef struct Type Type; 82 typedef struct Type Type;
82 typedef struct PtrType PtrType; 83 typedef struct PtrType PtrType;
83 typedef struct ChanType ChanType; 84 typedef struct ChanType ChanType;
84 typedef struct MapType MapType; 85 typedef struct MapType MapType;
85 typedef struct Defer Defer; 86 typedef struct Defer Defer;
86 typedef struct Panic Panic; 87 typedef struct Panic Panic;
87 typedef struct Hmap Hmap; 88 typedef struct Hmap Hmap;
88 typedef struct Hiter Hiter; 89 typedef struct Hiter Hiter;
89 typedef struct Hchan Hchan; 90 typedef struct Hchan Hchan;
90 typedef struct Complex64 Complex64; 91 typedef struct Complex64 Complex64;
91 typedef struct Complex128 Complex128; 92 typedef struct Complex128 Complex128;
92 typedef struct LibCall LibCall; 93 typedef struct LibCall LibCall;
93 typedef struct WinCallbackContext WinCallbackContext; 94 typedef struct WinCallbackContext WinCallbackContext;
94 typedef struct Timer Timer;
95 typedef struct GCStats GCStats; 95 typedef struct GCStats GCStats;
96 typedef struct LFNode LFNode; 96 typedef struct LFNode LFNode;
97 typedef struct ParFor ParFor; 97 typedef struct ParFor ParFor;
98 typedef struct ParForThread ParForThread; 98 typedef struct ParForThread ParForThread;
99 typedef struct CgoMal CgoMal; 99 typedef struct CgoMal CgoMal;
100 typedef struct PollDesc PollDesc; 100 typedef struct PollDesc PollDesc;
101 typedef struct DebugVars DebugVars; 101 typedef struct DebugVars DebugVars;
102 102
103 /* 103 /*
104 * Per-CPU declaration. 104 * Per-CPU declaration.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 }; 208 };
209 struct Gobuf 209 struct Gobuf
210 { 210 {
211 // The offsets of sp, pc, and g are known to (hard-coded in) libmach. 211 // The offsets of sp, pc, and g are known to (hard-coded in) libmach.
212 uintptr sp; 212 uintptr sp;
213 uintptr pc; 213 uintptr pc;
214 G* g; 214 G* g;
215 void* ctxt; // this has to be a pointer so that GC scans it 215 void* ctxt; // this has to be a pointer so that GC scans it
216 uintreg ret; 216 uintreg ret;
217 uintptr lr; 217 uintptr lr;
218 };
219 // Known to compiler.
220 // Changes here must also be made in src/cmd/gc/select.c's selecttype.
221 struct SudoG
222 {
223 G* g;
224 uint32* selectdone;
225 SudoG* next;
226 SudoG* prev;
227 void* elem; // data element
228 int64 releasetime;
229 int32 nrelease; // -1 for acquire
230 SudoG* waitlink; // G.waiting list
218 }; 231 };
219 struct GCStats 232 struct GCStats
220 { 233 {
221 // the struct must consist of only uint64's, 234 // the struct must consist of only uint64's,
222 // because it is casted to uint64[]. 235 // because it is casted to uint64[].
223 uint64 nhandoff; 236 uint64 nhandoff;
224 uint64 nhandoffcnt; 237 uint64 nhandoffcnt;
225 uint64 nprocyield; 238 uint64 nprocyield;
226 uint64 nosyield; 239 uint64 nosyield;
227 uint64 nsleep; 240 uint64 nsleep;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 M* m; // for debuggers, but offset not hard-coded 290 M* m; // for debuggers, but offset not hard-coded
278 M* lockedm; 291 M* lockedm;
279 int32 sig; 292 int32 sig;
280 int32 writenbuf; 293 int32 writenbuf;
281 byte* writebuf; 294 byte* writebuf;
282 uintptr sigcode0; 295 uintptr sigcode0;
283 uintptr sigcode1; 296 uintptr sigcode1;
284 uintptr sigpc; 297 uintptr sigpc;
285 uintptr gopc; // pc of go statement that created this goroutin e 298 uintptr gopc; // pc of go statement that created this goroutin e
286 uintptr racectx; 299 uintptr racectx;
300 SudoG *waiting; // sudog structures this G is waiting on (that h ave a valid elem ptr)
287 uintptr end[]; 301 uintptr end[];
288 }; 302 };
289 303
290 struct M 304 struct M
291 { 305 {
292 G* g0; // goroutine with scheduling stack 306 G* g0; // goroutine with scheduling stack
293 void* moreargp; // argument pointer for more stack 307 void* moreargp; // argument pointer for more stack
294 Gobuf morebuf; // gobuf arg to morestack 308 Gobuf morebuf; // gobuf arg to morestack
295 309
296 // Fields not known to debuggers. 310 // Fields not known to debuggers.
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 SigPanic = 1<<3, // if the signal is from the kernel, panic 453 SigPanic = 1<<3, // if the signal is from the kernel, panic
440 SigDefault = 1<<4, // if the signal isn't explicitly requested, don 't monitor it 454 SigDefault = 1<<4, // if the signal isn't explicitly requested, don 't monitor it
441 SigHandling = 1<<5, // our signal handler is registered 455 SigHandling = 1<<5, // our signal handler is registered
442 SigIgnored = 1<<6, // the signal was ignored before we registered f or it 456 SigIgnored = 1<<6, // the signal was ignored before we registered f or it
443 SigGoExit = 1<<7, // cause all runtime procs to exit (only used on Plan 9). 457 SigGoExit = 1<<7, // cause all runtime procs to exit (only used on Plan 9).
444 }; 458 };
445 459
446 // Layout of in-memory per-function information prepared by linker 460 // Layout of in-memory per-function information prepared by linker
447 // See http://golang.org/s/go12symtab. 461 // See http://golang.org/s/go12symtab.
448 // Keep in sync with linker and with ../../libmach/sym.c 462 // Keep in sync with linker and with ../../libmach/sym.c
449 // and with package debug/gosym. 463 // and with package debug/gosym and with symtab.go in package runtime.
450 struct Func 464 struct Func
451 { 465 {
452 uintptr entry; // start pc 466 uintptr entry; // start pc
453 int32 nameoff;// function name 467 int32 nameoff;// function name
454 ········ 468 ········
455 int32 args; // in/out args size 469 int32 args; // in/out args size
456 int32 frame; // legacy frame size; use pcsp if possible 470 int32 frame; // legacy frame size; use pcsp if possible
457 471
458 int32 pcsp; 472 int32 pcsp;
459 int32 pcfile; 473 int32 pcfile;
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 extern int32 runtime·ncpu; 758 extern int32 runtime·ncpu;
745 extern bool runtime·iscgo; 759 extern bool runtime·iscgo;
746 extern void (*runtime·sysargs)(int32, uint8**); 760 extern void (*runtime·sysargs)(int32, uint8**);
747 extern uintptr runtime·maxstring; 761 extern uintptr runtime·maxstring;
748 extern uint32 runtime·cpuid_ecx; 762 extern uint32 runtime·cpuid_ecx;
749 extern uint32 runtime·cpuid_edx; 763 extern uint32 runtime·cpuid_edx;
750 extern DebugVars runtime·debug; 764 extern DebugVars runtime·debug;
751 extern uintptr runtime·maxstacksize; 765 extern uintptr runtime·maxstacksize;
752 extern byte* runtime·gcdatamask; 766 extern byte* runtime·gcdatamask;
753 extern byte* runtime·gcbssmask; 767 extern byte* runtime·gcbssmask;
768 extern Note runtime·signote;
754 769
755 /* 770 /*
756 * common functions and data 771 * common functions and data
757 */ 772 */
758 int32 runtime·strcmp(byte*, byte*); 773 int32 runtime·strcmp(byte*, byte*);
759 int32 runtime·strncmp(byte*, byte*, uintptr); 774 int32 runtime·strncmp(byte*, byte*, uintptr);
760 byte* runtime·strstr(byte*, byte*); 775 byte* runtime·strstr(byte*, byte*);
761 intgo runtime·findnull(byte*); 776 intgo runtime·findnull(byte*);
762 intgo runtime·findnullw(uint16*); 777 intgo runtime·findnullw(uint16*);
763 void runtime·dump(byte*, int32); 778 void runtime·dump(byte*, int32);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 int8* runtime·funcname(Func*); 861 int8* runtime·funcname(Func*);
847 int32 runtime·pcdatavalue(Func*, int32, uintptr); 862 int32 runtime·pcdatavalue(Func*, int32, uintptr);
848 void runtime·stackinit(void); 863 void runtime·stackinit(void);
849 void* runtime·stackalloc(G*, uint32); 864 void* runtime·stackalloc(G*, uint32);
850 void runtime·stackfree(G*, void*, Stktop*); 865 void runtime·stackfree(G*, void*, Stktop*);
851 void runtime·shrinkstack(G*); 866 void runtime·shrinkstack(G*);
852 MCache* runtime·allocmcache(void); 867 MCache* runtime·allocmcache(void);
853 void runtime·freemcache(MCache*); 868 void runtime·freemcache(MCache*);
854 void runtime·mallocinit(void); 869 void runtime·mallocinit(void);
855 void runtime·gcinit(void); 870 void runtime·gcinit(void);
856 void runtime·chaninit(void);
857 void* runtime·mallocgc(uintptr size, Type* typ, uint32 flag); 871 void* runtime·mallocgc(uintptr size, Type* typ, uint32 flag);
858 void runtime·runpanic(Panic*); 872 void runtime·runpanic(Panic*);
859 uintptr runtime·getcallersp(void*); 873 uintptr runtime·getcallersp(void*);
860 int32 runtime·mcount(void); 874 int32 runtime·mcount(void);
861 int32 runtime·gcount(void); 875 int32 runtime·gcount(void);
862 void runtime·mcall(void(*)(G*)); 876 void runtime·mcall(void(*)(G*));
863 void runtime·onM(void(*)(void)); 877 void runtime·onM(void(*)(void));
864 uint32 runtime·fastrand1(void); 878 uint32 runtime·fastrand1(void);
865 void runtime·rewindmorestack(Gobuf*); 879 void runtime·rewindmorestack(Gobuf*);
866 int32 runtime·timediv(int64, int32, int32*); 880 int32 runtime·timediv(int64, int32, int32*);
(...skipping 26 matching lines...) Expand all
893 void runtime·gosched_m(G*); 907 void runtime·gosched_m(G*);
894 void runtime·schedtrace(bool); 908 void runtime·schedtrace(bool);
895 void runtime·park(bool(*)(G*, void*), void*, String); 909 void runtime·park(bool(*)(G*, void*), void*, String);
896 void runtime·parkunlock(Lock*, String); 910 void runtime·parkunlock(Lock*, String);
897 void runtime·tsleep(int64, String); 911 void runtime·tsleep(int64, String);
898 M* runtime·newm(void); 912 M* runtime·newm(void);
899 void runtime·goexit(void); 913 void runtime·goexit(void);
900 void runtime·asmcgocall(void (*fn)(void*), void*); 914 void runtime·asmcgocall(void (*fn)(void*), void*);
901 void runtime·entersyscall(void); 915 void runtime·entersyscall(void);
902 void runtime·entersyscallblock(void); 916 void runtime·entersyscallblock(void);
903 void runtime·entersyscall_m(void);
904 void runtime·exitsyscall(void); 917 void runtime·exitsyscall(void);
918 void runtime·entersyscallblock_m(void);
905 G* runtime·newproc1(FuncVal*, byte*, int32, int32, void*); 919 G* runtime·newproc1(FuncVal*, byte*, int32, int32, void*);
906 bool runtime·sigsend(int32 sig); 920 bool runtime·sigsend(int32 sig);
907 int32 runtime·callers(int32, uintptr*, int32); 921 int32 runtime·callers(int32, uintptr*, int32);
908 int32 runtime·gcallers(G*, int32, uintptr*, int32); 922 int32 runtime·gcallers(G*, int32, uintptr*, int32);
909 int64 runtime·nanotime(void); // monotonic time 923 int64 runtime·nanotime(void); // monotonic time
910 int64 runtime·unixnanotime(void); // real time, can skip 924 int64 runtime·unixnanotime(void); // real time, can skip
911 void runtime·dopanic(int32); 925 void runtime·dopanic(int32);
912 void runtime·startpanic(void); 926 void runtime·startpanic(void);
913 void runtime·freezetheworld(void); 927 void runtime·freezetheworld(void);
914 void runtime·unwindstack(G*, byte*); 928 void runtime·unwindstack(G*, byte*);
(...skipping 13 matching lines...) Expand all
928 uintptr runtime·netpollfd(PollDesc*); 942 uintptr runtime·netpollfd(PollDesc*);
929 void runtime·netpollarm(PollDesc*, int32); 943 void runtime·netpollarm(PollDesc*, int32);
930 void** runtime·netpolluser(PollDesc*); 944 void** runtime·netpolluser(PollDesc*);
931 bool runtime·netpollclosing(PollDesc*); 945 bool runtime·netpollclosing(PollDesc*);
932 void runtime·netpolllock(PollDesc*); 946 void runtime·netpolllock(PollDesc*);
933 void runtime·netpollunlock(PollDesc*); 947 void runtime·netpollunlock(PollDesc*);
934 void runtime·crash(void); 948 void runtime·crash(void);
935 void runtime·parsedebugvars(void); 949 void runtime·parsedebugvars(void);
936 void _rt0_go(void); 950 void _rt0_go(void);
937 void* runtime·funcdata(Func*, int32); 951 void* runtime·funcdata(Func*, int32);
938 int32» runtime·setmaxthreads(int32); 952 void» runtime·setmaxthreads_m(void);
939 G* runtime·timejump(void); 953 G* runtime·timejump(void);
940 void runtime·iterate_itabs(void (*callback)(Itab*)); 954 void runtime·iterate_itabs(void (*callback)(Itab*));
941 void runtime·iterate_finq(void (*callback)(FuncVal*, byte*, uintptr, Type*, P trType*)); 955 void runtime·iterate_finq(void (*callback)(FuncVal*, byte*, uintptr, Type*, P trType*));
942 956
943 #pragma varargck argpos runtime·printf 1 957 #pragma varargck argpos runtime·printf 1
944 #pragma varargck type "c" int32 958 #pragma varargck type "c" int32
945 #pragma varargck type "d" int32 959 #pragma varargck type "d" int32
946 #pragma varargck type "d" uint32 960 #pragma varargck type "d" uint32
947 #pragma varargck type "D" int64 961 #pragma varargck type "D" int64
948 #pragma varargck type "D" uint64 962 #pragma varargck type "D" uint64
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 extern float64 runtime·neginf; 1133 extern float64 runtime·neginf;
1120 extern uint64 ·nan; 1134 extern uint64 ·nan;
1121 extern uint64 ·posinf; 1135 extern uint64 ·posinf;
1122 extern uint64 ·neginf; 1136 extern uint64 ·neginf;
1123 #define ISNAN(f) ((f) != (f)) 1137 #define ISNAN(f) ((f) != (f))
1124 1138
1125 enum 1139 enum
1126 { 1140 {
1127 UseSpanType = 1, 1141 UseSpanType = 1,
1128 }; 1142 };
LEFTRIGHT

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