Changeset 66 in dev
- Timestamp:
- Mar 9, 2007, 4:59:13 AM (18 years ago)
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler32/CParameter.cpp
r64 r66 66 66 nCountOfTempObjects++; 67 67 68 if( type == DEF_OBJECT ){68 if( type != DEF_STRUCT ){ 69 69 //一時参照を作成 70 70 … … 114 114 op_call(pSub_free); 115 115 } 116 else if( types[i2].type == DEF_OBJECT ){117 op_pop( REG_NON );118 op_pop( REG_NON );119 }120 116 else{ 121 SetError(300,NULL,cp); 122 } 123 117 if( Is64Type( types[i2].type ) ){ 118 //pop ... 参照を消す 119 //pop ... 上位32ビット 120 //pop ... 下位32ビット 121 op_add_esp( PTR_SIZE * 3 ); 122 } 123 else{ 124 //pop ... 参照を消す 125 //pop ... 値を消す 126 op_add_esp( PTR_SIZE * 2 ); 127 } 128 } 124 129 } 125 130 } … … 363 368 //一時オブジェクトをコピー 364 369 365 if( types[i2].type == DEF_OBJECT ){370 if( types[i2].type != DEF_STRUCT ){ 366 371 // 一時参照のための領域を考慮する 367 372 nCountOfNowTempObjects++; -
BasicCompiler32/Compile_Calc.cpp
r64 r66 223 223 224 224 //fistp qword ptr[esp] 225 fpu_cast(); 226 OpBuffer[obp++]=(char)0xDF; 227 OpBuffer[obp++]=(char)0x3C; 228 OpBuffer[obp++]=(char)0x24; 229 fpu_cast_end(); 225 op_fistp_ptr_esp( sizeof(_int64) ); 230 226 } 231 227 else if(OldType==DEF_SINGLE){ … … 237 233 238 234 //fistp qword ptr[esp] 239 fpu_cast(); 240 OpBuffer[obp++]=(char)0xDF; 241 OpBuffer[obp++]=(char)0x3C; 242 OpBuffer[obp++]=(char)0x24; 243 fpu_cast_end(); 235 op_fistp_ptr_esp( sizeof(_int64) ); 244 236 } 245 237 else if(IsWholeNumberType(OldType)){ … … 288 280 289 281 //fistp dword ptr[esp] 290 fpu_cast(); 291 OpBuffer[obp++]=(char)0xDB; 292 OpBuffer[obp++]=(char)0x1C; 293 OpBuffer[obp++]=(char)0x24; 294 fpu_cast_end(); 282 op_fistp_ptr_esp( sizeof(long) ); 295 283 } 296 284 else if(OldType==DEF_SINGLE){ … … 299 287 300 288 //fistp dword ptr[esp] 301 fpu_cast(); 302 OpBuffer[obp++]=(char)0xDB; 303 OpBuffer[obp++]=(char)0x1C; 304 OpBuffer[obp++]=(char)0x24; 305 fpu_cast_end(); 289 op_fistp_ptr_esp( sizeof(long) ); 306 290 } 307 291 else if(OldType==DEF_INT64||OldType==DEF_QWORD){ -
BasicCompiler32/Compile_Calc_PushVar.cpp
r62 r66 66 66 } 67 67 void SetReg_WholeVariable(int type,RELATIVE_VAR *pRelativeVar,int reg){ 68 int var _size;69 70 var _size=GetTypeSize(type,-1);71 72 if(var _size==sizeof(_int64)){68 int varSize; 69 70 varSize=GetTypeSize(type,-1); 71 72 if(varSize==sizeof(_int64)){ 73 73 //64ビットの場合はedx:eaxにロード 74 74 if(reg!=REG_EAX){ … … 91 91 if(pRelativeVar->bOffsetOffset){ 92 92 //mov reg, ptr[ecx+offset] 93 op_mov_RM(var _size,reg,REG_ECX,(int)pRelativeVar->offset,MOD_BASE_DISP32);93 op_mov_RM(varSize,reg,REG_ECX,(int)pRelativeVar->offset,MOD_BASE_DISP32); 94 94 } 95 95 else{ 96 96 //mov reg, ptr[offset] 97 op_mov_RM(var _size,reg,0,(int)pRelativeVar->offset,MOD_DISP32);97 op_mov_RM(varSize,reg,0,(int)pRelativeVar->offset,MOD_DISP32); 98 98 } 99 99 obp-=sizeof(long); … … 104 104 if(pRelativeVar->bOffsetOffset){ 105 105 //add ecx,qword ptr[offset] 106 op_add_RM(var _size,REG_ECX,REG_NON,(int)pRelativeVar->offset,MOD_DISP32);106 op_add_RM(varSize,REG_ECX,REG_NON,(int)pRelativeVar->offset,MOD_DISP32); 107 107 } 108 108 else{ 109 109 //mov ecx,qword ptr[offset] 110 op_mov_RM(var _size,REG_ECX,REG_NON,(int)pRelativeVar->offset,MOD_DISP32);110 op_mov_RM(varSize,REG_ECX,REG_NON,(int)pRelativeVar->offset,MOD_DISP32); 111 111 } 112 112 obp-=sizeof(long); … … 119 119 if(pRelativeVar->bOffsetOffset){ 120 120 //mov reg, ptr[ebp+ecx+offset] 121 op_mov_RM_ex(var _size,reg,REG_EBP,REG_ECX,(int)pRelativeVar->offset,USE_OFFSET);121 op_mov_RM_ex(varSize,reg,REG_EBP,REG_ECX,(int)pRelativeVar->offset,USE_OFFSET); 122 122 } 123 123 else{ 124 124 //mov reg, ptr[ebp+offset] 125 op_mov_RM(var _size,reg,REG_EBP,(int)pRelativeVar->offset,MOD_BASE_DISP32);125 op_mov_RM(varSize,reg,REG_EBP,(int)pRelativeVar->offset,MOD_BASE_DISP32); 126 126 } 127 127 obp-=sizeof(long); … … 132 132 if(pRelativeVar->bOffsetOffset){ 133 133 //add ecx,qword ptr[ebp+offset] 134 op_add_RM(var _size,REG_ECX,REG_EBP,(int)pRelativeVar->offset,MOD_BASE_DISP32);134 op_add_RM(varSize,REG_ECX,REG_EBP,(int)pRelativeVar->offset,MOD_BASE_DISP32); 135 135 } 136 136 else{ 137 137 //mov ecx,qword ptr[ebp+offset] 138 op_mov_RM(var _size,REG_ECX,REG_EBP,(int)pRelativeVar->offset,MOD_BASE_DISP32);138 op_mov_RM(varSize,REG_ECX,REG_EBP,(int)pRelativeVar->offset,MOD_BASE_DISP32); 139 139 } 140 140 obp-=sizeof(long); … … 147 147 directmem: 148 148 //mov reg, ptr[ecx] 149 op_mov_RM(var _size,reg,REG_ECX,0,MOD_BASE);149 op_mov_RM(varSize,reg,REG_ECX,0,MOD_BASE); 150 150 } 151 151 } -
BasicCompiler32/Compile_Set_Var.cpp
r64 r66 274 274 } 275 275 276 void SetWholeVariable(int var_size,int type,RELATIVE_VAR *pRelative){ 277 if(type==DEF_DOUBLE){ 278 //Double型 279 // st(0)の内容をedx:eaxに変換 280 281 //TODO: 実装 282 SetError(); 283 } 284 else if(type==DEF_SINGLE){ 285 //Single型 286 // st(0)の内容をeaxに変換 287 288 //TODO: 実装 289 SetError(); 276 void SetWholeVariable(int varSize,int calcType,RELATIVE_VAR *pRelative){ 277 if( IsRealNumberType( calcType ) ){ 278 // 実数型から整数型へ変換する 279 280 if( varSize == sizeof(_int64) ){ 281 // 64bitへ 282 // st(0) -> edx:eax 283 breakpoint; 284 285 //push 286 //push 287 op_sub_esp( PTR_SIZE * 2 ); 288 289 //fistp qword ptr[esp] 290 op_fistp_ptr_esp( sizeof(_int64) ); 291 292 //pop eax 293 op_pop( REG_EAX ); 294 295 //pop edx 296 op_pop( REG_EDX ); 297 } 298 else{ 299 // 32bit 300 // st(0) -> eax 301 302 //push 303 op_push( REG_NON ); 304 305 //fistp dword ptr[esp] 306 op_fistp_ptr_esp( sizeof(long) ); 307 308 //pop eax 309 op_pop( REG_EAX ); 310 } 290 311 } 291 312 else{ 292 313 //その他の整数 293 314 294 if(var _size==sizeof(_int64)){315 if(varSize==sizeof(_int64)){ 295 316 //eaxの値を64ビット(edx:eax)に拡張する 296 ExtendTypeTo64( type);297 } 298 else if(var _size==sizeof(long)){317 ExtendTypeTo64(calcType); 318 } 319 else if(varSize==sizeof(long)){ 299 320 //レジスタの値を32ビット(eax)に拡張する 300 ExtendTypeTo32( type,REG_EAX);301 } 302 else if(var _size==sizeof(short)){321 ExtendTypeTo32(calcType,REG_EAX); 322 } 323 else if(varSize==sizeof(short)){ 303 324 //レジスタの値を16ビット(ax)に拡張する 304 ExtendTypeTo16( type,REG_EAX);325 ExtendTypeTo16(calcType,REG_EAX); 305 326 } 306 327 //8ビットは拡張なし 307 328 } 308 329 309 if(var _size==sizeof(_int64)){330 if(varSize==sizeof(_int64)){ 310 331 //下位32ビット 311 332 SetWholeVariable(sizeof(long),DEF_LONG,pRelative); 312 333 334 //上位32ビット 335 336 //直接参照に切り替え 337 SetVarPtrToEax(pRelative); 338 pRelative->dwKind=VAR_DIRECTMEM; 339 340 //mov ecx,eax 341 op_mov_RR( REG_ECX, REG_EAX ); 342 343 //add ecx,sizeof(long) 344 op_add_RV8( REG_ECX, sizeof(long) ); 345 313 346 //mov eax,edx 314 347 op_mov_RR( REG_EAX, REG_EDX ); 315 348 316 //上位32ビット317 if( pRelative->dwKind == VAR_DIRECTMEM ){318 //add ecx,sizeof(long)319 op_add_RV8( REG_ECX, sizeof(long) );320 }321 pRelative->offset+=sizeof(long);322 349 SetWholeVariable(sizeof(long),DEF_LONG,pRelative); 323 pRelative->offset-=sizeof(long);324 350 325 351 return; … … 329 355 if(pRelative->bOffsetOffset){ 330 356 //mov ptr[ecx+offset],eax/ax/al 331 op_mov_MR(var _size,REG_EAX,REG_ECX,(int)pRelative->offset,MOD_BASE_DISP32);357 op_mov_MR(varSize,REG_EAX,REG_ECX,(int)pRelative->offset,MOD_BASE_DISP32); 332 358 } 333 359 else{ 334 360 //mov ptr[offset],eax/ax/al 335 op_mov_MR(var _size,REG_EAX,0,(int)pRelative->offset,MOD_DISP32);361 op_mov_MR(varSize,REG_EAX,0,(int)pRelative->offset,MOD_DISP32); 336 362 } 337 363 obp-=sizeof(long); … … 342 368 if(pRelative->bOffsetOffset){ 343 369 //add ecx,qword ptr[offset] 344 op_add_RM(var _size,REG_ECX,REG_NON,(int)pRelative->offset,MOD_DISP32);370 op_add_RM(varSize,REG_ECX,REG_NON,(int)pRelative->offset,MOD_DISP32); 345 371 } 346 372 else{ 347 373 //mov ecx,qword ptr[offset] 348 op_mov_RM(var _size,REG_ECX,REG_NON,(int)pRelative->offset,MOD_DISP32);374 op_mov_RM(varSize,REG_ECX,REG_NON,(int)pRelative->offset,MOD_DISP32); 349 375 } 350 376 obp-=sizeof(long); … … 357 383 if(pRelative->bOffsetOffset){ 358 384 //mov ptr[ebp+ecx+offset],eax/ax/al 359 op_mov_MR_ex(var _size,REG_EAX,REG_EBP,REG_ECX,(int)pRelative->offset,USE_OFFSET);385 op_mov_MR_ex(varSize,REG_EAX,REG_EBP,REG_ECX,(int)pRelative->offset,USE_OFFSET); 360 386 } 361 387 else{ 362 388 //mov ptr[ebp+offset],eax/ax/al 363 op_mov_MR(var _size,REG_EAX,REG_EBP,(int)pRelative->offset,MOD_BASE_DISP32);389 op_mov_MR(varSize,REG_EAX,REG_EBP,(int)pRelative->offset,MOD_BASE_DISP32); 364 390 } 365 391 obp-=sizeof(long); … … 370 396 if(pRelative->bOffsetOffset){ 371 397 //add ecx,qword ptr[ebp+offset] 372 op_add_RM(var _size,REG_ECX,REG_EBP,(int)pRelative->offset,MOD_BASE_DISP32);398 op_add_RM(varSize,REG_ECX,REG_EBP,(int)pRelative->offset,MOD_BASE_DISP32); 373 399 } 374 400 else{ 375 401 //mov ecx,qword ptr[ebp+offset] 376 op_mov_RM(var _size,REG_ECX,REG_EBP,(int)pRelative->offset,MOD_BASE_DISP32);402 op_mov_RM(varSize,REG_ECX,REG_EBP,(int)pRelative->offset,MOD_BASE_DISP32); 377 403 } 378 404 obp-=sizeof(long); … … 386 412 387 413 //mov ptr[ecx],eax/ax/al 388 op_mov_MR(var _size,REG_EAX,REG_ECX,0,MOD_BASE);414 op_mov_MR(varSize,REG_EAX,REG_ECX,0,MOD_BASE); 389 415 } 390 416 } -
BasicCompiler32/NumOpe_Arithmetic.cpp
r3 r66 11 11 12 12 //fistp qword ptr[esp] 13 fpu_cast(); 14 OpBuffer[obp++]=(char)0xDF; 15 OpBuffer[obp++]=(char)0x3C; 16 OpBuffer[obp++]=(char)0x24; 17 fpu_cast_end(); 13 op_fistp_ptr_esp( sizeof(_int64) ); 18 14 19 15 //pop ebx … … 31 27 32 28 //fistp qword ptr[esp] 33 fpu_cast(); 34 OpBuffer[obp++]=(char)0xDF; 35 OpBuffer[obp++]=(char)0x3C; 36 OpBuffer[obp++]=(char)0x24; 37 fpu_cast_end(); 29 op_fistp_ptr_esp( sizeof(_int64) ); 38 30 39 31 //pop ebx … … 84 76 85 77 //fistp qword ptr[esp] 86 fpu_cast(); 87 OpBuffer[obp++]=(char)0xDF; 88 OpBuffer[obp++]=(char)0x3C; 89 OpBuffer[obp++]=(char)0x24; 90 fpu_cast_end(); 78 op_fistp_ptr_esp( sizeof(_int64) ); 91 79 92 80 //pop eax … … 104 92 105 93 //fistp qword ptr[esp] 106 fpu_cast(); 107 OpBuffer[obp++]=(char)0xDF; 108 OpBuffer[obp++]=(char)0x3C; 109 OpBuffer[obp++]=(char)0x24; 110 fpu_cast_end(); 94 op_fistp_ptr_esp( sizeof(_int64) ); 111 95 112 96 //pop eax … … 510 494 511 495 //fistp dword ptr[esp] 512 fpu_cast(); 513 OpBuffer[obp++]=(char)0xDB; 514 OpBuffer[obp++]=(char)0x1C; 515 OpBuffer[obp++]=(char)0x24; 516 fpu_cast_end(); 496 op_fistp_ptr_esp( sizeof(long) ); 517 497 } 518 498 else if(type[sp-1]==DEF_SINGLE){ … … 521 501 522 502 //fistp dword ptr[esp] 523 fpu_cast(); 524 OpBuffer[obp++]=(char)0xDB; 525 OpBuffer[obp++]=(char)0x1C; 526 OpBuffer[obp++]=(char)0x24; 527 fpu_cast_end(); 503 op_fistp_ptr_esp( sizeof(long) ); 528 504 } 529 505 … … 539 515 540 516 //fistp dword ptr[esp] 541 fpu_cast(); 542 OpBuffer[obp++]=(char)0xDB; 543 OpBuffer[obp++]=(char)0x1C; 544 OpBuffer[obp++]=(char)0x24; 545 fpu_cast_end(); 517 op_fistp_ptr_esp( sizeof(long) ); 546 518 } 547 519 else if(type[sp-2]==DEF_SINGLE){ … … 550 522 551 523 //fistp dword ptr[esp] 552 fpu_cast(); 553 OpBuffer[obp++]=(char)0xDB; 554 OpBuffer[obp++]=(char)0x1C; 555 OpBuffer[obp++]=(char)0x24; 556 fpu_cast_end(); 524 op_fistp_ptr_esp( sizeof(long) ); 557 525 } 558 526 … … 786 754 787 755 //fistp dword ptr[esp] 788 fpu_cast(); 789 OpBuffer[obp++]=(char)0xDB; 790 OpBuffer[obp++]=(char)0x1C; 791 OpBuffer[obp++]=(char)0x24; 792 fpu_cast_end(); 756 op_fistp_ptr_esp( sizeof(long) ); 793 757 } 794 758 else if(type[sp-1]==DEF_SINGLE){ … … 797 761 798 762 //fistp dword ptr[esp] 799 fpu_cast(); 800 OpBuffer[obp++]=(char)0xDB; 801 OpBuffer[obp++]=(char)0x1C; 802 OpBuffer[obp++]=(char)0x24; 803 fpu_cast_end(); 763 op_fistp_ptr_esp( sizeof(long) ); 804 764 } 805 765 … … 815 775 816 776 //fistp dword ptr[esp] 817 fpu_cast(); 818 OpBuffer[obp++]=(char)0xDB; 819 OpBuffer[obp++]=(char)0x1C; 820 OpBuffer[obp++]=(char)0x24; 821 fpu_cast_end(); 777 op_fistp_ptr_esp( sizeof(long) ); 822 778 } 823 779 else if(type[sp-2]==DEF_SINGLE){ … … 826 782 827 783 //fistp dword ptr[esp] 828 fpu_cast(); 829 OpBuffer[obp++]=(char)0xDB; 830 OpBuffer[obp++]=(char)0x1C; 831 OpBuffer[obp++]=(char)0x24; 832 fpu_cast_end(); 784 op_fistp_ptr_esp( sizeof(long) ); 833 785 } 834 786 … … 1119 1071 1120 1072 //fistp dword ptr[esp] 1121 fpu_cast(); 1122 OpBuffer[obp++]=(char)0xDB; 1123 OpBuffer[obp++]=(char)0x1C; 1124 OpBuffer[obp++]=(char)0x24; 1125 fpu_cast_end(); 1073 op_fistp_ptr_esp( sizeof(long) ); 1126 1074 1127 1075 //pop ecx … … 1133 1081 1134 1082 //fistp dword ptr[esp] 1135 fpu_cast(); 1136 OpBuffer[obp++]=(char)0xDB; 1137 OpBuffer[obp++]=(char)0x1C; 1138 OpBuffer[obp++]=(char)0x24; 1139 fpu_cast_end(); 1083 op_fistp_ptr_esp( sizeof(long) ); 1140 1084 1141 1085 //pop ecx … … 1160 1104 1161 1105 //fistp qword ptr[esp] 1162 fpu_cast(); 1163 OpBuffer[obp++]=(char)0xDF; 1164 OpBuffer[obp++]=(char)0x3C; 1165 OpBuffer[obp++]=(char)0x24; 1166 fpu_cast_end(); 1106 op_fistp_ptr_esp( sizeof(_int64) ); 1167 1107 1168 1108 //pop eax … … 1180 1120 1181 1121 //fistp qword ptr[esp] 1182 fpu_cast(); 1183 OpBuffer[obp++]=(char)0xDF; 1184 OpBuffer[obp++]=(char)0x3C; 1185 OpBuffer[obp++]=(char)0x24; 1186 fpu_cast_end(); 1122 op_fistp_ptr_esp( sizeof(_int64) ); 1187 1123 1188 1124 //pop eax … … 1245 1181 1246 1182 //fistp dword ptr[esp] 1247 fpu_cast(); 1248 OpBuffer[obp++]=(char)0xDB; 1249 OpBuffer[obp++]=(char)0x1C; 1250 OpBuffer[obp++]=(char)0x24; 1251 fpu_cast_end(); 1183 op_fistp_ptr_esp( sizeof(long) ); 1252 1184 1253 1185 //pop ecx … … 1259 1191 1260 1192 //fistp dword ptr[esp] 1261 fpu_cast(); 1262 OpBuffer[obp++]=(char)0xDB; 1263 OpBuffer[obp++]=(char)0x1C; 1264 OpBuffer[obp++]=(char)0x24; 1265 fpu_cast_end(); 1193 op_fistp_ptr_esp( sizeof(long) ); 1266 1194 1267 1195 //pop ecx … … 1288 1216 1289 1217 //fistp dword ptr[esp] 1290 fpu_cast(); 1291 OpBuffer[obp++]=(char)0xDB; 1292 OpBuffer[obp++]=(char)0x1C; 1293 OpBuffer[obp++]=(char)0x24; 1294 fpu_cast_end(); 1218 op_fistp_ptr_esp( sizeof(long) ); 1295 1219 } 1296 1220 else if(type[sp-2]==DEF_SINGLE){ … … 1299 1223 1300 1224 //fistp dword ptr[esp] 1301 fpu_cast(); 1302 OpBuffer[obp++]=(char)0xDB; 1303 OpBuffer[obp++]=(char)0x1C; 1304 OpBuffer[obp++]=(char)0x24; 1305 fpu_cast_end(); 1225 op_fistp_ptr_esp( sizeof(long) ); 1306 1226 } 1307 1227 … … 1353 1273 1354 1274 //fistp dword ptr[esp] 1355 fpu_cast(); 1356 OpBuffer[obp++]=(char)0xDB; 1357 OpBuffer[obp++]=(char)0x1C; 1358 OpBuffer[obp++]=(char)0x24; 1359 fpu_cast_end(); 1275 op_fistp_ptr_esp( sizeof(long) ); 1360 1276 1361 1277 //pop ecx … … 1367 1283 1368 1284 //fistp dword ptr[esp] 1369 fpu_cast(); 1370 OpBuffer[obp++]=(char)0xDB; 1371 OpBuffer[obp++]=(char)0x1C; 1372 OpBuffer[obp++]=(char)0x24; 1373 fpu_cast_end(); 1285 op_fistp_ptr_esp( sizeof(long) ); 1374 1286 1375 1287 //pop ecx … … 1394 1306 1395 1307 //fistp qword ptr[esp] 1396 fpu_cast(); 1397 OpBuffer[obp++]=(char)0xDF; 1398 OpBuffer[obp++]=(char)0x3C; 1399 OpBuffer[obp++]=(char)0x24; 1400 fpu_cast_end(); 1308 op_fistp_ptr_esp( sizeof(_int64) ); 1401 1309 1402 1310 //pop eax … … 1414 1322 1415 1323 //fistp qword ptr[esp] 1416 fpu_cast(); 1417 OpBuffer[obp++]=(char)0xDF; 1418 OpBuffer[obp++]=(char)0x3C; 1419 OpBuffer[obp++]=(char)0x24; 1420 fpu_cast_end(); 1324 op_fistp_ptr_esp( sizeof(_int64) ); 1421 1325 1422 1326 //pop eax … … 1490 1394 1491 1395 //fistp dword ptr[esp] 1492 fpu_cast(); 1493 OpBuffer[obp++]=(char)0xDB; 1494 OpBuffer[obp++]=(char)0x1C; 1495 OpBuffer[obp++]=(char)0x24; 1496 fpu_cast_end(); 1396 op_fistp_ptr_esp( sizeof(long) ); 1497 1397 1498 1398 //pop ecx … … 1504 1404 1505 1405 //fistp dword ptr[esp] 1506 fpu_cast(); 1507 OpBuffer[obp++]=(char)0xDB; 1508 OpBuffer[obp++]=(char)0x1C; 1509 OpBuffer[obp++]=(char)0x24; 1510 fpu_cast_end(); 1406 op_fistp_ptr_esp( sizeof(long) ); 1511 1407 1512 1408 //pop ecx … … 1533 1429 1534 1430 //fistp dword ptr[esp] 1535 fpu_cast(); 1536 OpBuffer[obp++]=(char)0xDB; 1537 OpBuffer[obp++]=(char)0x1C; 1538 OpBuffer[obp++]=(char)0x24; 1539 fpu_cast_end(); 1431 op_fistp_ptr_esp( sizeof(long) ); 1540 1432 } 1541 1433 else if(type[sp-2]==DEF_SINGLE){ … … 1544 1436 1545 1437 //fistp dword ptr[esp] 1546 fpu_cast(); 1547 OpBuffer[obp++]=(char)0xDB; 1548 OpBuffer[obp++]=(char)0x1C; 1549 OpBuffer[obp++]=(char)0x24; 1550 fpu_cast_end(); 1438 op_fistp_ptr_esp( sizeof(long) ); 1551 1439 } 1552 1440 -
BasicCompiler32/NumOpe_TypeOperation.cpp
r55 r66 147 147 148 148 //fistp qword ptr[esp] 149 fpu_cast(); 150 OpBuffer[obp++]=(char)0xDF; 151 OpBuffer[obp++]=(char)0x3C; 152 OpBuffer[obp++]=(char)0x24; 153 fpu_cast_end(); 149 op_fistp_ptr_esp( sizeof(_int64) ); 154 150 } 155 151 else{ … … 161 157 162 158 //fistp dword ptr[esp] 163 fpu_cast(); 164 OpBuffer[obp++]=(char)0xDB; 165 OpBuffer[obp++]=(char)0x1C; 166 OpBuffer[obp++]=(char)0x24; 167 fpu_cast_end(); 159 op_fistp_ptr_esp( sizeof(long) ); 168 160 } 169 161 } … … 177 169 178 170 //fistp qword ptr[esp] 179 fpu_cast(); 180 OpBuffer[obp++]=(char)0xDF; 181 OpBuffer[obp++]=(char)0x3C; 182 OpBuffer[obp++]=(char)0x24; 183 fpu_cast_end(); 171 op_fistp_ptr_esp( sizeof(_int64) ); 184 172 } 185 173 else{ … … 188 176 189 177 //fistp dword ptr[esp] 190 fpu_cast(); 191 OpBuffer[obp++]=(char)0xDB; 192 OpBuffer[obp++]=(char)0x1C; 193 OpBuffer[obp++]=(char)0x24; 194 fpu_cast_end(); 178 op_fistp_ptr_esp( sizeof(long) ); 195 179 } 196 180 } -
BasicCompiler32/Opcode.h
r64 r66 138 138 void SetStructVariable(LONG_PTR lpVarIndex,int CalcType,LONG_PTR lpCalcIndex,BOOL bUseHeap); 139 139 void SetRealVariable(int VarType, int CalcType, RELATIVE_VAR *pRelativeVar); 140 void SetWholeVariable( int var_size,int type,RELATIVE_VAR *pRelative);140 void SetWholeVariable( int varSize,int calcType, RELATIVE_VAR *pRelative ); 141 141 142 142 void SetDoubleVariable(int type,DWORD VarKind,DWORD offset,BOOL bOffsetOffset); … … 179 179 180 180 //Compile_Var.cpp 181 void SetRelativeOffset( RELATIVE_VAR &relativeVar ); 181 182 void GetWithName(char *buffer); 182 183 void SetThisPtrToReg(int reg); … … 333 334 void op_fstp_base_offset (int type,int base_reg,int offset); 334 335 void op_fstp_base_offset_ex (int type,int base_reg1,int base_reg2,int offset,BOOL bUseOffset); 336 void op_fistp_ptr_esp ( int typeSize ); 335 337 void op_zero_reg(int reg); 336 338 void fpu_cast(); -
BasicCompiler32/op32_main.cpp
r64 r66 838 838 //ベースレジスタ 839 839 OpBuffer[obp++]=(char)(REGISTER_OPERAND(base_reg1)<<3 | REGISTER_OPERAND(base_reg2)); 840 } 841 } 842 void op_fistp_ptr_esp( int typeSize ){ 843 if( typeSize == sizeof(_int64) ){ 844 //64bit 845 846 //fistp qword ptr[esp] 847 fpu_cast(); 848 OpBuffer[obp++]=(char)0xDF; 849 OpBuffer[obp++]=(char)0x3C; 850 OpBuffer[obp++]=(char)0x24; 851 fpu_cast_end(); 852 } 853 else if( typeSize == sizeof(long) ){ 854 //32bit 855 856 //fistp dword ptr[esp] 857 fpu_cast(); 858 OpBuffer[obp++]=(char)0xDB; 859 OpBuffer[obp++]=(char)0x1C; 860 OpBuffer[obp++]=(char)0x24; 861 fpu_cast_end(); 862 } 863 else{ 864 SetError(); 840 865 } 841 866 } -
BasicCompiler64/CParameter.cpp
r64 r66 62 62 int type = NumOpe( ®, Parms[i2], DummyTypeInfo.type, DummyTypeInfo.u.lpIndex, &lpVarIndex ); 63 63 64 if( type == DEF_OBJECT ){64 if( type != DEF_STRUCT ){ 65 65 //一時参照を作成 66 66 pobj_sf->push( reg ); … … 115 115 op_call(pSub_free); 116 116 } 117 else if( types[i2].type == DEF_OBJECT ){117 else{ 118 118 pobj_sf->pop(); 119 119 pobj_sf->pop(); 120 }121 else{122 SetError(300,NULL,cp);123 120 } 124 121 } … … 423 420 } 424 421 else{ 425 //変数のアドレスを取得 426 int VarType; 427 LONG_PTR lpVarIndex; 428 if(GetVarOffset( 429 false, 430 false, 431 Parms[i2], 432 &VarType, 433 &RelativeVar, 434 &lpVarIndex)){ 435 436 if(DummyTypeInfo.type!=DEF_ANY){ 437 //型チェックを行う 438 if(DummyTypeInfo.type==VarType){ 439 if(DummyTypeInfo.type==DEF_OBJECT){ 440 if( !DummyTypeInfo.u.pobj_Class->IsEqualsOrSubClass( (CClass *)lpVarIndex ) ){ 441 SetError(11,Parms[i2],cp); 422 if( useTempParameters[i2] ){ 423 //一時オブジェクトをコピー 424 425 //mov reg, qword ptr[rsp+offset] 426 pobj_sf->ref_offset_data( reg, StackOffsetOfTempObject[i2] ); 427 } 428 else{ 429 //変数のアドレスを取得 430 int VarType; 431 LONG_PTR lpVarIndex; 432 if(GetVarOffset( 433 false, 434 false, 435 Parms[i2], 436 &VarType, 437 &RelativeVar, 438 &lpVarIndex)){ 439 440 if(DummyTypeInfo.type!=DEF_ANY){ 441 //型チェックを行う 442 if(DummyTypeInfo.type==VarType){ 443 if(DummyTypeInfo.type==DEF_OBJECT){ 444 if( !DummyTypeInfo.u.pobj_Class->IsEqualsOrSubClass( (CClass *)lpVarIndex ) ){ 445 SetError(11,Parms[i2],cp); 446 } 447 } 448 else if(DummyTypeInfo.type==DEF_STRUCT){ 449 if( !DummyTypeInfo.u.pobj_Class->IsEquals( (CClass *)lpVarIndex ) ){ 450 SetError(11,Parms[i2],cp); 451 } 442 452 } 443 453 } 444 else if(DummyTypeInfo.type==DEF_STRUCT){ 445 if( !DummyTypeInfo.u.pobj_Class->IsEquals( (CClass *)lpVarIndex ) ){ 446 SetError(11,Parms[i2],cp); 447 } 454 else if((VarType&FLAG_PTR)&&((VarType^FLAG_PTR)==DummyTypeInfo.type)){ 455 //仮引数がポインタ参照で、実引数が配列の先頭ポインタのとき 456 } 457 else{ 458 SetError(11,Parms[i2],cp); 448 459 } 449 460 } 450 else if((VarType&FLAG_PTR)&&((VarType^FLAG_PTR)==DummyTypeInfo.type)){ 451 //仮引数がポインタ参照で、実引数が配列の先頭ポインタのとき 452 } 453 else{ 454 SetError(11,Parms[i2],cp); 455 } 456 } 457 458 //変数アドレスをレジスタにセット 459 SetVarPtrToReg(reg,&RelativeVar); 460 461 } 462 else{ 463 //一時オブジェクトをコピー 464 465 //mov reg, qword ptr[rsp+offset] 466 pobj_sf->ref_offset_data( reg, StackOffsetOfTempObject[i2] ); 467 468 //VarType = NumOpe( ®, Parms[i2], DummyTypeInfo.type, DummyTypeInfo.u.lpIndex, &lpVarIndex ); 461 462 //変数アドレスをレジスタにセット 463 SetVarPtrToReg(reg,&RelativeVar); 464 465 } 469 466 } 470 467 } -
BasicCompiler64/Compile_Calc_PushVar.cpp
r62 r66 174 174 175 175 void SetReg_WholeVariable(int type,RELATIVE_VAR *pRelativeVar,int reg){ 176 int var _size;177 178 var _size=GetTypeSize(type,-1);176 int varSize; 177 178 varSize=GetTypeSize(type,-1); 179 179 180 180 if(pRelativeVar->dwKind==VAR_GLOBAL){ 181 181 if(pRelativeVar->bOffsetOffset){ 182 182 //mov reg, ptr[r11+offset] 183 op_mov_RM(var _size,reg,REG_R11,(int)pRelativeVar->offset,MOD_BASE_DISP32);183 op_mov_RM(varSize,reg,REG_R11,(int)pRelativeVar->offset,MOD_BASE_DISP32); 184 184 obp-=sizeof(long); 185 185 pobj_GlobalVarSchedule->add(); … … 188 188 else{ 189 189 //mov reg, ptr[offset] 190 op_mov_RM(var _size,reg,0,(int)pRelativeVar->offset,MOD_DISP32);190 op_mov_RM(varSize,reg,0,(int)pRelativeVar->offset,MOD_DISP32); 191 191 obp-=sizeof(long); 192 192 pobj_GlobalVarSchedule->add(); … … 215 215 if(pRelativeVar->bOffsetOffset){ 216 216 //mov reg, ptr[rsp+r11+offset] 217 op_mov_RM_ex(var _size,reg,REG_RSP,REG_R11,(int)pRelativeVar->offset,USE_OFFSET);217 op_mov_RM_ex(varSize,reg,REG_RSP,REG_R11,(int)pRelativeVar->offset,USE_OFFSET); 218 218 obp-=sizeof(long); 219 219 AddLocalVarAddrSchedule(); … … 222 222 else{ 223 223 //mov reg, ptr[rsp+offset] 224 op_mov_RM(var _size,reg,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32);224 op_mov_RM(varSize,reg,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32); 225 225 obp-=sizeof(long); 226 226 AddLocalVarAddrSchedule(); … … 249 249 directmem: 250 250 //mov reg, ptr[r11] 251 op_mov_RM(var _size,reg,REG_R11,0,MOD_BASE);251 op_mov_RM(varSize,reg,REG_R11,0,MOD_BASE); 252 252 } 253 253 } -
BasicCompiler64/Compile_Set_Var.cpp
r64 r66 333 333 SetWholeVariable( sizeof(char), DEF_BYTE, pRelative); 334 334 } 335 void SetWholeVariable(int var _size,int type,RELATIVE_VAR *pRelative){335 void SetWholeVariable(int varSize,int type,RELATIVE_VAR *pRelative){ 336 336 if(type==DEF_DOUBLE){ 337 337 //Double型 … … 349 349 //その他の整数 350 350 351 if(var _size==sizeof(_int64)){351 if(varSize==sizeof(_int64)){ 352 352 //レジスタの値を64ビット(rax)に拡張する 353 353 ExtendTypeTo64(type,REG_RAX); 354 354 } 355 else if(var _size==sizeof(long)){355 else if(varSize==sizeof(long)){ 356 356 //レジスタの値を32ビット(eax)に拡張する 357 357 ExtendTypeTo32(type,REG_RAX); 358 358 } 359 else if(var _size==sizeof(short)){359 else if(varSize==sizeof(short)){ 360 360 //レジスタの値を16ビット(ax)に拡張する 361 361 ExtendTypeTo16(type,REG_RAX); … … 367 367 if(pRelative->bOffsetOffset){ 368 368 //mov ptr[r11+offset],rax/eax/ax/al 369 op_mov_MR(var _size,REG_RAX,REG_R11,(int)pRelative->offset,MOD_BASE_DISP32);369 op_mov_MR(varSize,REG_RAX,REG_R11,(int)pRelative->offset,MOD_BASE_DISP32); 370 370 obp-=sizeof(long); 371 371 pobj_GlobalVarSchedule->add(); … … 374 374 else{ 375 375 //mov ptr[offset],rax/eax/ax/al 376 op_mov_MR(var _size,REG_RAX,0,(int)pRelative->offset,MOD_DISP32);376 op_mov_MR(varSize,REG_RAX,0,(int)pRelative->offset,MOD_DISP32); 377 377 obp-=sizeof(long); 378 378 pobj_GlobalVarSchedule->add(); … … 401 401 if(pRelative->bOffsetOffset){ 402 402 //mov ptr[rsp+r11+offset],rax/eax/ax/al 403 op_mov_MR_ex(var _size,REG_RAX,REG_RSP,REG_R11,(int)pRelative->offset,USE_OFFSET);403 op_mov_MR_ex(varSize,REG_RAX,REG_RSP,REG_R11,(int)pRelative->offset,USE_OFFSET); 404 404 obp-=sizeof(long); 405 405 AddLocalVarAddrSchedule(); … … 408 408 else{ 409 409 //mov ptr[rsp+offset],rax/eax/ax/al 410 op_mov_MR(var _size,REG_RAX,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32);410 op_mov_MR(varSize,REG_RAX,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32); 411 411 obp-=sizeof(long); 412 412 AddLocalVarAddrSchedule(); … … 436 436 437 437 //mov ptr[r11],rax/eax/ax/al 438 op_mov_MR(var _size,REG_RAX,REG_R11,0,MOD_BASE);439 } 440 } 438 op_mov_MR(varSize,REG_RAX,REG_R11,0,MOD_BASE); 439 } 440 } -
BasicCompiler64/Opcode.h
r64 r66 128 128 void mov_sp( int reg ); 129 129 int push(int reg); 130 void push(int xmm_reg,int var _size);130 void push(int xmm_reg,int varSize); 131 131 void ref_offset_data( int reg, int sp_offset ); 132 132 void ref(int reg); 133 void ref(int xmm_reg,int var _size);133 void ref(int xmm_reg,int varSize); 134 134 void pop(int reg = REG_NON); 135 void pop(int xmm_reg,int var _size);135 void pop(int xmm_reg,int varSize); 136 136 void parameter_allocate(int size); 137 137 void RunningSchedule(void); … … 289 289 void SetRealVariable(int VarType, int CalcType, RELATIVE_VAR *pRelativeVar); 290 290 void SetBooleanVariable(int type,RELATIVE_VAR *pRelative); 291 void SetWholeVariable(int var _size,int type,RELATIVE_VAR *pRelative);291 void SetWholeVariable(int varSize,int type,RELATIVE_VAR *pRelative); 292 292 293 293 //increment.cpp -
BasicCompiler64/stack_frame.cpp
r64 r66 70 70 return now_sp; 71 71 } 72 void CStackFrame::push(int xmm_reg,int var _size){72 void CStackFrame::push(int xmm_reg,int varSize){ 73 73 now_sp-=sizeof(_int64); 74 74 if(lowest_sp>now_sp) lowest_sp=now_sp; 75 75 76 if(var _size==sizeof(double)){76 if(varSize==sizeof(double)){ 77 77 //movlpd qword ptr[rsp+offset],xmm_reg 78 78 op_movlpd_MR(xmm_reg,REG_RSP,now_sp,MOD_BASE_DISP32); 79 79 } 80 if(var _size==sizeof(float)){80 if(varSize==sizeof(float)){ 81 81 //movss dword ptr[rsp+offset],xmm_reg 82 82 OpBuffer[obp++]=(char)0xF3; … … 106 106 ref_offset_data( reg, now_sp ); 107 107 } 108 void CStackFrame::ref(int xmm_reg,int var _size){109 if(var _size==sizeof(double)){108 void CStackFrame::ref(int xmm_reg,int varSize){ 109 if(varSize==sizeof(double)){ 110 110 //movlpd xmm_reg,qword ptr[rsp+offset] 111 111 op_movlpd_RM(xmm_reg,REG_RSP,now_sp,MOD_BASE_DISP32); 112 112 } 113 if(var _size==sizeof(float)){113 if(varSize==sizeof(float)){ 114 114 //movss xmm_reg,dword ptr[rsp+offset] 115 115 OpBuffer[obp++]=(char)0xF3; … … 132 132 now_sp+=sizeof(_int64); 133 133 } 134 void CStackFrame::pop(int xmm_reg,int var _size){135 ref(xmm_reg,var _size);134 void CStackFrame::pop(int xmm_reg,int varSize){ 135 ref(xmm_reg,varSize); 136 136 137 137 now_sp+=sizeof(_int64); -
BasicCompiler_Common/common.h
r65 r66 43 43 44 44 #ifdef _AMD64_ 45 #define VER_INFO "β1 4(x64)"45 #define VER_INFO "β15 (x64)" 46 46 #else 47 #define VER_INFO "β1 4"47 #define VER_INFO "β15" 48 48 #endif 49 49 -
ProjectEditor/Common.h
r65 r66 59 59 #define APPLICATION_NAME "ActiveBasic 5.0" 60 60 #define VERSION_APPLI_NAME APPLICATION_NAME 61 #define VERSION_STRING "5.00.00 β1 4"61 #define VERSION_STRING "5.00.00 β15" 62 62 63 63 #endif
Note:
See TracChangeset
for help on using the changeset viewer.