LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2012 The Go Authors. All rights reserved. | 1 // Copyright 2012 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 // The racewalk pass modifies the code tree for the function as follows: | 5 // The racewalk pass modifies the code tree for the function as follows: |
6 // | 6 // |
7 // 1. It inserts a call to racefuncenter at the beginning of each function. | 7 // 1. It inserts a call to racefuncenter at the beginning of each function. |
8 // 2. It inserts a call to racefuncexit at the end of each function. | 8 // 2. It inserts a call to racefuncexit at the end of each function. |
9 // 3. It inserts a call to raceread before each memory read. | 9 // 3. It inserts a call to raceread before each memory read. |
10 // 4. It inserts a call to racewrite before each memory write. | 10 // 4. It inserts a call to racewrite before each memory write. |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 case ONONAME: | 412 case ONONAME: |
413 case OLITERAL: | 413 case OLITERAL: |
414 case OSLICESTR: // always preceded by bounds checking, avoid double ins
trumentation. | 414 case OSLICESTR: // always preceded by bounds checking, avoid double ins
trumentation. |
415 case OTYPESW: // ignored by code generation, do not instrument. | 415 case OTYPESW: // ignored by code generation, do not instrument. |
416 goto ret; | 416 goto ret; |
417 } | 417 } |
418 | 418 |
419 ret: | 419 ret: |
420 if(n->op != OBLOCK) // OBLOCK is handled above in a special way. | 420 if(n->op != OBLOCK) // OBLOCK is handled above in a special way. |
421 racewalklist(n->list, init); | 421 racewalklist(n->list, init); |
422 » racewalknode(&n->ntest, &n->ntest->ninit, 0, 0); | 422 » if(n->ntest != N) |
423 » racewalknode(&n->nincr, &n->nincr->ninit, 0, 0); | 423 » » racewalknode(&n->ntest, &n->ntest->ninit, 0, 0); |
| 424 » if(n->nincr != N) |
| 425 » » racewalknode(&n->nincr, &n->nincr->ninit, 0, 0); |
424 racewalklist(n->nbody, nil); | 426 racewalklist(n->nbody, nil); |
425 racewalklist(n->nelse, nil); | 427 racewalklist(n->nelse, nil); |
426 racewalklist(n->rlist, nil); | 428 racewalklist(n->rlist, nil); |
427 *np = n; | 429 *np = n; |
428 } | 430 } |
429 | 431 |
430 static int | 432 static int |
431 isartificial(Node *n) | 433 isartificial(Node *n) |
432 { | 434 { |
433 // compiler-emitted artificial things that we do not want to instrument, | 435 // compiler-emitted artificial things that we do not want to instrument, |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 n = nod(OCONVNOP, n, N); | 635 n = nod(OCONVNOP, n, N); |
634 n->type = n->left->type; | 636 n->type = n->left->type; |
635 n->typecheck = 1; | 637 n->typecheck = 1; |
636 *np = n; | 638 *np = n; |
637 break; | 639 break; |
638 } | 640 } |
639 n->ninit = concat(n->ninit, init); | 641 n->ninit = concat(n->ninit, init); |
640 n->ullman = UINF; | 642 n->ullman = UINF; |
641 } | 643 } |
642 | 644 |
LEFT | RIGHT |