Changeset 62 in dev
- Timestamp:
- Feb 22, 2007, 3:57:56 AM (18 years ago)
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler32/Compile_Calc.cpp
r55 r62 656 656 657 657 658 if( VarType == DEF_OBJECT && VarRelativeVar.dwKind == VAR_REFLOCAL ){ 658 if( VarType == DEF_OBJECT 659 && (VarRelativeVar.dwKind == VAR_REFLOCAL || VarRelativeVar.dwKind == VAR_REFGLOBAL ) ){ 659 660 // 参照型オブジェクトへの代入(初期化)はポインタ変数と同様の処理に値する 660 661 PTR_LEVEL_UP( VarType ); 661 662 662 VarRelativeVar.dwKind = VAR_LOCAL; 663 if( VarRelativeVar.dwKind == VAR_REFGLOBAL ){ 664 VarRelativeVar.dwKind = VAR_GLOBAL; 665 } 666 else if( VarRelativeVar.dwKind == VAR_REFLOCAL ){ 667 VarRelativeVar.dwKind = VAR_LOCAL; 668 } 663 669 664 670 if( CalcType == DEF_OBJECT ){ -
BasicCompiler32/Compile_Calc_PushVar.cpp
r3 r62 21 21 op_fld_basereg(type,REG_ECX); 22 22 } 23 } 24 else if(pRelativeVar->dwKind==VAR_REFGLOBAL){ 25 SetError(300,NULL,cp); 23 26 } 24 27 else if(pRelativeVar->dwKind==VAR_LOCAL){ … … 89 92 //mov reg, ptr[ecx+offset] 90 93 op_mov_RM(var_size,reg,REG_ECX,(int)pRelativeVar->offset,MOD_BASE_DISP32); 91 obp-=sizeof(long);92 pobj_GlobalVarSchedule->add();93 obp+=sizeof(long);94 94 } 95 95 else{ 96 96 //mov reg, ptr[offset] 97 97 op_mov_RM(var_size,reg,0,(int)pRelativeVar->offset,MOD_DISP32); 98 obp-=sizeof(long); 99 pobj_GlobalVarSchedule->add(); 100 obp+=sizeof(long); 101 } 98 } 99 obp-=sizeof(long); 100 pobj_GlobalVarSchedule->add(); 101 obp+=sizeof(long); 102 } 103 else if(pRelativeVar->dwKind==VAR_REFGLOBAL){ 104 if(pRelativeVar->bOffsetOffset){ 105 //add ecx,qword ptr[offset] 106 op_add_RM(var_size,REG_ECX,REG_NON,(int)pRelativeVar->offset,MOD_DISP32); 107 } 108 else{ 109 //mov ecx,qword ptr[offset] 110 op_mov_RM(var_size,REG_ECX,REG_NON,(int)pRelativeVar->offset,MOD_DISP32); 111 } 112 obp-=sizeof(long); 113 pobj_GlobalVarSchedule->add(); 114 obp+=sizeof(long); 115 116 goto directmem; 102 117 } 103 118 else if(pRelativeVar->dwKind==VAR_LOCAL){ … … 105 120 //mov reg, ptr[ebp+ecx+offset] 106 121 op_mov_RM_ex(var_size,reg,REG_EBP,REG_ECX,(int)pRelativeVar->offset,USE_OFFSET); 107 obp-=sizeof(long);108 AddLocalVarAddrSchedule();109 obp+=sizeof(long);110 122 } 111 123 else{ 112 124 //mov reg, ptr[ebp+offset] 113 125 op_mov_RM(var_size,reg,REG_EBP,(int)pRelativeVar->offset,MOD_BASE_DISP32); 114 obp-=sizeof(long);115 AddLocalVarAddrSchedule();116 obp+=sizeof(long);117 }126 } 127 obp-=sizeof(long); 128 AddLocalVarAddrSchedule(); 129 obp+=sizeof(long); 118 130 } 119 131 else if(pRelativeVar->dwKind==VAR_REFLOCAL){ … … 121 133 //add ecx,qword ptr[ebp+offset] 122 134 op_add_RM(var_size,REG_ECX,REG_EBP,(int)pRelativeVar->offset,MOD_BASE_DISP32); 123 obp-=sizeof(long);124 AddLocalVarAddrSchedule();125 obp+=sizeof(long);126 135 } 127 136 else{ 128 137 //mov ecx,qword ptr[ebp+offset] 129 138 op_mov_RM(var_size,REG_ECX,REG_EBP,(int)pRelativeVar->offset,MOD_BASE_DISP32); 130 obp-=sizeof(long);131 AddLocalVarAddrSchedule();132 obp+=sizeof(long);133 }139 } 140 obp-=sizeof(long); 141 AddLocalVarAddrSchedule(); 142 obp+=sizeof(long); 134 143 135 144 goto directmem; … … 178 187 obp+=sizeof(long); 179 188 } 189 } 190 else if(pRelativeVar->dwKind==VAR_REFGLOBAL){ 191 SetError(300,NULL,cp); 180 192 } 181 193 else if(pRelativeVar->dwKind==VAR_LOCAL){ … … 275 287 } 276 288 } 289 else if(pRelativeVar->dwKind==VAR_REFGLOBAL){ 290 //mov eax,dword ptr[offset] 291 op_mov_RM( sizeof(long), REG_EAX, REG_NON, (int)pRelativeVar->offset, MOD_DISP32 ); 292 obp-=sizeof(long); 293 pobj_GlobalVarSchedule->add(); 294 obp+=sizeof(long); 295 296 if(pRelativeVar->bOffsetOffset){ 297 //add eax,ecx 298 OpBuffer[obp++]=(char)0x03; 299 OpBuffer[obp++]=(char)0xC1; 300 } 301 302 //push dword ptr[eax] 303 OpBuffer[obp++]=(char)0xFF; 304 OpBuffer[obp++]=(char)0x30; 305 } 277 306 else if(pRelativeVar->dwKind==VAR_LOCAL){ 278 307 if(pRelativeVar->bOffsetOffset){ … … 343 372 obp+=sizeof(long); 344 373 } 374 } 375 else if(pRelativeVar->dwKind==VAR_REFGLOBAL){ 376 //mov ebx,dword ptr[offset] 377 op_mov_RM( sizeof(long), REG_EBX, REG_NON, (int)pRelativeVar->offset, MOD_DISP32 ); 378 obp-=sizeof(long); 379 pobj_GlobalVarSchedule->add(); 380 obp+=sizeof(long); 381 382 if(pRelativeVar->bOffsetOffset){ 383 //add ebx,ecx 384 OpBuffer[obp++]=(char)0x03; 385 OpBuffer[obp++]=(char)0xD9; 386 } 387 388 //movsx eax,word ptr[ebx] 389 OpBuffer[obp++]=(char)0x0F; 390 OpBuffer[obp++]=(char)0xBF; 391 OpBuffer[obp++]=(char)0x03; 345 392 } 346 393 else if(pRelativeVar->dwKind==VAR_LOCAL){ … … 422 469 } 423 470 } 471 else if(pRelativeVar->dwKind==VAR_REFGLOBAL){ 472 //mov ebx,dword ptr[offset] 473 op_mov_RM( sizeof(long), REG_EBX, REG_NON, (int)pRelativeVar->offset, MOD_DISP32 ); 474 obp-=sizeof(long); 475 pobj_GlobalVarSchedule->add(); 476 obp+=sizeof(long); 477 478 if(pRelativeVar->bOffsetOffset){ 479 //add ebx,ecx 480 OpBuffer[obp++]=(char)0x03; 481 OpBuffer[obp++]=(char)0xD9; 482 } 483 484 //mov ax,word ptr[ebx] 485 OpBuffer[obp++]=(char)0x66; 486 OpBuffer[obp++]=(char)0x8B; 487 OpBuffer[obp++]=(char)0x03; 488 } 424 489 else if(pRelativeVar->dwKind==VAR_LOCAL){ 425 490 if(pRelativeVar->bOffsetOffset){ … … 498 563 } 499 564 } 565 else if(pRelativeVar->dwKind==VAR_REFGLOBAL){ 566 //mov ebx,dword ptr[offset] 567 op_mov_RM( sizeof(long), REG_EBX, REG_NON, (int)pRelativeVar->offset, MOD_DISP32 ); 568 obp-=sizeof(long); 569 pobj_GlobalVarSchedule->add(); 570 obp+=sizeof(long); 571 572 if(pRelativeVar->bOffsetOffset){ 573 //add ebx,ecx 574 OpBuffer[obp++]=(char)0x03; 575 OpBuffer[obp++]=(char)0xD9; 576 } 577 578 //movsx eax,byte ptr[ebx] 579 OpBuffer[obp++]=(char)0x0F; 580 OpBuffer[obp++]=(char)0xBE; 581 OpBuffer[obp++]=(char)0x03; 582 } 500 583 else if(pRelativeVar->dwKind==VAR_LOCAL){ 501 584 if(pRelativeVar->bOffsetOffset){ … … 574 657 } 575 658 } 659 else if(pRelativeVar->dwKind==VAR_REFGLOBAL){ 660 //mov ebx,dword ptr[offset] 661 op_mov_RM( sizeof(long), REG_EBX, REG_NON, (int)pRelativeVar->offset, MOD_DISP32 ); 662 obp-=sizeof(long); 663 pobj_GlobalVarSchedule->add(); 664 obp+=sizeof(long); 665 666 if(pRelativeVar->bOffsetOffset){ 667 //add ebx,ecx 668 OpBuffer[obp++]=(char)0x03; 669 OpBuffer[obp++]=(char)0xD9; 670 } 671 672 //mov al,byte ptr[ebx] 673 OpBuffer[obp++]=(char)0x8A; 674 OpBuffer[obp++]=(char)0x03; 675 } 576 676 else if(pRelativeVar->dwKind==VAR_LOCAL){ 577 677 if(pRelativeVar->bOffsetOffset){ -
BasicCompiler32/Compile_Set_Var.cpp
r55 r62 121 121 obp+=sizeof(long); 122 122 } 123 } 124 else if( VarKind==VAR_REFGLOBAL ){ 125 SetError(300,NULL,cp); 123 126 } 124 127 else if(VarKind==VAR_LOCAL){ … … 278 281 obp+=sizeof(long); 279 282 } 283 } 284 else if( VarKind==VAR_REFGLOBAL ){ 285 SetError(300,NULL,cp); 280 286 } 281 287 else if(VarKind==VAR_LOCAL){ … … 430 436 } 431 437 } 438 else if(pRelative->dwKind==VAR_REFLOCAL){ 439 if(pRelative->bOffsetOffset){ 440 //add ecx,dword ptr[offset] 441 op_add_RM( sizeof(long), REG_ECX, REG_NON, (int)pRelative->offset, MOD_DISP32 ); 442 } 443 else{ 444 //mov ecx,dword ptr[offset] 445 op_mov_RM( sizeof(long), REG_ECX, REG_NON, (int)pRelative->offset, MOD_DISP32 ); 446 } 447 obp-=sizeof(long); 448 pobj_GlobalVarSchedule->add(); 449 obp+=sizeof(long); 450 451 //mov dword ptr[ecx],eax 452 OpBuffer[obp++]=(char)0x89; 453 OpBuffer[obp++]=(char)0x01; 454 455 //mov dword ptr[ecx+sizeof(long)],edx 456 OpBuffer[obp++]=(char)0x89; 457 OpBuffer[obp++]=(char)0x51; 458 OpBuffer[obp++]=(char)0x04; 459 } 432 460 else if(pRelative->dwKind==VAR_LOCAL){ 433 461 if(pRelative->bOffsetOffset){ … … 573 601 obp+=sizeof(long); 574 602 } 603 } 604 else if(VarKind==VAR_REFGLOBAL){ 605 if(bOffsetOffset){ 606 //add ecx,dword ptr[offset] 607 op_add_RM( sizeof(long), REG_ECX, REG_NON, (int)offset, MOD_DISP32 ); 608 } 609 else{ 610 //mov ecx,dword ptr[offset] 611 op_mov_RM( sizeof(long), REG_ECX, REG_NON, (int)offset, MOD_DISP32 ); 612 } 613 obp-=sizeof(long); 614 pobj_GlobalVarSchedule->add(); 615 obp+=sizeof(long); 616 617 //mov dword ptr[ecx],eax 618 OpBuffer[obp++]=(char)0x89; 619 OpBuffer[obp++]=(char)0x01; 575 620 } 576 621 else if(VarKind==VAR_LOCAL){ … … 665 710 } 666 711 } 712 else if(VarKind==VAR_REFGLOBAL){ 713 //mov eax,dword ptr[offset] 714 op_mov_RM( sizeof(long), REG_EAX, REG_NON, (int)offset, MOD_DISP32 ); 715 obp-=sizeof(long); 716 pobj_GlobalVarSchedule->add(); 717 obp+=sizeof(long); 718 719 if(bOffsetOffset){ 720 //add eax,ecx 721 OpBuffer[obp++]=(char)0x03; 722 OpBuffer[obp++]=(char)0xC1; 723 } 724 725 //fistp dword ptr[eax] 726 fpu_cast(); 727 OpBuffer[obp++]=(char)0xDB; 728 OpBuffer[obp++]=(char)0x18; 729 fpu_cast_end(); 730 } 667 731 else if(VarKind==VAR_LOCAL){ 668 732 if(bOffsetOffset){ … … 751 815 } 752 816 } 817 else if(VarKind==VAR_REFGLOBAL){ 818 //mov ebx,dword ptr[offset] 819 op_mov_RM( sizeof(long), REG_EBX, REG_NON, (int)offset, MOD_DISP32 ); 820 obp-=sizeof(long); 821 pobj_GlobalVarSchedule->add(); 822 obp+=sizeof(long); 823 824 if(bOffsetOffset){ 825 //add ebx,ecx 826 OpBuffer[obp++]=(char)0x03; 827 OpBuffer[obp++]=(char)0xD9; 828 } 829 830 //mov word ptr[ebx],ax 831 OpBuffer[obp++]=(char)0x66; 832 OpBuffer[obp++]=(char)0x89; 833 OpBuffer[obp++]=(char)0x03; 834 } 753 835 else if(VarKind==VAR_LOCAL){ 754 836 if(bOffsetOffset){ … … 826 908 } 827 909 } 910 else if(VarKind==VAR_REFGLOBAL){ 911 //mov ebx,dword ptr[offset] 912 op_mov_RM( sizeof(long), REG_EBX, REG_NON, (int)offset, MOD_DISP32 ); 913 obp-=sizeof(long); 914 pobj_GlobalVarSchedule->add(); 915 obp+=sizeof(long); 916 917 if(bOffsetOffset){ 918 //add ebx,ecx 919 OpBuffer[obp++]=(char)0x03; 920 OpBuffer[obp++]=(char)0xD9; 921 } 922 923 //mov byte ptr[ebx],al 924 OpBuffer[obp++]=(char)0x88; 925 OpBuffer[obp++]=(char)0x03; 926 } 828 927 else if(VarKind==VAR_LOCAL){ 829 928 if(bOffsetOffset){ -
BasicCompiler32/Compile_Var.cpp
r56 r62 614 614 pRelativeVar->offset=GlobalVar[i].offset; 615 615 pRelativeVar->bOffsetOffset=0; 616 pRelativeVar->dwKind=VAR_GLOBAL; 616 if(GlobalVar[i].fRef){ 617 // 参照型 618 pRelativeVar->dwKind = VAR_REFGLOBAL; 619 } 620 else pRelativeVar->dwKind=VAR_GLOBAL; 617 621 *pType=GlobalVar[i].type; 618 622 lpIndex=GlobalVar[i].u.index; … … 1180 1184 GetNowStaticVarFullName(VarName,temporary); 1181 1185 1182 AddGlobalVariable( temporary,SubScripts,&TypeInfo,TypeSize,InitBuf,ConstractParameter,dwFlags);1186 AddGlobalVariable(isRef, temporary,SubScripts,&TypeInfo,TypeSize,InitBuf,ConstractParameter,dwFlags); 1183 1187 1184 1188 /* … … 1193 1197 ///////////////////////// 1194 1198 1195 AddGlobalVariable( VarName,SubScripts,&TypeInfo,TypeSize,InitBuf,ConstractParameter,dwFlags);1199 AddGlobalVariable(isRef, VarName,SubScripts,&TypeInfo,TypeSize,InitBuf,ConstractParameter,dwFlags); 1196 1200 } 1197 1201 else{ … … 1365 1369 } 1366 1370 } 1371 else if(pRelativeVar->dwKind==VAR_REFGLOBAL){ 1372 if(pRelativeVar->bOffsetOffset){ 1373 //mov eax,ecx 1374 OpBuffer[obp++]=(char)0x8B; 1375 OpBuffer[obp++]=(char)0xC1; 1376 1377 //add eax,dword ptr[offset] 1378 op_add_RM( sizeof(long), REG_EAX, REG_NON, (int)pRelativeVar->offset, MOD_DISP32 ); 1379 } 1380 else{ 1381 //mov eax,dword ptr[offset] 1382 op_mov_RM( sizeof(long), REG_EAX, REG_NON, (int)pRelativeVar->offset, MOD_DISP32 ); 1383 } 1384 obp-=sizeof(long); 1385 pobj_GlobalVarSchedule->add(); 1386 obp+=sizeof(long); 1387 } 1367 1388 else if(pRelativeVar->dwKind==VAR_LOCAL){ 1368 1389 if(pRelativeVar->bOffsetOffset){ -
BasicCompiler32/Opcode.h
r56 r62 6 6 7 7 //レジスタを示す定数 8 #define REG_NON -1 8 9 #define REG_EAX 0x00 //reg:000 9 10 #define REG_ECX 0x01 //reg:001 … … 27 28 28 29 //変数の種類 29 #define NON_VAR 0 30 #define VAR_GLOBAL 1 //Global Variable 31 #define VAR_LOCAL 2 //Local Variable 32 #define VAR_REFLOCAL 3 //Local Refference Variable 33 #define VAR_DIRECTMEM 4 //Direct memory 30 #define NON_VAR 0 31 #define VAR_GLOBAL 1 // Global Variable 32 #define VAR_REFGLOBAL 2 // Global Refference Variable 33 #define VAR_LOCAL 3 // Local Variable 34 #define VAR_REFLOCAL 4 // Local Refference Variable 35 #define VAR_DIRECTMEM 5 // Direct memory 34 36 35 37 -
BasicCompiler32/WatchList.cpp
r3 r62 14 14 if(pRelativeVar->dwKind==VAR_GLOBAL){ 15 15 return ImageBase+MemPos_RWSection+pRelativeVar->offset; 16 } 17 else if(pRelativeVar->dwKind==VAR_REFGLOBAL){ 18 extern HANDLE hDebugProcess; 19 ULONG_PTR lpData; 20 ULONG_PTR lpAccBytes; 21 ReadProcessMemory(hDebugProcess, 22 (void *)(ImageBase+MemPos_RWSection+pRelativeVar->offset), 23 &lpData, 24 sizeof(ULONG_PTR), 25 &lpAccBytes); 26 27 return lpData; 16 28 } 17 29 else if(pRelativeVar->dwKind==VAR_LOCAL){ … … 426 438 427 439 pRelativeVar->offset=GlobalVar[i].offset; 428 pRelativeVar->dwKind=VAR_GLOBAL; 440 if(GlobalVar[i].fRef) pRelativeVar->dwKind=VAR_REFGLOBAL; 441 else pRelativeVar->dwKind=VAR_GLOBAL; 429 442 *pType=GlobalVar[i].type; 430 443 lpIndex=GlobalVar[i].u.index; -
BasicCompiler32/increment.cpp
r55 r62 23 23 } 24 24 } 25 else if(pRelativeVar->dwKind==VAR_REFGLOBAL){ 26 if(pRelativeVar->bOffsetOffset){ 27 //add ecx,qword ptr[offset] 28 op_add_RM(sizeof(long),REG_ECX,REG_NON,(int)pRelativeVar->offset,MOD_DISP32); 29 } 30 else{ 31 //mov ecx,qword ptr[offset] 32 op_mov_RM(sizeof(long),REG_ECX,REG_NON,(int)pRelativeVar->offset,MOD_DISP32); 33 } 34 obp-=sizeof(long); 35 pobj_GlobalVarSchedule->add(); 36 obp+=sizeof(long); 37 38 goto directmem; 39 } 25 40 else if(pRelativeVar->dwKind==VAR_LOCAL){ 26 41 if(pRelativeVar->bOffsetOffset){ 27 42 //fstp ptr[ebp+ecx+offset] 28 43 op_fstp_base_offset_ex(type,REG_EBP,REG_ECX,(int)pRelativeVar->offset,USE_OFFSET); 29 obp-=sizeof(long);30 AddLocalVarAddrSchedule();31 obp+=sizeof(long);32 44 } 33 45 else{ 34 46 //fstp ptr[ebp+offset] 35 47 op_fstp_base_offset(type,REG_EBP,(int)pRelativeVar->offset); 36 obp-=sizeof(long);37 AddLocalVarAddrSchedule();38 obp+=sizeof(long);39 }48 } 49 obp-=sizeof(long); 50 AddLocalVarAddrSchedule(); 51 obp+=sizeof(long); 40 52 } 41 53 else if(pRelativeVar->dwKind==VAR_REFLOCAL){ … … 43 55 //add ecx,qword ptr[ebp+offset] 44 56 op_add_RM(sizeof(long),REG_ECX,REG_EBP,(int)pRelativeVar->offset,MOD_BASE_DISP32); 45 obp-=sizeof(long);46 AddLocalVarAddrSchedule();47 obp+=sizeof(long);48 57 } 49 58 else{ 50 59 //mov ecx,qword ptr[ebp+offset] 51 60 op_mov_RM(sizeof(long),REG_ECX,REG_EBP,(int)pRelativeVar->offset,MOD_BASE_DISP32); 52 obp-=sizeof(long);53 AddLocalVarAddrSchedule();54 obp+=sizeof(long);55 }61 } 62 obp-=sizeof(long); 63 AddLocalVarAddrSchedule(); 64 obp+=sizeof(long); 56 65 57 66 goto directmem; … … 151 160 //mov ptr[ecx+offset],eax/ax/al 152 161 op_mov_MR(var_size,reg,REG_ECX,(int)pRelative->offset,MOD_BASE_DISP32); 153 obp-=sizeof(long);154 pobj_GlobalVarSchedule->add();155 obp+=sizeof(long);156 162 } 157 163 else{ 158 164 //mov ptr[offset],eax/ax/al 159 165 op_mov_MR(var_size,reg,0,(int)pRelative->offset,MOD_DISP32); 160 obp-=sizeof(long); 161 pobj_GlobalVarSchedule->add(); 162 obp+=sizeof(long); 163 } 166 } 167 obp-=sizeof(long); 168 pobj_GlobalVarSchedule->add(); 169 obp+=sizeof(long); 170 } 171 else if(pRelative->dwKind==VAR_REFGLOBAL){ 172 if(pRelative->bOffsetOffset){ 173 //add ecx,qword ptr[offset] 174 op_add_RM(var_size,REG_ECX,REG_NON,(int)pRelative->offset,MOD_DISP32); 175 } 176 else{ 177 //mov ecx,qword ptr[offset] 178 op_mov_RM(var_size,REG_ECX,REG_NON,(int)pRelative->offset,MOD_DISP32); 179 } 180 obp-=sizeof(long); 181 pobj_GlobalVarSchedule->add(); 182 obp+=sizeof(long); 183 184 goto directmem; 164 185 } 165 186 else if(pRelative->dwKind==VAR_LOCAL){ … … 167 188 //mov ptr[ebp+ecx+offset],eax/ax/al 168 189 op_mov_MR_ex(var_size,reg,REG_EBP,REG_ECX,(int)pRelative->offset,USE_OFFSET); 169 obp-=sizeof(long);170 AddLocalVarAddrSchedule();171 obp+=sizeof(long);172 190 } 173 191 else{ 174 192 //mov ptr[ebp+offset],eax/ax/al 175 193 op_mov_MR(var_size,reg,REG_EBP,(int)pRelative->offset,MOD_BASE_DISP32); 176 obp-=sizeof(long);177 AddLocalVarAddrSchedule();178 obp+=sizeof(long);179 }194 } 195 obp-=sizeof(long); 196 AddLocalVarAddrSchedule(); 197 obp+=sizeof(long); 180 198 } 181 199 else if(pRelative->dwKind==VAR_REFLOCAL){ … … 183 201 //add ecx,qword ptr[ebp+offset] 184 202 op_add_RM(var_size,REG_ECX,REG_EBP,(int)pRelative->offset,MOD_BASE_DISP32); 185 obp-=sizeof(long);186 AddLocalVarAddrSchedule();187 obp+=sizeof(long);188 203 } 189 204 else{ 190 205 //mov ecx,qword ptr[ebp+offset] 191 206 op_mov_RM(var_size,REG_ECX,REG_EBP,(int)pRelative->offset,MOD_BASE_DISP32); 192 obp-=sizeof(long);193 AddLocalVarAddrSchedule();194 obp+=sizeof(long);195 }207 } 208 obp-=sizeof(long); 209 AddLocalVarAddrSchedule(); 210 obp+=sizeof(long); 196 211 197 212 goto directmem; -
BasicCompiler64/Compile_Calc.cpp
r55 r62 286 286 } 287 287 288 if( VarType == DEF_OBJECT && VarRelativeVar.dwKind == VAR_REFLOCAL ){ 288 if( VarType == DEF_OBJECT 289 && (VarRelativeVar.dwKind == VAR_REFLOCAL || VarRelativeVar.dwKind == VAR_REFGLOBAL ) ){ 289 290 // 参照型オブジェクトへの代入(初期化)はポインタ変数と同様の処理に値する 290 291 PTR_LEVEL_UP( VarType ); 291 292 292 VarRelativeVar.dwKind = VAR_LOCAL; 293 if( VarRelativeVar.dwKind == VAR_REFGLOBAL ){ 294 VarRelativeVar.dwKind = VAR_GLOBAL; 295 } 296 else if( VarRelativeVar.dwKind == VAR_REFLOCAL ){ 297 VarRelativeVar.dwKind = VAR_LOCAL; 298 } 293 299 294 300 if( CalcType == DEF_OBJECT ){ -
BasicCompiler64/Compile_Calc_PushVar.cpp
r40 r62 27 27 obp+=sizeof(long); 28 28 } 29 } 30 else if( pRelativeVar->dwKind == VAR_REFGLOBAL ){ 31 SetError(300,NULL,cp); 29 32 } 30 33 else if(pRelativeVar->dwKind==VAR_LOCAL){ … … 109 112 } 110 113 } 114 else if( pRelativeVar->dwKind == VAR_REFGLOBAL ){ 115 SetError(300,NULL,cp); 116 } 111 117 else if(pRelativeVar->dwKind==VAR_LOCAL){ 112 118 if(pRelativeVar->bOffsetOffset){ … … 188 194 } 189 195 } 196 else if( pRelativeVar->dwKind == VAR_REFGLOBAL ){ 197 if(pRelativeVar->bOffsetOffset){ 198 //add r11,qword ptr[offset] 199 op_add_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelativeVar->offset,MOD_DISP32); 200 obp-=sizeof(long); 201 pobj_GlobalVarSchedule->add(); 202 obp+=sizeof(long); 203 } 204 else{ 205 //mov r11,qword ptr[offset] 206 op_mov_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelativeVar->offset,MOD_DISP32); 207 obp-=sizeof(long); 208 pobj_GlobalVarSchedule->add(); 209 obp+=sizeof(long); 210 } 211 212 goto directmem; 213 } 190 214 else if(pRelativeVar->dwKind==VAR_LOCAL){ 191 215 if(pRelativeVar->bOffsetOffset){ -
BasicCompiler64/Compile_Set_Var.cpp
r40 r62 153 153 obp+=sizeof(long); 154 154 } 155 } 156 else if(pRelative->dwKind==VAR_REFGLOBAL){ 157 SetError(300,NULL,cp); 155 158 } 156 159 else if(pRelative->dwKind==VAR_LOCAL){ … … 242 245 } 243 246 } 247 else if(pRelative->dwKind==VAR_REFGLOBAL){ 248 SetError(300,NULL,cp); 249 } 244 250 else if(pRelative->dwKind==VAR_LOCAL){ 245 251 if(pRelative->bOffsetOffset){ … … 367 373 } 368 374 } 375 else if( pRelative->dwKind == VAR_REFGLOBAL ){ 376 if(pRelative->bOffsetOffset){ 377 //add r11,qword ptr[offset] 378 op_add_RM( sizeof(_int64), REG_R11, REG_NON, (int)pRelative->offset, MOD_DISP32 ); 379 obp-=sizeof(long); 380 pobj_GlobalVarSchedule->add(); 381 obp+=sizeof(long); 382 } 383 else{ 384 //mov r11,qword ptr[offset] 385 op_mov_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelative->offset,MOD_DISP32); 386 obp-=sizeof(long); 387 pobj_GlobalVarSchedule->add(); 388 obp+=sizeof(long); 389 } 390 391 goto directmem; 392 } 369 393 else if(pRelative->dwKind==VAR_LOCAL){ 370 394 if(pRelative->bOffsetOffset){ … … 386 410 if(pRelative->bOffsetOffset){ 387 411 //add r11,qword ptr[rsp+offset] 388 OpBuffer[obp++]=(char)0x4C; 389 OpBuffer[obp++]=(char)0x03; 390 OpBuffer[obp++]=(char)0x9C; 391 OpBuffer[obp++]=(char)0x24; 392 *((long *)(OpBuffer+obp))=(int)pRelative->offset; 412 op_add_RM( sizeof(_int64), REG_R11, REG_RSP, (int)pRelative->offset, MOD_BASE_DISP32 ); 413 obp-=sizeof(long); 393 414 AddLocalVarAddrSchedule(); 394 415 obp+=sizeof(long); -
BasicCompiler64/Compile_Var.cpp
r56 r62 647 647 pRelativeVar->offset=GlobalVar[i].offset; 648 648 pRelativeVar->bOffsetOffset=0; 649 pRelativeVar->dwKind=VAR_GLOBAL; 649 if(GlobalVar[i].fRef){ 650 // 参照型 651 pRelativeVar->dwKind = VAR_REFGLOBAL; 652 } 653 else pRelativeVar->dwKind=VAR_GLOBAL; 650 654 *pType=GlobalVar[i].type; 651 655 lpIndex=GlobalVar[i].u.index; … … 1181 1185 GetNowStaticVarFullName(VarName,temporary); 1182 1186 1183 AddGlobalVariable( temporary,SubScripts,&TypeInfo,TypeSize,InitBuf,ConstractParameter,dwFlags);1187 AddGlobalVariable(isRef,temporary,SubScripts,&TypeInfo,TypeSize,InitBuf,ConstractParameter,dwFlags); 1184 1188 1185 1189 /* … … 1194 1198 ///////////////////////// 1195 1199 1196 AddGlobalVariable( VarName,SubScripts,&TypeInfo,TypeSize,InitBuf,ConstractParameter,dwFlags);1200 AddGlobalVariable(isRef,VarName,SubScripts,&TypeInfo,TypeSize,InitBuf,ConstractParameter,dwFlags); 1197 1201 } 1198 1202 else{ … … 1367 1371 } 1368 1372 } 1373 else if( pRelativeVar->dwKind == VAR_REFGLOBAL ){ 1374 if(pRelativeVar->bOffsetOffset){ 1375 //add r11,qword ptr[offset] 1376 op_add_RM( sizeof(_int64), REG_R11, REG_NON, (int)pRelativeVar->offset, MOD_DISP32 ); 1377 obp-=sizeof(long); 1378 pobj_GlobalVarSchedule->add(); 1379 obp+=sizeof(long); 1380 } 1381 else{ 1382 //mov r11,qword ptr[offset] 1383 op_mov_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelativeVar->offset,MOD_DISP32); 1384 obp-=sizeof(long); 1385 pobj_GlobalVarSchedule->add(); 1386 obp+=sizeof(long); 1387 } 1388 1389 goto directmem; 1390 } 1369 1391 else if(pRelativeVar->dwKind==VAR_LOCAL){ 1370 1392 if(pRelativeVar->bOffsetOffset){ -
BasicCompiler64/Opcode.h
r56 r62 53 53 //変数の種類 54 54 #define NON_VAR 0 55 #define VAR_GLOBAL 1 //Global Variable 56 #define VAR_LOCAL 2 //Local Variable 57 #define VAR_REFLOCAL 3 //Local Refference Variable 58 #define VAR_DIRECTMEM 5 //Direct memory 55 #define VAR_GLOBAL 1 // Global Variable 56 #define VAR_REFGLOBAL 2 // Global Refference Variable 57 #define VAR_LOCAL 3 // Local Variable 58 #define VAR_REFLOCAL 4 // Local Refference Variable 59 #define VAR_DIRECTMEM 5 // Direct memory 59 60 60 61 -
BasicCompiler64/WatchList.cpp
r40 r62 14 14 if(pRelativeVar->dwKind==VAR_GLOBAL){ 15 15 return ImageBase+MemPos_RWSection+pRelativeVar->offset; 16 } 17 else if( pRelativeVar->dwKind == VAR_REFGLOBAL ){ 18 extern HANDLE hDebugProcess; 19 LONG_PTR lpData; 20 SIZE_T stAccBytes; 21 ReadProcessMemory(hDebugProcess, 22 (void *)(ImageBase+MemPos_RWSection+pRelativeVar->offset), 23 &lpData, 24 sizeof(LONG_PTR), 25 &stAccBytes); 26 27 return lpData; 16 28 } 17 29 else if(pRelativeVar->dwKind==VAR_LOCAL){ … … 430 442 431 443 pRelativeVar->offset=GlobalVar[i].offset; 432 pRelativeVar->dwKind=VAR_GLOBAL; 444 if(GlobalVar[i].fRef) pRelativeVar->dwKind=VAR_REFGLOBAL; 445 else pRelativeVar->dwKind=VAR_GLOBAL; 433 446 *pType=GlobalVar[i].type; 434 447 lpIndex=GlobalVar[i].u.index; -
BasicCompiler_Common/Class.cpp
r59 r62 127 127 sprintf(temporary,"%s.%s",pobj_c->name,member->name); 128 128 AddGlobalVariable( 129 false, 129 130 temporary, 130 131 member->SubScripts, -
BasicCompiler_Common/Variable.cpp
r57 r62 1137 1137 1138 1138 1139 void AddGlobalVariable( char *name,int *SubScripts,TYPEINFO *pTypeInfo,int TypeSize,char *InitBuf,char *ConstractParameter,DWORD dwFlag){1139 void AddGlobalVariable(bool isRef, char *name,int *SubScripts,TYPEINFO *pTypeInfo,int TypeSize,char *InitBuf,char *ConstractParameter,DWORD dwFlag){ 1140 1140 ///////////////////////// 1141 1141 // グローバル変数を追加 … … 1159 1159 1160 1160 GlobalVar=(VARIABLE *)HeapReAlloc(hHeap,0,GlobalVar,(MaxGlobalVarNum+1)*sizeof(VARIABLE)); 1161 VARIABLE *pVar = &GlobalVar[MaxGlobalVarNum]; 1162 MaxGlobalVarNum++; 1163 1164 if( isRef ){ 1165 //参照型 1166 pVar->fRef = REF_VARIABLE; 1167 TypeSize = PTR_SIZE; 1168 } 1169 else pVar->fRef=0; 1161 1170 1162 1171 for(i2=1,i3=0;i3<255;i3++){ 1163 1172 //配列要素数 1164 GlobalVar[MaxGlobalVarNum].SubScripts[i3]=SubScripts[i3];1173 pVar->SubScripts[i3]=SubScripts[i3]; 1165 1174 1166 1175 if(SubScripts[i3]==-1) break; … … 1170 1179 if(VarSize%PTR_SIZE) VarSize+=PTR_SIZE-(VarSize%PTR_SIZE); 1171 1180 1172 //新しいオブジェクトポインタを取得1173 VARIABLE *pVar = &GlobalVar[MaxGlobalVarNum];1174 1175 //グローバル変数の個数を増加1176 MaxGlobalVarNum++;1177 1178 1181 lstrcpy(pVar->name,name); 1179 pVar->fRef = 0;1180 1182 if(dwFlag & DIMFLAG_CONST) pVar->bConst = true; 1181 1183 else pVar->bConst = false; … … 1218 1220 //単発式が初期値のオブジェクトの場合 1219 1221 //初期値をコピーコンストラクタに渡す 1222 1223 if( isRef ){ 1224 SetRefVariable( name, InitBuf ); 1225 } 1220 1226 } 1221 1227 else{ -
BasicCompiler_Common/Variable.h
r49 r62 28 28 BOOL GetDimentionFormat(const char *buffer, const bool isRef, char *VarName,int *SubScripts,TYPEINFO *pTypeInfo,char *InitBuf,char *ConstractParameter); 29 29 BOOL GetNowStaticVarFullName(char *VarName,char *FullName); 30 void AddGlobalVariable( char *name,int *SubScripts,TYPEINFO *pTypeInfo,int TypeSize,char *InitBuf,char *ConstractParameter,DWORD dwFlag);30 void AddGlobalVariable(bool isRef, char *name,int *SubScripts,TYPEINFO *pTypeInfo,int TypeSize,char *InitBuf,char *ConstractParameter,DWORD dwFlag); 31 31 -
ProjectEditor/ProjectEditor.cpp
r56 r62 2028 2028 hCompileView=(HWND)-1; 2029 2029 } 2030 2031 //インクルードディレクトリ 2032 sprintf(temp2," /include_dir:\"%s\"",pobj_nv->szIncludeDir); 2033 lstrcat(temporary,temp2); 2030 2034 2031 2035 sprintf(str,"%s%s",pj_editor_Dir,lpszCompilerName);
Note:
See TracChangeset
for help on using the changeset viewer.