Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

VM::VMLinker Class Reference

Represents the (assembler) linker. More...

#include <linker.h>

Collaboration diagram for VM::VMLinker:

Collaboration graph
[legend]
List of all members.

Public Types

typedef TLBTree< LSymbol,
TLDefaultOperators_CDT< LSymbol > > 
SymbolQueue
 SymbolQueue is used to queue symbols for linkage.


Public Member Functions

 VMLinker ()
 Construct linker object.

 ~VMLinker ()
 VM linker destructor.

int AddFile (AssemblerFile *afile)
 Add a file to the linker.

int LinkAll (AssemblerFile *out)
 Actually perform the linking.


Static Public Member Functions

NamespaceInfoSPM_ORD (NamespaceInfo::SymbolEntryE *se)

Private Member Functions

void _MergeNamespaceAndVTableInfo ()
 Merge namespace and class names.

NamespaceInfo_MergeNamespaceInfo_Recursive (NamespaceInfo **head_list, uint nheads)
 Merge namespace and class names; recursive.

void _CheckNamespaceInfo_Recursive (FileNode *fn, NamespaceInfo *ni)
 Used by _MergeNamespaceAndVTableInfo(); see there.

void _LinkFunction (FileNode *fn, ProgramStorage::Function *psf, NamespaceInfo::SymbolEntryE *se_linked)
 Process function for linkage.

void _LinkGlobalStorage (FileNode *fn, AssemblerFile::_GlobVars *gvar, AssemblerFile::_GlobVars *dest, char which)
 Link/merge global vars section of passed file.

void _LinkerFileNeeded (FileNode *fn)
 Perform linking of file.

void _LinkerNeedClassConstruct (ClassInfo *ci)
 Class needed for construction.

int _CheckBaseRecursion (ClassInfo *cni)
 Check if base classes are recursive.

void _CheckBaseRecursion_Recursive (FileNode *fn, NamespaceInfo *ni)
 This is the recursive "driver" for _CheckBaseRecursion().

void _PropagateUseFlags_Recursive (NamespaceInfo *ni)
 Make sure the need_* flags (need_cast) are set on all bases.

void _DoPropagateUseFlags (ClassInfo *from, ClassInfo *cni)
 Internally used by _PropagateUseFlags_Recursive().

void _GenerateSymbolProvideMap ()
 Set up the big symbol provide map.

void _GenerateSymbolProvideMap_AddGlobal (FileNode *fn, AssemblerFile::_GlobVars *gvar)
 Internally used by _GenerateSymbolProvideMap().

void _CreateInitFunction ()
 Create the ".init" function for linked file at end of linking.

FileNode_GetDefinitionFile (NamespaceInfo *from_here)
SymRef _SQPush (NamespaceInfo::SymbolEntryE *, NamespaceInfo::SymbolEntryB **update_se=NULL, LSymbol::SFlag sflag=LSymbol::SNone)
 Push entry into the symbol queue sq. Returns master symref.

SymRef _SQQuery (NamespaceInfo::SymbolEntryE *ni)
 Like _SQPush() but just query a symref for passed *ni.

void _SQPop ()
 Pop entry from the symbol queue sq.

bool _SQPeek (LSymbol &ls)
 Get smallest element without removal; Returns 0 if emtpy.

 VMLinker (const VMLinker &)
 Do not use:.

void operator= (const VMLinker &)
 Do not use:.


Private Attributes

Config cfg
 Configuration data stored here.

LinkedList< FileNodeflist
 List of all files.

int n_errors
 Count errors during linking:.

SymbolQueue sq
TypeID master_TypeID_cnt
SymRef master_SymRef_cnt
 SymRef counter in linked output.

SymbolProvideMap symbol_provide_map
AssemblerFileout

Detailed Description

Represents the (assembler) linker.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
Contains linker config and functions to do file loading and linking.

This class is NOT C++-safe.

Definition at line 43 of file linker.h.


Member Typedef Documentation

typedef TLBTree< LSymbol,TLDefaultOperators_CDT<LSymbol> > VM::VMLinker::SymbolQueue
 

SymbolQueue is used to queue symbols for linkage.

Definition at line 145 of file linker.h.


