aboutsummaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2014-09-21 15:49:47 -0400
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2014-09-21 15:49:47 -0400
commitb4d06df669e1eaf6c98cacb5c5f299bb5324e804 (patch)
tree50fb039c2cf280921e7650230cb42b0669e17f0b /profile.c
parent94e3f93395de538d73826e128281a3ea9591a5a9 (diff)
parent8b4e8f702df30b2b2238158504de5d8eb436958d (diff)
downloadegawk-b4d06df669e1eaf6c98cacb5c5f299bb5324e804.tar.gz
egawk-b4d06df669e1eaf6c98cacb5c5f299bb5324e804.tar.bz2
egawk-b4d06df669e1eaf6c98cacb5c5f299bb5324e804.zip
Merge 'master' into select
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 eae24b1c..d07bea4a 100644
--- a/profile.c
+++ b/profile.c
@@ -731,20 +731,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);