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 | 6 |
7 import "unsafe" | 7 import "unsafe" |
8 | 8 |
9 // Declarations for runtime services implemented in C or assembly. | 9 // Declarations for runtime services implemented in C or assembly. |
10 // C implementations of these functions are in stubs.goc. | 10 // C implementations of these functions are in stubs.goc. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // m->ptrarg[x]. Return values can be passed in those | 61 // m->ptrarg[x]. Return values can be passed in those |
62 // same slots. | 62 // same slots. |
63 var ( | 63 var ( |
64 mcacheRefill_m, | 64 mcacheRefill_m, |
65 largeAlloc_m, | 65 largeAlloc_m, |
66 mprofMalloc_m, | 66 mprofMalloc_m, |
67 gc_m, | 67 gc_m, |
68 setFinalizer_m, | 68 setFinalizer_m, |
69 markallocated_m, | 69 markallocated_m, |
70 unrollgcprog_m, | 70 unrollgcprog_m, |
71 » unrollgcproginplace_m mFunction | 71 » unrollgcproginplace_m, |
| 72 » gosched_m mFunction |
72 ) | 73 ) |
73 | 74 |
74 // memclr clears n bytes starting at ptr. | 75 // memclr clears n bytes starting at ptr. |
75 // in memclr_*.s | 76 // in memclr_*.s |
76 //go:noescape | 77 //go:noescape |
77 func memclr(ptr unsafe.Pointer, n uintptr) | 78 func memclr(ptr unsafe.Pointer, n uintptr) |
78 | 79 |
79 func racemalloc(p unsafe.Pointer, size uintptr) | 80 func racemalloc(p unsafe.Pointer, size uintptr) |
80 func tracealloc(p unsafe.Pointer, size uintptr, typ *_type) | 81 func tracealloc(p unsafe.Pointer, size uintptr, typ *_type) |
81 | 82 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // compiles down to a single xor instruction. | 156 // compiles down to a single xor instruction. |
156 // USE CAREFULLY! | 157 // USE CAREFULLY! |
157 func noescape(p unsafe.Pointer) unsafe.Pointer { | 158 func noescape(p unsafe.Pointer) unsafe.Pointer { |
158 x := uintptr(p) | 159 x := uintptr(p) |
159 return unsafe.Pointer(x ^ 0) | 160 return unsafe.Pointer(x ^ 0) |
160 } | 161 } |
161 | 162 |
162 // gopersistentalloc allocates a permanent (not garbage collected) | 163 // gopersistentalloc allocates a permanent (not garbage collected) |
163 // memory region of size n. Use wisely! | 164 // memory region of size n. Use wisely! |
164 func gopersistentalloc(n uintptr) unsafe.Pointer | 165 func gopersistentalloc(n uintptr) unsafe.Pointer |
OLD | NEW |