Changeset 432 in dev for trunk


Ignore:
Timestamp:
Mar 11, 2008, 7:22:05 PM (16 years ago)
Author:
dai_9181
Message:

[431]を64bit版にマージ。

Location:
trunk/abdev/BasicCompiler64
Files:
2 edited

Legend:

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

    r427 r432  
    77#include "../BasicCompiler_Common/common.h"
    88#include "Opcode.h"
     9
     10#ifdef _AMD64_
     11#include "../BasicCompiler64/FunctionValue.h"
     12#else
     13#include "../BasicCompiler32/FunctionValue.h"
     14#endif
    915
    1016int GetFunctionFromName(char *FuncName){
     
    2026    if( lstrcmpi( FuncName, "_System_GetBp" ) == 0 )    return FUNC_SYSTEM_GET_BP;
    2127    if( lstrcmpi( FuncName, "_System_GetSp" ) == 0 )    return FUNC_SYSTEM_GET_SP;
    22     if( lstrcmp( FuncName, "_System_New" ) == 0 )       return FUNC_SYSTEM_NEW;
     28    if( lstrcmp( FuncName, "_System_GetComVtbl" ) == 0 )        return FUNC_SYSTEM_GET_COM_VTBL;
     29    if( lstrcmp( FuncName, "_System_GetVtblList" ) == 0 )       return FUNC_SYSTEM_GET_VTBL_LIST;
     30    if( lstrcmp( FuncName, "_System_GetDefaultConstructor" ) == 0 ) return FUNC_SYSTEM_GET_DEFAULT_CONSTRUCTOR;
     31    if( lstrcmp( FuncName, "_System_GetDestructor" ) == 0 )         return FUNC_SYSTEM_GET_DESTRUCTOR;
    2332    if( lstrcmpi( FuncName, "GetDouble" ) == 0 )        return FUNC_GETDOUBLE;
    2433    if( lstrcmpi( FuncName, "GetSingle" ) == 0 )        return FUNC_GETSINGLE;
     
    471480}
    472481
    473 void Opcode_Func_System_New( const char *parameter, Type &resultType, bool isCallOn )
    474 {
    475     if( !compiler.StringToType( parameter, resultType ) )
    476     {
    477         SetError();
    478         return;
    479     }
    480     if( !resultType.IsObject() )
    481     {
    482         SetError();
    483         return;
    484     }
    485 
    486     if( isCallOn )
    487     {
    488         Type tempResultType;
    489         if( !Operator_New( parameter, resultType, tempResultType ) )
    490         {
    491             return;
    492         }
    493 
    494         if( !resultType.Equals( tempResultType ) )
    495         {
    496             SetError();
    497         }
    498     }
     482void Opcode_Func_System_GetComVtbl( const char *parameter )
     483{
     484    Type classType;
     485    compiler.StringToType( parameter, classType );
     486
     487    // mov rax,com_vtbl
     488    compiler.codeGenerator.op_mov_RV_com_vtbl( REG_RAX, &classType.GetClass() );
     489}
     490void Opcode_Func_System_GetVtblList( const char *parameter )
     491{
     492    Type classType;
     493    compiler.StringToType( parameter, classType );
     494
     495    // mov rax,com_vtbl
     496    compiler.codeGenerator.op_mov_RV_vtbl( REG_RAX, &classType.GetClass() );
     497}
     498void Opcode_Func_System_GetDefaultConstructor( const char *parameter )
     499{
     500    Type classType;
     501    compiler.StringToType( parameter, classType );
     502
     503    if( classType.GetClass().GetConstructorMethod() )
     504    {
     505        //mov rax,ProcAddr
     506        compiler.codeGenerator.op_addressof( REG_RAX, &classType.GetClass().GetConstructorMethod()->GetUserProc() );
     507    }
     508    else
     509    {
     510        // デフォルトコンストラクタを持たない
     511
     512        //xor rax,rax
     513        compiler.codeGenerator.op_zero_reg( REG_RAX );
     514    }
     515}
     516void Opcode_Func_System_GetDestructor( const char *parameter )
     517{
     518    Type classType;
     519    compiler.StringToType( parameter, classType );
     520
     521    //mov rax,ProcAddr
     522    compiler.codeGenerator.op_addressof( REG_RAX, &classType.GetClass().GetDestructorMethod()->GetUserProc() );
    499523}
    500524
     
    566590            resultType.SetBasicType( DEF_INT64 );
    567591            break;
    568         case FUNC_SYSTEM_NEW:
    569             Opcode_Func_System_New( Parameter, resultType, isCallOn );
     592        case FUNC_SYSTEM_GET_COM_VTBL:
     593            if( isCallOn ) Opcode_Func_System_GetComVtbl( Parameter );
     594            resultType.SetBasicType( DEF_PTR_VOID );
     595            break;
     596        case FUNC_SYSTEM_GET_VTBL_LIST:
     597            if( isCallOn ) Opcode_Func_System_GetVtblList( Parameter );
     598            resultType.SetBasicType( DEF_PTR_VOID );
     599            break;
     600        case FUNC_SYSTEM_GET_DEFAULT_CONSTRUCTOR:
     601            if( isCallOn ) Opcode_Func_System_GetDefaultConstructor( Parameter );
     602            resultType.SetBasicType( DEF_PTR_VOID );
     603            break;
     604        case FUNC_SYSTEM_GET_DESTRUCTOR:
     605            if( isCallOn ) Opcode_Func_System_GetDestructor( Parameter );
     606            resultType.SetBasicType( DEF_PTR_VOID );
    570607            break;
    571608
  • trunk/abdev/BasicCompiler64/FunctionValue.h

    r427 r432  
    2020#define FUNC_SYSTEM_GET_BP  0x0625
    2121#define FUNC_SYSTEM_GET_SP  0x0626
    22 #define FUNC_SYSTEM_NEW     0x0627
     22#define FUNC_SYSTEM_GET_COM_VTBL    0x0627
     23#define FUNC_SYSTEM_GET_VTBL_LIST   0x0628
     24#define FUNC_SYSTEM_GET_DEFAULT_CONSTRUCTOR     0x0629
     25#define FUNC_SYSTEM_GET_DESTRUCTOR              0x062A
    2326
    2427//ポインタ
Note: See TracChangeset for help on using the changeset viewer.