Changeset 73 in dev for BasicCompiler64
- Timestamp:
- Mar 16, 2007, 11:07:14 PM (18 years ago)
- Location:
- BasicCompiler64
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler64/CParameter.cpp
r71 r73 112 112 113 113 //call free 114 extern S UBINFO*pSub_free;114 extern SubInfo *pSub_free; 115 115 op_call(pSub_free); 116 116 } … … 135 135 136 136 //call calloc 137 extern S UBINFO*pSub_calloc;137 extern SubInfo *pSub_calloc; 138 138 op_call(pSub_calloc); 139 139 -
BasicCompiler64/Compile_CallProc.cpp
r71 r73 8 8 void Call_DebugSys_SaveContext(){ 9 9 //call _System_GetEip 10 extern S UBINFO*pSub_System_GetEip;10 extern SubInfo *pSub_System_GetEip; 11 11 op_call(pSub_System_GetEip); 12 12 … … 18 18 19 19 //call _DebugSys_SaveContext 20 extern S UBINFO*pSub_DebugSys_SaveContext;20 extern SubInfo *pSub_DebugSys_SaveContext; 21 21 op_call(pSub_DebugSys_SaveContext); 22 22 } … … 96 96 } 97 97 98 void Opcode_CallProc(const char *Parameter,S UBINFO*psi,DWORD dwFlags,char *ObjectName,int RefType){98 void Opcode_CallProc(const char *Parameter,SubInfo *psi,DWORD dwFlags,char *ObjectName,int RefType){ 99 99 int i2; 100 100 … … 234 234 235 235 //エラーチェック 236 if( !pobj_parameter->ErrorCheck(psi->name,psi-> pRealParmInfo,psi->RealParmNum,psi->SecondParmNum) ){236 if( !pobj_parameter->ErrorCheck(psi->name,psi->realParams,psi->SecondParmNum) ){ 237 237 //パラメータにエラーがあるときは処理を終える 238 238 return; … … 241 241 if(psi->dwType==SUBTYPE_MACRO){ 242 242 //マクロ関数の場合は、パラメータ省略を考慮する 243 pobj_parameter->MacroParameterSupport(psi-> pRealParmInfo);243 pobj_parameter->MacroParameterSupport(psi->realParams); 244 244 } 245 245 … … 248 248 249 249 //一時オブジェクトを生成 250 pobj_parameter->NewTempParameters( psi->name,psi-> pRealParmInfo,psi->RealParmNum,psi->RealSecondParmNum );250 pobj_parameter->NewTempParameters( psi->name,psi->realParams,psi->RealSecondParmNum ); 251 251 252 252 //レジスタ、スタックフレームにセット 253 pobj_parameter->SetParameter(psi->name,psi-> pRealParmInfo,psi->RealParmNum,psi->RealSecondParmNum);253 pobj_parameter->SetParameter(psi->name,psi->realParams,psi->RealSecondParmNum); 254 254 255 255 if(psi->ReturnType==DEF_STRUCT && psi->isReturnRef == false){ … … 271 271 272 272 //call calloc 273 extern S UBINFO*pSub_calloc;273 extern SubInfo *pSub_calloc; 274 274 op_call(pSub_calloc); 275 275 -
BasicCompiler64/Compile_Func.cpp
r64 r73 95 95 void Opcode_Func_AddressOf( const char *name ){ 96 96 extern int cp; 97 S UBINFO*psi;97 SubInfo *psi; 98 98 99 99 extern LONG_PTR ProcPtr_BaseIndex; … … 101 101 //左辺の型にのっとり、オーバーロードを解決 102 102 103 std::vector<S UBINFO*> subs;103 std::vector<SubInfo *> subs; 104 104 GetOverloadSubHash( name, subs ); 105 105 if( subs.size() == 0 ){ -
BasicCompiler64/Compile_Object.cpp
r64 r73 32 32 //////////////////////// 33 33 34 std::vector<S UBINFO*> subs;34 std::vector<SubInfo *> subs; 35 35 pobj_c->EnumMethod( pobj_c->name, subs ); 36 36 37 S UBINFO*psi;37 SubInfo *psi; 38 38 if( subs.size() > 0 ){ 39 39 //オーバーロードを解決 … … 121 121 122 122 //call _System_GC_malloc_ForObject 123 extern S UBINFO*pSub_System_GC_malloc_ForObject;123 extern SubInfo *pSub_System_GC_malloc_ForObject; 124 124 op_call(pSub_System_GC_malloc_ForObject); 125 125 } … … 128 128 129 129 //call _System_GC_malloc_ForObjectPtr 130 extern S UBINFO*pSub_System_GC_malloc_ForObjectPtr;130 extern SubInfo *pSub_System_GC_malloc_ForObjectPtr; 131 131 op_call(pSub_System_GC_malloc_ForObjectPtr); 132 132 } … … 328 328 if( isSweeping ){ 329 329 //call _System_GC_free_for_SweepingDelete 330 extern S UBINFO*pSub_System_GC_free_for_SweepingDelete;330 extern SubInfo *pSub_System_GC_free_for_SweepingDelete; 331 331 op_call(pSub_System_GC_free_for_SweepingDelete); 332 332 } 333 333 else{ 334 334 //call free 335 extern S UBINFO*pSub_free;335 extern SubInfo *pSub_free; 336 336 op_call(pSub_free); 337 337 } -
BasicCompiler64/Compile_ProcOp.cpp
r64 r73 204 204 } 205 205 } 206 void CompileBufferInProcedure(S UBINFO*psi){206 void CompileBufferInProcedure(SubInfo *psi){ 207 207 extern char *basbuf; 208 208 extern HANDLE hHeap; 209 extern S UBINFO**ppSubHash;209 extern SubInfo **ppSubHash; 210 210 extern BOOL bDebugCompile; 211 211 int i3,i4,VarSize,BufferSize; … … 328 328 LocalVar=(VARIABLE *)HeapReAlloc(hHeap,0,LocalVar,(MaxLocalVarNum+1)*sizeof(VARIABLE)); 329 329 330 lstrcpy(LocalVar[MaxLocalVarNum].name,psi-> pRealParmInfo[i3].name);330 lstrcpy(LocalVar[MaxLocalVarNum].name,psi->realParams[i3].GetVarName.c_str()); 331 331 332 332 // TODO: パラメータのConst定義の指定が未完成 333 333 LocalVar[MaxLocalVarNum].bConst=false; 334 334 335 LocalVar[MaxLocalVarNum].bArray=psi-> pRealParmInfo[i3].bArray;336 memcpy(LocalVar[MaxLocalVarNum].SubScripts,psi-> pRealParmInfo[i3].SubScripts,MAX_ARRAYDIM*sizeof(int));337 338 LocalVar[MaxLocalVarNum].type=psi-> pRealParmInfo[i3].type;335 LocalVar[MaxLocalVarNum].bArray=psi->realParams[i3].IsArray()?TRUE:FALSE; 336 memcpy(LocalVar[MaxLocalVarNum].SubScripts,psi->realParams[i3].GetSubScriptsPtr(),MAX_ARRAYDIM*sizeof(int)); 337 338 LocalVar[MaxLocalVarNum].type=psi->realParams[i3].GetBasicType(); 339 339 if(LocalVar[MaxLocalVarNum].type==DEF_OBJECT 340 340 ||LocalVar[MaxLocalVarNum].type==DEF_STRUCT){ … … 343 343 } 344 344 345 LocalVar[MaxLocalVarNum].u.index=psi-> pRealParmInfo[i3].u.index;346 347 if(psi-> pRealParmInfo[i3].bByVal&&psi->pRealParmInfo[i3].type==DEF_STRUCT){345 LocalVar[MaxLocalVarNum].u.index=psi->realParams[i3].GetIndex(); 346 347 if(psi->realParams[i3].IsRef() == false&&psi->realParams[i3].IsStruct()){ 348 348 //構造体のByValパラメータ 349 349 LocalVar[MaxLocalVarNum].fRef=REF_PARAMETER | OBJECT_PARAMETER; … … 351 351 } 352 352 else{ 353 if(psi-> pRealParmInfo[i3].bByVal&&psi->pRealParmInfo[i3].bArray==0){353 if(psi->realParams[i3].IsRef() == false&&psi->realParams[i3].IsArray()){ 354 354 LocalVar[MaxLocalVarNum].fRef=0; 355 355 VarSize=GetTypeSize(LocalVar[MaxLocalVarNum].type,LocalVar[MaxLocalVarNum].u.index); … … 383 383 384 384 //コンパイル中の関数 385 extern S UBINFO*pCompilingSubInfo;385 extern SubInfo *pCompilingSubInfo; 386 386 pCompilingSubInfo=psi; 387 387 … … 396 396 for(i3=psi->RealParmNum-1;i3>=0;i3--){ 397 397 if(i3==3){ 398 if( IsRealNumberType(psi->pRealParmInfo[i3].type)&&psi->pRealParmInfo[i3].bByVal){398 if(psi->realParams[i3].IsReal()&&psi->realParams[i3].IsRef() == false){ 399 399 //movsd qword ptr[rsp+0x20],xmm3 400 400 op_movsd_MR(REG_XMM3,REG_RSP,0x20,MOD_BASE_DISP32); … … 406 406 } 407 407 if(i3==2){ 408 if( IsRealNumberType(psi->pRealParmInfo[i3].type)&&psi->pRealParmInfo[i3].bByVal){408 if(psi->realParams[i3].IsReal()&&psi->realParams[i3].IsRef() == false){ 409 409 //movsd qword ptr[rsp+0x18],xmm2 410 410 op_movsd_MR(REG_XMM2,REG_RSP,0x18,MOD_BASE_DISP32); … … 416 416 } 417 417 if(i3==1){ 418 if( IsRealNumberType(psi->pRealParmInfo[i3].type)&&psi->pRealParmInfo[i3].bByVal){418 if(psi->realParams[i3].IsReal()&&psi->realParams[i3].IsRef() == false){ 419 419 //movsd qword ptr[rsp+0x10],xmm1 420 420 op_movsd_MR(REG_XMM1,REG_RSP,0x10,MOD_BASE_DISP32); … … 426 426 } 427 427 if(i3==0){ 428 if( IsRealNumberType(psi->pRealParmInfo[i3].type)&&psi->pRealParmInfo[i3].bByVal){428 if(psi->realParams[i3].IsReal()&&psi->realParams[i3].IsRef() == false){ 429 429 //movsd qword ptr[rsp+0x8],xmm0 430 430 op_movsd_MR(REG_XMM0,REG_RSP,0x8,MOD_BASE_DISP32); … … 497 497 498 498 //call _DebugSys_StartProc 499 extern S UBINFO*pSub_DebugSys_StartProc;499 extern SubInfo *pSub_DebugSys_StartProc; 500 500 op_call(pSub_DebugSys_StartProc); 501 501 } … … 720 720 if(bDebugCompile&&bDebugSupportProc==0){ 721 721 //call _DebugSys_EndProc 722 extern S UBINFO*pSub_DebugSys_EndProc;722 extern SubInfo *pSub_DebugSys_EndProc; 723 723 op_call(pSub_DebugSys_EndProc); 724 724 } … … 819 819 } 820 820 void CompileLocal(){ 821 extern S UBINFO**ppSubHash;821 extern SubInfo **ppSubHash; 822 822 int i2; 823 S UBINFO*psi;823 SubInfo *psi; 824 824 825 825 extern BOOL bDll; … … 835 835 //_System_InitStaticLocalVariablesは一番最後にコンパイル 836 836 //※一般関数内の静的変数オブジェクトをすべて収集しなければならない 837 extern S UBINFO*pSub_System_InitStaticLocalVariables;837 extern SubInfo *pSub_System_InitStaticLocalVariables; 838 838 pSub_System_InitStaticLocalVariables->bCompile=1; 839 839 840 840 //_System_Call_Destructor_of_GlobalObjectは一番最後にコンパイル 841 extern S UBINFO*pSub_System_Call_Destructor_of_GlobalObject;841 extern SubInfo *pSub_System_Call_Destructor_of_GlobalObject; 842 842 pSub_System_Call_Destructor_of_GlobalObject->bCompile=1; 843 843 -
BasicCompiler64/Compile_Set_Var.cpp
r66 r73 107 107 108 108 //call free 109 extern S UBINFO*pSub_free;109 extern SubInfo *pSub_free; 110 110 op_call(pSub_free); 111 111 } -
BasicCompiler64/Compile_Statement.cpp
r64 r73 5 5 int i,i2; 6 6 char buffer[8192]; 7 S UBINFO*psi;7 SubInfo *psi; 8 8 9 9 for(i=0;;i++){ … … 44 44 45 45 //GetSubHash内でエラー提示が行われた場合 46 if(psi==(S UBINFO*)-1) return;46 if(psi==(SubInfo *)-1) return; 47 47 48 48 if(psi==0){ … … 54 54 55 55 //GetSubHash内でエラー提示が行われた場合 56 if(psi==(S UBINFO*)-1) return;56 if(psi==(SubInfo *)-1) return; 57 57 } 58 58 … … 722 722 pobj_c=(CClass *)lpIndex; 723 723 724 std::vector<S UBINFO*> subs;724 std::vector<SubInfo *> subs; 725 725 pobj_c->EnumMethod( CALC_EQUAL, subs ); 726 726 if( subs.size() == 0 ){ … … 739 739 740 740 //オーバーロードを解決 741 S UBINFO*psi;741 SubInfo *psi; 742 742 psi=OverloadSolution("==",subs,ppi,iParmNum,NULL); 743 743 HeapDefaultFree(ppi); … … 883 883 884 884 //call _System_GetEip 885 extern S UBINFO*pSub_System_GetEip;885 extern SubInfo *pSub_System_GetEip; 886 886 op_call(pSub_System_GetEip); 887 887 … … 945 945 //戻り値をセット 946 946 if(Parameter[0]){ 947 extern S UBINFO*pCompilingSubInfo;947 extern SubInfo *pCompilingSubInfo; 948 948 char *temp; 949 949 if(pCompilingSubInfo->name[0]==1&&pCompilingSubInfo->name[1]==ESC_OPERATOR) … … 1075 1075 OpcodeCalc(temp2); 1076 1076 1077 S UBINFO*psi;1077 SubInfo *psi; 1078 1078 if(bFile) psi=GetSubHash("INPUT_FromFile"); 1079 1079 else psi=GetSubHash("INPUT_FromPrompt"); … … 1177 1177 OpcodeCalc(temp2); 1178 1178 1179 S UBINFO*psi;1179 SubInfo *psi; 1180 1180 if(bFile) psi=GetSubHash("PRINTUSING_ToFile"); 1181 1181 else psi=GetSubHash("PRINTUSING_ToPrompt"); … … 1281 1281 if(sw) lstrcat(buffer,"+Ex\"\\r\\n\""); 1282 1282 1283 S UBINFO*psi;1283 SubInfo *psi; 1284 1284 if(bFile) psi=GetSubHash("PRINT_ToFile"); 1285 1285 else psi=GetSubHash("PRINT_ToPrompt"); -
BasicCompiler64/Compile_Var.cpp
r69 r73 562 562 563 563 char temporary[VN_SIZE]; 564 extern S UBINFO*pCompilingSubInfo;564 extern SubInfo *pCompilingSubInfo; 565 565 if(pCompilingSubInfo){ 566 566 GetNowStaticVarFullName(VarName,temporary); -
BasicCompiler64/MakePeHdr.cpp
r67 r73 6 6 // 特殊関数の構造体ポインタ 7 7 //////////////////////////// 8 S UBINFO8 SubInfo 9 9 *pSub_System_StartupProgram, 10 10 *pSub_DebugSys_StartProc, … … 352 352 353 353 //call _System_Call_Destructor_of_GlobalObject 354 extern S UBINFO*pSub_System_Call_Destructor_of_GlobalObject;354 extern SubInfo *pSub_System_Call_Destructor_of_GlobalObject; 355 355 op_call(pSub_System_Call_Destructor_of_GlobalObject); 356 356 … … 500 500 ExportNamesLength=lstrlen(lpExportNames)+1; 501 501 502 extern S UBINFO**ppSubHash;503 S UBINFO*psi,*psi2;502 extern SubInfo **ppSubHash; 503 SubInfo *psi,*psi2; 504 504 while(1){ 505 505 //辞書順にサーチ -
BasicCompiler64/NumOpe_Arithmetic.cpp
r64 r73 559 559 560 560 //call pow 561 extern S UBINFO*pSub_pow;561 extern SubInfo *pSub_pow; 562 562 op_call(pSub_pow); 563 563 -
BasicCompiler64/Opcode.h
r71 r73 350 350 351 351 private: 352 BOOL _overload_check( PARAMETER_INFO *ppi,int pi_num,TYPEINFO *pReturnTypeInfo,int overload_level);353 S UBINFO *OverloadSolutionWithReturnType( const char *name, std::vector<SUBINFO*> &subs );352 BOOL _overload_check( Parameters ¶ms, TYPEINFO *pReturnTypeInfo,int overload_level); 353 SubInfo *OverloadSolutionWithReturnType( const char *name, std::vector<SubInfo *> &subs ); 354 354 public: 355 S UBINFO *OverloadSolution( const char *name, std::vector<SUBINFO*> &subs );355 SubInfo *OverloadSolution( const char *name, std::vector<SubInfo *> &subs ); 356 356 357 357 BOOL ErrorCheck(const char *FuncName,PARAMETER_INFO *ppi,int pi_num,int SecondParmNum); … … 385 385 #define PROCFLAG_NEW 1 386 386 int Opcode_CallProcPtr(char *variable,char *Parameter,PROCPTRINFO *pi,LONG_PTR *plpIndex); 387 void Opcode_CallProc(const char *Parameter,S UBINFO*psi,DWORD dwFlags,char *ObjectName,int RefType);387 void Opcode_CallProc(const char *Parameter,SubInfo *psi,DWORD dwFlags,char *ObjectName,int RefType); 388 388 int Opcode_CallDllProc(char *Parameter,DECLAREINFO *pdi,LONG_PTR *plpIndex); 389 389 … … 512 512 void op_fld_ptr_esp(int type); 513 513 void op_zero_reg(int reg); 514 void op_call( S UBINFO*psi );514 void op_call( SubInfo *psi ); 515 515 void op_call( DECLAREINFO *pdi ); -
BasicCompiler64/OperatorProc.cpp
r64 r73 23 23 24 24 //call free 25 extern S UBINFO*pSub_free;25 extern SubInfo *pSub_free; 26 26 op_call(pSub_free); 27 27 } … … 32 32 pobj_c=(CClass *)index_stack[sp-2]; 33 33 34 std::vector<S UBINFO*> subs;34 std::vector<SubInfo *> subs; 35 35 pobj_c->EnumMethod( idCalc, subs ); 36 36 if( subs.size() == 0 ){ … … 84 84 if(idCalc==CALC_EQUAL) lstrcpy(temporary,"=="); 85 85 else GetCalcName(idCalc,temporary); 86 S UBINFO*psi;86 SubInfo *psi; 87 87 psi=OverloadSolution(temporary,subs,ppi,iParmNum,pBaseTypeInfo); 88 88 … … 94 94 else{ 95 95 //オーバーロードされていないが、パラメータ個数が一致しないとき 96 if(iParmNum!=psi-> ParmNum){96 if(iParmNum!=psi->params.size()){ 97 97 HeapDefaultFree(ppi); 98 98 return -1; … … 102 102 for(i=0;i<iParmNum;i++){ 103 103 CheckDifferentType( 104 psi->p ParmInfo[i].type,105 psi->p ParmInfo[i].u.index,104 psi->params[i]->GetBasicType(), 105 psi->params[i]->GetIndex(), 106 106 ppi[i].type, 107 107 ppi[i].u.index, … … 113 113 114 114 if(bTwoTerm){ 115 if( psi->pRealParmInfo[1].type==DEF_STRUCT&&psi->pRealParmInfo[1].bByVal){115 if( psi->realParams[1]->IsStruct() && psi->realParams[1]->IsRef() == false ){ 116 116 //一時オブジェクトはメソッド内で破棄される 117 117 bUseHeap[sp-1]=0; … … 137 137 138 138 //call calloc 139 extern S UBINFO*pSub_calloc;139 extern SubInfo *pSub_calloc; 140 140 op_call(pSub_calloc); 141 141 … … 154 154 SetOneTermToReg_Whole64Calc(type[sp-1],®2); 155 155 pobj_reg->UnlockReg(); 156 if( !psi-> pRealParmInfo[1].bByVal){156 if( !psi->realParams[1]->IsRef() == false ){ 157 157 //一時参照を作成 158 158 pobj_sf->push( reg2 ); … … 253 253 254 254 if(bTwoTerm){ 255 if( !psi-> pRealParmInfo[1].bByVal){255 if( !psi->realParams[1]->IsRef() == false ){ 256 256 //一時参照を破棄 257 257 pobj_sf->pop(); … … 341 341 void CallIndexerGetterProc(int reg,CClass *pobj_Class,char *ObjectName,char *Parameter,TYPEINFO &RetTypeInfo){ 342 342 343 std::vector<S UBINFO*> subs;343 std::vector<SubInfo *> subs; 344 344 pobj_Class->EnumMethod( CALC_ARRAY_GET, subs ); 345 345 if( subs.size() == 0 ){ -
BasicCompiler64/WatchList.cpp
r64 r73 309 309 ULONG_PTR Debugging_GetThisPtrOffset(LONG_PTR obp_Rip){ 310 310 int i; 311 S UBINFO*psi;311 SubInfo *psi; 312 312 313 313 //ripからプロシージャを取得 -
BasicCompiler64/amd64_main.cpp
r64 r73 1791 1791 ///////////////////////////// 1792 1792 1793 void op_call( S UBINFO*psi ){1793 void op_call( SubInfo *psi ){ 1794 1794 OpBuffer[obp++] = (char)0xE8; 1795 1795 pobj_SubAddrSchedule->add( psi, 1 ); -
BasicCompiler64/varlist.cpp
r69 r73 354 354 if(pobj_dti->lplpSpBase[i2]==0) return; 355 355 356 extern S UBINFO**ppSubHash;357 S UBINFO*psi;356 extern SubInfo **ppSubHash; 357 SubInfo *psi; 358 358 for(i3=0,sw=0;i3<MAX_HASH;i3++){ 359 359 psi=ppSubHash[i3]; … … 586 586 587 587 //プロシージャ コンボボックス 588 extern S UBINFO**ppSubHash;589 S UBINFO*psi;588 extern SubInfo **ppSubHash; 589 SubInfo *psi; 590 590 int sw; 591 591 SendMessage(hProcCombo,CB_RESETCONTENT,0,0); … … 709 709 710 710 if(pobj_dti->lplpSpBase[i2]){ 711 extern S UBINFO**ppSubHash;712 S UBINFO*psi;711 extern SubInfo **ppSubHash; 712 SubInfo *psi; 713 713 for(i3=0,sw=0;i3<MAX_HASH;i3++){ 714 714 psi=ppSubHash[i3];
Note:
See TracChangeset
for help on using the changeset viewer.