Changeset 95 in dev for BasicCompiler32


Ignore:
Timestamp:
Apr 15, 2007, 1:34:02 AM (17 years ago)
Author:
dai_9181
Message:

RegisterGlobalRootsの自動生成に対応

Location:
BasicCompiler32
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler32/Compile_ProcOp.cpp

    r94 r95  
    214214
    215215            pobj_DBClass->Compile_System_InitializeUserTypes();
     216    }
     217    else if( userProc.GetName() == "RegisterGlobalRoots"
     218        && userProc.HasParentClass()
     219        && (string)userProc.GetParentClass().name == "_System_CGarbageCollection" ){
     220
     221            Compile_AddGlobalRootsForGc();
    216222    }
    217223    else{
  • BasicCompiler32/Compile_Var.cpp

    r89 r95  
    13181318    }
    13191319}
     1320
     1321bool Compile_AddGlobalRootsForGc(){
     1322    UserProc *pUserProc_AddGlobalRootPtr = GetClassMethod( "_System_CGarbageCollection", "AddGlobalRootPtr" );
     1323    if( !pUserProc_AddGlobalRootPtr ){
     1324        SetError(3, "_System_CGarbageCollection.AddGlobalRootPtr", -1 );
     1325        return false;
     1326    }
     1327
     1328    BOOST_FOREACH( const Variable *pVar, globalVars ){
     1329        if( pVar->IsObject() || pVar->IsPointer() || pVar->IsStruct() ){
     1330            // オブジェクトまたはポインタだったとき
     1331            // ※構造体も含む(暫定対応)
     1332
     1333            // 変数領域に要するLONG_PTR単位の個数を引き渡す
     1334            op_push_V( pVar->GetMemorySize()/PTR_SIZE );
     1335
     1336
     1337            /////////////////////////////
     1338            // ルートポインタを引き渡す
     1339
     1340            //mov eax,offset
     1341            op_mov_RV(REG_EAX,(int)pVar->offset);
     1342            obp-=sizeof(long);
     1343            pobj_GlobalVarSchedule->add();
     1344            obp+=sizeof(long);
     1345
     1346            //push eax
     1347            op_push( REG_EAX );
     1348
     1349            //
     1350            /////////////////////////////
     1351
     1352
     1353            /////////////////////////////
     1354            // Thisポインタを引き渡す
     1355
     1356            SetThisPtrToReg(REG_EAX);
     1357
     1358            //push eax
     1359            op_push( REG_EAX );
     1360
     1361            //
     1362            /////////////////////////////
     1363
     1364
     1365            // call AddGlobalRootPtr
     1366            op_call( pUserProc_AddGlobalRootPtr );
     1367
     1368            ReallocNativeCodeBuffer();
     1369        }
     1370    }
     1371
     1372    return true;
     1373}
  • BasicCompiler32/MakePeHdr.cpp

    r91 r95  
    88// 特殊関数の構造体ポインタ
    99////////////////////////////
     10
     11// グローバル関数、静的メソッド
    1012UserProc
    1113    *pSub_System_StartupProgram,
     
    3840   
    3941    *pSub_esp_error;
     42
     43// 動的メソッド
     44UserProc
     45    *pUserProc_System_CGarbageCollection_RegisterGlobalRoots;
    4046
    4147
     
    250256        pSubStaticMethod_System_TypeBase_InitializeUserTypes->Using();
    251257        pSubStaticMethod_System_TypeBase_InitializeUserTypes->ThisIsAutoGenerationProc();
     258    }
     259
     260    if( pUserProc_System_CGarbageCollection_RegisterGlobalRoots = GetClassMethod( "_System_CGarbageCollection", "RegisterGlobalRoots" ) ){
     261        pUserProc_System_CGarbageCollection_RegisterGlobalRoots->Using();
     262        pUserProc_System_CGarbageCollection_RegisterGlobalRoots->ThisIsAutoGenerationProc();
    252263    }
    253264
  • BasicCompiler32/Opcode.h

    r79 r95  
    192192void dim( char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags);
    193193void SetVarPtrToEax(RELATIVE_VAR *pRelativeVar);
     194bool Compile_AddGlobalRootsForGc();
    194195
    195196//ParamImpl.cpp
Note: See TracChangeset for help on using the changeset viewer.