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

Delta Between Two Patch Sets: src/cmd/dist/buildruntime.c

Issue 7221082: code review 7221082: cmd/dist: redirect acid output to file to separate from... (Closed)
Left Patch Set: diff -r 445186a20cee https://code.google.com/p/go/ Created 12 years, 1 month ago
Right Patch Set: diff -r 445186a20cee https://code.google.com/p/go/ Created 12 years, 1 month 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2012 The Go Authors. All rights reserved. 1 // Copyright 2012 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 #include "a.h" 5 #include "a.h"
6 6
7 /* 7 /*
8 * Helpers for building pkg/runtime. 8 * Helpers for building pkg/runtime.
9 */ 9 */
10 10
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 bwritestr(&out, "// auto generated by go tool dist\n\n"); 198 bwritestr(&out, "// auto generated by go tool dist\n\n");
199 for(i=0; i<nelem(zasmhdr); i++) { 199 for(i=0; i<nelem(zasmhdr); i++) {
200 if(hasprefix(goarch, zasmhdr[i].goarch) && hasprefix(goos, zasmh dr[i].goos)) { 200 if(hasprefix(goarch, zasmhdr[i].goarch) && hasprefix(goos, zasmh dr[i].goos)) {
201 bwritestr(&out, zasmhdr[i].hdr); 201 bwritestr(&out, zasmhdr[i].hdr);
202 goto ok; 202 goto ok;
203 } 203 }
204 } 204 }
205 fatal("unknown $GOOS/$GOARCH in mkzasm"); 205 fatal("unknown $GOOS/$GOARCH in mkzasm");
206 ok: 206 ok:
207 207
208 » // Run 6c -D GOOS_goos -D GOARCH_goarch -I workdir -a -o workdir/proc.ac id proc.c 208 » // Run 6c -D GOOS_goos -D GOARCH_goarch -I workdir -a -n -o workdir/proc .acid proc.c
209 // to get acid [sic] output. 209 // to get acid [sic] output.
210 vreset(&argv); 210 vreset(&argv);
211 vadd(&argv, bpathf(&b, "%s/%sc", tooldir, gochar)); 211 vadd(&argv, bpathf(&b, "%s/%sc", tooldir, gochar));
212 vadd(&argv, "-D"); 212 vadd(&argv, "-D");
213 vadd(&argv, bprintf(&b, "GOOS_%s", goos)); 213 vadd(&argv, bprintf(&b, "GOOS_%s", goos));
214 vadd(&argv, "-D"); 214 vadd(&argv, "-D");
215 vadd(&argv, bprintf(&b, "GOARCH_%s", goarch)); 215 vadd(&argv, bprintf(&b, "GOARCH_%s", goarch));
216 vadd(&argv, "-I"); 216 vadd(&argv, "-I");
217 vadd(&argv, bprintf(&b, "%s", workdir)); 217 vadd(&argv, bprintf(&b, "%s", workdir));
218 vadd(&argv, "-a");
219 vadd(&argv, "-n");
218 vadd(&argv, "-o"); 220 vadd(&argv, "-o");
219 vadd(&argv, bpathf(&b, "%s/proc.acid", workdir)); 221 vadd(&argv, bpathf(&b, "%s/proc.acid", workdir));
220 vadd(&argv, "-a");
221 vadd(&argv, "-n");
iant 2013/02/01 05:57:18 This -n option is not in the comment above.
222 vadd(&argv, "proc.c"); 222 vadd(&argv, "proc.c");
223 runv(nil, dir, CheckExit, &argv); 223 runv(nil, dir, CheckExit, &argv);
224 readfile(&in, bpathf(&b, "%s/proc.acid", workdir)); 224 readfile(&in, bpathf(&b, "%s/proc.acid", workdir));
225 ········ 225 ········
226 // Convert input like 226 // Convert input like
227 // aggr G 227 // aggr G
228 // { 228 // {
229 // Gobuf 24 sched; 229 // Gobuf 24 sched;
230 // 'Y' 48 stack0; 230 // 'Y' 48 stack0;
231 // } 231 // }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 // Mostly we just write the output of 6c -q to the file. 285 // Mostly we just write the output of 6c -q to the file.
286 // However, we run it on multiple files, so we have to delete 286 // However, we run it on multiple files, so we have to delete
287 // the duplicated definitions, and we don't care about the funcs 287 // the duplicated definitions, and we don't care about the funcs
288 // and consts, so we delete those too. 288 // and consts, so we delete those too.
289 //· 289 //·
290 void 290 void
291 mkzruntimedefs(char *dir, char *file) 291 mkzruntimedefs(char *dir, char *file)
292 { 292 {
293 int i, skip; 293 int i, skip;
294 char *p; 294 char *p;
295 » Buf in, b, out; 295 » Buf in, b, b1, out;
296 Vec argv, lines, fields, seen; 296 Vec argv, lines, fields, seen;
297 ········ 297 ········
298 binit(&in); 298 binit(&in);
299 binit(&b); 299 binit(&b);
300 binit(&b1);
300 binit(&out); 301 binit(&out);
301 vinit(&argv); 302 vinit(&argv);
302 vinit(&lines); 303 vinit(&lines);
303 vinit(&fields); 304 vinit(&fields);
304 vinit(&seen); 305 vinit(&seen);
305 ········ 306 ········
306 bwritestr(&out, "// auto generated by go tool dist\n" 307 bwritestr(&out, "// auto generated by go tool dist\n"
307 "\n" 308 "\n"
308 "package runtime\n" 309 "package runtime\n"
309 "import \"unsafe\"\n" 310 "import \"unsafe\"\n"
310 "var _ unsafe.Pointer\n" 311 "var _ unsafe.Pointer\n"
311 "\n" 312 "\n"
312 ); 313 );
313 314
314 ········ 315 ········
315 » // Run 6c -D GOOS_goos -D GOARCH_goarch -I workdir -q 316 » // Run 6c -D GOOS_goos -D GOARCH_goarch -I workdir -q -n -o workdir/runt imedefs
316 // on each of the runtimedefs C files. 317 // on each of the runtimedefs C files.
317 vadd(&argv, bpathf(&b, "%s/%sc", tooldir, gochar)); 318 vadd(&argv, bpathf(&b, "%s/%sc", tooldir, gochar));
318 vadd(&argv, "-D"); 319 vadd(&argv, "-D");
319 vadd(&argv, bprintf(&b, "GOOS_%s", goos)); 320 vadd(&argv, bprintf(&b, "GOOS_%s", goos));
320 vadd(&argv, "-D"); 321 vadd(&argv, "-D");
321 vadd(&argv, bprintf(&b, "GOARCH_%s", goarch)); 322 vadd(&argv, bprintf(&b, "GOARCH_%s", goarch));
322 vadd(&argv, "-I"); 323 vadd(&argv, "-I");
323 vadd(&argv, bprintf(&b, "%s", workdir)); 324 vadd(&argv, bprintf(&b, "%s", workdir));
324 vadd(&argv, "-q"); 325 vadd(&argv, "-q");
326 vadd(&argv, "-n");
327 vadd(&argv, "-o");
328 vadd(&argv, bpathf(&b, "%s/runtimedefs", workdir));
325 vadd(&argv, ""); 329 vadd(&argv, "");
326 p = argv.p[argv.len-1]; 330 p = argv.p[argv.len-1];
327 for(i=0; i<nelem(runtimedefs); i++) { 331 for(i=0; i<nelem(runtimedefs); i++) {
328 argv.p[argv.len-1] = runtimedefs[i]; 332 argv.p[argv.len-1] = runtimedefs[i];
329 » » runv(&b, dir, CheckExit, &argv); 333 » » runv(nil, dir, CheckExit, &argv);
334 » » readfile(&b, bpathf(&b1, "%s/runtimedefs", workdir));
330 bwriteb(&in, &b); 335 bwriteb(&in, &b);
331 } 336 }
332 argv.p[argv.len-1] = p; 337 argv.p[argv.len-1] = p;
333 ················ 338 ················
334 // Process the aggregate output. 339 // Process the aggregate output.
335 skip = 0; 340 skip = 0;
336 splitlines(&lines, bstr(&in)); 341 splitlines(&lines, bstr(&in));
337 for(i=0; i<lines.len; i++) { 342 for(i=0; i<lines.len; i++) {
338 p = lines.p[i]; 343 p = lines.p[i];
339 // Drop comment, func, and const lines. 344 // Drop comment, func, and const lines.
(...skipping 21 matching lines...) Expand all
361 continue; 366 continue;
362 } 367 }
363 ················ 368 ················
364 bwritestr(&out, p); 369 bwritestr(&out, p);
365 } 370 }
366 ········ 371 ········
367 writefile(&out, file, 0); 372 writefile(&out, file, 0);
368 373
369 bfree(&in); 374 bfree(&in);
370 bfree(&b); 375 bfree(&b);
376 bfree(&b1);
371 bfree(&out); 377 bfree(&out);
372 vfree(&argv); 378 vfree(&argv);
373 vfree(&lines); 379 vfree(&lines);
374 vfree(&fields); 380 vfree(&fields);
375 vfree(&seen); 381 vfree(&seen);
376 } 382 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

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