aboutsummaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-09-10 08:18:21 +0300
committerArnold D. Robbins <arnold@skeeve.com>2014-09-10 08:18:21 +0300
commit6de0102373304c0fdf70a7ddeb17dd1caa3a9b23 (patch)
tree7a8f3f18180e0b84893a4cccd883c80ffb7d9bc0 /profile.c
parentd7c8dfd41bd5671ddfa6c81b2ef1779cab06e56b (diff)
parentca9f23d6c33c4b5cb3786d480948a42988ca99ac (diff)
downloadegawk-6de0102373304c0fdf70a7ddeb17dd1caa3a9b23.tar.gz
egawk-6de0102373304c0fdf70a7ddeb17dd1caa3a9b23.tar.bz2
egawk-6de0102373304c0fdf70a7ddeb17dd1caa3a9b23.zip
Merge branch 'master' into comment
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/profile.c b/profile.c
index e2211e1b..3c4c9181 100644
--- a/profile.c
+++ b/profile.c
@@ -755,20 +755,28 @@ cleanup:
ip = pc + 1;
indent(ip->forloop_body->exec_count);
fprintf(prof_fp, "%s (", op2str(pc->opcode));
- pprint(pc->nexti, ip->forloop_cond, true);
- fprintf(prof_fp, "; ");
- if (ip->forloop_cond->opcode == Op_no_op &&
- ip->forloop_cond->nexti == ip->forloop_body)
+ /* If empty for looop header, print it a little more nicely. */
+ if ( pc->nexti->opcode == Op_no_op
+ && ip->forloop_cond == pc->nexti
+ && pc->target_continue->opcode == Op_jmp) {
+ fprintf(prof_fp, ";;");
+ } else {
+ pprint(pc->nexti, ip->forloop_cond, true);
fprintf(prof_fp, "; ");
- else {
- pprint(ip->forloop_cond, ip->forloop_body, true);
- t1 = pp_pop();
- fprintf(prof_fp, "%s; ", t1->pp_str);
- pp_free(t1);
- }
- pprint(pc->target_continue, pc->target_break, true);
+ if (ip->forloop_cond->opcode == Op_no_op &&
+ ip->forloop_cond->nexti == ip->forloop_body)
+ fprintf(prof_fp, "; ");
+ else {
+ pprint(ip->forloop_cond, ip->forloop_body, true);
+ t1 = pp_pop();
+ fprintf(prof_fp, "%s; ", t1->pp_str);
+ pp_free(t1);
+ }
+
+ pprint(pc->target_continue, pc->target_break, true);
+ }
fprintf(prof_fp, ") {\n");
indent_in();
pprint(ip->forloop_body->nexti, pc->target_continue, false);