Changeset 325 in dev for trunk/abdev/BasicCompiler32
- Timestamp:
- Sep 25, 2007, 8:56:38 AM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler32
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/Compile_CallProc.cpp
r320 r325 424 424 return true; 425 425 } 426 427 void Opcode_CallDelegate( const Delegate &dg, const char *methodPtrValueStr, const char *objPtrValueStr, const char *params ) 428 { 429 /////////////////////////////////////////////////////////////// 430 // _System_LocalThisのダミーをセット 431 /////////////////////////////////////////////////////////////// 432 433 char temporary[VN_SIZE]={0}; 434 if( objPtrValueStr && objPtrValueStr[0] ){ 435 //_System_LocalThis(第一パラメータ)のダミーを作成 436 lstrcpy(temporary,"0,"); 437 } 438 if( dg.ReturnType().IsStruct() ){ 439 // ※ByRef _System_ReturnValue パラメータのダミーをセット 440 lstrcat(temporary,"0,"); 441 } 442 443 if(params[0]=='\0'&&temporary[0]) 444 temporary[lstrlen(temporary)-1]=0; 445 else lstrcat(temporary,params); 446 447 448 ParamImpl *pobj_parameter = new ParamImpl( params ); 449 450 //一時オブジェクトを生成 451 pobj_parameter->NewTempParameters( dg.GetName(), dg.Params() ); 452 453 //レジスタ、スタックフレームにセット 454 int ParmSize = pobj_parameter->SetParameter( dg.GetName(), dg.Params() ); 455 456 457 if( objPtrValueStr && objPtrValueStr[0] ) 458 { 459 RELATIVE_VAR RelativeVar; 460 //Constアクセスが不可能なメソッドの場合 461 if( !GetVarOffsetReadWrite( objPtrValueStr, &RelativeVar, Type() ) ){ 462 Jenga::Throw( "Opcode_CallDelegate関数内で呼ばれるGetVarOffsetReadWrite関数に失敗" ); 463 return; 464 } 465 466 SetVarPtrToEax(&RelativeVar); 467 468 // 参照を実体ポインタにする 469 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_ECX, REG_EAX, 0, MOD_BASE ); 470 471 //push ecx 472 compiler.codeGenerator.op_push(REG_ECX); 473 } 474 475 476 { 477 //////////////////////// 478 // call 479 //////////////////////// 480 RELATIVE_VAR RelativeVar; 481 GetVarOffsetReadOnly( methodPtrValueStr, &RelativeVar, Type() ); 482 SetVarPtrToEax( &RelativeVar ); 483 484 //mov eax,dword ptr[eax] 485 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EAX, 0, MOD_BASE ); 486 487 //call eax 488 compiler.codeGenerator.op_call_R( REG_EAX ); 489 } 490 491 492 //一時オブジェクトを破棄 493 pobj_parameter->DeleteTempParameters(); 494 495 //パラメータオブジェクトを破棄 496 delete pobj_parameter; 497 } -
trunk/abdev/BasicCompiler32/Compile_Func.cpp
r301 r325 9 9 10 10 int GetFunctionFromName(char *FuncName){ 11 if(lstrcmpi(FuncName,"CUDbl")==0) return FUNC_CUDBL; 12 if(lstrcmpi(FuncName,"Fix")==0) return FUNC_FIX; 13 if(lstrcmpi(FuncName,"Len")==0) return FUNC_LEN; 14 if(lstrcmpi(FuncName,"AddressOf")==0) return FUNC_ADDRESSOF; 15 if(lstrcmpi(FuncName,"SizeOf")==0) return FUNC_SIZEOF; 16 if(lstrcmpi(FuncName,"VarPtr")==0) return FUNC_VARPTR; 17 if(lstrcmpi(FuncName,"ObjPtr")==0) return FUNC_OBJPTR; 18 if(lstrcmpi(FuncName,"GetDouble")==0) return FUNC_GETDOUBLE; 19 if(lstrcmpi(FuncName,"GetSingle")==0) return FUNC_GETSINGLE; 20 if(lstrcmpi(FuncName,"GetQWord")==0) return FUNC_GETQWORD; 21 if(lstrcmpi(FuncName,"GetDWord")==0) return FUNC_GETDWORD; 22 if(lstrcmpi(FuncName,"GetWord")==0) return FUNC_GETWORD; 23 if(lstrcmpi(FuncName,"GetByte")==0) return FUNC_GETBYTE; 11 if( lstrcmpi( FuncName, "CUDbl" ) == 0 ) return FUNC_CUDBL; 12 if( lstrcmpi( FuncName, "Fix" ) == 0 ) return FUNC_FIX; 13 if( lstrcmpi( FuncName, "Len" ) == 0 ) return FUNC_LEN; 14 if( lstrcmpi( FuncName, "AddressOf" ) == 0 ) return FUNC_ADDRESSOF; 15 if( lstrcmpi( FuncName, "SizeOf" ) == 0 ) return FUNC_SIZEOF; 16 if( lstrcmpi( FuncName, "VarPtr" ) == 0 ) return FUNC_VARPTR; 17 if( lstrcmpi( FuncName, "ObjPtr" ) == 0 ) return FUNC_OBJPTR; 18 if( lstrcmpi( FuncName, "__delegate_dynamicmethod_call" ) == 0 ) return FUNC_DELEGATE_DYNAMICMETHOD_CALL; 19 if( lstrcmpi( FuncName, "__delegate_staticmethod_call" ) == 0 ) return FUNC_DELEGATE_STATICMETHOD_CALL; 20 if( lstrcmpi( FuncName, "GetDouble" ) == 0 ) return FUNC_GETDOUBLE; 21 if( lstrcmpi( FuncName, "GetSingle" ) == 0 ) return FUNC_GETSINGLE; 22 if( lstrcmpi( FuncName, "GetQWord" ) == 0 ) return FUNC_GETQWORD; 23 if( lstrcmpi( FuncName, "GetDWord" ) == 0 ) return FUNC_GETDWORD; 24 if( lstrcmpi( FuncName, "GetWord" ) == 0 ) return FUNC_GETWORD; 25 if( lstrcmpi( FuncName, "GetByte" ) == 0 ) return FUNC_GETBYTE; 24 26 return 0; 25 27 } … … 394 396 } 395 397 } 398 399 void Opcode_Func_delegate_call( const char *paramsStr, Type &resultType, bool isDynamicCall, bool isCallOn ) 400 { 401 if( isCallOn ) 402 { 403 int i = 0; 404 char methodPtrParamStr[VN_SIZE]; 405 i = GetOneParameter( paramsStr, i, methodPtrParamStr ); 406 407 char objPtrValueStr[VN_SIZE]; 408 if( isDynamicCall ) 409 { 410 i = GetOneParameter( paramsStr, i, objPtrValueStr ); 411 } 412 413 Opcode_CallDelegate( compiler.pCompilingClass->GetDelegate(), methodPtrParamStr, objPtrValueStr, paramsStr + i ); 414 } 415 416 resultType = UserProc::CompilingUserProc().ReturnType(); 417 } 418 396 419 void Opcode_Func_GetPtrData(const char *Parameter,const int type){ 397 420 Type tempType; … … 482 505 Opcode_Func_ObjPtr( Parameter, resultType, isCallOn ); 483 506 break; 507 case FUNC_DELEGATE_DYNAMICMETHOD_CALL: 508 Opcode_Func_delegate_call( Parameter, resultType, true, isCallOn ); 509 break; 510 case FUNC_DELEGATE_STATICMETHOD_CALL: 511 Opcode_Func_delegate_call( Parameter, resultType, false, isCallOn ); 512 break; 484 513 485 514 case FUNC_GETDOUBLE: -
trunk/abdev/BasicCompiler32/FunctionValue.h
r109 r325 13 13 14 14 //その他 15 #define FUNC_ADDRESSOF 0x0619 16 #define FUNC_SIZEOF 0x0620 15 #define FUNC_ADDRESSOF 0x0619 16 #define FUNC_SIZEOF 0x0620 17 #define FUNC_DELEGATE_DYNAMICMETHOD_CALL 0x0621 18 #define FUNC_DELEGATE_STATICMETHOD_CALL 0x0622 17 19 18 20 //ポインタ 19 #define FUNC_GETDOUBLE 0x063020 #define FUNC_GETSINGLE 0x063121 #define FUNC_GETQWORD 0x063222 #define FUNC_GETDWORD 0x063323 #define FUNC_GETWORD 0x063424 #define FUNC_GETBYTE 0x063521 #define FUNC_GETDOUBLE 0x0630 22 #define FUNC_GETSINGLE 0x0631 23 #define FUNC_GETQWORD 0x0632 24 #define FUNC_GETDWORD 0x0633 25 #define FUNC_GETWORD 0x0634 26 #define FUNC_GETBYTE 0x0635 -
trunk/abdev/BasicCompiler32/Opcode.h
r316 r325 215 215 bool Opcode_CallProc(const char *Parameter,const UserProc *pUserProc,DWORD dwFlags,const char *ObjectName ); 216 216 bool Opcode_CallDllProc( const char *lpszParms, const DllProc *pDllProc ); 217 void Opcode_CallDelegate( const Delegate &dg, const char *methodPtrValueStr, const char *objPtrValueStr, const char *params ); 217 218 218 219 //Compile_ProcOp.cpp
Note:
See TracChangeset
for help on using the changeset viewer.