mCRL2
Loading...
Searching...
No Matches
atermpp::detail::thread_aterm_pool Class Referencefinal

This is a thread's specific access to the global aterm pool which ensures that garbage collection and hash table resizing can proceed. More...

#include <thread_aterm_pool.h>

Inheritance diagram for atermpp::detail::thread_aterm_pool:
atermpp::detail::thread_aterm_pool_interface mcrl2::utilities::noncopyable

Public Member Functions

 thread_aterm_pool (aterm_pool &global_pool)
 
 ~thread_aterm_pool () override
 
function_symbol create_function_symbol (const std::string &name, const std::size_t arity, const bool check_for_registered_functions=false)
 
function_symbol create_function_symbol (std::string &&name, const std::size_t arity, const bool check_for_registered_functions=false)
 
void create_int (aterm &term, std::size_t val)
 
void create_term (aterm &term, const function_symbol &sym)
 
template<class ... Terms>
void create_appl (aterm &term, const function_symbol &sym, const Terms &... arguments)
 
template<class Term , class INDEX_TYPE , class ... Terms>
void create_appl_index (aterm &term, const function_symbol &sym, const Terms &... arguments)
 
template<typename ForwardIterator >
void create_appl_dynamic (aterm &term, const function_symbol &sym, ForwardIterator begin, ForwardIterator end)
 
template<typename InputIterator , typename ATermConverter >
void create_appl_dynamic (aterm &term, const function_symbol &sym, ATermConverter convert_to_aterm, InputIterator begin, InputIterator end)
 \threadsafe
 
void register_variable (aterm *variable)
 Consider the given variable when marking underlying terms.
 
void deregister_variable (aterm *variable)
 Removes the given variable from the active variables.
 
void register_container (aterm_container *variable)
 Consider the given container when marking underlying terms.
 
void deregister_container (aterm_container *variable)
 Removes the given container from the active variables.
 
void mark () override
 Mark the terms created by this thread to prevent them being garbage collected.
 
void print_local_performance_statistics () const override
 Print performance statistics for data stored for this thread.
 
std::size_t protection_set_size () const override
 
mcrl2::utilities::shared_guard lock_shared ()
 Acquire a shared lock on this thread aterm pool.
 
mcrl2::utilities::lock_guard lock ()
 Acquire an exclusive lock.
 
bool is_shared_locked ()
 Returns true iff we are in a shared section.
 
void collect ()
 Triggers a global garbage collection.
 
template<typename InputIterator >
void create_appl_dynamic (aterm &term, const function_symbol &sym, InputIterator begin, InputIterator end)
 
- Public Member Functions inherited from atermpp::detail::thread_aterm_pool_interface
virtual ~thread_aterm_pool_interface ()
 
virtual void mark ()=0
 Mark the terms created by this thread to prevent them being garbage collected.
 
virtual void print_local_performance_statistics () const =0
 Print performance statistics for data stored for this thread.
 
virtual std::size_t protection_set_size () const =0
 

Private Attributes

aterm_poolm_pool
 
mcrl2::utilities::shared_mutex m_shared_mutex
 Keeps track of pointers to all existing aterm variables and containers.
 
mcrl2::utilities::hashtable< aterm * > * m_variables
 
mcrl2::utilities::hashtable< detail::aterm_container * > * m_containers
 
std::size_t m_variable_insertions = 0
 
std::size_t m_container_insertions = 0
 
std::stack< std::reference_wrapper< _aterm > > m_todo
 A reusable todo stack.
 
bool m_is_main_thread = false
 

Additional Inherited Members

- Private Member Functions inherited from mcrl2::utilities::noncopyable
 noncopyable ()=default
 
 noncopyable (const noncopyable &)=delete
 
noncopyableoperator= (const noncopyable &)=delete
 

Detailed Description

This is a thread's specific access to the global aterm pool which ensures that garbage collection and hash table resizing can proceed.

Definition at line 27 of file thread_aterm_pool.h.

Constructor & Destructor Documentation

◆ thread_aterm_pool()

atermpp::detail::thread_aterm_pool::thread_aterm_pool ( aterm_pool global_pool)
inline

Identify the first constructor call as the main thread.

Definition at line 30 of file thread_aterm_pool.h.

◆ ~thread_aterm_pool()

atermpp::detail::thread_aterm_pool::~thread_aterm_pool ( )
inlineoverride

Definition at line 48 of file thread_aterm_pool.h.

Member Function Documentation

◆ collect()

void atermpp::detail::thread_aterm_pool::collect ( )
inline

Triggers a global garbage collection.

Definition at line 122 of file thread_aterm_pool.h.

◆ create_appl()

template<class ... Terms>
void atermpp::detail::thread_aterm_pool::create_appl ( aterm term,
const function_symbol sym,
const Terms &...  arguments 
)
inline

threadsafe

Definition at line 57 of file thread_aterm_pool_implementation.h.

◆ create_appl_dynamic() [1/3]

template<typename InputIterator , typename ATermConverter >
void atermpp::detail::thread_aterm_pool::create_appl_dynamic ( aterm term,
const function_symbol sym,
ATermConverter  convert_to_aterm,
InputIterator  begin,
InputIterator  end 
)
inline

\threadsafe

Definition at line 116 of file thread_aterm_pool_implementation.h.

◆ create_appl_dynamic() [2/3]

template<typename ForwardIterator >
void atermpp::detail::thread_aterm_pool::create_appl_dynamic ( aterm term,
const function_symbol sym,
ForwardIterator  begin,
ForwardIterator  end 
)
inline

threadsafe

◆ create_appl_dynamic() [3/3]

