Changeset 358 in dev


Ignore:
Timestamp:
Nov 6, 2007, 2:35:15 AM (17 years ago)
Author:
dai_9181
Message:

Try-Catchを試験的に実装。
(まだ下記の動作しか実装していません)
・Try
・Catch(パラメータ無し)
・Throw(パラメータ無し)

Location:
trunk/abdev
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/abdev/BasicCompiler32/Compile_Func.cpp

    r357 r358  
    2020    if( lstrcmpi( FuncName, "_System_GetNowScopeCatchAddresses" ) == 0 )return FUNC_SYSTEM_GET_NOW_SCOPE_CATCH_ADDRESS;
    2121    if( lstrcmpi( FuncName, "_System_GetBp" ) == 0 )    return FUNC_SYSTEM_GET_BP;
     22    if( lstrcmpi( FuncName, "_System_GetSp" ) == 0 )    return FUNC_SYSTEM_GET_SP;
    2223    if( lstrcmpi( FuncName, "GetDouble" ) == 0 )        return FUNC_GETDOUBLE;
    2324    if( lstrcmpi( FuncName, "GetSingle" ) == 0 )        return FUNC_GETSINGLE;
     
    582583    compiler.codeGenerator.op_mov_RR(REG_EAX,REG_EBP);
    583584}
     585void Opcode_Func_System_Get_Sp()
     586{
     587    //mov eax,esp
     588    compiler.codeGenerator.op_mov_RR(REG_EAX,REG_ESP);
     589}
    584590
    585591void Opcode_Func_GetPtrData(const char *Parameter,const int type){
     
    679685        case FUNC_SYSTEM_GET_NOW_SCOPE_CATCH_ADDRESS:
    680686            if( isCallOn ) Exception::Opcode_Func_System_GetNowScopeCatchAddress();
    681             resultType.SetBasicType( DEF_LONG );
     687            resultType.SetBasicType( DEF_PTR_VOID );
    682688            break;
    683689        case FUNC_SYSTEM_GET_BP:
     
    685691            resultType.SetBasicType( DEF_LONG );
    686692            break;
     693        case FUNC_SYSTEM_GET_SP:
     694            if( isCallOn ) Opcode_Func_System_Get_Sp();
     695            resultType.SetBasicType( DEF_LONG );
     696            break;
    687697
    688698        case FUNC_GETDOUBLE:
  • trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp

    r355 r358  
    100100        UserProc::CompileStartForUserProc( pBackUserProc );
    101101
    102 
    103         //ret
    104         compiler.codeGenerator.op_ret();
    105     }
    106     else if( userProc.GetName() == "_System_GetSp" ){
    107         //mov eax,esp
    108         compiler.codeGenerator.op_mov_RR(REG_EAX,REG_ESP);
    109 
    110         //add eax,PTR_SIZE
    111         compiler.codeGenerator.op_add_RV8(REG_EAX,PTR_SIZE);
    112102
    113103        //ret
  • trunk/abdev/BasicCompiler32/FunctionValue.h

    r357 r358  
    1919#define FUNC_SYSTEM_GET_NOW_SCOPE_CATCH_ADDRESS 0x0623
    2020#define FUNC_SYSTEM_GET_BP  0x0624
     21#define FUNC_SYSTEM_GET_SP  0x0625
    2122
    2223//ポインタ
  • trunk/abdev/BasicCompiler32/MakePeHdr.cpp

    r357 r358  
    3333    *pSub_System_Call_Destructor_of_GlobalObject,
    3434    *pSub_System_End,
    35     *pSub_System_GetSp,
    3635    *pSub_pow,
    3736    *pSub_calloc,
     
    252251    if(pSub_System_End=GetSubHash("_System_End",1)){
    253252        pSub_System_End->Using();
    254     }
    255 
    256     if(pSub_System_GetSp=GetSubHash("_System_GetSp",1)){
    257         pSub_System_GetSp->Using();
    258         pSub_System_GetSp->ThisIsSystemProc();
    259253    }
    260254
  • trunk/abdev/BasicCompiler64/Compile_Func.cpp

    r357 r358  
    1717    if( lstrcmpi( FuncName, "__delegate_staticmethod_call" ) == 0 )     return FUNC_DELEGATE_STATICMETHOD_CALL;
    1818    if( lstrcmpi( FuncName, "_System_GetNowScopeCatchAddresses" ) == 0 )return FUNC_SYSTEM_GET_NOW_SCOPE_CATCH_ADDRESS;
     19    if( lstrcmpi( FuncName, "_System_GetBp" ) == 0 )    return FUNC_SYSTEM_GET_BP;
     20    if( lstrcmpi( FuncName, "_System_GetSp" ) == 0 )    return FUNC_SYSTEM_GET_SP;
    1921    if( lstrcmpi( FuncName, "GetDouble" ) == 0 )        return FUNC_GETDOUBLE;
    2022    if( lstrcmpi( FuncName, "GetSingle" ) == 0 )        return FUNC_GETSINGLE;
     
    447449    compiler.codeGenerator.op_mov_RR(REG_RAX,REG_RBP);
    448450}
     451void Opcode_Func_System_Get_Sp()
     452{
     453    //mov rax,rsp
     454    compiler.codeGenerator.op_mov_RR(REG_RAX,REG_RSP);
     455}
    449456
    450457void Opcode_Func_GetPtrData( const char *Parameter, const int type ){
     
    501508        case FUNC_SYSTEM_GET_NOW_SCOPE_CATCH_ADDRESS:
    502509            if( isCallOn ) Exception::Opcode_Func_System_GetNowScopeCatchAddress();
    503             resultType.SetBasicType( DEF_LONG );
     510            resultType.SetBasicType( DEF_PTR_VOID );
    504511            break;
    505512        case FUNC_SYSTEM_GET_BP:
    506513            if( isCallOn ) Opcode_Func_System_Get_Bp();
    507             resultType.SetBasicType( DEF_LONG );
     514            resultType.SetBasicType( DEF_INT64 );
     515            break;
     516        case FUNC_SYSTEM_GET_SP:
     517            if( isCallOn ) Opcode_Func_System_Get_Sp();
     518            resultType.SetBasicType( DEF_INT64 );
    508519            break;
    509520
  • trunk/abdev/BasicCompiler64/Compile_ProcOp.cpp

    r355 r358  
    117117        //add rsp,8
    118118        compiler.codeGenerator.op_add_RV(REG_RSP,0x8);
    119 
    120         //ret
    121         compiler.codeGenerator.op_ret();
    122     }
    123     else if( userProc.GetName() == "_System_GetSp" ){
    124         //mov rax,rsp
    125         compiler.codeGenerator.op_mov_RR(REG_RAX,REG_RSP);
    126 
    127         //add rax,PTR_SIZE
    128         compiler.codeGenerator.op_add_RV(REG_RAX,PTR_SIZE);
    129119
    130120        //ret
  • trunk/abdev/BasicCompiler64/FunctionValue.h

    r357 r358  
    1818#define FUNC_SYSTEM_GET_NOW_SCOPE_CATCH_ADDRESS 0x0623
    1919#define FUNC_SYSTEM_GET_BP  0x0624
     20#define FUNC_SYSTEM_GET_SP  0x0625
    2021
    2122//ポインタ
  • trunk/abdev/BasicCompiler64/MakePeHdr.cpp

    r357 r358  
    3333    *pSub_System_Call_Destructor_of_GlobalObject,
    3434    *pSub_System_End,
    35     *pSub_System_GetSp,
    3635    *pSub_pow,
    3736    *pSub_calloc,
     
    245244    if(pSub_System_End=GetSubHash("_System_End",1)){
    246245        pSub_System_End->Using();
    247     }
    248 
    249     if(pSub_System_GetSp=GetSubHash("_System_GetSp",1)){
    250         pSub_System_GetSp->Using();
    251         pSub_System_GetSp->ThisIsSystemProc();
    252246    }
    253247
  • trunk/abdev/BasicCompiler_Common/include/ver.h

    r355 r358  
    66// バージョン付加文字列
    77#ifdef _AMD64_
    8 #define VER_INFO        "(x64) (rev.367)"
     8#define VER_INFO        "(x64) (rev.373)"
    99#else
    10 #define VER_INFO        "(rev.367)"
     10#define VER_INFO        "(rev.373)"
    1111#endif
  • trunk/abdev/BasicCompiler_Common/src/Exception.cpp

    r357 r358  
    5151
    5252    char temporary[1024];
    53     lstrcpy( temporary, "_System_pobj_AllThreads->GetCurrentException()->BeginTryScope( _System_GetNowScopeCatchAddresses() As VoidPtr, _System_GetBp() As LONG_PTR, _System_GetSp() As LONG_PTR )" );
     53    lstrcpy( temporary, "ExceptionService.BeginTryScope( _System_GetNowScopeCatchAddresses() As VoidPtr, _System_GetBp() As LONG_PTR, _System_GetSp() As LONG_PTR )" );
    5454    MakeMiddleCode( temporary );
    5555    ChangeOpcode( temporary );
Note: See TracChangeset for help on using the changeset viewer.