Cache

dotty.tools.dotc.transform.init.Semantic$.Cache$
object Cache

Cache used in fixed point computation

The analysis computes the least fixed point for the cache (see doc for ExprValueCache).

For the fixed point computation to terminate, we need to make sure that the domain of the cache, i.e. the key pair (Ref, Tree) is finite. As the code is finite, we only need to carefully design the abstract domain to be finitary.

We also need to make sure that the computing function (i.e. the abstract interpreter) is monotone. Error handling breaks monotonicity of the abstract interpreter, because when an error happens, we always return the bottom value Hot for an expression. It is not a threat for termination because when an error happens, we stop the fixed point computation at the end of the iteration where the error happens. Care must be paid to tests of errors, monotonicity will be broken if we simply ignore the test errors (See TryReporter).

Note: It's tempting to use location of trees as key. That should be avoided as a template may have the same location as its single statement body. Macros may also create incorrect locations.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Cache.type

Members list

Concise view

Type members

Classlikes

class Cache

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any