z3 / src / ast / act_cache.h

Copyright (c) 2011 Microsoft Corporation

Module Name:



    expr -> expr activity cache
    It maintains at most N unused entries


    Leonardo (leonardo) 2011-04-12


#ifndef _ACT_CACHE_H_
#define _ACT_CACHE_H_


class act_cache {
    ast_manager &        m_manager;
    typedef cmap<expr*, expr*, obj_ptr_hash<expr>, default_eq<expr*> > map;
    map                  m_table;
    ptr_vector<expr>     m_queue; // recently created queue
    unsigned             m_qhead;
    unsigned             m_unused;
    unsigned             m_max_unused;

    void compress_queue();
    void init();
    void dec_refs();
    void del_unused();

    act_cache(ast_manager & m);
    act_cache(ast_manager & m, unsigned max_unused);
    void insert(expr * k, expr * v);
    expr * find(expr * k);
    void reset();
    void cleanup();
    unsigned size() const { return m_table.size(); }
    unsigned capacity() const { return m_table.capacity(); }
    bool empty() const { return m_table.empty(); }
    bool check_invariant() const;

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.