fun yes = (print "yes"; yes)
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
size_of