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

VM::AssemblerFile Class Reference

Represents an assembler input file. More...

#include <asmfile.h>

Inheritance diagram for VM::AssemblerFile:

Inheritance graph
[legend]
Collaboration diagram for VM::AssemblerFile:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual ~AssemblerFile ()
virtual int ParseFile (const TLString &fname, SError &error, uint32 file_num)
 Read in an assembler file.

int ResolveIDsNamespaceLocal ()
 Resolve/lookup all TypeIDs and SymRefs in the namespace tree.

virtual int WriteFile (const TLString &fname, SError &error)
 Write an assembler file.


Protected Types

typedef TLLinearQueue< GlobalVarEntry,
TLDefaultOperators_CDT< GlobalVarEntry > > 
GlobalVarList

Protected Member Functions

 AssemblerFile ()

Protected Attributes

Config cfg
 Configuration data stored here.

SCLocation filename
 Which file was read in; only the file name is set in this object.

uint32 file_num
TLString abi_version
 ABI version noted in the file.

NamespaceInfonspc_root
VM::AssemblerFile::_GlobVars gvar_v
VM::AssemblerFile::_GlobVars gvar_p
ProgramStorage program
 The program code.

ImplicitMapTable< ClassInfo,
TypeID, ImplicitMapOperators<
ClassInfo, TypeID, ORD_TypeID > > 
tid2classinfo
ImplicitMapTable< NamespaceInfo::SymbolEntryE,
SymRef, ImplicitMapOperators<
NamespaceInfo::SymbolEntryE,
SymRef, ORD_SymRef_SE > > 
symref2symbol
InternalSymbolList internal_symbols
 Like symref2symbol but for internal symbols.

InternalClassList internal_classes
IDMapTable< SymRef, ProgramStorage::Function * > symref2function
IDMapTable< SymRef, GlobalVarEntry * > symref2globvar
 This is "provide" information for global variables (non-intrnl).

VM::AssemblerFile::SLabelInfo slabel_init
 .start and and .init info, if specified (max 1 per file of each)

VM::AssemblerFile::SLabelInfo slabel_start
 .start and and .init info, if specified (max 1 per file of each)


Private Member Functions

int _ResolveIDsNamespaceLocal_Recursive (NamespaceInfo *root)
 Used by ResolveIDsNamespaceLocal().

int _ResolveSymrefsInGlobal (_GlobVars *gvar)
 Resolve SymRefs in gobal vars.

 AssemblerFile (const AssemblerFile &)
 Do not use:.

void operator= (const AssemblerFile &)

Friends

class VMLinker

Detailed Description

Represents an assembler input file.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
Contains all information in one assembler input file (either plaintext or binary assembly).

This class is NOT C++-safe.

Definition at line 54 of file asmfile.h.


Member Typedef Documentation

typedef TLLinearQueue<GlobalVarEntry, TLDefaultOperators_CDT<GlobalVarEntry> > VM::AssemblerFile::GlobalVarList [protected]
 

Definition at line 191 of file asmfile.h.


Constructor & Destructor Documentation

VM::AssemblerFile::AssemblerFile const AssemblerFile  )  [private]
 

Do not use:.

VM::AssemblerFile::AssemblerFile  )  [protected]
 

Constructor creates empty "assembler file content"; use derived class.

Definition at line 250 of file asmfile.cc.

References nspc_root, VM::AssemblerFile::SLabelInfo::pfunc, slabel_init, and slabel_start.

VM::AssemblerFile::~AssemblerFile  )  [virtual]
 

Destructor frees everything including the info tree and program memory.

Definition at line 270 of file asmfile.cc.

References DELETE(), nspc_root, VM::AssemblerFile::SLabelInfo::pfunc, slabel_init, and slabel_start.


Member Function Documentation

int VM::AssemblerFile::_ResolveIDsNamespaceLocal_Recursive NamespaceInfo root  )  [private]
 

Used by ResolveIDsNamespaceLocal().

For internal use only.

Definition at line 100 of file asmfile.cc.

References VM::NamespaceInfo::asm_loc, Assert, VM::ClassInfo::base, VM::ClassInfo::BaseEntry::ci, VM::ClassInfo::CompleteName(), VM::NamespaceInfo::down, Error(), filename, LinkedList< NamespaceInfo >::first(), internal_classes, internal_symbols, ImplicitMapTable< ClassInfo, TypeID, ImplicitMapOperators< ClassInfo, TypeID, ORD_TypeID > >::lookup(), VM::AssemblerFile::InternalSymbolList::LookupStore(), VM::AssemblerFile::InternalClassList::LookupStore(), VM::NonResizeableArray< VTableEntry, uint32 >::n(), VM::NonResizeableArray< BaseEntry, uint32 >::n(), LinkedListBase< NamespaceInfo >::next, VM::NamespaceInfo::nstype, TLString::str(), symref2symbol, VM::ClassInfo::BaseEntry::tid, tid2classinfo, uint32, and VM::ClassInfo::vtable.

