Changeset 64 in dev for BasicCompiler32/Compile_ProcOp.cpp
- Timestamp:
- Mar 8, 2007, 2:49:34 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler32/Compile_ProcOp.cpp
r63 r64 293 293 294 294 LocalVar[MaxLocalVarNum].type=psi->pRealParmInfo[i3].type; 295 if(LocalVar[MaxLocalVarNum].type==DEF_OBJECT){ 296 if(psi->bExport) 297 SetError(24,NULL,cp); 295 if(LocalVar[MaxLocalVarNum].type==DEF_OBJECT 296 ||LocalVar[MaxLocalVarNum].type==DEF_STRUCT){ 297 if(psi->bExport) 298 SetError(24,NULL,cp); 298 299 } 299 300 300 301 LocalVar[MaxLocalVarNum].u.index=psi->pRealParmInfo[i3].u.index; 301 302 302 if(psi->pRealParmInfo[i3].bByVal&&psi->pRealParmInfo[i3].type==DEF_ OBJECT){303 // 実態オブジェクトのByValパラメータ303 if(psi->pRealParmInfo[i3].bByVal&&psi->pRealParmInfo[i3].type==DEF_STRUCT){ 304 //構造体のByValパラメータ 304 305 LocalVar[MaxLocalVarNum].fRef=REF_PARAMETER | OBJECT_PARAMETER; 305 306 VarSize=PTR_SIZE; … … 370 371 OpBuffer[obp++]=(char)0x57; 371 372 372 if(psi->ReturnType!= -1){373 if(psi->ReturnType!=DEF_NON){ 373 374 //戻り値が存在するとき 374 375 … … 377 378 else temp=psi->name; 378 379 379 if(psi->ReturnType==DEF_OBJECT && psi->isReturnRef == false){ 380 //戻り値用オブジェクトのコンストラクタを呼び出す 381 if( psi->u.Return_pobj_c->GetConstructorMethod() ){ 382 sprintf(temporary,"%s.%s()",temp,psi->u.Return_pobj_c->name); 383 OpcodeOthers(temporary); 384 } 380 if(psi->ReturnType==DEF_STRUCT && psi->isReturnRef == false){ 381 //戻り値用の構造体(値型)はパラメータで引き渡される 385 382 } 386 383 else{ … … 517 514 for(i3=0;i3<pobj_CompilingClass->iMemberNum;i3++){ 518 515 CMember *pMember = pobj_CompilingClass->ppobj_Member[i3]; 519 int MemberTypeSize= 520 GetTypeSize(pMember->TypeInfo.type, 521 pMember->TypeInfo.u.lpIndex); 522 523 int MemberObjectNum= 524 JumpSubScripts(pMember->SubScripts); 525 526 int offset = pobj_CompilingClass->GetMemberOffset( pMember->name, NULL ); 527 528 if(pMember->TypeInfo.type==DEF_OBJECT && pMember->IsRef() == false){ 529 CMethod *method = pMember->TypeInfo.u.pobj_Class->GetConstructorMethod(); 530 if( method ){ 531 if( method->psi->RealParmNum == 1 ){ //Thisポインタを第一引数に持ち合わせるため、引数なしの場合はこの値が1になる 532 for(i4=0;i4<MemberObjectNum;i4++){ 533 //Thisポインタをecxにコピー 534 SetThisPtrToReg(REG_ECX); 535 536 //add ecx,offset 537 OpBuffer[obp++]=(char)0x81; 538 OpBuffer[obp++]=(char)0xC1; 539 *((long *)(OpBuffer+obp))=offset+i4*MemberTypeSize; 540 obp+=sizeof(long); 541 542 //push ecx 543 op_push(REG_ECX); 544 545 //call constructor 546 op_call( method->psi ); 547 } 548 } 549 } 516 if(pMember->TypeInfo.type==DEF_OBJECT){ 517 // オブジェクトメンバを発見したとき 518 519 sprintf(temporary, "This.%s=%c%c%s()", 520 pMember->name, 521 1, ESC_NEW, 522 pMember->TypeInfo.u.pobj_Class->name ); 523 OpcodeCalc( temporary ); 550 524 } 551 525 } … … 619 593 } 620 594 621 //実体クラスを持つメンバのデストラクタを呼び出す 595 //実体クラスを持つメンバのデストラクタ呼び出しはGCに任せる 596 /* 622 597 //※コンストラクタと逆順序で呼び出す 623 598 int offset; … … 658 633 } 659 634 } 660 } 635 }*/ 661 636 } 662 637 } … … 706 681 707 682 if(bDebugCompile&&bDebugSupportProc==0){ 708 *((long *)(OpBuffer+EspOffsetSchedule))=AllLocalVarSize-BaseOffset ;683 *((long *)(OpBuffer+EspOffsetSchedule))=AllLocalVarSize-BaseOffset-sizeof(long); 709 684 710 685 //call _DebugSys_EndProc … … 713 688 } 714 689 715 if(psi->ReturnType!= -1){690 if(psi->ReturnType!=DEF_NON){ 716 691 //戻り値をeax、edxに設定 717 692 RELATIVE_VAR RelativeVar; … … 726 701 i3=psi->ReturnType; 727 702 728 if(i3==DEF_OBJECT ){703 if(i3==DEF_OBJECT || i3==DEF_STRUCT){ 729 704 SetVarPtrToEax(&RelativeVar); 705 if( i3==DEF_OBJECT ){ 706 //mov eax,dword ptr[eax] 707 op_mov_RM( sizeof(long), REG_EAX, REG_EAX, 0, MOD_BASE ); 708 } 730 709 } 731 710 else if(i3==DEF_DOUBLE){ … … 818 797 op_pop(REG_EBX); 819 798 799 if(bDebugCompile){ 800 //cmp esp,ebp 801 op_cmp_RR( REG_ESP, REG_EBP ); 802 803 //jz 6(次のcallとbreakpointを飛び越す) 804 OpBuffer[obp++]=(char)0x74; 805 OpBuffer[obp++]=(char)0x06; 806 807 //call _esp_error 808 extern SUBINFO *pSub_esp_error; 809 op_call( pSub_esp_error ); 810 811 breakpoint; 812 } 813 820 814 //mov esp,ebp 821 815 OpBuffer[obp++]=(char)0x8B;
Note:
See TracChangeset
for help on using the changeset viewer.