OLD | NEW |
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 int32 intgo; // Go's int |
| 23 typedef uint32 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 M* waitm; // linked list of waiting M's (sema-based impl) | 136 M* waitm; // linked list of waiting M's (sema-based impl) |
133 }; | 137 }; |
134 union Note | 138 union Note |
135 { | 139 { |
136 uint32 key; // futex-based impl | 140 uint32 key; // futex-based impl |
137 M* waitm; // waiting M (sema-based impl) | 141 M* waitm; // waiting M (sema-based impl) |
138 }; | 142 }; |
139 struct String | 143 struct String |
140 { | 144 { |
141 byte* str; | 145 byte* str; |
142 » int32» len; | 146 » intgo» len; |
143 }; | 147 }; |
144 struct Iface | 148 struct Iface |
145 { | 149 { |
146 Itab* tab; | 150 Itab* tab; |
147 void* data; | 151 void* data; |
148 }; | 152 }; |
149 struct Eface | 153 struct Eface |
150 { | 154 { |
151 Type* type; | 155 Type* type; |
152 void* data; | 156 void* data; |
153 }; | 157 }; |
154 struct Complex64 | 158 struct Complex64 |
155 { | 159 { |
156 float32 real; | 160 float32 real; |
157 float32 imag; | 161 float32 imag; |
158 }; | 162 }; |
159 struct Complex128 | 163 struct Complex128 |
160 { | 164 { |
161 float64 real; | 165 float64 real; |
162 float64 imag; | 166 float64 imag; |
163 }; | 167 }; |
164 | 168 |
165 struct Slice | 169 struct Slice |
166 { // must not move anything | 170 { // must not move anything |
167 byte* array; // actual data | 171 byte* array; // actual data |
168 » uint32» len;» » // number of elements | 172 » uintgo» len;» » // number of elements |
169 » uint32» cap;» » // allocated number of elements | 173 » uintgo» cap;» » // allocated number of elements |
170 }; | 174 }; |
171 struct Gobuf | 175 struct Gobuf |
172 { | 176 { |
173 // The offsets of these fields are known to (hard-coded in) libmach. | 177 // The offsets of these fields are known to (hard-coded in) libmach. |
174 uintptr sp; | 178 uintptr sp; |
175 byte* pc; | 179 byte* pc; |
176 G* g; | 180 G* g; |
177 }; | 181 }; |
178 struct GCStats | 182 struct GCStats |
179 { | 183 { |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 G* runtime·allg; | 515 G* runtime·allg; |
512 G* runtime·lastg; | 516 G* runtime·lastg; |
513 M* runtime·allm; | 517 M* runtime·allm; |
514 extern int32 runtime·gomaxprocs; | 518 extern int32 runtime·gomaxprocs; |
515 extern bool runtime·singleproc; | 519 extern bool runtime·singleproc; |
516 extern uint32 runtime·panicking; | 520 extern uint32 runtime·panicking; |
517 extern int32 runtime·gcwaiting; // gc is waiting to run | 521 extern int32 runtime·gcwaiting; // gc is waiting to run |
518 int8* runtime·goos; | 522 int8* runtime·goos; |
519 int32 runtime·ncpu; | 523 int32 runtime·ncpu; |
520 extern bool runtime·iscgo; | 524 extern bool runtime·iscgo; |
521 extern void (*runtime·sysargs)(int32, uint8**); | 525 extern »void» (*runtime·sysargs)(int32, uint8**); |
| 526 extern» uint32» runtime·maxstring; |
522 | 527 |
523 /* | 528 /* |
524 * common functions and data | 529 * common functions and data |
525 */ | 530 */ |
526 int32 runtime·strcmp(byte*, byte*); | 531 int32 runtime·strcmp(byte*, byte*); |
527 byte* runtime·strstr(byte*, byte*); | 532 byte* runtime·strstr(byte*, byte*); |
528 int32 runtime·findnull(byte*); | 533 int32 runtime·findnull(byte*); |
529 int32 runtime·findnullw(uint16*); | 534 int32 runtime·findnullw(uint16*); |
530 void runtime·dump(byte*, int32); | 535 void runtime·dump(byte*, int32); |
531 int32 runtime·runetochar(byte*, int32); | 536 int32 runtime·runetochar(byte*, int32); |
(...skipping 15 matching lines...) Expand all Loading... |
547 void runtime·throw(int8*); | 552 void runtime·throw(int8*); |
548 void runtime·panicstring(int8*); | 553 void runtime·panicstring(int8*); |
549 void runtime·prints(int8*); | 554 void runtime·prints(int8*); |
550 void runtime·printf(int8*, ...); | 555 void runtime·printf(int8*, ...); |
551 byte* runtime·mchr(byte*, byte, byte*); | 556 byte* runtime·mchr(byte*, byte, byte*); |
552 int32 runtime·mcmp(byte*, byte*, uint32); | 557 int32 runtime·mcmp(byte*, byte*, uint32); |
553 void runtime·memmove(void*, void*, uint32); | 558 void runtime·memmove(void*, void*, uint32); |
554 void* runtime·mal(uintptr); | 559 void* runtime·mal(uintptr); |
555 String runtime·catstring(String, String); | 560 String runtime·catstring(String, String); |
556 String runtime·gostring(byte*); | 561 String runtime·gostring(byte*); |
557 String runtime·gostringn(byte*, int32); | 562 String runtime·gostringn(byte*, intgo); |
558 Slice» runtime·gobytes(byte*, int32); | 563 Slice» runtime·gobytes(byte*, intgo); |
559 String runtime·gostringnocopy(byte*); | 564 String runtime·gostringnocopy(byte*); |
560 String runtime·gostringw(uint16*); | 565 String runtime·gostringw(uint16*); |
561 void runtime·initsig(void); | 566 void runtime·initsig(void); |
562 void runtime·sigenable(uint32 sig); | 567 void runtime·sigenable(uint32 sig); |
563 int32 runtime·gotraceback(void); | 568 int32 runtime·gotraceback(void); |
564 void runtime·goroutineheader(G*); | 569 void runtime·goroutineheader(G*); |
565 void runtime·traceback(uint8 *pc, uint8 *sp, uint8 *lr, G* gp); | 570 void runtime·traceback(uint8 *pc, uint8 *sp, uint8 *lr, G* gp); |
566 void runtime·tracebackothers(G*); | 571 void runtime·tracebackothers(G*); |
567 int32 runtime·write(int32, void*, int32); | 572 int32 runtime·write(int32, void*, int32); |
568 int32 runtime·mincore(void*, uintptr, byte*); | 573 int32 runtime·mincore(void*, uintptr, byte*); |
(...skipping 27 matching lines...) Expand all Loading... |
596 void runtime·stackfree(void*, uintptr); | 601 void runtime·stackfree(void*, uintptr); |
597 MCache* runtime·allocmcache(void); | 602 MCache* runtime·allocmcache(void); |
598 void runtime·freemcache(MCache*); | 603 void runtime·freemcache(MCache*); |
599 void runtime·mallocinit(void); | 604 void runtime·mallocinit(void); |
600 bool runtime·ifaceeq_c(Iface, Iface); | 605 bool runtime·ifaceeq_c(Iface, Iface); |
601 bool runtime·efaceeq_c(Eface, Eface); | 606 bool runtime·efaceeq_c(Eface, Eface); |
602 uintptr runtime·ifacehash(Iface); | 607 uintptr runtime·ifacehash(Iface); |
603 uintptr runtime·efacehash(Eface); | 608 uintptr runtime·efacehash(Eface); |
604 void* runtime·malloc(uintptr size); | 609 void* runtime·malloc(uintptr size); |
605 void runtime·free(void *v); | 610 void runtime·free(void *v); |
606 bool» runtime·addfinalizer(void*, void(*fn)(void*), int32); | 611 bool» runtime·addfinalizer(void*, void(*fn)(void*), uintptr); |
607 void runtime·runpanic(Panic*); | 612 void runtime·runpanic(Panic*); |
608 void* runtime·getcallersp(void*); | 613 void* runtime·getcallersp(void*); |
609 int32 runtime·mcount(void); | 614 int32 runtime·mcount(void); |
610 int32 runtime·gcount(void); | 615 int32 runtime·gcount(void); |
611 void runtime·mcall(void(*)(G*)); | 616 void runtime·mcall(void(*)(G*)); |
612 uint32 runtime·fastrand1(void); | 617 uint32 runtime·fastrand1(void); |
613 | 618 |
614 void runtime·exit(int32); | 619 void runtime·exit(int32); |
615 void runtime·breakpoint(void); | 620 void runtime·breakpoint(void); |
616 void runtime·gosched(void); | 621 void runtime·gosched(void); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 void runtime·mapassign(MapType*, Hmap*, byte*, byte*); | 805 void runtime·mapassign(MapType*, Hmap*, byte*, byte*); |
801 void runtime·mapaccess(MapType*, Hmap*, byte*, byte*, bool*); | 806 void runtime·mapaccess(MapType*, Hmap*, byte*, byte*, bool*); |
802 void runtime·mapiternext(struct hash_iter*); | 807 void runtime·mapiternext(struct hash_iter*); |
803 bool runtime·mapiterkey(struct hash_iter*, void*); | 808 bool runtime·mapiterkey(struct hash_iter*, void*); |
804 void runtime·mapiterkeyvalue(struct hash_iter*, void*, void*); | 809 void runtime·mapiterkeyvalue(struct hash_iter*, void*, void*); |
805 Hmap* runtime·makemap_c(MapType*, int64); | 810 Hmap* runtime·makemap_c(MapType*, int64); |
806 | 811 |
807 Hchan* runtime·makechan_c(ChanType*, int64); | 812 Hchan* runtime·makechan_c(ChanType*, int64); |
808 void runtime·chansend(ChanType*, Hchan*, byte*, bool*); | 813 void runtime·chansend(ChanType*, Hchan*, byte*, bool*); |
809 void runtime·chanrecv(ChanType*, Hchan*, byte*, bool*, bool*); | 814 void runtime·chanrecv(ChanType*, Hchan*, byte*, bool*, bool*); |
810 int32 runtime·chanlen(Hchan*); | |
811 int32 runtime·chancap(Hchan*); | |
812 bool runtime·showframe(Func*); | 815 bool runtime·showframe(Func*); |
813 | 816 |
814 void runtime·ifaceE2I(struct InterfaceType*, Eface, Iface*); | 817 void runtime·ifaceE2I(struct InterfaceType*, Eface, Iface*); |
815 | 818 |
816 uintptr runtime·memlimit(void); | 819 uintptr runtime·memlimit(void); |
817 | 820 |
818 // If appropriate, ask the operating system to control whether this | 821 // If appropriate, ask the operating system to control whether this |
819 // thread should receive profiling signals. This is only necessary on OS X. | 822 // thread should receive profiling signals. This is only necessary on OS X. |
820 // An operating system should not deliver a profiling signal to a | 823 // An operating system should not deliver a profiling signal to a |
821 // thread that is not actually executing (what good is that?), but that's | 824 // thread that is not actually executing (what good is that?), but that's |
822 // what OS X prefers to do. When profiling is turned on, we mask | 825 // what OS X prefers to do. When profiling is turned on, we mask |
823 // away the profiling signal when threads go to sleep, so that OS X | 826 // away the profiling signal when threads go to sleep, so that OS X |
824 // is forced to deliver the signal to a thread that's actually running. | 827 // is forced to deliver the signal to a thread that's actually running. |
825 // This is a no-op on other systems. | 828 // This is a no-op on other systems. |
826 void runtime·setprof(bool); | 829 void runtime·setprof(bool); |
827 | 830 |
828 // float.c | 831 // float.c |
829 extern float64 runtime·nan; | 832 extern float64 runtime·nan; |
830 extern float64 runtime·posinf; | 833 extern float64 runtime·posinf; |
831 extern float64 runtime·neginf; | 834 extern float64 runtime·neginf; |
832 extern uint64 ·nan; | 835 extern uint64 ·nan; |
833 extern uint64 ·posinf; | 836 extern uint64 ·posinf; |
834 extern uint64 ·neginf; | 837 extern uint64 ·neginf; |
835 #define ISNAN(f) ((f) != (f)) | 838 #define ISNAN(f) ((f) != (f)) |
OLD | NEW |