Constructor & Destructor Documentation

VM::VMLinker::VMLinker const VMLinker  )  [private]
 

Do not use:.

VM::VMLinker::VMLinker  ) 
 

Construct linker object.

Definition at line 1582 of file linker.cc.

VM::VMLinker::~VMLinker  ) 
 

VM linker destructor.

Definition at line 1595 of file linker.cc.

References DELETE(), flist, LinkedList< FileNode >::IsEmpty(), out, and LinkedList< FileNode >::PopFirst().


Member Function Documentation

int VM::VMLinker::_CheckBaseRecursion ClassInfo cni  )  [private]
 

Check if base classes are recursive.

For internal use only.

E.g. you cannot make a class a base of itself. Things like that are normally not part of the linker but of the VM input validation but the linker would recurse infinitely while propagating class use informaition in case of recursive bases.

Return value is number of errors.

Definition at line 656 of file linker.cc.

References Assert, VM::ClassInfo::base, VM::ClassInfoIE::ci(), VM::NonResizeableArray< BaseEntry, uint32 >::n(), VM::NamespaceInfo::nstype, VM::NamespaceInfo::recursion_flag, and uint32.

Referenced by _CheckBaseRecursion_Recursive().

void VM::VMLinker::_CheckBaseRecursion_Recursive FileNode fn,
NamespaceInfo ni
[private]
 

This is the recursive "driver" for _CheckBaseRecursion().

Definition at line 681 of file linker.cc.

References _CheckBaseRecursion(), VM::NamespaceInfo::asm_loc, VM::NamespaceInfo::CompleteName(), VM::NamespaceInfo::down, Error(), LinkedList< NamespaceInfo >::first(), n_errors, LinkedListBase< NamespaceInfo >::next, VM::NamespaceInfo::nstype, and TLString::str().

Referenced by _MergeNamespaceAndVTableInfo().

void VM::VMLinker::_CheckNamespaceInfo_Recursive FileNode fn,
NamespaceInfo ni
[private]
 

Used by _MergeNamespaceAndVTableInfo(); see there.

For internal use only.

Definition at line 479 of file linker.cc.

References VM::NonResizeableArray< VTableEntry, uint32 >::alloc(), VM::NonResizeableArray< BaseEntry, uint32 >::alloc(), VM::NamespaceInfo::asm_loc, Assert, VM::ClassInfo::base, VM::ClassInfoIE::ci(), VM::ClassInfo::BaseEntry::ci, VM::ClassInfoIE::class_tid, VM::NamespaceInfo::CompleteName(), VM::NamespaceInfo::down, Error(), LinkedList< NamespaceInfo >::first(), VM::AssemblerFile::internal_classes, VM::NamespaceInfo::link_info_set, VM::NamespaceInfo::linked, VM::NonResizeableArray< VTableEntry, uint32 >::n(), VM::NonResizeableArray< BaseEntry, uint32 >::n(), n_errors, LinkedListBase< NamespaceInfo >::next, VM::NamespaceInfo::SymbolEntryE::nspc, VM::NamespaceInfo::nstype, VM::ClassInfo::BaseEntry::off, out, VM::ClassInfo::VTableEntry::se, TLString::str(), uint, uint32, and VM::ClassInfo::vtable.

Referenced by _MergeNamespaceAndVTableInfo().

void VM::VMLinker::_CreateInitFunction  )  [private]
 

Create the ".init" function for linked file at end of linking.

Definition at line 1197 of file linker.cc.

References VM::ProgramStorage::AddFunction(), VM::InstructionStorage::append(), Assert, DELETE(), VM::NamespaceInfo::SymbolEntryE::extid, VM::VMLinker::FileNode::f, LinkedList< FileNode >::first(), flist, VM::NamespaceInfo::SymbolEntryE::ftype, VM::NamespaceInfo::SymbolEntryE::linked, VM::NamespaceInfo::SymbolEntryE::name, VM::VMLinker::FileNode::needed, LinkedListBase< FileNode >::next, VM::NamespaceInfo::SymbolEntryE::nspc, VM::AssemblerFile::nspc_root, out, VM::AssemblerFile::SLabelInfo::pfunc, VM::AssemblerFile::program, VM::ProgramStorage::Function::se, VM::AssemblerFile::SLabelInfo::se, VM::AssemblerFile::slabel_init, and VM::SymRef.

