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

Delta Between Two Patch Sets: src/cmd/6g/gsubr.c

Issue 6922048: code review 6922048: cmd/{5,6,8}g: reduce size of Prog and Addr (Closed)
Left Patch Set: diff -r ec3ae5b98922 https://code.google.com/p/go Created 12 years, 3 months ago
Right Patch Set: diff -r 8ea9d438b64e https://go.googlecode.com/hg/ Created 12 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/cmd/6g/gobj.c ('k') | src/cmd/6g/list.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Derived from Inferno utils/6c/txt.c 1 // Derived from Inferno utils/6c/txt.c
2 // http://code.google.com/p/inferno-os/source/browse/utils/6c/txt.c 2 // http://code.google.com/p/inferno-os/source/browse/utils/6c/txt.c
3 // 3 //
4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. 4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
5 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) 5 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net)
6 // Portions Copyright © 1997-1999 Vita Nuova Limited 6 // Portions Copyright © 1997-1999 Vita Nuova Limited
7 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov a.com) 7 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov a.com)
8 // Portions Copyright © 2004,2006 Bruce Ellis 8 // Portions Copyright © 2004,2006 Bruce Ellis
9 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) 9 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net)
10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others 10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 */ 110 */
111 Prog* 111 Prog*
112 gbranch(int as, Type *t, int likely) 112 gbranch(int as, Type *t, int likely)
113 { 113 {
114 Prog *p; 114 Prog *p;
115 ········ 115 ········
116 USED(t); 116 USED(t);
117 117
118 p = prog(as); 118 p = prog(as);
119 p->to.type = D_BRANCH; 119 p->to.type = D_BRANCH;
120 » p->to.branch = P; 120 » p->to.u.branch = P;
121 if(as != AJMP && likely != 0) { 121 if(as != AJMP && likely != 0) {
122 p->from.type = D_CONST; 122 p->from.type = D_CONST;
123 p->from.offset = likely > 0; 123 p->from.offset = likely > 0;
124 } 124 }
125 return p; 125 return p;
126 } 126 }
127 127
128 /* 128 /*
129 * patch previous branch to jump to to. 129 * patch previous branch to jump to to.
130 */ 130 */
131 void 131 void
132 patch(Prog *p, Prog *to) 132 patch(Prog *p, Prog *to)
133 { 133 {
134 if(p->to.type != D_BRANCH) 134 if(p->to.type != D_BRANCH)
135 fatal("patch: not a branch"); 135 fatal("patch: not a branch");
136 » p->to.branch = to; 136 » p->to.u.branch = to;
137 p->to.offset = to->loc; 137 p->to.offset = to->loc;
138 } 138 }
139 139
140 Prog* 140 Prog*
141 unpatch(Prog *p) 141 unpatch(Prog *p)
142 { 142 {
143 Prog *q; 143 Prog *q;
144 144
145 if(p->to.type != D_BRANCH) 145 if(p->to.type != D_BRANCH)
146 fatal("unpatch: not a branch"); 146 fatal("unpatch: not a branch");
147 » q = p->to.branch; 147 » q = p->to.u.branch;
148 » p->to.branch = P; 148 » p->to.u.branch = P;
149 p->to.offset = 0; 149 p->to.offset = 0;
150 return q; 150 return q;
151 } 151 }
152 152
153 /* 153 /*
154 * start a new Prog list. 154 * start a new Prog list.
155 */ 155 */
156 Plist* 156 Plist*
157 newplist(void) 157 newplist(void)
158 { 158 {
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 } 1195 }
1196 break; 1196 break;
1197 1197
1198 case OLITERAL: 1198 case OLITERAL:
1199 switch(n->val.ctype) { 1199 switch(n->val.ctype) {
1200 default: 1200 default:
1201 fatal("naddr: const %lT", n->type); 1201 fatal("naddr: const %lT", n->type);
1202 break; 1202 break;
1203 case CTFLT: 1203 case CTFLT:
1204 a->type = D_FCONST; 1204 a->type = D_FCONST;
1205 » » » a->dval = mpgetflt(n->val.u.fval); 1205 » » » a->u.dval = mpgetflt(n->val.u.fval);
1206 break; 1206 break;
1207 case CTINT: 1207 case CTINT:
1208 case CTRUNE: 1208 case CTRUNE:
1209 a->sym = S; 1209 a->sym = S;
1210 a->type = D_CONST; 1210 a->type = D_CONST;
1211 a->offset = mpgetfix(n->val.u.xval); 1211 a->offset = mpgetfix(n->val.u.xval);
1212 break; 1212 break;
1213 case CTSTR: 1213 case CTSTR:
1214 datagostring(n->val.u.sval, a); 1214 datagostring(n->val.u.sval, a);
1215 break; 1215 break;
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
2249 naddr(&n2, a, 1); 2249 naddr(&n2, a, 1);
2250 goto yes; 2250 goto yes;
2251 2251
2252 yes: 2252 yes:
2253 return 1; 2253 return 1;
2254 2254
2255 no: 2255 no:
2256 sudoclean(); 2256 sudoclean();
2257 return 0; 2257 return 0;
2258 } 2258 }
LEFTRIGHT

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