From 78a12c9d706f6197d3710ece04e9bd8d4eebe713 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 16 Aug 2016 17:03:27 -0700 Subject: 3202 - bugfix: 'start-running' and refcounts When you pass an ingredient to a recipe using 'start-running' it mostly behaves identically to performing a regular function call. However, if the calling function completed before the new routine had a chance to run, the ingredients passed in ran the risk of being reclaimed. In response, let's always increment refcounts at the time of a function call rather than when the ingredients are read inside the callee. Now the summary of commit 3197 is modified to this: Update refcounts of products after every instruction, EXCEPT: a) when instruction is a non-primitive and the callee starts with 'local-scope' (because it's already not decremented in 'return') OR: b) when instruction is primitive 'next-ingredient' or 'next-ingredient-without-typechecking' --- 027call_ingredient.cc | 1 + 1 file changed, 1 insertion(+) (limited to '027call_ingredient.cc') diff --git a/027call_ingredient.cc b/027call_ingredient.cc index 9e98cdc2..1bc3a563 100644 --- a/027call_ingredient.cc +++ b/027call_ingredient.cc @@ -33,6 +33,7 @@ for (int i = 0; i < SIZE(ingredients); ++i) { reagent/*copy*/ ingredient = call_instruction.ingredients.at(i); // End Compute Call Ingredient current_call().ingredients.push_back(ingredient); + // End Populate Call Ingredient } :(before "End Primitive Recipe Declarations") -- cgit 1.4.1-2-gfad0