Referenced by LinkAll().

void VM::VMLinker::_DoPropagateUseFlags ClassInfo from,
ClassInfo cni
[private]
 

Internally used by _PropagateUseFlags_Recursive().

Definition at line 1160 of file linker.cc.

References Assert, VM::ClassInfo::base, VM::ClassInfoIE::ci(), VM::NonResizeableArray< BaseEntry, uint32 >::n(), VM::ClassInfo::need_cast, VM::ClassInfo::need_construct, and uint32.

Referenced by _PropagateUseFlags_Recursive().

void VM::VMLinker::_GenerateSymbolProvideMap  )  [private]
 

Set up the big symbol provide map.

For internal use only.

Definition at line 786 of file linker.cc.

References _GenerateSymbolProvideMap_AddGlobal(), VM::VMLinker::SymbolProvideMap::AddNode(), VM::NamespaceInfo::asm_loc, Assert, VM::VMLinker::SymbolProvideMap::clear(), VM::NamespaceInfo::SymbolEntryB::CompleteName(), Error(), VM::FuncType::exported, VM::NamespaceInfo::SymbolEntryE::extid, VM::VMLinker::FileNode::f, LinkedList< FileNode >::first(), VM::ProgramStorage::FirstFunction(), flist, VM::NamespaceInfo::SymbolEntryE::ftype, VM::AssemblerFile::gvar_p, VM::AssemblerFile::gvar_v, VM::ProgramStorage::Function::loc, n_errors, LinkedListBase< Function >::next, LinkedListBase< FileNode >::next, VM::NamespaceInfo::SymbolEntryE::nspc, VM::AssemblerFile::nspc_root, VM::AssemblerFile::program, VM::ProgramStorage::Function::se, TLString::str(), symbol_provide_map, and Warning().

Referenced by LinkAll().

void VM::VMLinker::_GenerateSymbolProvideMap_AddGlobal FileNode fn,
AssemblerFile::_GlobVars gvar
[private]
 

Internally used by _GenerateSymbolProvideMap().

For internal use only.

Definition at line 760 of file linker.cc.

References VM::VMLinker::SymbolProvideMap::AddNode(), VM::NamespaceInfo::asm_loc, VM::NamespaceInfo::SymbolEntryB::CompleteName(), Error(), VM::VMLinker::FileNode::f, VM::AssemblerFile::filename, VM::AssemblerFile::_GlobVars::globvarq, n_errors, VM::NamespaceInfo::SymbolEntryE::nspc, TLString::str(), symbol_provide_map, and Warning().

Referenced by _GenerateSymbolProvideMap().

VMLinker::FileNode * VM::VMLinker::_GetDefinitionFile NamespaceInfo from_here  )  [private]
 

Get file in which passed symbol is defined. FIXME: Currently O(nfiles), should be O(1).

Definition at line 119 of file linker.cc.

References Assert, VM::VMLinker::FileNode::f, LinkedList< FileNode >::first(), flist, LinkedListBase< FileNode >::next, VM::AssemblerFile::nspc_root, and VM::NamespaceInfo::parent.

Referenced by LinkAll().

void VM::VMLinker::_LinkerFileNeeded FileNode fn  )  [private]
 

Perform linking of file.

For internal use only.

In case the file is not yet marked as needed, perform linking and mark it as needd. "Linking" is done by simply adding the required symbols to the queue.

Definition at line 929 of file linker.cc.

References _LinkGlobalStorage(), _SQPush(), VM::VMLinker::FileNode::f, VM::AssemblerFile::gvar_p, VM::AssemblerFile::gvar_v, VM::VMLinker::FileNode::needed, out, VM::AssemblerFile::SLabelInfo::pfunc, VM::AssemblerFile::SLabelInfo::se, and VM::AssemblerFile::slabel_init.

Referenced by LinkAll().

void VM::VMLinker::_LinkerNeedClassConstruct ClassInfo ci  )  [private]
 

Class needed for construction.

For internal use only.

This will make sure all the required symbols for the vtable are queued.

