Changeset 51 in dev for BasicCompiler32
- Timestamp:
- Feb 10, 2007, 8:30:19 PM (18 years ago)
- Location:
- BasicCompiler32
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler32/CParameter.cpp
r50 r51 109 109 110 110 //call destructor 111 int i5 = types[i2].u.pobj_Class->DestructorMemberSubIndex;112 if( i5 != -1){113 op_call( types[i2].u.pobj_Class->ppobj_Method[i5]->psi );111 CMethod *method = types[i2].u.pobj_Class->GetDestructorMethod(); 112 if( method ){ 113 op_call( method->psi ); 114 114 } 115 115 … … 148 148 CalcType.type=NumOpe_GetType(Parameter,&BaseType,&CalcType.u.lpIndex); 149 149 150 if( pobj_Class->CopyConstructorMemberSubIndex!=-1&&151 CalcType.type==DEF_OBJECT&&CalcType.u.pobj_Class==pobj_Class){150 if( pobj_Class->GetCopyConstructorMethod() 151 && CalcType.type==DEF_OBJECT&&CalcType.u.pobj_Class==pobj_Class){ 152 152 //////////////////////////////////// 153 153 // コピーコンストラクタを呼び出す … … 179 179 180 180 //call constructor 181 op_call(pobj_Class-> ppobj_Method[pobj_Class->CopyConstructorMemberSubIndex]->psi);181 op_call(pobj_Class->GetCopyConstructorMethod()->psi); 182 182 183 183 … … 191 191 192 192 193 if( pobj_Class->ConstructorMemberSubIndex!=-1){193 if( pobj_Class->GetConstructorMethod() ){ 194 194 //////////////////////////////// 195 195 // コンストラクタを呼び出す … … 200 200 201 201 //call constructor 202 op_call(pobj_Class-> ppobj_Method[pobj_Class->ConstructorMemberSubIndex]->psi);202 op_call(pobj_Class->GetConstructorMethod()->psi); 203 203 } 204 204 -
BasicCompiler32/Compile_CallProc.cpp
r50 r51 95 95 96 96 void Opcode_CallProc(char *Parameter,SUBINFO *psi,DWORD dwFlags,char *ObjectName,int RefType){ 97 int i ,i2;97 int i2; 98 98 99 99 if(psi->dwType==SUBTYPE_MACRO){ … … 338 338 OpBuffer[obp++]=(char)0x11; 339 339 340 for(i=0,i2=0;i<pobj_c->iMethodNum;i++){ 341 if(pobj_c->ppobj_Method[i]->psi==psi) break; 342 if(pobj_c->ppobj_Method[i]->psi->bVirtual) i2++; 343 } 340 i2 = pobj_c->GetFuncNumInVtbl( psi ); 344 341 345 342 //call dword ptr[edx+func_index] -
BasicCompiler32/Compile_Func.cpp
r50 r51 324 324 OpBuffer[obp++]=(char)0x11; 325 325 326 int i,i2; 327 for(i=0,i2=0;i<pobj_c->iMethodNum;i++){ 328 if(pobj_c->ppobj_Method[i]->psi==psi) break; 329 if(pobj_c->ppobj_Method[i]->psi->bVirtual) i2++; 330 } 326 int i2 = pobj_c->GetFuncNumInVtbl( psi ); 331 327 332 328 //mov eax,dword ptr[edx+func_index] -
BasicCompiler32/Compile_Object.cpp
r50 r51 220 220 221 221 222 CMethod *method = pobj_c->GetDestructorMethod(); 223 if( method == NULL ) return 0; 224 222 225 //mov ecx,DestructorProcAddr 223 i2=pobj_c->DestructorMemberSubIndex;224 if(i2==-1) return -1;225 226 OpBuffer[obp++]=(char)0xB9; 226 pobj_SubAddrSchedule->add( pobj_c->ppobj_Method[i2]->psi,0);227 pobj_c->ppobj_Method[i2]->psi->bUse=1;227 pobj_SubAddrSchedule->add(method->psi,0); 228 method->psi->bUse=1; 228 229 obp+=sizeof(long); 229 230 -
BasicCompiler32/Compile_ProcOp.cpp
r50 r51 219 219 extern SUBINFO **ppSubHash; 220 220 extern BOOL bDebugCompile; 221 int i3,i4, i5,VarSize,LocalVarSchedule,EspOffsetSchedule,BufferSize,BaseOffset;221 int i3,i4,VarSize,LocalVarSchedule,EspOffsetSchedule,BufferSize,BaseOffset; 222 222 char temporary[VN_SIZE]; 223 223 … … 379 379 if(psi->ReturnType==DEF_OBJECT && psi->isReturnRef == false){ 380 380 //戻り値用オブジェクトのコンストラクタを呼び出す 381 if( psi->u.Return_pobj_c->ConstructorMemberSubIndex!=-1){381 if( psi->u.Return_pobj_c->GetConstructorMethod() ){ 382 382 sprintf(temporary,"%s.%s()",temp,psi->u.Return_pobj_c->name); 383 383 OpcodeOthers(temporary); … … 462 462 BOOL bThisIsSuperClass; 463 463 if(pobj_CompilingClass->pobj_InheritsClass==0) bThisIsSuperClass=1; 464 else if( pobj_CompilingClass->pobj_InheritsClass->ConstructorMemberSubIndex==-1){464 else if( pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod() == NULL ){ 465 465 //インターフェイスを継承したときはコンストラクタを持たない 466 466 bThisIsSuperClass=1; … … 497 497 RemoveStringPare(temporary); 498 498 499 i3=pobj_CompilingClass->pobj_InheritsClass->ConstructorMemberSubIndex;500 499 Opcode_CallProc(temporary, 501 pobj_CompilingClass->p pobj_Method[i3]->psi,500 pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod()->psi, 502 501 0, 503 502 "", … … 506 505 else{ 507 506 //基底クラスのコンストラクタを暗黙的に呼び出す 508 i3=pobj_CompilingClass->pobj_InheritsClass->ConstructorMemberSubIndex;509 507 Opcode_CallProc("", 510 pobj_CompilingClass->p pobj_Method[i3]->psi,508 pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod()->psi, 511 509 0, 512 510 "", … … 524 522 for(i3=0;i3<pobj_CompilingClass->iMemberNum;i3++){ 525 523 CMember *pMember = pobj_CompilingClass->ppobj_Member[i3]; 524 MemberTypeSize= 525 GetTypeSize(pMember->TypeInfo.type, 526 pMember->TypeInfo.u.lpIndex); 527 528 MemberObjectNum= 529 JumpSubScripts(pMember->SubScripts); 526 530 527 531 offset=GetSizeOfClassMember(pobj_CompilingClass,pMember->name,NULL); 528 532 529 if(pMember->TypeInfo.type==DEF_OBJECT){ 530 if(pMember->TypeInfo.u.pobj_Class->ConstructorMemberSubIndex!=-1){ 531 i5=pMember->TypeInfo.u.pobj_Class->ConstructorMemberSubIndex; 532 if(pMember->TypeInfo.u.pobj_Class->ppobj_Method[i5]->psi->RealParmNum==1){ //Thisポインタを第一引数に持ち合わせるため、引数なしの場合はこの値が1になる 533 534 MemberTypeSize= 535 GetTypeSize(pMember->TypeInfo.type, 536 pMember->TypeInfo.u.lpIndex); 537 538 MemberObjectNum= 539 JumpSubScripts(pMember->SubScripts); 540 533 if(pMember->TypeInfo.type==DEF_OBJECT && pMember->IsRef() == false){ 534 CMethod *method = pMember->TypeInfo.u.pobj_Class->GetConstructorMethod(); 535 if( method ){ 536 if( method->psi->RealParmNum == 1 ){ //Thisポインタを第一引数に持ち合わせるため、引数なしの場合はこの値が1になる 541 537 for(i4=0;i4<MemberObjectNum;i4++){ 542 538 //Thisポインタをecxにコピー … … 553 549 554 550 //call constructor 555 op_call( pMember->TypeInfo.u.pobj_Class->ppobj_Method[i5]->psi);551 op_call( method->psi ); 556 552 } 557 553 } … … 618 614 基底クラスのデストラクタを呼び出す */ 619 615 620 i3=pobj_CompilingClass->pobj_InheritsClass->DestructorMemberSubIndex;621 if( i3!=-1){616 CMethod *method = pobj_CompilingClass->pobj_InheritsClass->GetDestructorMethod(); 617 if( method ){ 622 618 Opcode_CallProc("", 623 pobj_CompilingClass->ppobj_Method[i3]->psi,619 method->psi, 624 620 0, 625 621 "", … … 647 643 648 644 if(pMember->TypeInfo.type==DEF_OBJECT){ 649 if(pMember->TypeInfo.u.pobj_Class->DestructorMemberSubIndex!=-1){ 645 CMethod *method = pMember->TypeInfo.u.pobj_Class->GetDestructorMethod(); 646 if( method ){ 650 647 for(i4=MemberObjectNum-1;i4>=0;i4--){ 651 648 //Thisポインタをecxにコピー … … 662 659 663 660 //call destructor 664 i5=pMember->TypeInfo.u.pobj_Class->DestructorMemberSubIndex; 665 op_call(pMember->TypeInfo.u.pobj_Class->ppobj_Method[i5]->psi); 661 op_call( method->psi ); 666 662 } 667 663 } -
BasicCompiler32/Compile_Statement.cpp
r50 r51 106 106 } 107 107 if(i2==DEF_OBJECT){ 108 CClass *pobj_Class; 109 pobj_Class=(CClass *)lp; 110 if(pobj_Class->DestructorMemberSubIndex!=-1){ 111 //デストラクタの呼び出し 112 113 //push eax 114 op_push(REG_EAX); 115 116 //push eax 117 op_push(REG_EAX); 118 119 //call destructor 120 int i5; 121 i5=pobj_Class->DestructorMemberSubIndex; 122 op_call(pobj_Class->ppobj_Method[i5]->psi); 123 } 124 else{ 125 //push eax 126 op_push(REG_EAX); 127 } 128 129 //call free 130 extern SUBINFO *pSub_free; 131 op_call(pSub_free); 108 //mov ebx,eax 109 op_mov_RR(REG_EBX,REG_EAX); 110 111 FreeTempObject(REG_EBX,(CClass *)lp); 132 112 } 133 113 return; -
BasicCompiler32/MakePeHdr.cpp
r42 r51 1049 1049 // プロシージャポインタスケジュール 1050 1050 for(i=0;i<pobj_SubAddrSchedule->num;i++){ 1051 if(pobj_SubAddrSchedule->ppsi[i]->CompileAddress==0 1052 &&pobj_SubAddrSchedule->ppsi[i]->EndOpAddr==0){ 1053 SetError(300,NULL,-1); 1054 } 1055 1051 1056 if(pobj_SubAddrSchedule->pbCall[i]){ 1052 1057 *((long *)(OpBuffer+pobj_SubAddrSchedule->pObpValues[i]))= -
BasicCompiler32/NumOpe.cpp
r49 r51 96 96 97 97 //call constructor 98 op_call(pobj_StringClass-> ppobj_Method[pobj_StringClass->ConstructorMemberSubIndex]->psi);98 op_call(pobj_StringClass->GetConstructorMethod()->psi); 99 99 } 100 100 -
BasicCompiler32/OperatorProc.cpp
r50 r51 5 5 if(!IsSafeReg(reg)) SetError(300,NULL,cp); 6 6 7 if(pobj_c->DestructorMemberSubIndex!=-1){ 7 CMethod *method = pobj_c->GetDestructorMethod(); 8 if( method ){ 8 9 //push reg 9 10 op_push(reg); 10 11 11 12 //call DestructorProcAddr 12 op_call( pobj_c->ppobj_Method[pobj_c->DestructorMemberSubIndex]->psi);13 op_call( method->psi ); 13 14 } 14 15
Note:
See TracChangeset
for help on using the changeset viewer.