From d990e8f07aee36f68bcd270889d20c2d22b9aa0b Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 17 Aug 2016 19:04:35 -0700 Subject: 3219 Trying keeping html in the master branch: https://github.com/blog/2228-simpler-github-pages-publishing Let's see if https://akkartik.github.io/mu updates after I push this commit to just the master branch. --- html/043space.cc.html | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'html/043space.cc.html') diff --git a/html/043space.cc.html b/html/043space.cc.html index 22f7f869..e04b8cfc 100644 --- a/html/043space.cc.html +++ b/html/043space.cc.html @@ -91,9 +91,8 @@ absolutize(x); void absolutize(reagent& x) { if (is_raw(x) || is_dummy(x)) return; if (x.name == "default-space") return; - if (!x.initialized) { + if (!x.initialized) raise << to_original_string(current_instruction()) << ": reagent not initialized: '" << x.original_string << "'\n" << end(); - } x.set_value(address(x.value, space_base(x))); x.properties.push_back(pair<string, string_tree*>("raw", NULL)); assert(is_raw(x)); @@ -277,13 +276,13 @@ try_reclaim_locals(); const instruction& inst = exiting_recipe.steps.at(i); for (int i = 0; i < SIZE(inst.products); ++i) { // local variables only - if (has_property(inst.products.at(i), "space")) continue; if (has_property(inst.products.at(i), "lookup")) continue; if (has_property(inst.products.at(i), "raw")) continue; // tests often want to check such locations after they run if (escaping(inst.products.at(i))) continue; + // End Checks For Reclaiming Locals trace(9999, "mem") << "clearing " << inst.products.at(i).original_string << end(); zeros.resize(size_of(inst.products.at(i))); - write_memory(inst.products.at(i), zeros, /*always update refcounts*/-1); + write_memory(inst.products.at(i), zeros); } } trace(9999, "mem") << "automatically abandoning " << current_call().default_space << end(); @@ -292,23 +291,6 @@ try_reclaim_locals(); /*refcount*/1 + /*array length*/1 + /*number-of-locals*/Name[r][""]); } -//: since we don't decrement refcounts for escaping values above, make sure we -//: don't increment them when the caller saves them either - -:(replace{} "bool should_update_refcounts_in_write_memory(int product_index)") -bool should_update_refcounts_in_write_memory(int product_index) { - assert(Current_routine); // run-time only - if (product_index == -1) return true; - assert(product_index >= 0); - const instruction& inst = current_instruction(); - if (inst.operation < MAX_PRIMITIVE_RECIPES) return true; - if (!contains_key(Recipe, inst.operation)) return true; - const recipe& caller = get(Recipe, inst.operation); - if (caller.steps.empty()) return true; - // if the recipe deosn't begin with 'local-scope', always update refcounts - return caller.steps.at(0).old_name != "local-scope"; -} - :(code) // is this reagent one of the values returned by the current (reply) instruction? // is the corresponding ingredient saved in the caller? @@ -325,6 +307,24 @@ try_reclaim_locals(); return false; } +//: since we don't decrement refcounts for escaping values above, make sure we +//: don't increment them when the caller saves them either + +:(after "Write Products of Instruction") +Update_refcounts_in_write_memory = should_update_refcounts_in_write_memory(); +:(before "End Write Products of Instruction") +Update_refcounts_in_write_memory = true; +:(code) +bool should_update_refcounts_in_write_memory() { + const instruction& inst = current_instruction(); + // End should_update_refcounts_in_write_memory Special-cases For Primitives + if (inst.operation < MAX_PRIMITIVE_RECIPES) return true; + if (!contains_key(Recipe, inst.operation)) return true; + const recipe& callee = get(Recipe, inst.operation); + if (callee.steps.empty()) return true; + return callee.steps.at(0).old_name != "local-scope"; // callees that call local-scope are already dealt with before return +} + bool caller_uses_product(int product_index) { assert(Current_routine); // run-time only assert(!Current_routine->calls.empty()); -- cgit 1.4.1-2-gfad0