GCSIM
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
global_root Class Referencefinal

defines the structure of the global variable in the root-set table. Inherits from root_set_base. More...

#include <global-root.hpp>

Public Member Functions

 global_root (header *var_ptr)
 creates the instance of the global variable
 
void set_global_variable (header *var_ptr) noexcept
 setter for the global variable.
 
virtual void accept (gc_visitor &visitor) noexcept override
 accepts the gc visitor.
 
- Public Member Functions inherited from root_set_base
virtual ~root_set_base ()=default
 deletes the root_set_base object.
 

Private Member Functions

headerget_global_variable_unlocked () noexcept
 getter for the variable.
 

Private Attributes

std::mutex global_mutex
 used for global variable synchronization.
 
headerglobal_variable_ptr
 pointer to a header of the variable on the heap
 

Friends

class garbage_collector
 allowing gc to access getter for the variable.
 

Detailed Description

defines the structure of the global variable in the root-set table. Inherits from root_set_base.

Constructor & Destructor Documentation

◆ global_root()

global_root::global_root ( header var_ptr)

creates the instance of the global variable

Parameters
var_ptr- pointer to a header of the global variable on the heap

Member Function Documentation

◆ accept()

void global_root::accept ( gc_visitor visitor)
overridevirtualnoexcept

accepts the gc visitor.

Parameters
visitor- reference to a gc visitor. Calls marking on the gc visitor for global variable element.

Implements root_set_base.

◆ get_global_variable_unlocked()

header * global_root::get_global_variable_unlocked ( )
privatenoexcept

getter for the variable.

Warning
must be called when lock is held already.
Returns
pointer to a header of the variable.

◆ set_global_variable()

void global_root::set_global_variable ( header var_ptr)
noexcept

setter for the global variable.

Parameters
var_ptr- pointer to the header of the global variable on the heap

Friends And Related Symbol Documentation

◆ garbage_collector

friend class garbage_collector
friend

allowing gc to access getter for the variable.

Member Data Documentation

◆ global_mutex

std::mutex global_root::global_mutex
mutableprivate

used for global variable synchronization.

◆ global_variable_ptr

header* global_root::global_variable_ptr
private

pointer to a header of the variable on the heap


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