Referenced by ResolveIDsNamespaceLocal().

int VM::AssemblerFile::_ResolveSymrefsInGlobal _GlobVars gvar  )  [private]
 

Resolve SymRefs in gobal vars.

For internal use only.

Definition at line 174 of file asmfile.cc.

References Assert, Error(), filename, VM::AssemblerFile::_GlobVars::globvarq, and symref2symbol.

Referenced by ResolveIDsNamespaceLocal().

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

int VM::AssemblerFile::ParseFile const TLString fname,
SError error,
uint32  file_num
[virtual]
 

Read in an assembler file.

Read in file named fname; errors during opening are returned in error, parse errors are reported directly to the user.

Note: Only one file may be read in. You need to use multiple AssemblerFile objects for more than one file.

file_num is a serial number for the file used to make non-exported symbol names unique.

Returns number of errors.

Reimplemented in VM::AssemblerFile_Plaintext.

Definition at line 235 of file asmfile.cc.

References CritAssert, and uint32.

int VM::AssemblerFile::ResolveIDsNamespaceLocal  ) 
 

Resolve/lookup all TypeIDs and SymRefs in the namespace tree.

This will resolve all TypeIDs in all namespace nodes in the tree (i.e. class base entries) but not in the program section. Also, all SymRefs in the vtables and global vars of the file as well as the SymRef labels (i.e. symref entries in ProgramStorage::Function) will be resolved into SymbolEntry's.

This means, that after the call, the ID-and-Pointer unions hold the correct value in the pointer member and the ID member is invalid (see ClassInfo::VTableEntry, ClassInfo::BaseEntry).

Returns number of errors.

Definition at line 197 of file asmfile.cc.

References _ResolveIDsNamespaceLocal_Recursive(), _ResolveSymrefsInGlobal(), Assert, Error(), VM::ProgramStorage::FirstFunction(), gvar_p, gvar_v, VM::ProgramStorage::Function::loc, LinkedListBase< Function >::next, nspc_root, VM::AssemblerFile::SLabelInfo::pfunc, program, VM::ProgramStorage::Function::se, slabel_init, slabel_start, VM::ProgramStorage::Function::symref, and symref2symbol.

Referenced by VM::VMLinker::LinkAll().

int VM::AssemblerFile::WriteFile const TLString fname,
SError error
[virtual]
 

Write an assembler file.

This function will write the current content of the class to the passed assembler file. Possible file IO error is returned in the SError object.

Returns 0 on sucess, non-zero on failure.

Reimplemented in VM::AssemblerFile_Plaintext.

Definition at line 243 of file asmfile.cc.

References CritAssert.

Referenced by main().


Friends And Related Function Documentation

friend class VMLinker [friend]
 

Definition at line 56 of file asmfile.h.


Member Data Documentation

TLString VM::AssemblerFile::abi_version [protected]
 

ABI version noted in the file.

Definition at line 184 of file asmfile.h.

Referenced by VM::VMLinker::LinkAll().

Config VM::AssemblerFile::cfg [protected]
 

Configuration data stored here.

Definition at line 174 of file asmfile.h.

uint32 VM::AssemblerFile::file_num [protected]
 

Serial number of the file assigned when reading in the file used to make unique non-exported symbol names.

Definition at line 181 of file asmfile.h.

SCLocation VM::AssemblerFile::filename [protected]
 

Which file was read in; only the file name is set in this object.

Definition at line 177 of file asmfile.h.

Referenced by VM::VMLinker::_GenerateSymbolProvideMap_AddGlobal(), VM::VMLinker::_LinkGlobalStorage(), _ResolveIDsNamespaceLocal_Recursive(), _ResolveSymrefsInGlobal(), and VM::VMLinker::LinkAll().

struct VM::AssemblerFile::_GlobVars VM::AssemblerFile::gvar_p [protected]
 

Referenced by VM::VMLinker::_GenerateSymbolProvideMap(), VM::VMLinker::_LinkerFileNeeded(), and ResolveIDsNamespaceLocal().

struct VM::AssemblerFile::_GlobVars VM::AssemblerFile::gvar_v [protected]
 

