GiNaC 1.8.7
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GiNaC::remember_table Class Reference

The remember table is organized like an n-fold associative cache in a microprocessor. More...

#include <remember.h>

Inheritance diagram for GiNaC::remember_table:

Public Member Functions

 remember_table ()
 
 remember_table (unsigned s, unsigned as, unsigned strat)
 
bool lookup_entry (function const &f, ex &result) const
 
void add_entry (function const &f, ex const &result)
 
void clear_all_entries ()
 
void show_statistics (std::ostream &os, unsigned level) const
 

Static Public Member Functions

static std::vector< remember_table > & remember_tables ()
 

Protected Member Functions

void init_table ()
 

Protected Attributes

unsigned table_size
 
unsigned max_assoc_size
 
unsigned remember_strategy
 

Detailed Description

The remember table is organized like an n-fold associative cache in a microprocessor.

The table has a width of 's' (which is rounded to table_size, some power of 2 near 's', internally) and a depth of 'as' (unless you choose that entries are never discarded). The place where an entry is stored depends on the hashvalue of the parameters of the function (this corresponds to the address of byte to be cached). The 'log_2(table_size)' least significant bits of this hashvalue give the slot in which the entry will be stored or looked up. Each slot can take up to 'as' entries. If a slot is full, an older entry is removed by one of the following strategies:

Definition at line 83 of file remember.h.

Constructor & Destructor Documentation

◆ remember_table() [1/2]

GiNaC::remember_table::remember_table ( )

◆ remember_table() [2/2]

GiNaC::remember_table::remember_table ( unsigned  s,
unsigned  as,
unsigned  strat 
)

Definition at line 146 of file remember.cpp.

References init_table(), GiNaC::log2(), and table_size.

Member Function Documentation

◆ lookup_entry()

bool GiNaC::remember_table::lookup_entry ( function const &  f,
ex result 
) const

Definition at line 157 of file remember.cpp.

References GiNaC::basic::gethash(), GINAC_ASSERT, and table_size.

◆ add_entry()

void GiNaC::remember_table::add_entry ( function const &  f,
ex const &  result 
)

Definition at line 164 of file remember.cpp.

References GiNaC::basic::gethash(), GINAC_ASSERT, and table_size.

◆ clear_all_entries()

void GiNaC::remember_table::clear_all_entries ( )

Definition at line 171 of file remember.cpp.

References init_table().

◆ show_statistics()

void GiNaC::remember_table::show_statistics ( std::ostream &  os,
unsigned  level 
) const

◆ remember_tables()

std::vector< remember_table > & GiNaC::remember_table::remember_tables ( )
static

◆ init_table()

void GiNaC::remember_table::init_table ( )
protected

Definition at line 177 of file remember.cpp.

References max_assoc_size, remember_strategy, and table_size.

Referenced by clear_all_entries(), and remember_table().

Member Data Documentation

◆ table_size

unsigned GiNaC::remember_table::table_size
protected

Definition at line 94 of file remember.h.

Referenced by add_entry(), init_table(), lookup_entry(), and remember_table().

◆ max_assoc_size

unsigned GiNaC::remember_table::max_assoc_size
protected

Definition at line 95 of file remember.h.

Referenced by init_table(), and remember_table().

◆ remember_strategy

unsigned GiNaC::remember_table::remember_strategy
protected

Definition at line 96 of file remember.h.

Referenced by init_table(), and remember_table().


The documentation for this class was generated from the following files:

This page is part of the GiNaC developer's reference. It was generated automatically by doxygen. For an introduction, see the tutorial.