about summary refs log tree commit diff stats
path: root/arc/.traces
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-08-16 14:30:19 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-08-16 14:39:38 -0700
commit7a29cf544e73fbd516b2e6118c093fd5df81a274 (patch)
tree9a0f9b566d1d1199f72d9f6839de69c6205aa430 /arc/.traces
parent6a218cff3ae7e7d5a77da493d1ba42c6be95a2fc (diff)
downloadmu-7a29cf544e73fbd516b2e6118c093fd5df81a274.tar.gz
3197
Replace an integer with a boolean across two layers of function calls.

It has long been one of the ugliest consequences of my approach with
layers that functions might need to be introduced with unnecessary
arguments simply because we have no clean way to add parameters to a
function definition after the fact -- or to add the default argument
corresponding to that parameter in calls. This problem is exacerbated by
the redundant argument having to be passed in through multiple layers of
functions. In this instance:

In layer 20 we define write_memory with an argument called
'saving_instruction_products' which isn't used yet.

In layer 36 we reveal that we use this argument in a call to
should_update_refcounts_in_write_memory() -- where it is again not used
yet.

Layer 43 finally clarifies what we're shooting for:

  a) In general when we need to update some memory, we always want to
  update refcounts.

  b) The only exception is when we're reclaiming locals in a function
  that set up its stack frame using 'local-scope' (signalling that it
  wants immediate reclamation). At that point we avoid decrementing
  refcounts of 'escaping' addresses that are being returned, and we also
  avoid incrementing refcounts of products in the caller instruction.
  The latter case is basically why we need this boolean and its dance
  across 3 layers.

In summary, write_memory() needs to update refcounts except if:
  we're writing products for an instruction,
  the instruction is not a primitive, and
  the (callee) recipe for the instruction starts with 'local-scope'.
Diffstat (limited to 'arc/.traces')
0 files changed, 0 insertions, 0 deletions