Definition at line 1105 of file linker.cc.

References _SQPush(), Assert, VM::ClassInfo::CompleteName(), VM::AssemblerFile::internal_symbols, VM::NamespaceInfo::SymbolEntryE::linked, VM::NamespaceInfo::linked, VM::NonResizeableArray< VTableEntry, uint32 >::n(), VM::ClassInfo::need_construct, VM::NamespaceInfo::SymbolEntryE::nspc, out, VM::ClassInfo::VTableEntry::se, TLString::str(), uint, uint32, VM::ClassInfo::vtable, and Warning().

Referenced by _LinkFunction().

void VM::VMLinker::_LinkFunction FileNode fn,
ProgramStorage::Function psf,
NamespaceInfo::SymbolEntryE se_linked
[private]
 

Process function for linkage.

For internal use only.

Scan through function and add all needed symbols to the symbol queue. Mark all needed TypeIDs as needed. Substitute SymRefs and TypeIDs in the function with their designated linked SymRef and TypeID.

Definition at line 948 of file linker.cc.

References _LinkerNeedClassConstruct(), _SQPush(), VM::VMLinker::Config::abandon_out_maps, VM::ProgramStorage::AddFunction(), VM::InstructionStorage::append(), Assert, cfg, VM::ClassInfoIE::class_tid, VM::NamespaceInfo::SymbolEntryB::CompleteName(), Error(), VM::VMLinker::FileNode::f, VM::InstructionStorage::index(), VM::InstructionStorage::InstructionAt(), VM::InstructionStorage::length(), VM::NamespaceInfo::SymbolEntryE::linked, VM::NamespaceInfo::linked, VM::ProgramStorage::Function::loc, ImplicitMapTable< ClassInfo, TypeID, ImplicitMapOperators< ClassInfo, TypeID, ORD_TypeID > >::lookup(), n_errors, VM::ClassInfo::need_cast, VM::ClassInfo::need_construct, VM::NamespaceInfo::nstype, out, VM::AssemblerFile::SLabelInfo::pfunc, VM::PrgAdr, VM::AssemblerFile::program, VM::ProgramStorage::Function::se, VM::AssemblerFile::SLabelInfo::se, VM::INST::DescEntry::size, VM::AssemblerFile::slabel_start, TLString::str(), VM::SymRef, VM::AssemblerFile::symref2function, VM::AssemblerFile::symref2symbol, VM::INST::DescEntry::symref_off, VM::AssemblerFile::tid2classinfo, VM::TypeID, VM::INST::DescEntry::typeid_off, and uint.

Referenced by LinkAll().

void VM::VMLinker::_LinkGlobalStorage FileNode fn,
AssemblerFile::_GlobVars gvar,
AssemblerFile::_GlobVars dest,
char  which
[private]
 

Link/merge global vars section of passed file.

For internal use only.

This is internally used by _LinkerFileNeeded(); never call directly.

Definition at line 844 of file linker.cc.

References _SQQuery(), _unused_, VM::VMLinker::Config::abandon_out_maps, IDMapTable< SymRef, GlobalVarEntry * >::AddNode(), Assert, cfg, VM::NamespaceInfo::SymbolEntryB::CompleteName(), Error(), VM::VMLinker::FileNode::f, VM::AssemblerFile::filename, VM::AssemblerFile::_GlobVars::globvarq, VM::NamespaceInfo::linked, VM::NamespaceInfo::SymbolEntryE::linked, IDMapTable< SymRef, GlobalVarEntry * >::lookup(), VM::NamespaceInfo::map_name2symbol, n_errors, VM::NamespaceInfo::SymbolEntryE::nspc, VM::AssemblerFile::GlobalVarEntry::off, VM::Offset, out, VM::AssemblerFile::GlobalVarEntry::se, VM::AssemblerFile::_GlobVars::size, TLBTree< SymbolEntryE *, PtrListOperators< SymbolEntryE > >::store(), TLString::str(), VM::NamespaceInfo::symbol, VM::NamespaceInfo::SymbolEntryB::symref, VM::AssemblerFile::symref2globvar, VM::AssemblerFile::symref2symbol, uint, and Warning().

Referenced by _LinkerFileNeeded().

