OLD | NEW |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 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 // "Portable" code generation. | 5 // "Portable" code generation. |
6 // Compiled separately for 5g, 6g, and 8g, so allowed to use gg.h, opt.h. | 6 // Compiled separately for 5g, 6g, and 8g, so allowed to use gg.h, opt.h. |
7 // Must code to the intersection of the three back ends. | 7 // Must code to the intersection of the three back ends. |
8 | 8 |
9 #include <u.h> | 9 #include <u.h> |
10 #include <libc.h> | 10 #include <libc.h> |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 pl->name = linksym(curfn->nname->sym); | 185 pl->name = linksym(curfn->nname->sym); |
186 | 186 |
187 setlineno(curfn); | 187 setlineno(curfn); |
188 | 188 |
189 nodconst(&nod1, types[TINT32], 0); | 189 nodconst(&nod1, types[TINT32], 0); |
190 ptxt = gins(ATEXT, isblank(curfn->nname) ? N : curfn->nname, &nod1); | 190 ptxt = gins(ATEXT, isblank(curfn->nname) ? N : curfn->nname, &nod1); |
191 if(fn->dupok) | 191 if(fn->dupok) |
192 ptxt->TEXTFLAG |= DUPOK; | 192 ptxt->TEXTFLAG |= DUPOK; |
193 if(fn->wrapper) | 193 if(fn->wrapper) |
194 ptxt->TEXTFLAG |= WRAPPER; | 194 ptxt->TEXTFLAG |= WRAPPER; |
| 195 if(fn->needctxt) |
| 196 ptxt->TEXTFLAG |= NEEDCTXT; |
195 | 197 |
196 // Clumsy but important. | 198 // Clumsy but important. |
197 // See test/recover.go for test cases and src/pkg/reflect/value.go | 199 // See test/recover.go for test cases and src/pkg/reflect/value.go |
198 // for the actual functions being considered. | 200 // for the actual functions being considered. |
199 if(myimportpath != nil && strcmp(myimportpath, "reflect") == 0) { | 201 if(myimportpath != nil && strcmp(myimportpath, "reflect") == 0) { |
200 if(strcmp(curfn->nname->sym->name, "callReflect") == 0 || strcmp
(curfn->nname->sym->name, "callMethod") == 0) | 202 if(strcmp(curfn->nname->sym->name, "callReflect") == 0 || strcmp
(curfn->nname->sym->name, "callMethod") == 0) |
201 ptxt->TEXTFLAG |= WRAPPER; | 203 ptxt->TEXTFLAG |= WRAPPER; |
202 }······· | 204 }······· |
203 ········ | 205 ········ |
204 afunclit(&ptxt->from, curfn->nname); | 206 afunclit(&ptxt->from, curfn->nname); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 } | 480 } |
479 if((thechar == '5' && n->op != OREGISTER) || !n->addable || n->op == OLI
TERAL) { | 481 if((thechar == '5' && n->op != OREGISTER) || !n->addable || n->op == OLI
TERAL) { |
480 regalloc(®, types[tptr], n); | 482 regalloc(®, types[tptr], n); |
481 cgen(n, ®); | 483 cgen(n, ®); |
482 gins(ACHECKNIL, ®, N); | 484 gins(ACHECKNIL, ®, N); |
483 regfree(®); | 485 regfree(®); |
484 return; | 486 return; |
485 } | 487 } |
486 gins(ACHECKNIL, n, N); | 488 gins(ACHECKNIL, n, N); |
487 } | 489 } |
OLD | NEW |