about summary refs log tree commit diff stats
path: root/024jump.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-02-25 00:17:46 -0800
committerKartik Agaram <vc@akkartik.com>2019-02-25 01:50:53 -0800
commitc442a5ad806b6cccbb3ec4c5744b14b0c1f31a01 (patch)
tree318fb1d56e7ee3c750635d3326ad0739dfdacefe /024jump.cc
parente5998f74ac29bb4bf2aedfdd6fbea801ffdb08f6 (diff)
downloadmu-c442a5ad806b6cccbb3ec4c5744b14b0c1f31a01.tar.gz
4987 - support `browse_trace` tool in SubX
I've extracted it into a separate binary, independent of my Mu prototype.

I also cleaned up my tracing layer to be a little nicer. Major improvements:

- Realized that incremental tracing really ought to be the default.
  And to minimize printing traces to screen.

- Finally figured out how to combine layers and call stack frames in a
  single dimension of depth. The answer: optimize for the experience of
  `browse_trace`. Instructions occupy a range of depths based on their call
  stack frame, and minor details of an instruction lie one level deeper
  in each case.

Other than that, I spent some time adjusting levels everywhere to make
`browse_trace` useful.
Diffstat (limited to '024jump.cc')
-rw-r--r--024jump.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/024jump.cc b/024jump.cc
index 14c14297..5b95fd19 100644
--- a/024jump.cc
+++ b/024jump.cc
@@ -33,7 +33,7 @@ case JUMP: {
 case JUMP: {
   assert(current_instruction().ingredients.at(0).initialized);
   current_step_index() += ingredients.at(0).at(0)+1;
-  trace(9998, "run") << "jumping to instruction " << current_step_index() << end();
+  trace(Callstack_depth+1, "run") << "jumping to instruction " << current_step_index() << end();
   // skip rest of this instruction
   write_products = false;
   fall_through_to_next_instruction = false;
@@ -91,11 +91,11 @@ case JUMP_IF: {
 case JUMP_IF: {
   assert(current_instruction().ingredients.at(1).initialized);
   if (!scalar_ingredient(ingredients, 0)) {
-    trace(9998, "run") << "jump-if fell through" << end();
+    trace(Callstack_depth+1, "run") << "jump-if fell through" << end();
     break;
   }
   current_step_index() += ingredients.at(1).at(0)+1;
-  trace(9998, "run") << "jumping to instruction " << current_step_index() << end();
+  trace(Callstack_depth+1, "run") << "jumping to instruction " << current_step_index() << end();
   // skip rest of this instruction
   write_products = false;
   fall_through_to_next_instruction = false;
@@ -162,11 +162,11 @@ case JUMP_UNLESS: {
 case JUMP_UNLESS: {
   assert(current_instruction().ingredients.at(1).initialized);
   if (scalar_ingredient(ingredients, 0)) {
-    trace(9998, "run") << "jump-unless fell through" << end();
+    trace(Callstack_depth+1, "run") << "jump-unless fell through" << end();
     break;
   }
   current_step_index() += ingredients.at(1).at(0)+1;
-  trace(9998, "run") << "jumping to instruction " << current_step_index() << end();
+  trace(Callstack_depth+1, "run") << "jumping to instruction " << current_step_index() << end();
   // skip rest of this instruction
   write_products = false;
   fall_through_to_next_instruction = false;