void VM::VMLinker::_MergeNamespaceAndVTableInfo  )  [private]
 

Merge namespace and class names.

For internal use only.

This will build up the master namespace/class info tree in nspc_root but and then check if the class info is compatible.

Definition at line 699 of file linker.cc.

References _CheckBaseRecursion_Recursive(), _CheckNamespaceInfo_Recursive(), _MergeNamespaceInfo_Recursive(), Assert, VM::VMLinker::FileNode::f, LinkedList< FileNode >::first(), flist, FREE(), n_errors, LinkedListBase< FileNode >::next, VM::AssemblerFile::nspc_root, out, and uint.

Referenced by LinkAll().

NamespaceInfo * VM::VMLinker::_MergeNamespaceInfo_Recursive NamespaceInfo **  head_list,
uint  nheads
[private]
 

Merge namespace and class names; recursive.

For internal use only.

Todo:
_MergeNamespaceInfo_Recursive(): Possible speedup if we memorize which d->membvar[] have

linker.cc: Could use local stack allocation ala alloca() or char buf[n] if supported. See GMP for similar implementation.

Definition at line 145 of file linker.cc.

References _unused_, VM::VMLinker::Config::abandon_out_maps, VM::NamespaceInfo::AddChild(), ImplicitMapTable< ClassInfo, TypeID, ImplicitMapOperators< ClassInfo, TypeID, ORD_TypeID > >::AddNode(), VM::NamespaceInfo::asm_loc, Assert, cfg, VM::ClassInfo::CompleteName(), LinkedList< NamespaceInfo >::count(), CritAssert, VM::NamespaceInfo::down, Error(), LinkedList< NamespaceInfo >::first(), FREE(), HeapSort(), VM::VMLinker::Config::ignore_simple_type_missing, InsertionSort(), VM::VarType::IsPointerType(), VM::NamespaceInfo::linked, master_TypeID_cnt, VM::ClassInfo::membvar, VM::NonResizeableArray< MemberVarEntry, uint32 >::n(), VM::NonResizeableArray< T, N >::n(), n_errors, VM::ClassInfo::MemberVarEntry::name, VM::NamespaceInfo::name, LinkedListBase< NamespaceInfo >::next, VM::NamespaceInfo::nstype, VM::ClassInfo::nvirtuals, VM::ClassInfo::MemberVarEntry::off, out, VM::NonResizeableArray< MemberVarEntry, uint32 >::ptr(), VM::ClassInfo::size, ssize_t, TLString::str(), VM::AssemblerFile::tid2classinfo, TLBinarySearch(), uint, and VM::ClassInfo::MemberVarEntry::vtype.

Referenced by _MergeNamespaceAndVTableInfo().

void VM::VMLinker::_PropagateUseFlags_Recursive NamespaceInfo ni  )  [private]
 

Make sure the need_* flags (need_cast) are set on all bases.

Definition at line 1181 of file linker.cc.

References _DoPropagateUseFlags(), VM::NamespaceInfo::down, LinkedList< NamespaceInfo >::first(), VM::ClassInfo::need_cast, VM::ClassInfo::need_construct, LinkedListBase< NamespaceInfo >::next, and VM::NamespaceInfo::nstype.

Referenced by LinkAll().

bool VM::VMLinker::_SQPeek LSymbol ls  )  [private]
 

Get smallest element without removal; Returns 0 if emtpy.

Definition at line 111 of file linker.cc.

References TLBTree< T, _OP >::GetSmallest(), and sq.

Referenced by LinkAll().

void VM::VMLinker::_SQPop  )  [private]
 

Pop entry from the symbol queue sq.

Definition at line 104 of file linker.cc.

References TLBTree< T, _OP >::RemoveSmallest(), and sq.

Referenced by LinkAll().

SymRef VM::VMLinker::_SQPush NamespaceInfo::SymbolEntryE ,
NamespaceInfo::SymbolEntryB **  update_se = NULL,
LSymbol::SFlag  sflag = LSymbol::SNone
[private]
 

Push entry into the symbol queue sq. Returns master symref.

Definition at line 56 of file linker.cc.

