Changeset 273 in dev for trunk/abdev/BasicCompiler_Common/src
- Timestamp:
- Aug 11, 2007, 4:03:49 PM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler_Common/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/src/Compiler.cpp
r270 r273 13 13 { 14 14 // メタ情報 15 pNowObjectModule-> meta.StaticLink( pStaticLibrary->meta);15 pNowObjectModule->StaticLink( *pStaticLibrary ); 16 16 } 17 17 } -
trunk/abdev/BasicCompiler_Common/src/DataTable.cpp
r256 r273 7 7 #include <memory.h> 8 8 #include <stdlib.h> 9 10 void DataTable::Realloc( int size )11 {12 this->buffer = (char *)realloc( this->buffer, size + 100 );13 this->size = size;14 }15 9 16 10 int DataTable::AddBinary( const void *buffer, int size ){ -
trunk/abdev/BasicCompiler_Common/src/Linker.cpp
r263 r273 78 78 void Linker::ResolveGlobalVarSchedules( long rwSectionBaseOffset ) 79 79 { 80 int allInitVarSize = compiler.GetObjectModule().meta.GetGlobalVars().GetAllInitSize(); 81 80 82 BOOST_FOREACH( const Schedule &schedule, nativeCode.GetSchedules() ) 81 83 { … … 84 86 if( nativeCode.GetLong( schedule.GetOffset() ) & 0x80000000 ) 85 87 { 86 extern int AllInitGlobalVarSize;87 88 nativeCode.Overwrite( 88 89 schedule.GetOffset(), 89 static_cast<long>( AllInitGlobalVarSize + (nativeCode.GetLong( schedule.GetOffset() ) & 0x7FFFFFFF) + imageBase + rwSectionBaseOffset )90 static_cast<long>( allInitVarSize + (nativeCode.GetLong( schedule.GetOffset() ) & 0x7FFFFFFF) + imageBase + rwSectionBaseOffset ) 90 91 ); 91 92 } … … 101 102 } 102 103 103 void Linker::Link( vector<ObjectModule *> &objectModules)104 void Linker::Link( ObjectModule &masterObjectModule ) 104 105 { 105 106 // nativeCodeは初期状態でなければならない … … 108 109 SetError(); 109 110 } 110 111 /*112 BOOST_FOREACH( ObjectModule *pObjectModule, objectModules )113 {114 }*/115 ObjectModule &masterObjectModule = *objectModules[0];116 111 117 112 nativeCode.Put( masterObjectModule.globalNativeCode, false ); -
trunk/abdev/BasicCompiler_Common/src/Meta.cpp
r272 r273 36 36 } 37 37 38 void Meta::StaticLink( Meta &meta )38 void Meta::StaticLink( Meta &meta, long dataSectionBaseOffset ) 39 39 { 40 40 // 名前空間 … … 53 53 UserProc *pUserProc = meta.GetUserProcs().Iterator_GetNext(); 54 54 pUserProc->isTargetObjectModule = false; 55 56 pUserProc->GetNativeCode().ResetDataSectionBaseOffset( dataSectionBaseOffset ); 57 55 58 this->userProcs.Put( pUserProc ); 56 59 } -
trunk/abdev/BasicCompiler_Common/src/NativeCode.cpp
r263 r273 125 125 sourceLines.push_back( SourceLine( (long)sourceLines.size(), size, cp, sourceLineType ) ); 126 126 } 127 128 void NativeCode::ResetDataSectionBaseOffset( long dataSectionBaseOffset ) 129 { 130 BOOST_FOREACH( const Schedule &schedule, schedules ) 131 { 132 if( schedule.GetType() == Schedule::DataTable ) 133 { 134 Overwrite( 135 schedule.GetOffset(), 136 GetLong( schedule.GetOffset() ) + dataSectionBaseOffset 137 ); 138 } 139 } 140 } -
trunk/abdev/BasicCompiler_Common/src/Variable.cpp
r248 r273 73 73 return NULL; 74 74 } 75 76 void Variables::Add( Variable *pVar, bool isInitArea ) 77 { 78 int alignment = 0; 79 if( pVar->GetType().IsStruct() ){ 80 alignment = pVar->GetType().GetClass().GetFixedAlignment(); 81 } 82 83 if( isInitArea ){ 84 //初期バッファがあるとき 85 86 if( alignment ){ 87 if( allInitSize % alignment ){ 88 allInitSize += alignment - (allInitSize % alignment); 89 } 90 } 91 92 pVar->SetOffsetAddress( allInitSize ); 93 allInitSize += pVar->GetMemorySize(); 94 } 95 else{ 96 //初期バッファがないとき 97 98 if( alignment ){ 99 if( allSize % alignment ){ 100 allSize += alignment - (allSize % alignment); 101 } 102 } 103 104 pVar->SetOffsetAddress( allSize | 0x80000000 ); 105 allSize += pVar->GetMemorySize(); 106 } 107 108 push_back( pVar ); 109 }
Note:
See TracChangeset
for help on using the changeset viewer.