Data

dotty.tools.dotc.transform.init.Objects.Cache.Data
class Data extends Cache[Config, Res]

Attributes

Graph
Supertypes
class Cache[Config, Res]
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def cachedEval(thisV: ThisValue, expr: Tree, cacheResult: Boolean)(fun: Tree => Value)(using MutableData, Data): Value
def get(thisV: Value, expr: Tree)(using MutableData, Data): Option[Value]

Inherited methods

def cachedEval(config: Config, expr: Tree, cacheResult: Boolean, default: Res)(eval: Tree => Res): Res

Evaluate an expression with cache

Evaluate an expression with cache

The algorithmic skeleton is as follows:

if don't cache result then
  return eval(expr)
if this.current.contains(config, expr) then
  return cached value
else
  val assumed = this.last(config, expr) or bottom value if absent
  this.current(config, expr) = assumed
  val actual = eval(expr)

  if assumed != actual then
    this.changed = true
    this.current(config, expr) = actual

Attributes

Inherited from:
Cache
def get(config: Config, expr: Tree): Option[Res]

Attributes

Inherited from:
Cache

Attributes

Inherited from:
Cache

Attributes

Inherited from:
Cache

Prepare cache for the next iteration

Prepare cache for the next iteration

  1. Reset changed flag.

  2. Use current cache as last cache and set current cache to be empty.

Attributes

Inherited from:
Cache