OLD | NEW |
1 // Copyright 2014 The Go Authors. All rights reserved. | 1 // Copyright 2014 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 package runtime | 5 package runtime |
6 #include "runtime.h" | 6 #include "runtime.h" |
7 #include "arch_GOARCH.h" | 7 #include "arch_GOARCH.h" |
8 #include "malloc.h" | 8 #include "malloc.h" |
9 #include "stack.h" | 9 #include "stack.h" |
10 #include "../../cmd/ld/textflag.h" | 10 #include "../../cmd/ld/textflag.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #pragma textflag NOSPLIT | 26 #pragma textflag NOSPLIT |
27 func golock(p *Lock) { | 27 func golock(p *Lock) { |
28 runtime·lock(p); | 28 runtime·lock(p); |
29 } | 29 } |
30 #pragma textflag NOSPLIT | 30 #pragma textflag NOSPLIT |
31 func gounlock(p *Lock) { | 31 func gounlock(p *Lock) { |
32 runtime·unlock(p); | 32 runtime·unlock(p); |
33 } | 33 } |
34 | 34 |
35 #pragma textflag NOSPLIT | |
36 func goreadgogc() (r int32) { | |
37 r = runtime·readgogc(); | |
38 } | |
39 | |
40 // entry point for testing | 35 // entry point for testing |
41 // TODO: mcall and run on M stack | 36 // TODO: mcall and run on M stack |
42 func gostringW(str Slice) (s String) { | 37 func gostringW(str Slice) (s String) { |
43 s = runtime·gostringw((uint16*)str.array); | 38 s = runtime·gostringw((uint16*)str.array); |
44 } | 39 } |
45 | 40 |
46 #pragma textflag NOSPLIT | 41 #pragma textflag NOSPLIT |
47 func gonanotime() (r int64) { | |
48 r = runtime·nanotime(); | |
49 } | |
50 | |
51 #pragma textflag NOSPLIT | |
52 func goatomicload(p *uint32) (v uint32) { | |
53 v = runtime·atomicload(p); | |
54 } | |
55 | |
56 #pragma textflag NOSPLIT | |
57 func goatomicloadp(p **byte) (v *byte) { | |
58 v = runtime·atomicloadp(p); | |
59 } | |
60 | |
61 #pragma textflag NOSPLIT | |
62 func goatomicstore(p *uint32, v uint32) { | |
63 runtime·atomicstore(p, v); | |
64 } | |
65 | |
66 #pragma textflag NOSPLIT | |
67 func goatomicstorep(p **byte, v *byte) { | |
68 runtime·atomicstorep(p, v); | |
69 } | |
70 | |
71 #pragma textflag NOSPLIT | |
72 func runtime·goxadd(p *uint32, x uint32) (ret uint32) { | |
73 ret = runtime·xadd(p, x); | |
74 } | |
75 | |
76 #pragma textflag NOSPLIT | |
77 func runtime·gocas(p *uint32, x uint32, y uint32) (ret bool) { | |
78 ret = runtime·cas(p, x, y); | |
79 } | |
80 | |
81 #pragma textflag NOSPLIT | |
82 func runtime·gocasx(p *uintptr, x uintptr, y uintptr) (ret bool) { | |
83 ret = runtime·casp((void**)p, (void*)x, (void*)y); | |
84 } | |
85 | |
86 #pragma textflag NOSPLIT | |
87 func runtime·getg() (ret *G) { | 42 func runtime·getg() (ret *G) { |
88 ret = g; | 43 ret = g; |
89 } | 44 } |
90 | 45 |
91 #pragma textflag NOSPLIT | 46 #pragma textflag NOSPLIT |
92 func runtime·acquirem() (ret *M) { | 47 func runtime·acquirem() (ret *M) { |
93 ret = g->m; | 48 ret = g->m; |
94 ret->locks++; | 49 ret->locks++; |
95 } | 50 } |
96 | 51 |
(...skipping 12 matching lines...) Expand all Loading... |
109 } | 64 } |
110 | 65 |
111 // For testing. | 66 // For testing. |
112 // TODO: find a better place for this. | 67 // TODO: find a better place for this. |
113 func GCMask(x Eface) (mask Slice) { | 68 func GCMask(x Eface) (mask Slice) { |
114 runtime·getgcmask(x.data, x.type, &mask.array, &mask.len); | 69 runtime·getgcmask(x.data, x.type, &mask.array, &mask.len); |
115 mask.cap = mask.len; | 70 mask.cap = mask.len; |
116 } | 71 } |
117 | 72 |
118 #pragma textflag NOSPLIT | 73 #pragma textflag NOSPLIT |
119 func gopersistentalloc(size uintptr) (x *void) { | |
120 // TODO: used only for itabs for now. Need to make &mstats.other_sys ar
g parameterized. | |
121 x = runtime·persistentalloc(size, 0, &mstats.other_sys); | |
122 } | |
123 | |
124 #pragma textflag NOSPLIT | |
125 func reflect·typelinks() (ret Slice) { | 74 func reflect·typelinks() (ret Slice) { |
126 extern Type *runtime·typelink[], *runtime·etypelink[]; | 75 extern Type *runtime·typelink[], *runtime·etypelink[]; |
127 ret.array = (byte*)runtime·typelink; | 76 ret.array = (byte*)runtime·typelink; |
128 ret.len = runtime·etypelink - runtime·typelink; | 77 ret.len = runtime·etypelink - runtime·typelink; |
129 ret.cap = ret.len; | 78 ret.cap = ret.len; |
130 } | 79 } |
OLD | NEW |