Changeset 223 in dev


Ignore:
Timestamp:
Jul 19, 2007, 3:38:13 AM (17 years ago)
Author:
dai_9181
Message:
 
Location:
trunk/abdev
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/abdev/BasicCompiler32/MakePeHdr.cpp

    r215 r223  
    10531053
    10541054
    1055     /////////////////////////////
    1056     // GC用の変数スケジュール
    1057     /////////////////////////////
    1058     PerformedGcVarSchedule();
    1059 
    1060 
    1061 
    10621055    ////////////////////////////
    10631056    // エクスポート情報の再配置
  • trunk/abdev/BasicCompiler64/MakePeHdr.cpp

    r220 r223  
    10571057
    10581058
    1059     /////////////////////////////
    1060     // GC用の変数スケジュール
    1061     /////////////////////////////
    1062     PerformedGcVarSchedule();
    1063 
    1064 
    10651059    ////////////////////////////
    10661060    // エクスポート情報の再配置
  • trunk/abdev/BasicCompiler_Common/PESchedule.cpp

    r206 r223  
    2525    length=0;
    2626    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;
    3227}
    3328CReloc::~CReloc(){
     
    3934        buffer=0;
    4035    }
    41 
    42     HeapDefaultFree(pdwData_CodeSection);
    43     HeapDefaultFree(pdwData_DataSection);
    4436}
    4537void CReloc::copy(CReloc *por){
     
    5749    NowCountAddrToReloc=por->NowCountAddrToReloc;
    5850
    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;
    6654}
    6755
     
    7058    if(!bDll) return;
    7159
    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 );
    7561}
    7662void CReloc::AddSchedule_DataSection(DWORD addr){
     
    7864    if(!bDll) return;
    7965
    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 );
    8367}
    8468
     
    136120    NowPageRVAToReloc=0;
    137121
    138     int i;
    139     for(i=0;i<iNum_CodeSection;i++){
     122    BOOST_FOREACH( DWORD addr, codeSectionAddresses )
     123    {
    140124        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    {
    145130        extern int MemPos_DataSection;
    146         __add(MemPos_DataSection + pdwData_DataSection[i]);
     131        __add(MemPos_DataSection + addr);
    147132    }
    148133}
  • trunk/abdev/BasicCompiler_Common/PESchedule.h

    r206 r223  
    2222
    2323private:
    24     DWORD *pdwData_CodeSection;
    25     int iNum_CodeSection;
     24    std::vector<DWORD> codeSectionAddresses;
    2625public:
    2726    void AddSchedule_CodeSection(DWORD addr);
    2827
    2928private:
    30     DWORD *pdwData_DataSection;
    31     int iNum_DataSection;
     29    std::vector<DWORD> dataSectionAddresses;
    3230public:
    3331    void AddSchedule_DataSection(DWORD addr);
  • trunk/abdev/BasicCompiler_Common/common.h

    r209 r223  
    389389//gc.cpp
    390390void InitGCVariables(void);
    391 void PerformedGcVarSchedule(void);
    392391
    393392
  • trunk/abdev/BasicCompiler_Common/gc.cpp

    r206 r223  
    99#endif
    1010
    11 int Schedule_GlobalRoot_StartPtr;
    12 int Schedule_GlobalRoot_Size;
    13 
    1411void InitGCVariables(void){
    1512    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 
    2513    Type type;
    2614    RELATIVE_VAR RelativeVar;
    27     GetVarOffsetReadWrite("_System_gc_GlobalRoot_StartPtr",&RelativeVar,type);
    28 
    29     //mov rax,ptr
    30     op_mov_RV(PTR_SIZE,REG_RAX,0);
    31     Schedule_GlobalRoot_StartPtr=obp-sizeof(long);
    32 
    33     //mov ptr[offset],rax/eax
    34     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,ptr
    50     op_mov_RV(PTR_SIZE,REG_RAX,0);
    51     Schedule_GlobalRoot_Size=obp-sizeof(long);
    52 
    53     //mov ptr[offset],rax/eax
    54     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 
    5915
    6016
     
    7834
    7935}
    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.