Referenced by VM::VMLinker::_GenerateSymbolProvideMap(), VM::VMLinker::_LinkerFileNeeded(), and ResolveIDsNamespaceLocal().

InternalClassList VM::AssemblerFile::internal_classes [protected]
 

Like internal_symbols for internal TypeIDs. Well, somebody must take care of the memory and allocation...

Definition at line 220 of file asmfile.h.

Referenced by VM::VMLinker::_CheckNamespaceInfo_Recursive(), and _ResolveIDsNamespaceLocal_Recursive().

InternalSymbolList VM::AssemblerFile::internal_symbols [protected]
 

Like symref2symbol but for internal symbols.

Definition at line 217 of file asmfile.h.

Referenced by VM::VMLinker::_LinkerNeedClassConstruct(), and _ResolveIDsNamespaceLocal_Recursive().

NamespaceInfo* VM::AssemblerFile::nspc_root [protected]
 

Root of the namespace / class info tree. Note: Root is always plain NamespaceInfo and name is a NULL ref.

Definition at line 188 of file asmfile.h.

Referenced by VM::VMLinker::_CreateInitFunction(), VM::VMLinker::_GenerateSymbolProvideMap(), VM::VMLinker::_GetDefinitionFile(), VM::VMLinker::_MergeNamespaceAndVTableInfo(), AssemblerFile(), VM::VMLinker::LinkAll(), ResolveIDsNamespaceLocal(), and ~AssemblerFile().

ProgramStorage VM::AssemblerFile::program [protected]
 

The program code.

Definition at line 203 of file asmfile.h.

Referenced by VM::VMLinker::_CreateInitFunction(), VM::VMLinker::_GenerateSymbolProvideMap(), VM::VMLinker::_LinkFunction(), and ResolveIDsNamespaceLocal().

struct VM::AssemblerFile::SLabelInfo VM::AssemblerFile::slabel_init [protected]
 

.start and and .init info, if specified (max 1 per file of each)

Referenced by VM::VMLinker::_CreateInitFunction(), VM::VMLinker::_LinkerFileNeeded(), AssemblerFile(), VM::VMLinker::LinkAll(), ResolveIDsNamespaceLocal(), and ~AssemblerFile().

struct VM::AssemblerFile::SLabelInfo VM::AssemblerFile::slabel_start [protected]
 

.start and and .init info, if specified (max 1 per file of each)

Referenced by VM::VMLinker::_LinkFunction(), AssemblerFile(), VM::VMLinker::LinkAll(), ResolveIDsNamespaceLocal(), and ~AssemblerFile().

IDMapTable<SymRef,ProgramStorage::Function*> VM::AssemblerFile::symref2function [protected]
 

Mapping SYMREF -> program function (in current file; in linked list in program). This is "provide" information for functions. Not for ".init"/".start" Non-internal symbols, only.

Definition at line 228 of file asmfile.h.

Referenced by VM::VMLinker::_LinkFunction(), and VM::VMLinker::LinkAll().

IDMapTable<SymRef,GlobalVarEntry*> VM::AssemblerFile::symref2globvar [protected]
 

This is "provide" information for global variables (non-intrnl).

Definition at line 231 of file asmfile.h.

Referenced by VM::VMLinker::_LinkGlobalStorage().

ImplicitMapTable< NamespaceInfo::SymbolEntryE,SymRef, ImplicitMapOperators<NamespaceInfo::SymbolEntryE,SymRef, ORD_SymRef_SE> > VM::AssemblerFile::symref2symbol [protected]
 

Mapping SYMREF -> symbol name + info; for this file, only. This is "need/map" information. Non-internal symbols, only.

Definition at line 214 of file asmfile.h.

Referenced by VM::VMLinker::_LinkFunction(), VM::VMLinker::_LinkGlobalStorage(), _ResolveIDsNamespaceLocal_Recursive(), _ResolveSymrefsInGlobal(), VM::VMLinker::LinkAll(), and ResolveIDsNamespaceLocal().

ImplicitMapTable< ClassInfo,TypeID, ImplicitMapOperators<ClassInfo,TypeID,ORD_TypeID> > VM::AssemblerFile::tid2classinfo [protected]
 

Mapping TYPEID -> ClassInfo for this file, only. Non-internal TypeIDs, only.

Definition at line 208 of file asmfile.h.

Referenced by VM::VMLinker::_LinkFunction(), VM::VMLinker::_MergeNamespaceInfo_Recursive(), and _ResolveIDsNamespaceLocal_Recursive().


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