A flat reachability-based measure



    fun yes = (print "yes"; yes)
  

\[\neg\]

πŸ’₯

πŸ™‚

You can prove it!

πŸ™ƒ

It's complicated...

The aim of this work is to simplify this process


size_of_heap s
=
size_of reachabe_values s.refs {}


       <|s.locals|> ++ <|s.stack|> ++ <|s.global|>
      
size_of vals refs seen


β”œβ”€β”€β”€ ftail [1,2,3] ──── <= heap_limit

β”œβ”€β”€β”€ ftail [2,3] ──── <= heap_limit

β”œβ”€β”€β”€ ftail [3]  ──── <= heap_limit

β”œβ”€β”€β”€ ftail []  ──── <= heap_limit

    β”œβ”€β”€[2,...,n]──┼───rest────

    <=

    β”œβ”€β”€[1,2,...,n]──┼───rest────
  

🀦

size_of vals refs seen

A flat reachability-based measure

The set of all reachable values


    <|s.locals|> ++ <|s.stack|> ++ <|s.global|>
  


    [
     Block 71 some_tag [Number 1; Block 74 ...];
     Number 57;
     Word64 0xF5CA15;
     Word64 0x01368E;
     Word64 0xC81026;
     RefPtr 45;
     Block 75 some_tag [RefPtr 84; ...];
    ]
  

The set of all reachable values addresses

The set of all reachable addresses

=


      reachable_addrs refs blocks roots =
        { y | βˆƒx. x ∈ roots ∧ RTC (next refs blocks) x y }
    

Once we have that, we measure!

πŸŽ‰

flat_size_of refs blocks roots

  • Proven equivalent to size_of
  • Published on IFL2021