From c442a5ad806b6cccbb3ec4c5744b14b0c1f31a01 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 25 Feb 2019 00:17:46 -0800 Subject: 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. --- 033exclusive_container.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to '033exclusive_container.cc') diff --git a/033exclusive_container.cc b/033exclusive_container.cc index c2d69f60..5c57972e 100644 --- a/033exclusive_container.cc +++ b/033exclusive_container.cc @@ -150,19 +150,19 @@ case MAYBE_CONVERT: { write_products = false; if (tag == static_cast(get_or_insert(Memory, base_address))) { const reagent& variant = variant_type(base, tag); - trace("mem") << "storing 1 in location " << status.value << end(); + trace(Callstack_depth+1, "mem") << "storing 1 in location " << status.value << end(); put(Memory, status.value, 1); if (!is_dummy(product)) { // Write Memory in Successful MAYBE_CONVERT in Run for (int i = 0; i < size_of(variant); ++i) { double val = get_or_insert(Memory, base_address+/*skip tag*/1+i); - trace("mem") << "storing " << no_scientific(val) << " in location " << product.value+i << end(); + trace(Callstack_depth+1, "mem") << "storing " << no_scientific(val) << " in location " << product.value+i << end(); put(Memory, product.value+i, val); } } } else { - trace("mem") << "storing 0 in location " << status.value << end(); + trace(Callstack_depth+1, "mem") << "storing 0 in location " << status.value << end(); put(Memory, status.value, 0); } break; @@ -305,7 +305,7 @@ $error: 0 :(before "End check_merge_call Special-cases") case EXCLUSIVE_CONTAINER: { assert(state.data.top().container_element_index == 0); - trace("transform") << "checking exclusive container " << to_string(container) << " vs ingredient " << ingredient_index << end(); + trace(102, "transform") << "checking exclusive container " << to_string(container) << " vs ingredient " << ingredient_index << end(); // easy case: exact match if (types_strictly_match(container, inst.ingredients.at(ingredient_index))) return; @@ -320,7 +320,7 @@ case EXCLUSIVE_CONTAINER: { return; } const reagent& variant = variant_type(container, ingredient.value); - trace("transform") << "tag: " << ingredient.value << end(); + trace(102, "transform") << "tag: " << ingredient.value << end(); // replace union with its variant state.data.pop(); state.data.push(merge_check_point(variant, 0)); -- cgit 1.4.1-2-gfad0