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 #include "runtime.h" | 5 #include "runtime.h" |
6 #include "arch_GOARCH.h" | 6 #include "arch_GOARCH.h" |
7 #include "malloc.h" | 7 #include "malloc.h" |
8 #include "race.h" | 8 #include "race.h" |
9 #include "../../cmd/ld/textflag.h" | 9 #include "textflag.h" |
10 | 10 |
11 String runtime·emptystring; | 11 String runtime·emptystring; |
12 | 12 |
13 #pragma textflag NOSPLIT | 13 #pragma textflag NOSPLIT |
14 intgo | 14 intgo |
15 runtime·findnull(byte *s) | 15 runtime·findnull(byte *s) |
16 { | 16 { |
17 intgo l; | 17 intgo l; |
18 | 18 |
19 if(s == nil) | 19 if(s == nil) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 { | 83 { |
84 Slice sl; | 84 Slice sl; |
85 | 85 |
86 sl.array = runtime·mallocgc(n, 0, FlagNoScan|FlagNoZero); | 86 sl.array = runtime·mallocgc(n, 0, FlagNoScan|FlagNoZero); |
87 sl.len = n; | 87 sl.len = n; |
88 sl.cap = n; | 88 sl.cap = n; |
89 runtime·memmove(sl.array, p, n); | 89 runtime·memmove(sl.array, p, n); |
90 return sl; | 90 return sl; |
91 } | 91 } |
92 | 92 |
| 93 #pragma textflag NOSPLIT |
93 String | 94 String |
94 runtime·gostringnocopy(byte *str) | 95 runtime·gostringnocopy(byte *str) |
95 { | 96 { |
96 String s; | 97 String s; |
97 ········ | 98 ········ |
98 s.str = str; | 99 s.str = str; |
99 s.len = runtime·findnull(str); | 100 s.len = runtime·findnull(str); |
100 return s; | 101 return s; |
101 } | 102 } |
102 | 103 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 sp2 = s2; | 279 sp2 = s2; |
279 for(;;) { | 280 for(;;) { |
280 if(*sp2 == 0) | 281 if(*sp2 == 0) |
281 return s1; | 282 return s1; |
282 if(*sp1++ != *sp2++) | 283 if(*sp1++ != *sp2++) |
283 break; | 284 break; |
284 } | 285 } |
285 } | 286 } |
286 return nil; | 287 return nil; |
287 } | 288 } |
OLD | NEW |