Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1730)

Unified Diff: src/cmd/5g/cgen.c

Issue 6586072: cmd/5g: fix out of registers in nested calls, add compi... (Closed)
Patch Set: diff -r c6f9c0f01c09 https://go.googlecode.com/hg/ Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/torture.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cmd/5g/cgen.c
===================================================================
--- a/src/cmd/5g/cgen.c
+++ b/src/cmd/5g/cgen.c
@@ -16,7 +16,7 @@
{
Node *nl, *nr, *r;
Node n1, n2, n3, f0, f1;
- int a, w;
+ int a, w, rg;
Prog *p1, *p2, *p3;
Addr addr;
@@ -406,7 +406,22 @@
break;
case OCALLMETH:
- cgen_callmeth(n, 0);
+ case OCALLFUNC:
+ // Release res so that it is available for cgen_call.
+ // Pick it up again after the call.
+ rg = -1;
+ if(n->ullman >= UINF) {
+ if(res->op == OREGISTER || res->op == OINDREG) {
+ rg = res->val.u.reg;
+ reg[rg]--;
+ }
+ }
+ if(n->op == OCALLMETH)
+ cgen_callmeth(n, 0);
+ else
+ cgen_call(n, 0);
+ if(rg >= 0)
+ reg[rg]++;
cgen_callret(n, res);
break;
@@ -415,11 +430,6 @@
cgen_callret(n, res);
break;
- case OCALLFUNC:
- cgen_call(n, 0);
- cgen_callret(n, res);
- break;
-
case OMOD:
case ODIV:
a = optoas(n->op, nl->type);
« no previous file with comments | « no previous file | test/torture.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b