aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2020-06-10 09:52:45 -0400
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2020-06-10 09:52:45 -0400
commita53ba84a4c0c8cfcc944d08aa30d062afc6df9a3 (patch)
tree9bd5879ea9ec4034eb1855c219358843c6c790ce
parentdff45aba93a56a50d5ad26c5ef1597abc1e2fe79 (diff)
downloadegawk-a53ba84a4c0c8cfcc944d08aa30d062afc6df9a3.tar.gz
egawk-a53ba84a4c0c8cfcc944d08aa30d062afc6df9a3.tar.bz2
egawk-a53ba84a4c0c8cfcc944d08aa30d062afc6df9a3.zip
Convert exec_count to unsigned long long.
-rw-r--r--ChangeLog9
-rw-r--r--awk.h2
-rw-r--r--debug.c2
-rw-r--r--doc/ChangeLog5
-rw-r--r--doc/bc_notes3
-rw-r--r--profile.c8
6 files changed, 22 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 8e1930d7..3b82e350 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2020-06-10 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ Convert exec_count from long long to unsigned long long.
+ * awk.h (INSTRUCTION): Change ldl type from long long to unsigned
+ long long.
+ * debug.c (print_instruction): Fix printf format for exec_count.
+ * profile.c (indent): The argument is now an unsigned long long,
+ and fix the printf format to match.
+
2020-06-10 Arnold D. Robbins <arnold@skeeve.com>
Thanks to Andrew Schorr for suggestion of better way to
diff --git a/awk.h b/awk.h
index 5ba6bb9f..283817a1 100644
--- a/awk.h
+++ b/awk.h
@@ -759,7 +759,7 @@ typedef struct exp_instruction {
awk_value_t *result,
struct awk_ext_func *finfo);
long dl;
- long long ldl; // for exec_count
+ unsigned long long ldl; // for exec_count
char *name;
} d;
diff --git a/debug.c b/debug.c
index e0822605..d53b9b8a 100644
--- a/debug.c
+++ b/debug.c
@@ -4074,7 +4074,7 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump)
break;
case Op_exec_count:
- print_func(fp, "[exec_count = %ld]\n", pc->exec_count);
+ print_func(fp, "[exec_count = %llu]\n", pc->exec_count);
break;
case Op_store_var:
diff --git a/doc/ChangeLog b/doc/ChangeLog
index b7d145e2..94f3e3d5 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2020-06-10 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * bc_notes: Add new field `unsigned long long ldl' to INSTRUCTION,
+ and update the definition of exec_count.
+
2020-06-09 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in (Implementation Limits): Update the table to be more
diff --git a/doc/bc_notes b/doc/bc_notes
index b548cec5..bca13a71 100644
--- a/doc/bc_notes
+++ b/doc/bc_notes
@@ -154,6 +154,7 @@ typedef struct exp_instruction {
struct exp_instruction *di;
NODE *(*fptr) P((int));
long dl;
+ unsigned long long ldl;
char *name;
} d;
@@ -251,7 +252,7 @@ typedef struct exp_instruction {
/*------------------ pretty printing/profiling --------*/
/* Op_exec_count */
-#define exec_count d.dl
+#define exec_count d.ldl
/* Op_K_while */
#define while_body d.di
diff --git a/profile.c b/profile.c
index e9c9053a..f959c228 100644
--- a/profile.c
+++ b/profile.c
@@ -135,7 +135,7 @@ init_profiling_signals()
/* indent --- print out enough tabs */
static void
-indent(long long count)
+indent(unsigned long long count)
{
int i;
@@ -143,7 +143,7 @@ indent(long long count)
if (count == 0)
fprintf(prof_fp, "\t");
else
- fprintf(prof_fp, "%6lld ", count);
+ fprintf(prof_fp, "%6llu ", count);
}
assert(indent_level >= 0);
@@ -297,7 +297,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, int flags)
ip2 = (pc + 1)->lasti;
if (do_profile && ip1->exec_count > 0)
- fprintf(prof_fp, " # %lld", ip1->exec_count);
+ fprintf(prof_fp, " # %llu", ip1->exec_count);
end_line(ip1);
skip_comment = true;
@@ -1043,7 +1043,7 @@ cleanup:
ip1 = pc->branch_if;
if (ip1->exec_count > 0)
- fprintf(prof_fp, " # %lld", ip1->exec_count);
+ fprintf(prof_fp, " # %llu", ip1->exec_count);
ip1 = end_line(ip1);
indent_in();
if (pc->comment != NULL)