about summary refs log tree commit diff stats
path: root/031merge.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 /031merge.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 '031merge.cc')
-rw-r--r--031merge.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/031merge.cc b/031merge.cc
index c56579a5..99b6846a 100644
--- a/031merge.cc
+++ b/031merge.cc
@@ -114,7 +114,7 @@ Transform.push_back(check_merge_calls);  // idempotent
 :(code)
 void check_merge_calls(const recipe_ordinal r) {
   const recipe& caller = get(Recipe, r);
-  trace(9991, "transform") << "--- type-check merge instructions in recipe " << caller.name << end();
+  trace(101, "transform") << "--- type-check merge instructions in recipe " << caller.name << end();
   for (int i = 0;  i < SIZE(caller.steps);  ++i) {
     const instruction& inst = caller.steps.at(i);
     if (inst.name != "merge") continue;
@@ -145,7 +145,7 @@ void check_merge_call(const vector<reagent>& ingredients, const reagent& product
   state.data.push(merge_check_point(product, 0));
   while (true) {
     assert(!state.data.empty());
-    trace("transform") << ingredient_index << " vs " << SIZE(ingredients) << end();
+    trace(102, "transform") << ingredient_index << " vs " << SIZE(ingredients) << end();
     if (ingredient_index >= SIZE(ingredients)) {
       raise << maybe(caller.name) << "too few ingredients in '" << to_original_string(inst) << "'\n" << end();
       return;
@@ -161,7 +161,7 @@ void check_merge_call(const vector<reagent>& ingredients, const reagent& product
         if (state.data.top().container_element_index == 0 && types_coercible(container, inst.ingredients.at(ingredient_index)))
           return;
         const reagent& expected_ingredient = element_type(container.type, state.data.top().container_element_index);
-        trace("transform") << "checking container " << to_string(container) << " || " << to_string(expected_ingredient) << " vs ingredient " << ingredient_index << end();
+        trace(102, "transform") << "checking container " << to_string(container) << " || " << to_string(expected_ingredient) << " vs ingredient " << ingredient_index << end();
         // if the current element is the ingredient we expect, move on to the next element/ingredient
         if (types_coercible(expected_ingredient, ingredients.at(ingredient_index))) {
           ++ingredient_index;