Changeset 223 in dev for trunk/abdev
- Timestamp:
- Jul 19, 2007, 3:38:13 AM (17 years ago)
- Location:
- trunk/abdev
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/MakePeHdr.cpp
r215 r223 1053 1053 1054 1054 1055 /////////////////////////////1056 // GC用の変数スケジュール1057 /////////////////////////////1058 PerformedGcVarSchedule();1059 1060 1061 1062 1055 //////////////////////////// 1063 1056 // エクスポート情報の再配置 -
trunk/abdev/BasicCompiler64/MakePeHdr.cpp
r220 r223 1057 1057 1058 1058 1059 /////////////////////////////1060 // GC用の変数スケジュール1061 /////////////////////////////1062 PerformedGcVarSchedule();1063 1064 1065 1059 //////////////////////////// 1066 1060 // エクスポート情報の再配置 -
trunk/abdev/BasicCompiler_Common/PESchedule.cpp
r206 r223 25 25 length=0; 26 26 NowPageRVAToReloc=0; 27 28 pdwData_CodeSection=(DWORD *)HeapAlloc(hHeap,0,1);29 iNum_CodeSection=0;30 pdwData_DataSection=(DWORD *)HeapAlloc(hHeap,0,1);31 iNum_DataSection=0;32 27 } 33 28 CReloc::~CReloc(){ … … 39 34 buffer=0; 40 35 } 41 42 HeapDefaultFree(pdwData_CodeSection);43 HeapDefaultFree(pdwData_DataSection);44 36 } 45 37 void CReloc::copy(CReloc *por){ … … 57 49 NowCountAddrToReloc=por->NowCountAddrToReloc; 58 50 59 iNum_CodeSection=por->iNum_CodeSection; 60 pdwData_CodeSection=(DWORD *)HeapAlloc(hHeap,0,iNum_CodeSection*sizeof(DWORD)); 61 memcpy(pdwData_CodeSection,por->pdwData_CodeSection,iNum_CodeSection*sizeof(DWORD)); 62 63 iNum_DataSection=por->iNum_DataSection; 64 pdwData_DataSection=(DWORD *)HeapAlloc(hHeap,0,iNum_DataSection*sizeof(DWORD)); 65 memcpy(pdwData_DataSection,por->pdwData_DataSection,iNum_DataSection*sizeof(DWORD)); 51 codeSectionAddresses = por->codeSectionAddresses; 52 53 dataSectionAddresses = por->dataSectionAddresses; 66 54 } 67 55 … … 70 58 if(!bDll) return; 71 59 72 pdwData_CodeSection=(DWORD *)HeapReAlloc(hHeap,0,pdwData_CodeSection,(iNum_CodeSection+1)*sizeof(DWORD)); 73 pdwData_CodeSection[iNum_CodeSection]=addr; 74 iNum_CodeSection++; 60 codeSectionAddresses.push_back( addr ); 75 61 } 76 62 void CReloc::AddSchedule_DataSection(DWORD addr){ … … 78 64 if(!bDll) return; 79 65 80 pdwData_DataSection=(DWORD *)HeapReAlloc(hHeap,0,pdwData_DataSection,(iNum_DataSection+1)*sizeof(DWORD)); 81 pdwData_DataSection[iNum_DataSection]=addr; 82 iNum_DataSection++; 66 dataSectionAddresses.push_back( addr ); 83 67 } 84 68 … … 136 120 NowPageRVAToReloc=0; 137 121 138 int i;139 for(i=0;i<iNum_CodeSection;i++){122 BOOST_FOREACH( DWORD addr, codeSectionAddresses ) 123 { 140 124 extern int MemPos_CodeSection; 141 __add(MemPos_CodeSection + pdwData_CodeSection[i]); 142 } 143 144 for(i=0;i<iNum_DataSection;i++){ 125 __add(MemPos_CodeSection + addr); 126 } 127 128 BOOST_FOREACH( DWORD addr, dataSectionAddresses ) 129 { 145 130 extern int MemPos_DataSection; 146 __add(MemPos_DataSection + pdwData_DataSection[i]);131 __add(MemPos_DataSection + addr); 147 132 } 148 133 } -
trunk/abdev/BasicCompiler_Common/PESchedule.h
r206 r223 22 22 23 23 private: 24 DWORD *pdwData_CodeSection; 25 int iNum_CodeSection; 24 std::vector<DWORD> codeSectionAddresses; 26 25 public: 27 26 void AddSchedule_CodeSection(DWORD addr); 28 27 29 28 private: 30 DWORD *pdwData_DataSection; 31 int iNum_DataSection; 29 std::vector<DWORD> dataSectionAddresses; 32 30 public: 33 31 void AddSchedule_DataSection(DWORD addr); -
trunk/abdev/BasicCompiler_Common/common.h
r209 r223 389 389 //gc.cpp 390 390 void InitGCVariables(void); 391 void PerformedGcVarSchedule(void);392 391 393 392 -
trunk/abdev/BasicCompiler_Common/gc.cpp
r206 r223 9 9 #endif 10 10 11 int Schedule_GlobalRoot_StartPtr;12 int Schedule_GlobalRoot_Size;13 14 11 void InitGCVariables(void){ 15 12 char temporary[255]; 16 17 18 ///////////////////////////////19 // グローバル変数の開始位置20 ///////////////////////////////21 22 sprintf(temporary,"_System_gc_GlobalRoot_StartPtr%c%cVoidPtr",1,ESC_AS);23 OpcodeDim(temporary,0);24 25 13 Type type; 26 14 RELATIVE_VAR RelativeVar; 27 GetVarOffsetReadWrite("_System_gc_GlobalRoot_StartPtr",&RelativeVar,type);28 29 //mov rax,ptr30 op_mov_RV(PTR_SIZE,REG_RAX,0);31 Schedule_GlobalRoot_StartPtr=obp-sizeof(long);32 33 //mov ptr[offset],rax/eax34 op_mov_MR(PTR_SIZE,REG_RAX,0,(int)RelativeVar.offset,MOD_DISP32);35 obp-=sizeof(long);36 pobj_GlobalVarSchedule->add();37 obp+=sizeof(long);38 39 40 ///////////////////////////////41 // グローバル変数の大きさ42 ///////////////////////////////43 44 sprintf(temporary,"_System_gc_GlobalRoot_Size%c%cLong",1,ESC_AS);45 OpcodeDim(temporary,0);46 47 GetVarOffsetReadWrite("_System_gc_GlobalRoot_Size",&RelativeVar,type);48 49 //mov rax,ptr50 op_mov_RV(PTR_SIZE,REG_RAX,0);51 Schedule_GlobalRoot_Size=obp-sizeof(long);52 53 //mov ptr[offset],rax/eax54 op_mov_MR(PTR_SIZE,REG_RAX,0,(int)RelativeVar.offset,MOD_DISP32);55 obp-=sizeof(long);56 pobj_GlobalVarSchedule->add();57 obp+=sizeof(long);58 59 15 60 16 … … 78 34 79 35 } 80 81 void PerformedGcVarSchedule(void){82 //グローバル変数領域の開始位置83 extern DWORD ImageBase;84 extern int MemPos_RWSection;85 *((long *)(OpBuffer+Schedule_GlobalRoot_StartPtr))=ImageBase+MemPos_RWSection;86 pobj_Reloc->AddSchedule_CodeSection(Schedule_GlobalRoot_StartPtr);87 88 //グローバル変数領域のサイズ89 extern int AllInitGlobalVarSize;90 extern int AllGlobalVarSize;91 *((long *)(OpBuffer+Schedule_GlobalRoot_Size))=AllInitGlobalVarSize+AllGlobalVarSize;92 }
Note:
See TracChangeset
for help on using the changeset viewer.