Changeset 276 in dev for trunk/abdev/BasicCompiler_Common/src
- Timestamp:
- Aug 12, 2007, 1:25:20 AM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler_Common/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/src/Class.cpp
r272 r276 732 732 if(!pUserProc) continue; 733 733 734 // 古いOpBufferを利用する場合は_beginOpAddressOldでないとダメ735 //pVtbl[i]=pUserProc->_beginOpAddressOld+ImageBase+MemPos_CodeSection;736 734 pVtbl[i]=pUserProc->GetBeginOpAddress()+ImageBase+MemPos_CodeSection; 737 735 } … … 954 952 member->GetConstructParameter().c_str(), 955 953 0); 956 957 //ネイティブコードバッファの再確保958 ReallocNativeCodeBuffer();959 954 960 955 i++; … … 1502 1497 // コンパイル 1503 1498 ChangeOpcode( temporary ); 1504 1505 // ネイティブコードバッファの再確保1506 ReallocNativeCodeBuffer();1507 1499 } 1508 1500 … … 1550 1542 ChangeOpcode( temporary ); 1551 1543 } 1552 1553 // ネイティブコードバッファの再確保1554 ReallocNativeCodeBuffer();1555 1544 } 1556 1545 -
trunk/abdev/BasicCompiler_Common/src/CodeGenerator.cpp
r206 r276 4 4 #include <stdlib.h> 5 5 6 int obp,obp_AllocSize;7 6 int GlobalOpBufferSize; 8 char *OpBuffer;9 void ReallocNativeCodeBuffer(){10 if(obp_AllocSize<obp+8192){11 obp_AllocSize+=8192;12 OpBuffer=(char *)realloc(OpBuffer,obp_AllocSize); //matea13 }14 } -
trunk/abdev/BasicCompiler_Common/src/CommonCodeGenerator.cpp
r254 r276 9 9 { 10 10 pNativeCode->Overwrite( exitSubCodePosition, (long)( pNativeCode->GetSize()-(exitSubCodePosition+sizeof(long)) ) ); 11 }12 13 // TODO: 未完成14 BOOST_FOREACH( long exitSubCodePositionOld, _exitSubCodePositions_ObpOld )15 {16 extern int obp;17 pNativeCode->OverwriteOld( exitSubCodePositionOld, (long)( obp-(exitSubCodePositionOld+sizeof(long)) ) );18 11 } 19 12 } … … 45 38 46 39 pNativeCode->Overwrite( pPertialSchedule->GetCodePos(), (char)newValue ); 47 48 // TODO: 未完成(用が無くなったら消す)49 pNativeCode->OverwriteOld( pPertialSchedule->GetObpOld(), (char)newValue );50 40 } 51 41 else if( pPertialSchedule->GetTypeSize() == sizeof(long) ) 52 42 { 53 43 pNativeCode->Overwrite( pPertialSchedule->GetCodePos(), newValue ); 54 55 // TODO: 未完成(用が無くなったら消す)56 pNativeCode->OverwriteOld( pPertialSchedule->GetObpOld(), newValue );57 44 } 58 45 else … … 94 81 pNativeCode->GetLong(pPertialSchedule->GetCodePos()) + offset 95 82 ); 96 97 // TODO: 未完成(用が無くなったら消す)98 pNativeCode->OverwriteOld(99 pPertialSchedule->GetObpOld(),100 pNativeCode->_GetLong_ObpOld(pPertialSchedule->GetObpOld()) + offset101 );102 83 } 103 84 else … … 136 117 { 137 118 long newValue = pNativeCode->GetSize() - (pPertialSchedule->GetCodePos()+pPertialSchedule->GetTypeSize()); 138 139 extern int obp;140 long newValueOld = obp - (pPertialSchedule->GetObpOld()+pPertialSchedule->GetTypeSize());141 119 142 120 if( pPertialSchedule->GetTypeSize() == sizeof(char) ) … … 149 127 150 128 pNativeCode->Overwrite( pPertialSchedule->GetCodePos(), (char)newValue ); 151 152 // TODO: 未完成(用が無くなったら消す)153 pNativeCode->OverwriteOld( pPertialSchedule->GetObpOld(), (char)newValueOld );154 129 } 155 130 else if( pPertialSchedule->GetTypeSize() == sizeof(long) ) 156 131 { 157 132 pNativeCode->Overwrite( pPertialSchedule->GetCodePos(), newValue ); 158 159 // TODO: 未完成(用が無くなったら消す)160 pNativeCode->OverwriteOld( pPertialSchedule->GetObpOld(), newValueOld );161 133 } 162 134 else … … 184 156 { 185 157 long beginCodePos = pNativeCode->GetSize(); 186 {187 // TODO: 未完成188 extern int obp;189 beginCodePos = obp;190 }191 158 192 159 if( opcode == (char)0xEB ) … … 233 200 { 234 201 // 自分自身の命令サイズを考慮する場合 235 //offset += ( pNativeCode->GetSize() - beginCodePos ) + op_size; 236 237 // TODO: 未完成 238 extern int obp; 239 offset -= ( obp - beginCodePos ) + op_size; 202 offset -= ( pNativeCode->GetSize() - beginCodePos ) + op_size; 240 203 } 241 204 … … 301 264 void CodeGenerator::op_jmp_continue() 302 265 { 303 ////////////////////////////////////304 // エラー検出(必要なくなったら消す)305 extern int obp;306 if( GetContinueCodePosOld()-obp != GetContinueCodePos()-pNativeCode->GetSize() )307 {308 int continueCodePosOld = GetContinueCodePosOld();309 int continueCodePos = GetContinueCodePos();310 int size = pNativeCode->GetSize();311 int test=0;312 SetError();313 }314 ////////////////////////////////////315 316 317 266 if( GetContinueCodePos() == -1 ) 318 267 { … … 328 277 329 278 exitSubCodePositions.push_back( pNativeCode->GetSize() ); 330 331 extern int obp;332 _exitSubCodePositions_ObpOld.push_back( obp );333 279 334 280 pNativeCode->Put( (long)0 ); -
trunk/abdev/BasicCompiler_Common/src/LexicalScope.cpp
r265 r276 79 79 if(pVar->bLiving&&pVar->GetScopeLevel()==level){ 80 80 pVar->bLiving=0; 81 extern int obp; 82 pVar->SetScopeEndAddress( obp ); 81 pVar->SetScopeEndAddress( compiler.codeGenerator.GetNativeCodeSize() ); 83 82 } 84 83 } -
trunk/abdev/BasicCompiler_Common/src/Linker.cpp
r273 r276 110 110 } 111 111 112 nativeCode.Put( masterObjectModule.globalNativeCode , false);112 nativeCode.Put( masterObjectModule.globalNativeCode ); 113 113 114 114 masterObjectModule.meta.GetUserProcs().Iterator_Reset(); … … 117 117 const UserProc *pUserProc = masterObjectModule.meta.GetUserProcs().Iterator_GetNext(); 118 118 119 if( pUserProc-> IsUsing())119 if( pUserProc->GetNativeCode().GetSize() > 0 ) 120 120 { 121 121 pUserProc->SetBeginOpAddress( nativeCode.GetSize() ); 122 122 123 nativeCode.Put( pUserProc->GetNativeCode() , false);123 nativeCode.Put( pUserProc->GetNativeCode() ); 124 124 125 125 pUserProc->SetEndOpAddress( nativeCode.GetSize() ); -
trunk/abdev/BasicCompiler_Common/src/NativeCode.cpp
r273 r276 6 6 #define BREAK_EIP(checkEip) (obp+0x00401000>=checkEip) 7 7 8 void ObpPlus( int step ) 9 { 10 extern int obp; 11 obp += step; 12 13 // 例:epi=0x00401999 14 if( BREAK_EIP(0x00433FD7) ) 15 { 16 int test=0; 17 } 18 } 19 20 void NativeCode::Put( const NativeCode &nativeCode, bool isOpBuffer ) 8 void NativeCode::Put( const NativeCode &nativeCode ) 21 9 { 22 10 long baseOffset = size; 23 11 24 12 // コードバッファを追加 25 Put( nativeCode.codeBuffer, nativeCode.size , isOpBuffer);13 Put( nativeCode.codeBuffer, nativeCode.size ); 26 14 27 15 // スケジュールを追加 … … 64 52 *((long *)(codeBuffer+size))=0; 65 53 size += sizeof(long); 66 67 68 69 // 未完成70 if( isCall )71 {72 pobj_SubAddrSchedule->add(pUserProc,1);73 }74 else75 {76 pobj_SubAddrSchedule->add(pUserProc,0);77 }78 extern char *OpBuffer;79 extern int obp;80 *((long *)(OpBuffer+obp))=0;81 ObpPlus( sizeof(long) );82 54 } 83 55 … … 90 62 *((long *)(codeBuffer+size))=0; 91 63 size += sizeof(long); 92 93 94 95 // 未完成96 pobj_ImportAddrSchedule->add(pDllProc);97 extern char *OpBuffer;98 extern int obp;99 *((long *)(OpBuffer+obp))=0;100 ObpPlus( sizeof(long) );101 64 } 102 65 -
trunk/abdev/BasicCompiler_Common/src/ObjectModule.cpp
r274 r276 8 8 meta.StaticLink( objectModule.meta, dataTable.GetSize() ); 9 9 10 // ネイティブコードを結合 11 globalNativeCode.Put( objectModule.globalNativeCode ); 12 globalNativeCode.ResetDataSectionBaseOffset( dataTable.GetSize() ); 13 10 14 // データテーブルを結合 11 15 dataTable.Add( objectModule.dataTable );
Note:
See TracChangeset
for help on using the changeset viewer.