about summary refs log tree commit diff stats
path: root/027call_ingredient.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-08-16 17:03:27 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-08-16 17:03:27 -0700
commit78a12c9d706f6197d3710ece04e9bd8d4eebe713 (patch)
tree3951e166cb933c608eeb1a233e7a218497870751 /027call_ingredient.cc
parent19695cc7ca16d9129ed3ef2b46bf3460452dd6db (diff)
downloadmu-78a12c9d706f6197d3710ece04e9bd8d4eebe713.tar.gz
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'
Diffstat (limited to '027call_ingredient.cc')
-rw-r--r--027call_ingredient.cc1
1 files changed, 1 insertions, 0 deletions
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")