Changeset 290 in dev for trunk/abdev/BasicCompiler32
- Timestamp:
- Aug 21, 2007, 11:00:25 PM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler32
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/Compile_Calc.cpp
r265 r290 373 373 } 374 374 375 void SetVariableFromEax( int VarType,int CalcType,RELATIVE_VAR *pRelativeVar){375 void SetVariableFromEax( const Type &varType,int CalcType,RELATIVE_VAR *pRelativeVar){ 376 376 ///////////////////////////////////////////////// 377 377 // eaxの内容を変数にコピーするコードを抽出 378 378 ///////////////////////////////////////////////// 379 379 380 if(VarType==DEF_BOOLEAN){ 380 if( varType.IsBoolean() ) 381 { 381 382 //bool 382 383 SetBooleanVariable(CalcType,pRelativeVar); 383 384 } 384 else if( IsRealNumberType( VarType ) ){ 385 else if( varType.IsReal() ) 386 { 385 387 // Double/Single型変数へレジスタの値を代入 386 SetRealVariable(VarType, CalcType, pRelativeVar); 387 } 388 else if( IsWholeNumberType( VarType ) || VarType == DEF_OBJECT ){ 389 int typeSize = GetTypeSize( VarType, -1 ); 388 SetRealVariable(varType.GetBasicType(), CalcType, pRelativeVar); 389 } 390 else if( varType.IsWhole() || varType.IsObject() ) 391 { 392 int typeSize = varType.GetSize(); 390 393 391 394 //整数変数へraxの値を格納する … … 640 643 RestoreDefaultRegisterFromStackMemory( calcType.GetBasicType() ); 641 644 642 SetVariableFromEax(varType .GetBasicType(),calcType.GetBasicType(),&VarRelativeVar);643 } 645 SetVariableFromEax(varType,calcType.GetBasicType(),&VarRelativeVar); 646 } -
trunk/abdev/BasicCompiler32/Compile_Calc_PushVar.cpp
r253 r290 59 59 } 60 60 } 61 void SetReg_WholeVariable(int type,RELATIVE_VAR *pRelativeVar,int reg, bool is64Head){ 61 void SetReg_WholeVariable( Type &type, RELATIVE_VAR *pRelativeVar,int reg, bool is64Head) 62 { 62 63 int varSize; 63 64 64 varSize =GetTypeSize(type,-1);65 varSize = type.GetSize(); 65 66 66 67 if(varSize==sizeof(_int64)){ … … 72 73 73 74 //下位32ビットをeaxにロード 74 SetReg_WholeVariable( DEF_LONG,pRelativeVar,REG_EAX);75 SetReg_WholeVariable( Type(DEF_LONG),pRelativeVar,REG_EAX); 75 76 76 77 //上位32ビットをedxにロード 77 SetReg_WholeVariable( DEF_LONG,pRelativeVar,REG_EDX, true);78 SetReg_WholeVariable( Type(DEF_LONG),pRelativeVar,REG_EDX, true); 78 79 79 80 return; -
trunk/abdev/BasicCompiler32/Compile_CallProc.cpp
r265 r290 81 81 } 82 82 83 bool Opcode_CallProc(const char *Parameter,const UserProc *pUserProc,DWORD dwFlags,const char *ObjectName ,int RefType){83 bool Opcode_CallProc(const char *Parameter,const UserProc *pUserProc,DWORD dwFlags,const char *ObjectName ){ 84 84 int i2; 85 85 … … 115 115 Type varType; 116 116 GetVarType( ObjectName, varType, false ); 117 pobj_c = &varType.GetClass(); 118 if( NATURAL_TYPE( varType.GetBasicType() ) != DEF_OBJECT ){ 117 if( NATURAL_TYPE( varType.GetBasicType() ) == DEF_OBJECT ) 118 { 119 pobj_c = &varType.GetClass(); 120 } 121 else 122 { 119 123 pobj_c=compiler.GetObjectModule().meta.GetClasses().Find(ObjectName); 120 124 if( pobj_c ){ -
trunk/abdev/BasicCompiler32/Compile_Func.cpp
r265 r290 259 259 260 260 char ObjectName[VN_SIZE]; 261 int RefType;262 SplitObjectName(name,ObjectName, &RefType);261 ReferenceKind referenceKind; 262 SplitObjectName(name,ObjectName, referenceKind ); 263 263 264 264 if(ObjectName[0]){ … … 274 274 275 275 //参照タイプが整合しているかをチェック 276 if(type.GetBasicType()!=RefType) SetError(104,ObjectName,cp); 276 if( !( type.IsObject() && referenceKind == RefDot 277 || type.IsObjectPtr() && referenceKind == RefPointer ) ) 278 { 279 SetError(104,ObjectName,cp); 280 } 277 281 278 282 if(type.IsObjectPtr()){ -
trunk/abdev/BasicCompiler32/Compile_Object.cpp
r263 r290 52 52 Opcode_CallProc(CreateParameter, 53 53 pUserProc, 54 PROCFLAG_NEW,"" ,0);54 PROCFLAG_NEW,""); 55 55 56 56 { … … 65 65 Opcode_CallProc(temporary, 66 66 subs[0], 67 PROCFLAG_NEW,"" ,0);67 PROCFLAG_NEW,""); 68 68 } 69 69 else{ -
trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp
r285 r290 267 267 268 268 //コンパイル中の関数が属するクラス 269 compiler.pCompilingClass =pUserProc->GetParentClassPtr();269 compiler.pCompilingClass = pUserProc->GetParentClassPtr(); 270 270 271 271 //コンパイルスタートをクラス管理クラスに追加 … … 495 495 &compiler.pCompilingClass->GetSuperClass().GetConstructorMethod()->GetUserProc(), 496 496 0, 497 "" ,498 0);497 "" 498 ); 499 499 } 500 500 } … … 587 587 &method->GetUserProc(), 588 588 0, 589 "" ,590 0);589 "" 590 ); 591 591 } 592 592 } … … 629 629 GetVarOffsetReadWrite(temp,&RelativeVar,Type()); 630 630 631 i3=pUserProc->ReturnType().GetBasicType();632 633 if(i3==DEF_OBJECT || i3==DEF_STRUCT){631 const Type &returnType = pUserProc->ReturnType(); 632 if( returnType.IsObject() || returnType.IsStruct() ) 633 { 634 634 SetVarPtrToEax(&RelativeVar); 635 if( i3==DEF_OBJECT ){ 635 if( returnType.IsObject() ) 636 { 636 637 //mov eax,dword ptr[eax] 637 638 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EAX, 0, MOD_BASE ); 638 639 } 639 640 } 640 else if( i3==DEF_DOUBLE 641 || i3 == DEF_SINGLE ) 641 else if( returnType.IsReal() ) 642 642 { 643 643 //fld qword ptr[ebp+offset] 644 644 compiler.codeGenerator.localVarPertialSchedules.push_back( 645 compiler.codeGenerator.op_fld_base_offset( i3, REG_EBP, RelativeVar.offset, Schedule::None, true )645 compiler.codeGenerator.op_fld_base_offset( returnType.GetBasicType(), REG_EBP, RelativeVar.offset, Schedule::None, true ) 646 646 ); 647 647 } 648 else if(i3==DEF_INT64||i3==DEF_QWORD){ 649 //mov eax,dword ptr[ebp+offset] 650 compiler.codeGenerator.localVarPertialSchedules.push_back( 651 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::None, true ) 652 ); 653 654 //mov edx,dword ptr[ebp+offset+sizeof(long)] 655 compiler.codeGenerator.localVarPertialSchedules.push_back( 656 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EDX, REG_EBP, RelativeVar.offset+sizeof(long), MOD_BASE_DISP32, Schedule::None, true ) 657 ); 658 } 659 else if(i3==DEF_LONG||i3==DEF_DWORD|| 660 IsPtrType(i3)) 648 else if( returnType.Is64() ) 661 649 { 662 650 //mov eax,dword ptr[ebp+offset] … … 664 652 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::None, true ) 665 653 ); 666 } 667 else if(i3==DEF_INTEGER||i3==DEF_WORD || (Smoothie::IsUnicode()&&i3==DEF_CHAR)){ 654 655 //mov edx,dword ptr[ebp+offset+sizeof(long)] 656 compiler.codeGenerator.localVarPertialSchedules.push_back( 657 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EDX, REG_EBP, RelativeVar.offset+sizeof(long), MOD_BASE_DISP32, Schedule::None, true ) 658 ); 659 } 660 else if( returnType.GetSize() == sizeof(long) ) 661 { 662 //mov eax,dword ptr[ebp+offset] 663 compiler.codeGenerator.localVarPertialSchedules.push_back( 664 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::None, true ) 665 ); 666 } 667 else if( returnType.GetSize() == sizeof(short) ) 668 { 668 669 //xor eax,eax(eaxを0に初期化する) 669 670 compiler.codeGenerator.op_zero_reg(REG_EAX); … … 674 675 ); 675 676 } 676 else if(i3==DEF_SBYTE||i3==DEF_BYTE||i3==DEF_BOOLEAN || (Smoothie::IsUnicode()==false&&i3==DEF_CHAR)){ 677 else if( returnType.GetSize() == sizeof(char) ) 678 { 677 679 //xor eax,eax(eaxを0に初期化する) 678 680 compiler.codeGenerator.op_zero_reg(REG_EAX); … … 682 684 compiler.codeGenerator.op_mov_RM( sizeof(char), REG_EAX, REG_EBP, RelativeVar.offset, MOD_BASE_DISP32, Schedule::None, true ) 683 685 ); 686 } 687 else 688 { 689 SetError(); 684 690 } 685 691 } -
trunk/abdev/BasicCompiler32/Compile_Set_Var.cpp
r253 r290 188 188 189 189 //cmp eax,0 190 compiler.codeGenerator.op_cmp_value( GetTypeSize(type,-1),REG_EAX,0);190 compiler.codeGenerator.op_cmp_value(Type(type,-1).GetSize(),REG_EAX,0); 191 191 192 192 //setne al -
trunk/abdev/BasicCompiler32/Compile_Statement.cpp
r285 r290 81 81 } 82 82 83 Opcode_CallProc("",pUserProc,0,"" ,0);83 Opcode_CallProc("",pUserProc,0,""); 84 84 85 85 return; -
trunk/abdev/BasicCompiler32/Compile_Var.cpp
r288 r290 160 160 return 1; 161 161 } 162 bool _member_offset(bool isErrorEnabled, bool isWriteAccess, const CClass &objClass, const char *member, RELATIVE_VAR *pRelativeVar, Type &resultType, BOOL bPrivateAccess){ 162 bool _member_offset(bool isErrorEnabled, bool isWriteAccess, const Type &classType, const char *member, RELATIVE_VAR *pRelativeVar, Type &resultType, BOOL bPrivateAccess) 163 { 164 const CClass &objClass = classType.GetClass(); 163 165 164 166 ////////////////////////////////////// … … 221 223 resultType = pMember->GetType(); 222 224 225 226 ///////////////////////////////////////////////////////// 227 // ☆★☆ ジェネリクスサポート ☆★☆ 228 229 if( resultType.IsTypeParameter() ) 230 { 231 // 型パラメータだったとき 232 if( classType.HasActualGenericType() ) 233 { 234 // TODO: GetDummyActualGenericTypeを適切な形に実装し直す 235 resultType = classType.GetDummyActualGenericType(); 236 } 237 else 238 { 239 // TODO: ベースオブジェクト(指定されていないときはObjectクラス)にセットする 240 resultType.SetBasicType( DEF_OBJECT ); 241 } 242 } 243 244 // 245 ///////////////////////////////////////////////////////// 246 247 223 248 //ポインタ変数の場合 224 249 if( resultType.IsPointer() ){ … … 321 346 isErrorEnabled, 322 347 isWriteAccess, 323 pMember->GetType() .GetClass(),348 pMember->GetType(), 324 349 NestMember, 325 350 pRelativeVar, … … 345 370 RelativeVar.offset=-LocalVar_ThisPtrOffset; 346 371 347 SetReg_WholeVariable( DEF_PTR_VOID,&RelativeVar,reg);372 SetReg_WholeVariable(Type(DEF_PTR_VOID),&RelativeVar,reg); 348 373 } 349 374 … … 472 497 isErrorEnabled, 473 498 isWriteAccess, 474 *compiler.pCompilingClass,499 Type( DEF_OBJECT, *compiler.pCompilingClass ), 475 500 variable, 476 501 pRelativeVar, … … 701 726 isErrorEnabled, 702 727 isWriteAccess, 703 resultType .GetClass(),728 resultType, 704 729 member,pRelativeVar,resultType,0)) return false; 705 730 … … 1204 1229 SetError(); 1205 1230 } 1206 SetVariableFromEax( DEF_OBJECT, DEF_OBJECT, &RelativeVar );1231 SetVariableFromEax( Type( DEF_OBJECT, *compiler.GetObjectModule().meta.GetClasses().GetObjectClassPtr() ), DEF_OBJECT, &RelativeVar ); 1207 1232 } 1208 1233 } -
trunk/abdev/BasicCompiler32/MakePeHdr.cpp
r288 r290 397 397 InitGCVariables(); 398 398 399 if( compiler.IsStaticLibrary() )399 //if( compiler.IsStaticLibrary() ) 400 400 { 401 401 //_System_StartupProgramの呼び出し … … 504 504 } 505 505 506 CompileMessage( "リンク中..." ); 506 extern BOOL bError; 507 if( !bError ) 508 { 509 CompileMessage( "リンク中..." ); 510 } 507 511 508 512 -
trunk/abdev/BasicCompiler32/NumOpe.cpp
r276 r290 122 122 else if( resultType.IsWhole() || resultType.IsObject()){ 123 123 //整数型 124 SetReg_WholeVariable(resultType .GetBasicType(),&relativeVar,useReg);124 SetReg_WholeVariable(resultType,&relativeVar,useReg); 125 125 } 126 126 else if( resultType.IsStruct() ){ … … 142 142 return true; 143 143 } 144 bool TermMemberOpe( const CClass &objClass, const Type &baseType, Type &resultType, const char *termFull, const char *termLeft, const char *member ){ 144 bool TermMemberOpe( const Type &leftType, const Type &baseType, Type &resultType, const char *termFull, const char *termLeft, const char *member ) 145 { 146 const CClass &objClass = leftType.GetClass(); 147 145 148 const int useReg = REG_EAX; 146 149 147 if( GetMemberType( objClass, member, resultType, 0, false ) ){150 if( GetMemberType( leftType, member, resultType, 0, false ) ){ 148 151 // メンバが見つかったとき 149 152 … … 157 160 true, //エラー表示あり 158 161 false, //読み込み専用 159 objClass,162 leftType, 160 163 member,&relativeVar,resultType,0)){ 161 164 return false; … … 194 197 compiler.codeGenerator.op_push( useReg ); 195 198 196 if( !Opcode_CallProc(parameter,pUserProc,PROCFLAG_NEW,termLeft ,0) ){199 if( !Opcode_CallProc(parameter,pUserProc,PROCFLAG_NEW,termLeft) ){ 197 200 198 201 return false; … … 217 220 218 221 //SetUseRegFromRax(resultType.GetBasicType(),UseReg,XmmReg); 222 223 224 ///////////////////////////////////////////////////////// 225 // ☆★☆ ジェネリクスサポート ☆★☆ 226 227 if( resultType.IsTypeParameter() ) 228 { 229 // 型パラメータだったとき 230 if( leftType.HasActualGenericType() ) 231 { 232 // TODO: GetDummyActualGenericTypeを適切な形に実装し直す 233 resultType = leftType.GetDummyActualGenericType(); 234 } 235 else 236 { 237 // TODO: ベースオブジェクト(指定されていないときはObjectクラス)にセットする 238 resultType.SetBasicType( DEF_OBJECT ); 239 } 240 } 241 242 // 243 ///////////////////////////////////////////////////////// 219 244 } 220 245 … … 227 252 bool TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, BOOL *pbUseHeap, bool isWantObject, bool *pIsClassName, bool isProcedureCallOnly ){ 228 253 char parameter[VN_SIZE]; 254 255 if( (string)term=="a.x") 256 { 257 int test=0; 258 } 229 259 230 260 // Withを解決 … … 279 309 } 280 310 281 return TermMemberOpe( leftType .GetClass(), baseType, resultType, termFull, termLeft, member );311 return TermMemberOpe( leftType, baseType, resultType, termFull, termLeft, member ); 282 312 } 283 313 globalArea: -
trunk/abdev/BasicCompiler32/NumOpe_Arithmetic.cpp
r225 r290 217 217 } 218 218 219 if( GetTypeSize(type[sp-2],-1)==sizeof(_int64)){219 if(Type(type[sp-2],-1).GetSize()==sizeof(_int64)){ 220 220 if(AnswerType==DEF_SINGLE){ 221 221 //add esp,4 … … 652 652 } 653 653 //↓ここだけ例外DWord 654 if( GetTypeSize(type[sp-2],-1)==sizeof(_int64)||type[sp-2]==DEF_DWORD){654 if(Type(type[sp-2],-1).GetSize()==sizeof(_int64)||type[sp-2]==DEF_DWORD){ 655 655 if(AnswerType==DEF_SINGLE){ 656 656 //add esp,4 … … 997 997 sp=*pStackPointer; 998 998 999 int CastType; 1000 CastType=type[sp-1]; 1001 if((CastType&FLAG_CAST)==0){ 999 int castBasicType = type[sp-1]; 1000 if((castBasicType&FLAG_CAST)==0){ 1002 1001 SetError(47,NULL,cp); 1003 1002 return 0; 1004 1003 } 1005 CastType=CastType&(~FLAG_CAST); 1006 1007 if(IsPtrType(CastType)){ 1008 ChangeTypeToLong(type[sp-2]); 1009 } 1010 else if(IsRealNumberType(CastType)){ 1011 if(CastType==DEF_DOUBLE) ChangeTypeToDouble(type[sp-2]); 1012 else if(CastType==DEF_SINGLE) ChangeTypeToSingle(type[sp-2]); 1013 } 1014 else ChangeTypeToWhole(type[sp-2],CastType); 1015 1016 type[sp-2]=CastType; 1017 index_stack[sp-2]=index_stack[sp-1]; 1004 castBasicType = castBasicType&(~FLAG_CAST); 1005 1006 Type oldType( type[sp-2], index_stack[sp-2] ); 1007 Type castType( castBasicType, index_stack[sp-1] ); 1008 1009 if( castType.IsPointer() ) 1010 { 1011 ChangeTypeToLong( oldType.GetBasicType() ); 1012 } 1013 else if( castType.IsReal() ) 1014 { 1015 if( castType.IsDouble() ) 1016 { 1017 ChangeTypeToDouble( oldType.GetBasicType() ); 1018 } 1019 else if( castType.IsSingle() ) 1020 { 1021 ChangeTypeToSingle( oldType.GetBasicType() ); 1022 } 1023 } 1024 else 1025 { 1026 ChangeTypeToWhole( oldType, castType ); 1027 } 1028 1029 type[sp-2] = castType.GetBasicType(); 1030 index_stack[sp-2] = castType.GetIndex(); 1018 1031 1019 1032 sp--; -
trunk/abdev/BasicCompiler32/NumOpe_Logical.cpp
r225 r290 450 450 451 451 //cmp eax,0 452 compiler.codeGenerator.op_cmp_value( GetTypeSize(type[sp-1],-1),REG_EAX,0);452 compiler.codeGenerator.op_cmp_value(Type(type[sp-1],-1).GetSize(),REG_EAX,0); 453 453 454 454 //setne al -
trunk/abdev/BasicCompiler32/NumOpe_TypeOperation.cpp
r235 r290 8 8 #include "Opcode.h" 9 9 10 void ExtendStackTo32(int type); 11 void ExtendStackTo64(int type){ 12 if(Is64Type(type)) return; 10 void ExtendStackTo32( const Type &oldType ); 11 12 void ExtendStackTo64( const Type &oldType ) 13 { 14 if( oldType.Is64() ) 15 { 16 return; 17 } 13 18 14 19 //32ビットに拡張 15 ExtendStackTo32( type);20 ExtendStackTo32( oldType ); 16 21 17 22 //64ビットに拡張 18 if(IsSignedType(type)){ 23 if( oldType.IsSigned() ) 24 { 19 25 //符号あり 20 26 … … 44 50 } 45 51 } 46 void ExtendStackTo32(int type){ 47 if(GetTypeSize(type,-1)==sizeof(long)) return; 48 49 if(Is64Type(type)){ 52 void ExtendStackTo32( const Type &oldType ) 53 { 54 if( oldType.GetSize() == sizeof(long) ) 55 { 56 return; 57 } 58 59 if( oldType.Is64() ) 60 { 50 61 //pop eax 51 62 compiler.codeGenerator.op_pop(REG_EAX); … … 57 68 compiler.codeGenerator.op_push(REG_EAX); 58 69 } 59 else if(type==DEF_INTEGER || (Smoothie::IsUnicode()&&type==DEF_CHAR)){ 70 else if( oldType.IsInteger() ) 71 { 60 72 //pop eax 61 73 compiler.codeGenerator.op_pop(REG_EAX); … … 67 79 compiler.codeGenerator.op_push(REG_EAX); 68 80 } 69 else if(type==DEF_WORD){ 81 else if( oldType.IsWord() ) 82 { 70 83 //pop eax 71 84 compiler.codeGenerator.op_pop(REG_EAX); … … 77 90 compiler.codeGenerator.op_push(REG_EAX); 78 91 } 79 else if(type==DEF_SBYTE || (Smoothie::IsUnicode()==false&&type==DEF_CHAR)){ 92 else if( oldType.IsSByte() ) 93 { 80 94 //pop eax 81 95 compiler.codeGenerator.op_pop(REG_EAX); … … 87 101 compiler.codeGenerator.op_push(REG_EAX); 88 102 } 89 else if(type==DEF_BYTE||type==DEF_BOOLEAN){ 103 else if( oldType.IsByte() || oldType.IsBoolean() ) 104 { 90 105 //pop eax 91 106 compiler.codeGenerator.op_pop(REG_EAX); … … 98 113 } 99 114 } 100 void ExtendStackTo16(int type){ 101 if(type==DEF_SBYTE || (Smoothie::IsUnicode()==false&&type==DEF_CHAR)){ 115 void ExtendStackTo16( const Type &oldType ){ 116 if( oldType.IsSByte() ) 117 { 102 118 //pop eax 103 119 compiler.codeGenerator.op_pop(REG_EAX); … … 109 125 compiler.codeGenerator.op_push(REG_EAX); 110 126 } 111 else if(type==DEF_BYTE){ 127 else if( oldType.IsByte() ) 128 { 112 129 //pop eax 113 130 compiler.codeGenerator.op_pop(REG_EAX); … … 120 137 } 121 138 } 122 void ExtendStackTo8(int type){ 123 if(Is64Type(type)){ 139 void ExtendStackTo8( const Type &oldType ) 140 { 141 if( oldType.Is64() ) 142 { 124 143 //pop eax 125 144 compiler.codeGenerator.op_pop(REG_EAX); … … 134 153 135 154 136 void ChangeTypeToWhole(int OldType,int NewType){ 137 if(OldType==DEF_DOUBLE){ 138 if(Is64Type(NewType)){ 155 void ChangeTypeToWhole( const Type &oldType, const Type &newType ){ 156 if( oldType.IsDouble() ) 157 { 158 if( newType.Is64() ) 159 { 139 160 //fld qword ptr[esp] 140 161 compiler.codeGenerator.op_fld_ptr_esp(DEF_DOUBLE); … … 154 175 } 155 176 } 156 else if(OldType==DEF_SINGLE){ 157 if(Is64Type(NewType)){ 177 else if( oldType.IsSingle() ) 178 { 179 if( newType.Is64() ) 180 { 158 181 //fld dword ptr[esp] 159 182 compiler.codeGenerator.op_fld_ptr_esp(DEF_SINGLE); … … 176 199 //整数から整数へ変換 177 200 178 if(Is64Type(NewType)){ 179 ExtendStackTo64(OldType); 180 } 181 else if(GetTypeSize(NewType,-1)==sizeof(long)){ 182 ExtendStackTo32(OldType); 183 } 184 else if(GetTypeSize(NewType,-1)==sizeof(short)){ 185 ExtendStackTo16(OldType); 186 } 187 else if(GetTypeSize(NewType,-1)==sizeof(char)){ 188 ExtendStackTo8(OldType); 189 } 190 } 191 } 201 if( newType.Is64() ) 202 { 203 ExtendStackTo64( oldType ); 204 } 205 else if( newType.GetSize()==sizeof(long)){ 206 ExtendStackTo32( oldType ); 207 } 208 else if( newType.GetSize()==sizeof(short)){ 209 ExtendStackTo16( oldType ); 210 } 211 else if( newType.GetSize()==sizeof(char)){ 212 ExtendStackTo8( oldType ); 213 } 214 } 215 } -
trunk/abdev/BasicCompiler32/Opcode.h
r261 r290 59 59 void ChangeTypeToInteger(int OldType); 60 60 void ChangeTypeToByte(int OldType); 61 void SetVariableFromEax( int VarType,int CalcType,RELATIVE_VAR *pRelativeVar);61 void SetVariableFromEax( const Type &varType, int CalcType,RELATIVE_VAR *pRelativeVar); 62 62 void OpcodeCalc( const char *Command ); 63 63 … … 110 110 111 111 //NumOpe_TypeOperation.cpp 112 void ExtendStackTo64( int type);113 void ChangeTypeToWhole( int OldType,int NewType);112 void ExtendStackTo64( const Type &oldType ); 113 void ChangeTypeToWhole( const Type &oldType, const Type &newType ); 114 114 115 115 //Compile_Set_Var.cpp … … 147 147 //Compile_Calc_PushVar.cpp 148 148 void SetReg_RealVariable(int type,RELATIVE_VAR *pRelativeVar); 149 void SetReg_WholeVariable( int type,RELATIVE_VAR *pRelativeVar,int reg, bool is64Head = false);149 void SetReg_WholeVariable( Type &type, RELATIVE_VAR *pRelativeVar,int reg, bool is64Head = false); 150 150 void PushLongVariable(RELATIVE_VAR *pRelativeVar); 151 151 … … 156 156 //Compile_Var.cpp 157 157 void SetRelativeOffset( RELATIVE_VAR &relativeVar ); 158 bool _member_offset(bool isErrorEnabled, bool isWriteAccess, const CClass &objClass, const char *member, RELATIVE_VAR *pRelativeVar, Type &resultType, BOOL bPrivateAccess);158 bool _member_offset(bool isErrorEnabled, bool isWriteAccess, const Type &classType, const char *member, RELATIVE_VAR *pRelativeVar, Type &resultType, BOOL bPrivateAccess); 159 159 void SetThisPtrToReg(int reg); 160 160 bool GetVarOffset(bool isErrorEnabled,bool isWriteAccess,const char *NameBuffer,RELATIVE_VAR *pRelativeVar,Type &resultType, Subscripts *pResultSubscripts = NULL ); … … 208 208 #define PROCFLAG_NEW 1 209 209 bool Opcode_CallProcPtr( const char *variable, const char *lpszParms,ProcPointer *pProcPointer); 210 bool Opcode_CallProc(const char *Parameter,const UserProc *pUserProc,DWORD dwFlags,const char *ObjectName ,int RefType);210 bool Opcode_CallProc(const char *Parameter,const UserProc *pUserProc,DWORD dwFlags,const char *ObjectName ); 211 211 bool Opcode_CallDllProc( const char *lpszParms, const DllProc *pDllProc ); 212 212 -
trunk/abdev/BasicCompiler32/OperatorProc.cpp
r225 r290 79 79 for(int i=0;i<(int)params.size();i++){ 80 80 CheckDifferentType( 81 pUserProc->Params()[i]->GetBasicType(), 82 pUserProc->Params()[i]->GetIndex(), 83 params[i]->GetBasicType(), 84 params[i]->GetIndex(), 81 *pUserProc->Params()[i], 82 *params[i], 85 83 "", 86 84 i); … … 91 89 } 92 90 93 int right_side_size = GetTypeSize(type_stack[sp-1],index_stack[sp-1]);91 int right_side_size = Type(type_stack[sp-1],index_stack[sp-1]).GetSize(); 94 92 95 93 if(bTwoTerm){ … … 261 259 } 262 260 263 Opcode_CallProc(Parameter,subs[0],0,ObjectName ,DEF_OBJECT);261 Opcode_CallProc(Parameter,subs[0],0,ObjectName); 264 262 resultType = subs[0]->ReturnType(); 265 263 } -
trunk/abdev/BasicCompiler32/increment.cpp
r225 r290 35 35 else{ 36 36 //整数 37 SetReg_WholeVariable(varType .GetBasicType(),&VarRelativeVar,REG_EAX);37 SetReg_WholeVariable(varType,&VarRelativeVar,REG_EAX); 38 38 } 39 39 … … 114 114 if( varType.IsDouble() ) ChangeTypeToDouble(calcType.GetBasicType()); 115 115 else if( varType.IsSingle() ) ChangeTypeToSingle(calcType.GetBasicType()); 116 else ChangeTypeToWhole( calcType.GetBasicType(),varType.GetBasicType());116 else ChangeTypeToWhole( calcType, varType ); 117 117 118 118 int type_stack[255],sp; … … 202 202 } 203 203 204 SetVariableFromEax(varType .GetBasicType(),varType.GetBasicType(),&VarRelativeVar);204 SetVariableFromEax(varType,varType.GetBasicType(),&VarRelativeVar); 205 205 }
Note:
See TracChangeset
for help on using the changeset viewer.