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

Side by Side Diff: src/cmd/6g/gsubr.c

Issue 5966075: code review 5966075: cmd/gc: inline slice[arr,str] in the frontend (mostly). (Closed)
Patch Set: diff -r 316890203045 https://go.googlecode.com/hg/ Created 12 years, 11 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:
View unified diff | Download patch
OLDNEW
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 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 w = 8; 1050 w = 8;
1051 break; 1051 break;
1052 } 1052 }
1053 if(w != 0 && f != N && (af.width > w || at.width > w)) { 1053 if(w != 0 && f != N && (af.width > w || at.width > w)) {
1054 fatal("bad width: %P (%d, %d)\n", p, af.width, at.width); 1054 fatal("bad width: %P (%d, %d)\n", p, af.width, at.width);
1055 } 1055 }
1056 1056
1057 return p; 1057 return p;
1058 } 1058 }
1059 1059
1060 // Generate an instruction referencing *n
1061 // to force segv on nil pointer dereference.
1062 void
1063 checkref(Node *n)
1064 {
1065 Node m;
1066
1067 if(n->type->type->width < unmappedzero)
1068 return;
1069
1070 regalloc(&m, types[TUINTPTR], n);
1071 cgen(n, &m);
1072 m.xoffset = 0;
1073 m.op = OINDREG;
1074 m.type = types[TUINT8];
1075 gins(ATESTB, nodintconst(0), &m);
1076 regfree(&m);
1077 }
1078
1060 static void 1079 static void
1061 checkoffset(Addr *a, int canemitcode) 1080 checkoffset(Addr *a, int canemitcode)
1062 { 1081 {
1063 Prog *p; 1082 Prog *p;
1064 1083
1065 if(a->offset < unmappedzero) 1084 if(a->offset < unmappedzero)
1066 return; 1085 return;
1067 if(!canemitcode) 1086 if(!canemitcode)
1068 fatal("checkoffset %#llx, cannot emit code", a->offset); 1087 fatal("checkoffset %#llx, cannot emit code", a->offset);
1069 1088
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
2210 naddr(&n2, a, 1); 2229 naddr(&n2, a, 1);
2211 goto yes; 2230 goto yes;
2212 2231
2213 yes: 2232 yes:
2214 return 1; 2233 return 1;
2215 2234
2216 no: 2235 no:
2217 sudoclean(); 2236 sudoclean();
2218 return 0; 2237 return 0;
2219 } 2238 }
OLDNEW

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