diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-04-13 22:04:52 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-04-13 22:04:52 -0700 |
commit | f404eb55720ce5bcfe9e78b74933a0a2b69badef (patch) | |
tree | 2ad1e781f376dc6f7296ad3fe35ba2bc95c79085 /036refcount.cc | |
parent | ad05221de91b9ec058de36319c617e7ac771e950 (diff) | |
download | mu-f404eb55720ce5bcfe9e78b74933a0a2b69badef.tar.gz |
3819
Yet another attempt at trying to clean up commit 3216. I think this solution might finally let me stop agonizing over the problem. State variables for distinguishing call-sites are a reasonable mechanism, orthogonal to waypoints and the hook functions to hold them.
Diffstat (limited to '036refcount.cc')
-rw-r--r-- | 036refcount.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/036refcount.cc b/036refcount.cc index 10d451ab..8297c4ed 100644 --- a/036refcount.cc +++ b/036refcount.cc @@ -17,20 +17,22 @@ def main [ +run: {2: ("address" "number")} <- copy {0: "literal"} +mem: decrementing refcount of 1000: 1 -> 0 -:(before "End Globals") -//: escape hatch for a later layer -bool Update_refcounts_in_write_memory = true; - :(before "End write_memory(x) Special-cases") -if (Update_refcounts_in_write_memory) - update_any_refcounts(x, data); +update_any_refcounts(x, data); :(code) void update_any_refcounts(const reagent& canonized_x, const vector<double>& data) { + if (!should_update_refcounts()) return; increment_any_refcounts(canonized_x, data); // increment first so we don't reclaim on x <- copy x decrement_any_refcounts(canonized_x); } +//: escape hatch for a later layer +bool should_update_refcounts() { + // End should_update_refcounts() Special-cases + return true; +} + void increment_any_refcounts(const reagent& canonized_x, const vector<double>& data) { if (is_mu_address(canonized_x)) { assert(scalar(data)); |