References Assert, VM::NamespaceInfo::SymbolEntryB::CompleteName(), master_SymRef_cnt, VM::VMLinker::LSymbol::se, sq, TLBTree< T, _OP >::store(), TLString::str(), VM::VMLinker::LSymbol::symref, VM::NamespaceInfo::SymbolEntryB::symref, VM::SymRef, and Warning().

Referenced by _LinkerFileNeeded(), _LinkerNeedClassConstruct(), _LinkFunction(), and LinkAll().

SymRef VM::VMLinker::_SQQuery NamespaceInfo::SymbolEntryE ni  )  [private]
 

Like _SQPush() but just query a symref for passed *ni.

Definition at line 92 of file linker.cc.

References Assert, master_SymRef_cnt, TLBTree< T, _OP >::search(), sq, VM::VMLinker::LSymbol::symref, VM::NamespaceInfo::SymbolEntryB::symref, and VM::SymRef.

Referenced by _LinkGlobalStorage().

int VM::VMLinker::AddFile AssemblerFile afile  ) 
 

Add a file to the linker.

The passed file is added to the file list in the linker. + The file must have alredy been successfully read in (i.e. without error).

The linker will take care of the file object and free it (all unneded info in it) when linking or upon destruction.

Returns:
0 on success; !=0 on error (currently cannot happen).

Definition at line 1571 of file linker.cc.

References LinkedList< FileNode >::append(), and flist.

Referenced by main().

int VM::VMLinker::LinkAll AssemblerFile out  ) 
 

Actually perform the linking.

This function will do all the necessary things to link the files.

The linking will be performed and the output is stored into the passed file which must be allocated via new, empty and newly created.

Return value: error count.

Definition at line 1241 of file linker.cc.

References _CreateInitFunction(), _GenerateSymbolProvideMap(), _GetDefinitionFile(), _LinkerFileNeeded(), _LinkFunction(), _MergeNamespaceAndVTableInfo(), _PropagateUseFlags_Recursive(), _SQPeek(), _SQPop(), _SQPush(), _unused_, VM::VMLinker::Config::abandon_out_maps, VM::AssemblerFile::abi_version, StringTreeDump::append(), VM::NamespaceInfo::asm_loc, Assert, cfg, TLBTree< T, _OP >::clear(), VM::VMLinker::SymbolProvideMap::clear(), VM::NamespaceInfo::SymbolEntryB::CompleteName(), DELETE(), VM::NamespaceInfo::DumpTree(), Error(), VM::NamespaceInfo::SymbolEntryE::extid, VM::VMLinker::FileNode::f, VM::AssemblerFile::filename, LinkedList< FileNode >::first(), flist, VM::NamespaceInfo::linked, VM::NamespaceInfo::SymbolEntryE::linked, VM::VMLinker::SymbolProvideMap::lookup(), VM::NamespaceInfo::map_name2symbol, master_SymRef_cnt, master_TypeID_cnt, n_errors, VM::NamespaceInfo::SymbolEntryE::name, VM::VMLinker::FileNode::needed, LinkedListBase< FileNode >::next, VM::NamespaceInfo::SymbolEntryE::nspc, VM::AssemblerFile::nspc_root, out, SCLocation::path(), VM::AssemblerFile::SLabelInfo::pfunc, VM::AssemblerFile::ResolveIDsNamespaceLocal(), VM::VMLinker::LSymbol::se, VM::AssemblerFile::SLabelInfo::se, VM::VMLinker::LSymbol::sflag, VM::AssemblerFile::slabel_init, VM::AssemblerFile::slabel_start, sq, TLBTree< SymbolEntryE *, PtrListOperators< SymbolEntryE > >::store(), TLString::str(), VM::NamespaceInfo::symbol, symbol_provide_map, VM::VMLinker::LSymbol::symref, VM::NamespaceInfo::SymbolEntryB::symref, VM::AssemblerFile::symref2function, VM::AssemblerFile::symref2symbol, VM::VMLinker::LSymbol::update_se, Warning(), and StringTreeDump::write().

Referenced by main().

void VM::VMLinker::operator= const VMLinker  )  [private]
 

Do not use:.

NamespaceInfo* VM::VMLinker::SPM_ORD NamespaceInfo::SymbolEntryE se  )  [inline, static]
 