template<typename InputIterator >
void atermpp::detail::thread_aterm_pool::create_appl_dynamic ( aterm term,
const function_symbol sym,
InputIterator  begin,
InputIterator  end 
)

Definition at line 103 of file thread_aterm_pool_implementation.h.

◆ create_appl_index()

template<class Term , class INDEX_TYPE , class ... Terms>
void atermpp::detail::thread_aterm_pool::create_appl_index ( aterm term,
const function_symbol sym,
const Terms &...  arguments 
)
inline

threadsafe

Definition at line 67 of file thread_aterm_pool_implementation.h.

◆ create_function_symbol() [1/2]

function_symbol atermpp::detail::thread_aterm_pool::create_function_symbol ( const std::string &  name,
const std::size_t  arity,
const bool  check_for_registered_functions = false 
)
inline

threadsafe

Definition at line 32 of file thread_aterm_pool_implementation.h.

◆ create_function_symbol() [2/2]

function_symbol atermpp::detail::thread_aterm_pool::create_function_symbol ( std::string &&  name,
const std::size_t  arity,
const bool  check_for_registered_functions = false 
)
inline

threadsafe

Definition at line 25 of file thread_aterm_pool_implementation.h.

◆ create_int()

void atermpp::detail::thread_aterm_pool::create_int ( aterm term,
std::size_t  val 
)
inline

threadsafe

Definition at line 38 of file thread_aterm_pool_implementation.h.

◆ create_term()

void atermpp::detail::thread_aterm_pool::create_term ( aterm term,
const function_symbol sym 
)
inline

threadsafe

Definition at line 47 of file thread_aterm_pool_implementation.h.

◆ deregister_container()

void atermpp::detail::thread_aterm_pool::deregister_container ( aterm_container variable)
inline

Removes the given container from the active variables.

Definition at line 172 of file thread_aterm_pool_implementation.h.

◆ deregister_variable()

void atermpp::detail::thread_aterm_pool::deregister_variable ( aterm variable)
inline

Removes the given variable from the active variables.

Definition at line 149 of file thread_aterm_pool_implementation.h.

◆ is_shared_locked()

bool atermpp::detail::thread_aterm_pool::is_shared_locked ( )
inline

Returns true iff we are in a shared section.

Definition at line 119 of file thread_aterm_pool.h.

◆ lock()

mcrl2::utilities::lock_guard atermpp::detail::thread_aterm_pool::lock ( )
inline

Acquire an exclusive lock.

Definition at line 116 of file thread_aterm_pool.h.

◆ lock_shared()

mcrl2::utilities::shared_guard atermpp::detail::thread_aterm_pool::lock_shared ( )
inline

Acquire a shared lock on this thread aterm pool.

Definition at line 113 of file thread_aterm_pool.h.

◆ mark()

void atermpp::detail::thread_aterm_pool::mark ( )
inlineoverridevirtual

Mark the terms created by this thread to prevent them being garbage collected.

Implements atermpp::detail::thread_aterm_pool_interface.

Definition at line 178 of file thread_aterm_pool_implementation.h.

◆ print_local_performance_statistics()

void atermpp::detail::thread_aterm_pool::print_local_performance_statistics ( ) const
inlineoverridevirtual

Print performance statistics for data stored for this thread.

Implements atermpp::detail::thread_aterm_pool_interface.

Definition at line 204 of file thread_aterm_pool_implementation.h.

◆ protection_set_size()

std::size_t atermpp::detail::thread_aterm_pool::protection_set_size ( ) const
inlineoverridevirtual
Returns
The total number of terms residing in the pool.

Implements atermpp::detail::thread_aterm_pool_interface.

Definition at line 213 of file thread_aterm_pool_implementation.h.

◆ register_container()

void atermpp::detail::thread_aterm_pool::register_container ( aterm_container variable)
inline

Consider the given container when marking underlying terms.

Definition at line 155 of file thread_aterm_pool_implementation.h.

◆ register_variable()

void atermpp::detail::thread_aterm_pool::register_variable ( aterm variable)
inline

Consider the given variable when marking underlying terms.

Definition at line 129 of file thread_aterm_pool_implementation.h.

Member Data Documentation

◆ m_container_insertions

std::size_t atermpp::detail::thread_aterm_pool::m_container_insertions = 0
private

Definition at line 133 of file thread_aterm_pool.h.

◆ m_containers

mcrl2::utilities::hashtable<detail::aterm_container*>* atermpp::detail::thread_aterm_pool::m_containers
private

Definition at line 130 of file thread_aterm_pool.h.

◆ m_is_main_thread

bool atermpp::detail::thread_aterm_pool::m_is_main_thread = false
private

Definition at line 136 of file thread_aterm_pool.h.

◆ m_pool

aterm_pool& atermpp::detail::thread_aterm_pool::m_pool
private

Definition at line 125 of file thread_aterm_pool.h.

◆ m_shared_mutex

mcrl2::utilities::shared_mutex atermpp::detail::thread_aterm_pool::m_shared_mutex
private

Keeps track of pointers to all existing aterm variables and containers.

Definition at line 128 of file thread_aterm_pool.h.

◆ m_todo

std::stack<std::reference_wrapper<_aterm> > atermpp::detail::thread_aterm_pool::m_todo
private

A reusable todo stack.

Definition at line 134 of file thread_aterm_pool.h.

◆ m_variable_insertions

std::size_t atermpp::detail::thread_aterm_pool::m_variable_insertions = 0
private

Definition at line 132 of file thread_aterm_pool.h.

◆ m_variables

mcrl2::utilities::hashtable<aterm*>* atermpp::detail::thread_aterm_pool::m_variables
private

Definition at line 129 of file thread_aterm_pool.h.


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