From bd7a19a59014c64a2c3e9c0b6af802b04991de6a Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 10 Feb 2016 10:27:27 -0800 Subject: 2644 More tweaking of traces as I debug recipe specialization. --- 057static_dispatch.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to '057static_dispatch.cc') diff --git a/057static_dispatch.cc b/057static_dispatch.cc index 93a2e36e..fcae37ee 100644 --- a/057static_dispatch.cc +++ b/057static_dispatch.cc @@ -30,6 +30,7 @@ for (map >::iterator p = Recipe_variants.begin(); } :(before "End Load Recipe Header(result)") +// there can only ever be one variant for main if (result.name != "main" && contains_key(Recipe_ordinal, result.name)) { const recipe_ordinal r = get(Recipe_ordinal, result.name); //? cerr << result.name << ": " << contains_key(Recipe, r) << (contains_key(Recipe, r) ? get(Recipe, r).has_header : 0) << matching_variant_name(result) << '\n'; @@ -41,6 +42,7 @@ if (result.name != "main" && contains_key(Recipe_ordinal, result.name)) { put(Recipe_ordinal, new_name, Next_recipe_ordinal++); get_or_insert(Recipe_variants, result.name).push_back(get(Recipe_ordinal, new_name)); } + trace(9999, "load") << "switching " << result.name << " to " << new_name << end(); result.name = new_name; //? cerr << "=> " << new_name << '\n'; } @@ -169,7 +171,7 @@ void resolve_ambiguous_calls(recipe_ordinal r) { } void replace_best_variant(instruction& inst, const recipe& caller_recipe) { - trace(9992, "transform") << "instruction " << inst.name << end(); + trace(9992, "transform") << "instruction " << inst.original_string << end(); vector& variants = get(Recipe_variants, inst.name); //? trace(9992, "transform") << "checking base: " << get(Recipe_ordinal, inst.name) << end(); long long int best_score = variant_score(inst, get(Recipe_ordinal, inst.name)); @@ -180,6 +182,7 @@ void replace_best_variant(instruction& inst, const recipe& caller_recipe) { long long int current_score = variant_score(inst, variants.at(i)); trace(9992, "transform") << "score for variant " << i << ": " << current_score << end(); if (current_score > best_score) { + trace(9993, "transform") << "switching " << inst.name << " to " << get(Recipe, variants.at(i)).name << end(); inst.name = get(Recipe, variants.at(i)).name; best_score = current_score; } @@ -456,10 +459,10 @@ string header_label(recipe_ordinal r) { ostringstream out; out << "recipe " << caller.name; for (long long int i = 0; i < SIZE(caller.ingredients); ++i) - out << ' ' << caller.ingredients.at(i).original_string; + out << ' ' << caller.ingredients.at(i).to_string(); if (!caller.products.empty()) out << " ->"; for (long long int i = 0; i < SIZE(caller.products); ++i) - out << ' ' << caller.products.at(i).original_string; + out << ' ' << caller.products.at(i).to_string(); return out.str(); } -- cgit 1.4.1-2-gfad0