LEFT | RIGHT |
(no file at all) | |
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 <u.h> | 5 #include <u.h> |
6 #include <libc.h> | 6 #include <libc.h> |
7 #include "go.h" | 7 #include "go.h" |
8 #include "../../pkg/runtime/mgc0.h" | 8 #include "../../pkg/runtime/mgc0.h" |
9 | 9 |
10 /* | 10 /* |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 166 |
167 // link up fields | 167 // link up fields |
168 bucket->type = overflowfield; | 168 bucket->type = overflowfield; |
169 overflowfield->down = keysfield; | 169 overflowfield->down = keysfield; |
170 keysfield->down = valuesfield; | 170 keysfield->down = valuesfield; |
171 valuesfield->down = T; | 171 valuesfield->down = T; |
172 | 172 |
173 bucket->width = offset; | 173 bucket->width = offset; |
174 bucket->local = t->local; | 174 bucket->local = t->local; |
175 t->bucket = bucket; | 175 t->bucket = bucket; |
| 176 bucket->map = t; |
176 return bucket; | 177 return bucket; |
177 } | 178 } |
178 | 179 |
179 // Builds a type respresenting a Hmap structure for | 180 // Builds a type respresenting a Hmap structure for |
180 // the given map type. This type is not visible to users - | 181 // the given map type. This type is not visible to users - |
181 // we include only enough information to generate a correct GC | 182 // we include only enough information to generate a correct GC |
182 // program for it. | 183 // program for it. |
183 // Make sure this stays in sync with ../../pkg/runtime/hashmap.c! | 184 // Make sure this stays in sync with ../../pkg/runtime/hashmap.c! |
184 static Type* | 185 static Type* |
185 hmap(Type *t) | 186 hmap(Type *t) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 offset += widthptr; // nevacuate (last field in Hmap) | 223 offset += widthptr; // nevacuate (last field in Hmap) |
223 | 224 |
224 // link up fields | 225 // link up fields |
225 h->type = bucketsfield; | 226 h->type = bucketsfield; |
226 bucketsfield->down = oldbucketsfield; | 227 bucketsfield->down = oldbucketsfield; |
227 oldbucketsfield->down = T; | 228 oldbucketsfield->down = T; |
228 | 229 |
229 h->width = offset; | 230 h->width = offset; |
230 h->local = t->local; | 231 h->local = t->local; |
231 t->hmap = h; | 232 t->hmap = h; |
232 » h->hmap = t; | 233 » h->map = t; |
233 return h; | 234 return h; |
234 } | 235 } |
235 | 236 |
236 Type* | 237 Type* |
237 hiter(Type *t) | 238 hiter(Type *t) |
238 { | 239 { |
239 int32 n, off; | 240 int32 n, off; |
240 Type *field[7]; | 241 Type *field[7]; |
241 Type *i; | 242 Type *i; |
242 | 243 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 for(n = 0; n < 6; n++) { | 302 for(n = 0; n < 6; n++) { |
302 field[n]->down = field[n+1]; | 303 field[n]->down = field[n+1]; |
303 field[n]->width = off; | 304 field[n]->width = off; |
304 off += field[n]->type->width; | 305 off += field[n]->type->width; |
305 } | 306 } |
306 field[6]->down = T; | 307 field[6]->down = T; |
307 off += field[6]->type->width; | 308 off += field[6]->type->width; |
308 if(off != 11 * widthptr) | 309 if(off != 11 * widthptr) |
309 yyerror("hash_iter size not correct %d %d", off, 11 * widthptr); | 310 yyerror("hash_iter size not correct %d %d", off, 11 * widthptr); |
310 t->hiter = i; | 311 t->hiter = i; |
311 » i->hiter = t; | 312 » i->map = t; |
312 return i; | 313 return i; |
313 } | 314 } |
314 | 315 |
315 /* | 316 /* |
316 * f is method type, with receiver. | 317 * f is method type, with receiver. |
317 * return function type, receiver as first argument (or not). | 318 * return function type, receiver as first argument (or not). |
318 */ | 319 */ |
319 Type* | 320 Type* |
320 methodfunc(Type *f, Type *receiver) | 321 methodfunc(Type *f, Type *receiver) |
321 { | 322 { |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1465 ot = duintptr(s, ot, GC_END); | 1466 ot = duintptr(s, ot, GC_END); |
1466 ggloblsym(s, ot, 1, 1); | 1467 ggloblsym(s, ot, 1, 1); |
1467 | 1468 |
1468 if(t->align > 0) | 1469 if(t->align > 0) |
1469 off = rnd(off, t->align); | 1470 off = rnd(off, t->align); |
1470 if(off != t->width) | 1471 if(off != t->width) |
1471 fatal("dgcsym: off=%lld, size=%lld, type %T", off, t->width, t); | 1472 fatal("dgcsym: off=%lld, size=%lld, type %T", off, t->width, t); |
1472 | 1473 |
1473 return s; | 1474 return s; |
1474 } | 1475 } |
LEFT | RIGHT |