Changeset 350 in dev for trunk/abdev/BasicCompiler32
- Timestamp:
- Oct 14, 2007, 9:41:03 PM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler32
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/Compile_CallProc.cpp
r349 r350 156 156 ///////////////////////////////// 157 157 pMethod = NULL; 158 if( ! isStatic ) pMethod = pobj_c->GetDynamicMethodO fInterfaceMethod( pUserProc );158 if( ! isStatic ) pMethod = pobj_c->GetDynamicMethodOrInterfaceMethod( pUserProc ); 159 159 if( ! pMethod ){ 160 160 //動的メソッドが取得できなかったときは静的メソッドを当たる … … 280 280 ////////////////////////////////////////////////////// 281 281 // メンバ関数の場合 282 // ※_System_LocalThis パラメータを セット282 // ※_System_LocalThis パラメータをecxにセット 283 283 ////////////////////////////////////////////////////// 284 284 … … 319 319 } 320 320 } 321 322 //push ecx 323 compiler.codeGenerator.op_push(REG_ECX); 324 } 325 326 if( pUserProc->IsVirtual() && !isFixedClass ){ 327 //仮想関数(オブジェクトメソッド)呼び出し 328 //pObj->func_table->func1 329 // ->func2 330 // ->func3 331 321 } 322 323 if( pUserProc->IsVirtual() && !isFixedClass ) 324 { 332 325 int vtblIndex; 333 326 if( pobj_c->IsInterface() ) … … 347 340 348 341 // インターフェイスの場合は更に__thisを取得する 349 //mov rcx,qword ptr[rcx+offset_this]342 //mov ecx,qword ptr[ecx+offset_this] 350 343 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_ECX, REG_ECX, offset_this, MOD_BASE_DISP8 ); 351 344 … … 376 369 // vtblのポインタを取得 377 370 //mov edx,dword ptr[edx+vtblMasterListIndex] 378 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EDX, REG_EDX, vtblMasterListIndex, MOD_BASE_DISP32 ); 379 } 371 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EDX, REG_EDX, vtblMasterListIndex*PTR_SIZE, MOD_BASE_DISP32 ); 372 } 373 374 //push ecx 375 compiler.codeGenerator.op_push(REG_ECX); 380 376 381 377 //call dword ptr[edx+func_index] … … 399 395 //通常呼び出し 400 396 397 if( pUserProc->GetParentClassPtr() && isStatic == false ) 398 { 399 //push ecx 400 compiler.codeGenerator.op_push(REG_ECX); 401 } 402 401 403 //call ProcAddr 402 404 compiler.codeGenerator.op_call(pUserProc); -
trunk/abdev/BasicCompiler32/Compile_Func.cpp
r349 r350 315 315 // vtblのポインタを取得 316 316 //mov edx,dword ptr[edx+vtblMasterListIndex] 317 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EDX, REG_EDX, vtblMasterListIndex , MOD_BASE_DISP32 );317 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EDX, REG_EDX, vtblMasterListIndex*PTR_SIZE, MOD_BASE_DISP32 ); 318 318 } 319 319 -
trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp
r331 r350 258 258 UserProc::CompileStartForUserProc( pBackUserProc ); 259 259 cp=BackCp; 260 } 261 else if( userProc.HasParentClass() 262 && userProc.IsCastOperator() 263 && userProc.ReturnType().IsInterface() ) 264 { 265 // インターフェイス型にキャストするためのメソッド 266 267 int vtblMasterListIndex = userProc.GetParentClass().GetVtblMasterListIndex( &userProc.ReturnType().GetClass() ); 268 269 char temporary[1024]; 270 sprintf( temporary, 271 "Return New %s(ObjPtr( This ),Get_LONG_PTR( (Get_LONG_PTR( ObjPtr(This) ) + SizeOf(LONG_PTR)*%d) As VoidPtr ) As VoidPtr )", 272 userProc.ReturnType().GetClass().GetName().c_str(), 273 vtblMasterListIndex 274 ); 275 MakeMiddleCode( temporary ); 276 277 ChangeOpcode( temporary ); 260 278 } 261 279 else{ -
trunk/abdev/BasicCompiler32/Compile_Var.cpp
r334 r350 1214 1214 1215 1215 //New呼び出し 1216 if( type.IsObject() &&(dwFlags&DIMFLAG_NONCALL_CONSTRACTOR)==0&&InitBuf[0]=='\0'){ 1216 if( type.IsObject() 1217 && !type.IsInterface() 1218 &&(dwFlags&DIMFLAG_NONCALL_CONSTRACTOR)==0 1219 &&InitBuf[0]=='\0') 1220 { 1217 1221 char objectSize[255]; 1218 1222 if( subscripts.size() == 0 ){ -
trunk/abdev/BasicCompiler32/NumOpe.cpp
r347 r350 232 232 GetVarFormatString(methodName,parameter,lpPtrOffset,dummy,refType); 233 233 234 objClass.EnumDynamicMethodsO fInterfaceMethods( methodName, userProcs );234 objClass.EnumDynamicMethodsOrInterfaceMethods( methodName, userProcs ); 235 235 if(userProcs.size()){ 236 236 //オーバーロードを解決 … … 819 819 || term[0] == '\"' ) 820 820 { 821 if( baseType.IsObject() || baseType.IsNull() )821 if( !baseType.IsPointer() ) 822 822 { 823 823 //要求タイプがオブジェクト、または未定のとき -
trunk/abdev/BasicCompiler32/Opcode.h
r334 r350 220 220 //OperatorProc.cpp 221 221 void FreeTempObject(int reg,const CClass *pobj_c); 222 int CallOperatorProc(int idCalc, const Type &baseType, int *type_stack, LONG_PTR *index_stack,BOOL *bUseHeap,int &sp);222 int CallOperatorProc(int idCalc, const Type &baseType, int *type_stack, LONG_PTR *index_stack,BOOL *bUseHeap,int &sp); 223 223 void CallCastOperatorProc(Type &calcType,BOOL bCalcUseHeap,const Type &toType); 224 224 void CallIndexerGetterProc( const Type &classType, const char *ObjectName, char *Parameter,Type &resultType, DWORD dwProcFlags = 0 ); -
trunk/abdev/BasicCompiler32/OperatorProc.cpp
r342 r350 28 28 } 29 29 30 int CallOperatorProc(int idCalc, const Type &baseType, int *type_stack,LONG_PTR *index_stack,BOOL *bUseHeap,int &sp){ 30 int CallOperatorProc(int idCalc, const Type &baseType, int *type_stack, LONG_PTR *index_stack,BOOL *bUseHeap,int &sp) 31 { 32 Type leftType( type_stack[sp-2], index_stack[sp-2] ); 33 Type rightType( type_stack[sp-1] & (~FLAG_CAST), index_stack[sp-1] ); 34 31 35 //オーバーロードされたオペレータ関数を呼び出す 32 CClass *pobj_c; 33 pobj_c=(CClass *)index_stack[sp-2]; 36 const CClass *pobj_c = &leftType.GetClass(); 34 37 35 38 std::vector<const UserProc *> subs; … … 52 55 53 56 if(bTwoTerm){ 54 params.push_back( new Parameter( "", Type( type_stack[sp-1], index_stack[sp-1] )) );57 params.push_back( new Parameter( "", rightType ) ); 55 58 } 56 59 … … 89 92 } 90 93 91 int right_side_size = Type(type_stack[sp-1],index_stack[sp-1]).GetSize();94 int right_side_size = rightType.GetSize(); 92 95 93 96 if(bTwoTerm){
Note:
See TracChangeset
for help on using the changeset viewer.