Changeset 120 in dev


Ignore:
Timestamp:
May 13, 2007, 8:50:04 AM (17 years ago)
Author:
dai_9181
Message:

Parameter::Equals静的メソッドを廃止し、Parameters::Equalsメソッドを用意。
ポインタに要するサイズよりも一回り大きなアラインメントが指定されているときに、呼び出し側のオフセットズレを考慮するよう、修正

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler32/Compile_Var.cpp

    r116 r120  
    11041104        if( pVar->IsStruct() ){
    11051105            int alignment = pVar->GetClass().iAlign;
     1106
    11061107            if( alignment ){
    11071108                if( AllLocalVarSize % alignment ){
    11081109                    AllLocalVarSize += alignment - (AllLocalVarSize % alignment);
     1110                }
     1111            }
     1112
     1113            if( alignment == PTR_SIZE*2 ){
     1114                // ポインタに要するサイズよりも一回り大きなアラインメントが指定されているとき
     1115                // (例:CONTEXT構造体など)
     1116                // 呼び出し側のオフセットズレを考慮する
     1117
     1118                if( 0 == ( UserProc::CompilingUserProc().RealParams().GetMemorySize() + PTR_SIZE/*ret分*/ ) % alignment ){
     1119                    AllLocalVarSize += PTR_SIZE;
    11091120                }
    11101121            }
  • BasicCompiler64/Compile_Var.cpp

    r116 r120  
    10901090        if( pVar->IsStruct() ){
    10911091            int alignment = pVar->GetClass().iAlign;
     1092
    10921093            if( alignment ){
    10931094                if( AllLocalVarSize % alignment ){
    10941095                    AllLocalVarSize += alignment - (AllLocalVarSize % alignment);
     1096                }
     1097            }
     1098
     1099            if( alignment == PTR_SIZE*2 ){
     1100                // ポインタに要するサイズよりも一回り大きなアラインメントが指定されているとき
     1101                // (例:CONTEXT構造体など)
     1102                // 呼び出し側のオフセットズレを考慮する
     1103
     1104                if( 0 == ( UserProc::CompilingUserProc().RealParams().GetMemorySize() + PTR_SIZE/*ret分*/ ) % alignment ){
     1105                    AllLocalVarSize += PTR_SIZE;
    10951106                }
    10961107            }
  • BasicCompiler_Common/Class.cpp

    r117 r120  
    10891089
    10901090        if( method->pUserProc->GetName() == temporary ){
    1091             if( Parameter::Equals( method->pUserProc->Params(), pUserProc->Params() ) ){
     1091            if( method->pUserProc->Params().Equals( pUserProc->Params() ) ){
    10921092                //関数名、パラメータ属性が合致したとき
    10931093                SetError(15,pUserProc->GetName().c_str(),nowLine);
     
    11031103    foreach( CMethod *method, pobj_c->methods ){
    11041104        if( method->pUserProc->GetName() == temporary ){
    1105             if( Parameter::Equals( method->pUserProc->Params(), pUserProc->Params() ) ){
     1105            if( method->pUserProc->Params().Equals( pUserProc->Params() ) ){
    11061106
    11071107                if(method->bVirtual){
  • BasicCompiler_Common/Parameter.h

    r78 r120  
    22
    33#include "Type.h"
    4 
    5 class Parameter;
    6 typedef vector<Parameter *> Parameters;
    74
    85class Parameter : public Type
     
    8885        return false;
    8986    }
     87};
    9088
     89class Parameters : public vector<Parameter *>
     90{
     91public:
    9192
    92     static bool Equals( const Parameters &paramsA, const Parameters paramsB ){
    93         if( paramsA.size() != paramsB.size() ){
     93    bool Equals( const Parameters &params ) const
     94    {
     95        if( this->size() != params.size() ){
    9496            return false;
    9597        }
    9698
    97         int max = (int)paramsA.size();
     99        int max = (int)this->size();
    98100        for( int i=0; i<max; i++ ){
    99             if( !paramsA[i]->Equals( *paramsB[i] ) ){
     101            if( !(*this)[i]->Equals( *params[i] ) ){
    100102                return false;
    101103            }
     
    104106        return true;
    105107    }
     108
     109    int GetMemorySize() const
     110    {
     111        return (int)this->size() * PTR_SIZE;
     112    }
    106113};
  • BasicCompiler_Common/Subroutine.cpp

    r113 r120  
    622622                //重複エラーチェックを行う
    623623                if( pUserProc->IsEqualSymbol( *psi2 ) ){
    624                     if( Parameter::Equals( psi2->Params(), pUserProc->Params() ) ){
     624                    if( psi2->Params().Equals( pUserProc->Params() ) ){
    625625                        SetError(15,pUserProc->GetName().c_str(),nowLine);
    626626                        return 0;
  • ProjectEditor/SubOperation.cpp

    r118 r120  
    574574        if(lstrcmp(str,"Single")==0) return -1;
    575575        if(lstrcmpi(str,"Sleep")==0) return COM_SLEEP;
     576        if(lstrcmp(str,"Static")==0) return -1;
    576577        if(lstrcmp(str,"String")==0) return -1;
    577578        if(lstrcmpi(str,"Sub")==0) return COM_SUB;
Note: See TracChangeset for help on using the changeset viewer.