Changeset 95 in dev for BasicCompiler64


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

RegisterGlobalRootsの自動生成に対応

Location:
BasicCompiler64
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler64/Compile_ProcOp.cpp

    r94 r95  
    205205
    206206            pobj_DBClass->Compile_System_InitializeUserTypes();
     207    }
     208    else if( userProc.GetName() == "RegisterGlobalRoots"
     209        && userProc.HasParentClass()
     210        && (string)userProc.GetParentClass().name == "_System_CGarbageCollection" ){
     211
     212            Compile_AddGlobalRootsForGc();
    207213    }
    208214    else{
  • BasicCompiler64/Compile_Var.cpp

    r89 r95  
    13141314    }
    13151315}
     1316
     1317bool Compile_AddGlobalRootsForGc(){
     1318    UserProc *pUserProc_AddGlobalRootPtr = GetClassMethod( "_System_CGarbageCollection", "AddGlobalRootPtr" );
     1319    if( !pUserProc_AddGlobalRootPtr ){
     1320        SetError(3, "_System_CGarbageCollection.AddGlobalRootPtr", -1 );
     1321        return false;
     1322    }
     1323
     1324    BOOST_FOREACH( const Variable *pVar, globalVars ){
     1325        if( pVar->IsObject() || pVar->IsPointer() || pVar->IsStruct() ){
     1326            // オブジェクトまたはポインタだったとき
     1327            // ※構造体も含む(暫定対応)
     1328
     1329            // 変数領域に要するLONG_PTR単位の個数を引き渡す
     1330            //mov r8,count
     1331            op_mov_RV(sizeof(_int64), REG_R8,pVar->GetMemorySize()/PTR_SIZE);
     1332
     1333            // ルートポインタを引き渡す
     1334            //mov rdx,offset
     1335            op_mov_RV(sizeof(_int64), REG_RDX,(int)pVar->offset);
     1336            obp-=sizeof(long);
     1337            pobj_GlobalVarSchedule->add();
     1338            obp+=sizeof(long);
     1339
     1340            // Thisポインタを引き渡す
     1341            SetThisPtrToReg(REG_RCX);
     1342
     1343            // call AddGlobalRootPtr
     1344            op_call( pUserProc_AddGlobalRootPtr );
     1345
     1346            ReallocNativeCodeBuffer();
     1347        }
     1348    }
     1349
     1350    return true;
     1351}
  • BasicCompiler64/MakePeHdr.cpp

    r91 r95  
    66// 特殊関数の構造体ポインタ
    77////////////////////////////
     8
     9// グローバル関数、静的メソッド
    810UserProc
    911    *pSub_System_StartupProgram,
     
    2426    *pSub_System_GC_free_for_SweepingDelete,
    2527    *pSubStaticMethod_System_TypeBase_InitializeUserTypes;
     28
     29// 動的メソッド
     30UserProc
     31    *pUserProc_System_CGarbageCollection_RegisterGlobalRoots;
    2632
    2733
     
    231237        pSubStaticMethod_System_TypeBase_InitializeUserTypes->Using();
    232238        pSubStaticMethod_System_TypeBase_InitializeUserTypes->ThisIsAutoGenerationProc();
     239    }
     240
     241    if( pUserProc_System_CGarbageCollection_RegisterGlobalRoots = GetClassMethod( "_System_CGarbageCollection", "RegisterGlobalRoots" ) ){
     242        pUserProc_System_CGarbageCollection_RegisterGlobalRoots->Using();
     243        pUserProc_System_CGarbageCollection_RegisterGlobalRoots->ThisIsAutoGenerationProc();
    233244    }
    234245
  • BasicCompiler64/Opcode.h

    r79 r95  
    325325void dim( char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags);
    326326void SetVarPtrToReg(int reg,RELATIVE_VAR *pRelativeVar);
     327bool Compile_AddGlobalRootsForGc();
    327328
    328329//ParamImpl.cpp
Note: See TracChangeset for help on using the changeset viewer.