about summary refs log tree commit diff stats
path: root/402time.mu
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-10-29 22:12:27 -0700
committerKartik Agaram <vc@akkartik.com>2020-10-30 06:05:52 -0700
commit264acd9ec91a7e75dc43ec57d863777b7812cc52 (patch)
treeea6548648f189160692fb4b0f9df658481ff6096 /402time.mu
parent8fe51755bf9a0ac7270599cf096e7fc2ffd50c83 (diff)
downloadmu-264acd9ec91a7e75dc43ec57d863777b7812cc52.tar.gz
7144 - tmp: redo checks for function outputs
This isn't done, but an intermediate snapshot seems worth capturing.

Back in March (commit 6082), I made a plan to check writes to function
outputs using liveness analysis. I've been shying away from actually acting
on this plan ever since. In recent weeks I've had this gap bite me three
times.

Returning to the problem now, I think I don't actually need to compute
variable liveness. The compiler can, I think, do the same thing for output
registers whether their variables are alive or dead. The new rule is this:

Once a register gets a function output written to it, no local is popped
into it. Instead of popping outer locals to the register, we simply increment
the stack and keep going.

Since the function output will continue to live on the vars stack past
this point (see clean-up-block), any attempts to read shadowed variables
will throw an error as usual.

This rule is also now easy to explain to people, I think. "You wrote the
function output. Now the register can't be used for anything else."

It's really cool that this works (if it does). Another fruit from "Mu's
lovely property."
Diffstat (limited to '402time.mu')
0 files changed, 0 insertions, 0 deletions