Access control issues are the reason for this wrapper. Only usable for non-internal symbols.

Definition at line 73 of file linker.h.

References VM::NamespaceInfo::linked, and VM::NamespaceInfo::SymbolEntryE::nspc.

Referenced by VM::VMLinker::ProvideMapOP< T >::eq(), VM::VMLinker::ProvideMapOP< T >::le(), VM::VMLinker::ProvideMapOP< T >::lt(), and VM::VMLinker::ProvideMapOP< T >::ne().


Member Data Documentation

Config VM::VMLinker::cfg [private]
 

Configuration data stored here.

Definition at line 205 of file linker.h.

Referenced by _LinkFunction(), _LinkGlobalStorage(), _MergeNamespaceInfo_Recursive(), and LinkAll().

LinkedList<FileNode> VM::VMLinker::flist [private]
 

List of all files.

Definition at line 208 of file linker.h.

Referenced by _CreateInitFunction(), _GenerateSymbolProvideMap(), _GetDefinitionFile(), _MergeNamespaceAndVTableInfo(), AddFile(), LinkAll(), and ~VMLinker().

SymRef VM::VMLinker::master_SymRef_cnt [private]
 

SymRef counter in linked output.

Definition at line 233 of file linker.h.

Referenced by _SQPush(), _SQQuery(), and LinkAll().

TypeID VM::VMLinker::master_TypeID_cnt [private]
 

This is the TypeID counter which gets increased for each new ClassInfo in the master namespace tree. Starts with 1.

Definition at line 230 of file linker.h.

Referenced by _MergeNamespaceInfo_Recursive(), and LinkAll().

int VM::VMLinker::n_errors [private]
 

Count errors during linking:.

Definition at line 211 of file linker.h.

Referenced by _CheckBaseRecursion_Recursive(), _CheckNamespaceInfo_Recursive(), _GenerateSymbolProvideMap(), _GenerateSymbolProvideMap_AddGlobal(), _LinkFunction(), _LinkGlobalStorage(), _MergeNamespaceAndVTableInfo(), _MergeNamespaceInfo_Recursive(), and LinkAll().

AssemblerFile* VM::VMLinker::out [private]
 

The linking will put the output into this file which will hold the master namespace tree, etc:

  • nspc_root: Root of the unified namespace tree (master tree).
  • gvar_v,gvar_p: Linked (master) global storage.
  • program: All the (completely linked) functions.
This assembler file is the one passed with the LinkAll() function and allocated by somebody else. Will be freed by this class if non-NULL. To use lateron after linking, "transfer" the object by taking the pointer and assigning NULL here.

Definition at line 249 of file linker.h.

Referenced by _CheckNamespaceInfo_Recursive(), _CreateInitFunction(), _LinkerFileNeeded(), _LinkerNeedClassConstruct(), _LinkFunction(), _LinkGlobalStorage(), _MergeNamespaceAndVTableInfo(), _MergeNamespaceInfo_Recursive(), LinkAll(), and ~VMLinker().

SymbolQueue VM::VMLinker::sq [private]
 

Symbol queue for to-be-resolved symbols while linking.
NOTE: Use _SQPush() and _SQPop() to push into and pop from the queue.
NOTE: No symbol may appear more than once in the symbol queue; no already-linked symbol may be added to the queue. This means that the "linked" pointer may not be set. You MAY add 2 symbols which will, when resolved, be actually the same linked symbol.
NOTE: Internal symbols may not be pushed onto the queue. _SQPush() will detect that.

The SymbolQueue is sorted like the symbol provide map by names and then linked namespaces.

Definition at line 226 of file linker.h.

Referenced by _SQPeek(), _SQPop(), _SQPush(), _SQQuery(), and LinkAll().

SymbolProvideMap VM::VMLinker::symbol_provide_map [private]
 

Map of all provided symbols in all files. Names may appear more than once in case their namespace differs.

Definition at line 237 of file linker.h.

Referenced by _GenerateSymbolProvideMap(), _GenerateSymbolProvideMap_AddGlobal(), and LinkAll().


The documentation for this class was generated from the following files:
Generated on Sat Feb 19 22:36:21 2005 for Ray by doxygen 1.3.5