Listable Class Reference< base class which allows classes to be used in collections
More...
#include <Listable.h>
Inheritance diagram for Listable:
[legend]List of all members.
Detailed Description
< base class which allows classes to be used in collections
Polaris Base - See also:
- Listable.h
Listable.h
Listable.cc
The Listable class must be the base class of any object which can be placed in a collection. Listable contributes data and methods required for use by all Collections (including Elements and Map structures).
The underlying formula for the Collection hierarchy is that Collections hold objects called "wrappers" rather than the objects themselves. When an object is placed in a Collection, a new wrapper is created and the object is manipulated through the wrapper. The Listable class contributes a standardized interface to the Wrapper classes and the Collection hierarchy.
The Listable class contributes only two pieces of data: a pointer to the wrapper which will "own" it and a structure which allows all references to the Listable object to be properly counted and also contains a number of other flags:
refs: Number of pointers to the object from the Collection hierarchy (including the object's own wrapper). Reference counting is required to ensure that an object is not prematurely deleted. If an object is deleted and there are still references to the object, the object will be turned into a Zombie (a stripped-down object containing nothing but the Listable info which ensures that any future attempts to access the object are caught--see Zombie man page). Further, if an object has been placed in a collection and there are NO references to it, it is automatically deleted. valid_bit: Is this a valid object or is this a Zombie? collect_bit: Is this object in a collection? pulled_bit: Has this object been pulled by an assign operation?
The vast majority of the methods associated with the Listable class are non-public and should only be used by the Collection hierarchy routines.
Definition at line 123 of file Listable.h.
Constructor & Destructor Documentation
Member Function Documentation
| void Listable::assert_free |
( |
|
) |
[inline] |
|
|
|
Abort with a p-assert if the wrapper-pointer is NULL.
< No longer an error -- now results in turning into a Zombie p_assert(_flags._refs == 0, "Listable::assert_free(): " "Attempt to delete object with outstanding references");
Definition at line 271 of file Listable.h.
Referenced by Definition::rename(), and ~Listable(). |
| int Listable::fingerprint_ok |
( |
|
) |
[inline] |
|
|
|
return the next element of the list.
Reimplemented in NextEntry, and Statement.
Definition at line 88 of file Listable.cc.
References Wrapper::next_ref(), and Wrapper::object().
Referenced by _calc_loop_range(), _int_diff(), cdg2cfg(), convert_arithmetic_if(), enforce_standard_within_bounds(), get_in(), get_in_out(), get_out(), localize_goto(), Statement::next_ref(), parallel_loop_inside(), remove_postamble(), and unroll_loop(). |
|
|
void operator delete (void * ptr, size_t size);
Reimplemented in Statement.
Definition at line 100 of file Listable.cc.
References Wrapper::object(), and Wrapper::prev_ref().
Referenced by convert_arithmetic_if(), StmtList::del(), enforce_standard_within_bounds(), has_known_iteration_space(), in_parallel_region(), peel_loop_first(), Statement::prev_ref(), stripmine_horiz_loop(), stripmine_vert_loop(), and unroll_loop(). |
| void Listable::operator delete |
( |
void * |
ptr, |
|
|
unsigned int |
size |
|
) |
|
|
|
|
void * operator new (size_t size);
2.Replaced operator delete with Zombie conversion. WHY: 1,2.This change, in combination with changes in dec_refs_delete_or_zombie, solve the cyclic reference count problem. (Please see Modification history for dec_refs_delete_or_zombie)
... since Zombie::CTOR zeroes this
... to restore them to previous values.
Reimplemented in Zombie.
Definition at line 135 of file Listable.cc.
References _flags, packed_object::_refs, context, count(), and remember_memory(). |
| void* Listable::operator new |
( |
unsigned int |
size |
) |
|
|
|
|
Overload the new/delete for garbage collection.
Reimplemented in Zombie. |
| virtual Listable* Listable::listable_clone |
( |
|
) |
const [pure virtual] |
|
|
|
Copy and return a pointer to any Listable item (MUST be implemented correctly by subclasses for List copy functions to work).
Implemented in AbstractAccess, AccessDimension, ArrayBounds, ArrayDims, BinRep, CDElement, CDGNode, CDRepositoryEntry, CDRegion, myWorkSpace, BaseElement, BMNode, BaseRefElement, Database< S, T >, DatabaseData, Element< T >, KeyMapData, KeyDatabase< S, T >, MapData, KeyMap< S, T >, KeyMapData, List< T >, Map< S, T >, MapData, RefDatabase< S, T >, RefElement< T >, RefKeyDatabase< S, T >, MapData, RefKeyMap< S, T >, RefList< T >, IntElem, RefMap< S, T >, RefMapData, RefSet< T >, Set< T >, Zombie, CallSite, IPCPConstants, IPCPCallData, IPCPProcData, ReturnJumpFunction, JumpFunction, PropConstValue, PropConstWS, UnionFindSetElem, Data, ElementDV, DVfield, ActiveArc, DeadCodeElimWS, Definition, DefLoc, DefLocMap, DirectedEdge, AssertComment, AssertConcurrentRoutine, AssertCritical, AssertDepIO, AssertDepOverlap, AssertDepROvsRW, AssertDepRWvsWF, AssertDepWFvsRO, AssertDynLastValue, AssertEpilogue, AssertFirstValue, AssertForward, AssertInduction, AssertInline, AssertInstrument, Assertion, AssertLastValue, AssertLoopLabel, AssertMayMod, AssertNoDependence, AssertNoInline, AssertNoLastValue, AssertNoMod, AssertNoPutGet, AssertNoWait, AssertOverlap, AssertOverlapSort, AssertParallel, AssertParallelCondition, AssertPartialFirstValue, AssertPartialReduction, AssertPostamble, AssertPreamble, AssertPrivate, AssertPrivateDescr, AssertPrivateRefs, AssertPrivatizable, AssertPrologue, AssertRangeWritten, AssertReadOnlyRefs, AssertRecursiveInline, AssertReductDescr, AssertReduction, AssertRelation, AssertRTShadow, AssertRunTimeTest, AssertSafeCondition, AssertSchedule, AssertSerial, AssertShared, AssertSharedRefs, AssertSideEffectFree, AssertSubst, AssertTestMonotone, AssertUnknownShared, Directive, RecurrenceAssertion, DominatorWorkSpace, EquivalenceMember, ExprCountElem, ExprExponentElem, Expression, Format, GSAPathExpr, GSAPathMap, GSAWorkSpace, HeapElem, InlineObject, InlineWorkSpace, IntElem, IntraPCodeDomain, InterPCodeDomain, GlobalDefSite, LongElem, Monotonicity, pDominatorWorkSpace, AIRangeDict, ControlRangeDict, ExprSet, GSAControlRangeData, GSAControlRangeDict, GSARangeOrData, GSAFullRangeData, GSAFullRangeDict, PropCtrlRangeWS, PropRangeEdge, PropRangeWS, RangeAccessor, CompareData, SSAControlRangeData, SSAControlRangeDict, SSARangeOrData, SSAFullRangeData, SSAFullRangeDict, StmtTopOrderWS, StmtRanges, StmtRefRanges, RegistryElem, SharedBounds, SimBiGraph, SimBiGraphIterator, SimEdge, SimEdgeKernel, SimGraph, SimGraphIterator, SSAProgramUnit, s_control_type, Statement, StmtList, StringElem, SymbolAccess, SymbolAccessRef, IntElem, IntElem, TopSortNode, TranslateObject::SymRefElem, TranslateObject, UBiEdge, UBiGraph, UBiGraphIterator, UEdge, UGraph, UGraphIterator, ArgExprElem, MyWorkSpace, WorkSpace, MyWorkSpace, Database< String, VoidPtrDef >, Database< Statement *, IntElem >, Database< void *, IntElem >, Database< String, T >, Database< String, CommonBlock >, Database< int, Format >, Database< String, StmtRanges >, Database< String, IPCPProcData >, Database< String, IntElem >, Database< String, ProgramUnit >, Database< String, RefMap< Symbol, Expression > >, Database< String, Symbol >, Database< String, Equivalence >, Database< String, Namelist >, Database< String, IPCPCallData >, Database< ProgramUnit *, IntraPCodeDomain >, Database< String, BinRep >, Database< S, S >, Element< Expression >, List< IntElem >, List< IPCPConstants >, List< CDElement >, List< Statement >, List< WorkSpace >, List< StringElem >, List< ArgExprElem >, List< AccessDimension >, List< SharedBounds >, List< Data >, List< PropConstValue >, List< PropRangeEdge >, List< EquivalenceMember >, List< ArrayBounds >, List< s_control_type >, List< ActiveArc >, List< SimEdge >, List< ElementDV >, List< Assertion >, List< DVfield >, List< CDRepositoryEntry >, List< Expression >, List< AbstractAccess >, List< GSAPathExpr >, List< BinRep >, Map< Expression, IntElem >, Map< Symbol, IntElem >, Map< Statement, GSAControlRangeData >, Map< Symbol, GSAFullRangeData >, Map< Symbol, Expression >, Map< Statement, GSAPathMap >, Map< Symbol, GSARangeOrData >, Map< Symbol, DefLoc >, Map< HeapObject, HeapElem >, Map< Symbol, Set< Expression > >, Map< Symbol, RefSet< Expression > >, Map< Statement, InlineObject >, Map< Symbol, SSAFullRangeData >, Map< Symbol, UnionFindSetElem >, Map< Symbol, SymbolAccessRef >, Map< Symbol, SymbolAccess >, Map< Symbol, SymRefElem >, Map< Statement, Map< Symbol, Set< Expression > > >, Map< Symbol, CompareData >, Map< Statement, RefMap< Symbol, Expression > >, Map< Statement, SSAControlRangeData >, Map< Symbol, SSARangeOrData >, Map< Symbol, AbstractAccess >, Map< S, S >, RefDatabase< int, Statement >, RefDatabase< String, ProgramUnit >, RefElement< InlineWorkSpace >, RefElement< Statement >, RefElement< Listable >, RefElement< Symbol >, RefElement< AbstractAccess >, RefList< Statement >, RefList< Assertion >, RefList< Expression >, RefList< Symbol >, RefList< AbstractAccess >, RefMap< Symbol, Expression >, RefMap< Symbol, Statement >, RefMap< Format, Format >, RefMap< Symbol, Symbol >, RefSet< GSAFullRangeData >, RefSet< ProgramUnit >, RefSet< Statement >, RefSet< PropRangeEdge >, RefSet< SSAFullRangeData >, RefSet< Expression >, RefSet< Symbol >, Set< CallSite >, Set< Symbol * >, and Set< BinRep >.
Referenced by LiveWrapper::clone(), and BaseList::operator=(). |
| virtual void Listable::print |
( |
ostream & |
o |
) |
const [pure virtual] |
|
|
|
Implemented in AbstractAccess, AccessDimension, ArrayBounds, ArrayDims, BinRep, CDElement, CDGNode, CDRepositoryEntry, CDRegion, myWorkSpace, BaseElement, BMNode, BaseRefElement, Database< S, T >, DatabaseData, Element< T >, KeyMapData, KeyDatabase< S, T >, MapData, KeyMap< S, T >, KeyMapData, List< T >, Map< S, T >, MapData, RefDatabase< S, T >, RefElement< T >, RefKeyDatabase< S, T >, MapData, RefKeyMap< S, T >, RefList< T >, IntElem, RefMap< S, T >, RefMapData, RefSet< T >, Set< T >, Zombie, CommonBlock, CallSite, IPCPConstants, IPCPCallData, IPCPProcData, ReturnJumpFunction, PropConstValue, PropConstWS, UnionFindSetElem, Data, ElementDV, DVfield, ActiveArc, DeadCodeElimWS, Declaration, Definition, DefLoc, DefLocMap, Dictionary< T >, DirectedEdge, AssertComment, AssertConcurrentRoutine, AssertCritical, AssertDepIO, AssertDepOverlap, AssertDepROvsRW, AssertDepRWvsWF, AssertDepWFvsRO, AssertDynLastValue, AssertEpilogue, AssertFirstValue, AssertForward, AssertInduction, AssertInline, AssertInstrument, Assertion, AssertionList, AssertLastValue, AssertLoopLabel, AssertMayMod, AssertNoDependence, AssertNoInline, AssertNoLastValue, AssertNoMod, AssertNoPutGet, AssertNoWait, AssertOverlap, AssertOverlapSort, AssertParallel, AssertParallelCondition, AssertPartialFirstValue, AssertPartialReduction, AssertPostamble, AssertPreamble, AssertPrivate, AssertPrivateDescr, AssertPrivateRefs, AssertPrivatizable, AssertPrologue, AssertRangeWritten, AssertReadOnlyRefs, AssertRecursiveInline, AssertReductDescr, AssertReduction, AssertRelation, AssertRTShadow, AssertRunTimeTest, AssertSafeCondition, AssertSchedule, AssertSerial, AssertShared, AssertSharedRefs, AssertSideEffectFree, AssertSubst, AssertTestMonotone, AssertUnknownShared, Directive, RecurrenceAssertion, DominatorWorkSpace, EntryPoints, EquivalenceMember, Equivalence, DistributeExpr, ExprCountElem, ExprExponentElem, Expression, Format, FormatDB, GSAPathExpr, GSAPathMap, GSAWorkSpace, HeapElem, InlineObject, InlineWorkSpace, IntDef, IntElem, IntraPCodeDomain, InterPCodeDomain, GlobalDefSite, LongElem, Monotonicity, Namelist, pDominatorWorkSpace, PhiPlaceDef, Program, ProgramUnit, AIRangeDict, BaseStmtRanges, ControlRangeDict, ExprSet, GSAControlRangeData, GSAControlRangeDict, GSARangeOrData, GSAFullRangeData, GSAFullRangeDict, PropCtrlRangeWS, PropRangeEdge, PropRangeWS, RangeAccessor, CompareData, RangeComparator, SSAControlRangeData, SSAControlRangeDict, SSARangeOrData, SSAFullRangeData, SSAFullRangeDict, StmtTopOrderWS, RegistryElem, SharedBounds, SharedDims, SimBiGraph, SimBiGraphIterator, SimEdge, SimEdgeKernel, SimGraph, SimGraphIterator, SSAProgramUnit, s_control_type, NextEntry, Statement, StmtList, StringElem, BlockDataSymbol, FunctionSymbol, NamelistSymbol, PointerSymbol, ProgramSymbol, SubroutineSymbol, Symbol, SymbolicConstantSymbol, VariableSymbol, SymbolAccess, SymbolAccessRef, MapData, IntElem, IntElem, TopSortNode, TranslateObject::SymRefElem, TranslateObject, UBiEdge, UBiGraph, UBiGraphIterator, UEdge, UGraph, UGraphIterator, ArgExprElem, MyWorkSpace, WorkSpace, MyWorkSpace, Database< String, VoidPtrDef >, Database< Statement *, IntElem >, Database< void *, IntElem >, Database< String, T >, Database< String, CommonBlock >, Database< int, Format >, Database< String, StmtRanges >, Database< String, IPCPProcData >, Database< String, IntElem >, Database< String, ProgramUnit >, Database< String, RefMap< Symbol, Expression > >, Database< String, Symbol >, Database< String, Equivalence >, Database< String, Namelist >, Database< String, IPCPCallData >, Database< ProgramUnit *, IntraPCodeDomain >, Database< String, BinRep >, Database< S, S >, Element< Expression >, List< IntElem >, List< IPCPConstants >, List< CDElement >, List< Statement >, List< WorkSpace >, List< StringElem >, List< ArgExprElem >, List< AccessDimension >, List< SharedBounds >, List< Data >, List< PropConstValue >, List< PropRangeEdge >, List< EquivalenceMember >, List< ArrayBounds >, List< s_control_type >, List< ActiveArc >, List< SimEdge >, List< ElementDV >, List< Assertion >, List< DVfield >, List< CDRepositoryEntry >, List< Expression >, List< AbstractAccess >, List< GSAPathExpr >, List< BinRep >, Map< Expression, IntElem >, Map< Symbol, IntElem >, Map< Statement, GSAControlRangeData >, Map< Symbol, GSAFullRangeData >, Map< Symbol, Expression >, Map< Statement, GSAPathMap >, Map< Symbol, GSARangeOrData >, Map< Symbol, DefLoc >, Map< HeapObject, HeapElem >, Map< Symbol, Set< Expression > >, Map< Symbol, RefSet< Expression > >, Map< Statement, InlineObject >, Map< Symbol, SSAFullRangeData >, Map< Symbol, UnionFindSetElem >, Map< Symbol, SymbolAccessRef >, Map< Symbol, SymbolAccess >, Map< Symbol, SymRefElem >, Map< Statement, Map< Symbol, Set< Expression > > >, Map< Symbol, CompareData >, Map< Statement, RefMap< Symbol, Expression > >, Map< Statement, SSAControlRangeData >, Map< Symbol, SSARangeOrData >, Map< Symbol, AbstractAccess >, Map< S, S >, RefDatabase< int, Statement >, RefDatabase< String, ProgramUnit >, RefElement< InlineWorkSpace >, RefElement< Statement >, RefElement< Listable >, RefElement< Symbol >, RefElement< AbstractAccess >, RefList< Statement >, RefList< Assertion >, RefList< Expression >, RefList< Symbol >, RefList< AbstractAccess >, RefMap< Symbol, Expression >, RefMap< Symbol, Statement >, RefMap< Format, Format >, RefMap< Symbol, Symbol >, RefSet< GSAFullRangeData >, RefSet< ProgramUnit >, RefSet< Statement >, RefSet< PropRangeEdge >, RefSet< SSAFullRangeData >, RefSet< Expression >, RefSet< Symbol >, Set< CallSite >, Set< Symbol * >, Set< BinRep >, Dictionary< CommonBlock >, Dictionary< VoidPtrDef >, Dictionary< Equivalence >, Dictionary< Symbol >, and Dictionary< Namelist >.
Referenced by main(), operator<<(), Collection::print(), BaseRefElement::print(), BaseElement::print(), and Collection::structures_OK(). |
Friends And Related Function Documentation
| ostream& operator<< |
( |
ostream & |
o, |
|
|
const Listable & |
l |
|
) |
[friend] |
|
| void _listable_ref_dec |
( |
Listable * |
obj |
) |
[friend] |
|
| void * Listable::operator new |
( |
unsigned int |
size |
) |
throw (std::bad_alloc) [friend] |
|
| void operator delete |
( |
void * |
p |
) |
throw () [friend] |
|
| void dec_refs_delete_or_zombie |
( |
Listable * |
ptr |
) |
[friend] |
|
|
|
"Clean up:C++ garbage collection" _Byte_, 21(1):157(2)
First, the reference count is decremented. If there are still outstanding references, the object is turned into a Zombie (in order to catch any future attempts to reference the object), otherwise it is deleted. This is a function rather than a method because the only reasonable location for this method is in Listable and it is too chancy having a method changing its own type.
Definition at line 74 of file Zombie.cc.
Referenced by BaseElement::del(), BaseElement::modify(), and BaseElement::~BaseElement(). |
| void add_zombie_list |
( |
Listable * |
ptr |
) |
[friend] |
|
Member Data Documentation
The documentation for this class was generated from the following files:
|