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 #undef EXTERN | 5 #undef EXTERN |
6 #define EXTERN | 6 #define EXTERN |
7 #include <u.h> | 7 #include <u.h> |
8 #include <libc.h> | 8 #include <libc.h> |
9 #include "gg.h" | 9 #include "gg.h" |
10 #include "opt.h" | 10 #include "opt.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 * call f | 52 * call f |
53 * proc=0 normal call | 53 * proc=0 normal call |
54 * proc=1 goroutine run in new proc | 54 * proc=1 goroutine run in new proc |
55 * proc=2 defer call save away stack | 55 * proc=2 defer call save away stack |
56 */ | 56 */ |
57 void | 57 void |
58 ginscall(Node *f, int proc) | 58 ginscall(Node *f, int proc) |
59 { | 59 { |
60 Prog *p; | 60 Prog *p; |
61 Node reg, con; | 61 Node reg, con; |
| 62 Node r1; |
62 | 63 |
63 switch(proc) { | 64 switch(proc) { |
64 default: | 65 default: |
65 fatal("ginscall: bad proc %d", proc); | 66 fatal("ginscall: bad proc %d", proc); |
66 break; | 67 break; |
67 | 68 |
68 case 0: // normal call | 69 case 0: // normal call |
69 case -1: // normal call but no return | 70 case -1: // normal call but no return |
70 p = gins(ACALL, N, f); | 71 p = gins(ACALL, N, f); |
71 afunclit(&p->to); | 72 afunclit(&p->to); |
72 if(proc == -1 || noreturn(p)) | 73 if(proc == -1 || noreturn(p)) |
73 gins(AUNDEF, N, N); | 74 gins(AUNDEF, N, N); |
74 break; | 75 break; |
75 | 76 |
76 case 1: // call in new proc (go) | 77 case 1: // call in new proc (go) |
77 case 2: // deferred call (defer) | 78 case 2: // deferred call (defer) |
78 nodreg(®, types[TINT64], D_CX); | 79 nodreg(®, types[TINT64], D_CX); |
79 » » gins(APUSHQ, f, N); | 80 » » if (!debug['U']) |
| 81 » » » gins(APUSHQ, f, N); |
| 82 » » else { |
| 83 » » » regalloc(&r1, f->type, f); |
| 84 » » » gmove(f, &r1); |
| 85 » » » gins(APUSHQ, &r1, N); |
| 86 » » » regfree(&r1); |
| 87 » » } |
80 nodconst(&con, types[TINT32], argsize(f->type)); | 88 nodconst(&con, types[TINT32], argsize(f->type)); |
81 gins(APUSHQ, &con, N); | 89 gins(APUSHQ, &con, N); |
82 if(proc == 1) | 90 if(proc == 1) |
83 ginscall(newproc, 0); | 91 ginscall(newproc, 0); |
84 else { | 92 else { |
85 if(!hasdefer) | 93 if(!hasdefer) |
86 fatal("hasdefer=0 but has defer"); | 94 fatal("hasdefer=0 but has defer"); |
87 ginscall(deferproc, 0); | 95 ginscall(deferproc, 0); |
88 } | 96 } |
89 gins(APOPQ, N, ®); | 97 gins(APOPQ, N, ®); |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 gins(ASTOSB, N, N); // STOB AL,*(DI)+ | 946 gins(ASTOSB, N, N); // STOB AL,*(DI)+ |
939 } else | 947 } else |
940 while(c > 0) { | 948 while(c > 0) { |
941 gins(ASTOSB, N, N); // STOB AL,*(DI)+ | 949 gins(ASTOSB, N, N); // STOB AL,*(DI)+ |
942 c--; | 950 c--; |
943 } | 951 } |
944 | 952 |
945 restx(&n1, &oldn1); | 953 restx(&n1, &oldn1); |
946 restx(&ax, &oldax); | 954 restx(&ax, &oldax); |
947 } | 955 } |
OLD | NEW |