Changeset 316 in dev for trunk/abdev/BasicCompiler64/Compile_ProcOp.cpp
- Timestamp:
- Sep 7, 2007, 3:15:41 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler64/Compile_ProcOp.cpp
r309 r316 190 190 int i3,i4; 191 191 char temporary[VN_SIZE]; 192 193 if( pUserProc->IsUsing() == false || pUserProc->IsCompiled() ) return;194 192 195 193 if( pUserProc->GetLocalVars().size() ){ … … 620 618 GetVarOffsetReadWrite(temp,&RelativeVar,Type()); 621 619 622 i3=pUserProc->ReturnType().GetBasicType();623 624 if(i3==DEF_OBJECT || i3==DEF_STRUCT){620 const Type &returnType = pUserProc->ReturnType(); 621 if( returnType.IsObject() || returnType.IsStruct() ) 622 { 625 623 SetVarPtrToReg(REG_RAX,&RelativeVar); 626 if( i3==DEF_OBJECT ){ 624 if( returnType.IsObject() ) 625 { 627 626 //mov rax,qword ptr[rax] 628 627 compiler.codeGenerator.op_mov_RM( sizeof(_int64), REG_RAX, REG_RAX, 0, MOD_BASE ); 629 628 } 630 629 } 631 else if(i3==DEF_DOUBLE){ 630 else if( returnType.IsDouble() ) 631 { 632 632 //64ビット実数型 633 633 SetXmmReg_DoubleVariable(&RelativeVar,REG_XMM0); 634 634 } 635 else if(i3==DEF_SINGLE){ 635 else if( returnType.IsSingle() ) 636 { 636 637 //32ビット実数型 637 638 SetXmmReg_SingleVariable(&RelativeVar,REG_XMM0); 638 639 } 639 else if(IsWholeNumberType(i3)){ 640 else if( returnType.IsWhole() ) 641 { 640 642 //整数型 641 SetReg_WholeVariable( Type(i3),&RelativeVar,REG_RAX);643 SetReg_WholeVariable(returnType.GetSize(),&RelativeVar,REG_RAX); 642 644 } 643 645 else SetError(300,NULL,cp); … … 699 701 HeapDefaultFree(SynonymErrorWords); 700 702 } 701 702 void CompileBufferInProcedure( const UserProc &userProc ){703 if( userProc.IsUsing() == false || userProc.IsCompiled() ) return;704 705 _compile_proc( &userProc );706 707 // ログを履く708 char temporary[8192];709 temporary[0]=0;710 lstrcat( temporary, "------------------------------------------------------------------\n" );711 sprintf( temporary + lstrlen(temporary), "【 %s のコード情報】\n", userProc.GetName().c_str() );712 sprintf( temporary + lstrlen(temporary), "code size: %d bytes\n", userProc.GetCodeSize() );713 lstrcat( temporary, "------------------------------------------------------------------\n" );714 lstrcat( temporary, "\n" );715 trace_for_size( temporary );716 }717 void CompileLocal(){718 if( compiler.IsDll() ){719 //DLLの場合はグローバル変数を初期化するための関数を一番初めにコンパイルする720 const UserProc *pUserProc = GetSubHash("_System_InitDllGlobalVariables");721 if(pUserProc){722 CompileBufferInProcedure( *pUserProc );723 }724 else SetError(300,NULL,cp);725 }726 else727 {728 // グローバル領域を一番初めにコンパイルする729 extern const UserProc *pSub_System_GlobalArea;730 CompileBufferInProcedure( *pSub_System_GlobalArea );731 }732 733 //_System_TypeBase_InitializeUserTypesは一番最後にコンパイル734 extern const UserProc *pSubStaticMethod_System_TypeBase_InitializeUserTypes;735 pSubStaticMethod_System_TypeBase_InitializeUserTypes->CompleteCompile();736 737 //_System_InitStaticLocalVariablesは一番最後にコンパイル738 //※一般関数内の静的変数オブジェクトをすべて収集しなければならない739 extern const UserProc *pSub_System_InitStaticLocalVariables;740 pSub_System_InitStaticLocalVariables->CompleteCompile();741 742 //_System_Call_Destructor_of_GlobalObjectは一番最後にコンパイル743 extern const UserProc *pSub_System_Call_Destructor_of_GlobalObject;744 pSub_System_Call_Destructor_of_GlobalObject->CompleteCompile();745 746 repeat:747 compiler.GetObjectModule().meta.GetUserProcs().Iterator_Reset();748 while( compiler.GetObjectModule().meta.GetUserProcs().Iterator_HasNext() )749 {750 UserProc *pUserProc = compiler.GetObjectModule().meta.GetUserProcs().Iterator_GetNext();751 CompileBufferInProcedure( *pUserProc );752 }753 754 if( IsNeedProcCompile() ){755 //プロシージャコンパイルによって、プロシージャコンパイルが必要になる場合756 goto repeat;757 }758 759 //_System_TypeBase_InitializeUserTypesは最後のほうでコンパイル760 pSubStaticMethod_System_TypeBase_InitializeUserTypes->KillCompileStatus();761 CompileBufferInProcedure( *pSubStaticMethod_System_TypeBase_InitializeUserTypes );762 763 if( IsNeedProcCompile() ){764 //プロシージャコンパイルによって、プロシージャコンパイルが必要になる場合765 766 compiler.GetObjectModule().meta.GetUserProcs().Iterator_Reset();767 while( compiler.GetObjectModule().meta.GetUserProcs().Iterator_HasNext() )768 {769 UserProc *pUserProc = compiler.GetObjectModule().meta.GetUserProcs().Iterator_GetNext();770 CompileBufferInProcedure( *pUserProc );771 }772 }773 774 //_System_InitStaticLocalVariablesは一番最後にコンパイル775 pSub_System_InitStaticLocalVariables->KillCompileStatus();776 CompileBufferInProcedure( *pSub_System_InitStaticLocalVariables );777 778 //_System_Call_Destructor_of_GlobalObjectは一番最後にコンパイル779 pSub_System_Call_Destructor_of_GlobalObject->KillCompileStatus();780 CompileBufferInProcedure( *pSub_System_Call_Destructor_of_GlobalObject );781 }
Note:
See TracChangeset
for help on using the changeset viewer.