| 1 | #include "stdafx.h"
|
|---|
| 2 |
|
|---|
| 3 | #include <Compiler.h>
|
|---|
| 4 |
|
|---|
| 5 | #include "../BasicCompiler_Common/common.h"
|
|---|
| 6 | #include "Opcode.h"
|
|---|
| 7 |
|
|---|
| 8 | #include "FunctionValue.h"
|
|---|
| 9 |
|
|---|
| 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, "__ClassSizeOf" ) == 0 ) return FUNC_CLASS_SIZEOF;
|
|---|
| 17 | if( lstrcmpi( FuncName, "VarPtr" ) == 0 ) return FUNC_VARPTR;
|
|---|
| 18 | if( lstrcmpi( FuncName, "ObjPtr" ) == 0 ) return FUNC_OBJPTR;
|
|---|
| 19 | if( lstrcmpi( FuncName, "__delegate_dynamicmethod_call" ) == 0 ) return FUNC_DELEGATE_DYNAMICMETHOD_CALL;
|
|---|
| 20 | if( lstrcmpi( FuncName, "__delegate_staticmethod_call" ) == 0 ) return FUNC_DELEGATE_STATICMETHOD_CALL;
|
|---|
| 21 | if( lstrcmpi( FuncName, "_System_GetNowScopeCatchAddresses" ) == 0 )return FUNC_SYSTEM_GET_NOW_SCOPE_CATCH_ADDRESS;
|
|---|
| 22 | if( lstrcmpi( FuncName, "_System_GetNowScopeFinallyAddresses" ) == 0 )return FUNC_SYSTEM_GET_NOW_SCOPE_FINALLY_ADDRESS;
|
|---|
| 23 | if( lstrcmpi( FuncName, "_System_GetBp" ) == 0 ) return FUNC_SYSTEM_GET_BP;
|
|---|
| 24 | if( lstrcmpi( FuncName, "_System_GetSp" ) == 0 ) return FUNC_SYSTEM_GET_SP;
|
|---|
| 25 | if( lstrcmp( FuncName, "_System_GetComVtbl" ) == 0 ) return FUNC_SYSTEM_GET_COM_VTBL;
|
|---|
| 26 | if( lstrcmp( FuncName, "_System_GetVtblList" ) == 0 ) return FUNC_SYSTEM_GET_VTBL_LIST;
|
|---|
| 27 | if( lstrcmp( FuncName, "_System_GetDefaultConstructor" ) == 0 ) return FUNC_SYSTEM_GET_DEFAULT_CONSTRUCTOR;
|
|---|
| 28 | if( lstrcmp( FuncName, "_System_GetDestructor" ) == 0 ) return FUNC_SYSTEM_GET_DESTRUCTOR;
|
|---|
| 29 | if( lstrcmpi( FuncName, "GetDouble" ) == 0 ) return FUNC_GETDOUBLE;
|
|---|
| 30 | if( lstrcmpi( FuncName, "GetSingle" ) == 0 ) return FUNC_GETSINGLE;
|
|---|
| 31 | if( lstrcmpi( FuncName, "GetQWord" ) == 0 ) return FUNC_GETQWORD;
|
|---|
| 32 | if( lstrcmpi( FuncName, "GetDWord" ) == 0 ) return FUNC_GETDWORD;
|
|---|
| 33 | if( lstrcmpi( FuncName, "GetWord" ) == 0 ) return FUNC_GETWORD;
|
|---|
| 34 | if( lstrcmpi( FuncName, "GetByte" ) == 0 ) return FUNC_GETBYTE;
|
|---|
| 35 | return 0;
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 38 | void Opcode_Func_Fix(const char *lpszParms){
|
|---|
| 39 | Type resultType;
|
|---|
| 40 | if( !NumOpe( lpszParms, Type(), resultType ) ){
|
|---|
| 41 | return;
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | if( resultType.IsDouble() ){
|
|---|
| 45 | //fld qword ptr[esp]
|
|---|
| 46 | compiler.codeGenerator.op_fld_ptr_esp(DEF_DOUBLE);
|
|---|
| 47 |
|
|---|
| 48 | //fnstcw word ptr[esp]
|
|---|
| 49 | compiler.codeGenerator.PutOld(
|
|---|
| 50 | (char)0xD9,
|
|---|
| 51 | (char)0x3C,
|
|---|
| 52 | (char)0x24
|
|---|
| 53 | );
|
|---|
| 54 |
|
|---|
| 55 | //mov ax,word ptr[esp]
|
|---|
| 56 | compiler.codeGenerator.op_mov_RM( sizeof(short), REG_EAX, REG_ESP, 0, MOD_BASE );
|
|---|
| 57 |
|
|---|
| 58 | //or ah,0Ch
|
|---|
| 59 | compiler.codeGenerator.PutOld(
|
|---|
| 60 | (char)0x80,
|
|---|
| 61 | (char)0xCC,
|
|---|
| 62 | (char)0x0C
|
|---|
| 63 | );
|
|---|
| 64 |
|
|---|
| 65 | //mov word ptr[esp-2],ax
|
|---|
| 66 | compiler.codeGenerator.op_mov_MR( sizeof(short), REG_EAX, REG_ESP, -2, MOD_BASE_DISP8 );
|
|---|
| 67 |
|
|---|
| 68 | //fldcw word ptr[esp-2]
|
|---|
| 69 | compiler.codeGenerator.PutOld(
|
|---|
| 70 | (char)0xD9,
|
|---|
| 71 | (char)0x6C,
|
|---|
| 72 | (char)0x24,
|
|---|
| 73 | (char)0xFE
|
|---|
| 74 | );
|
|---|
| 75 |
|
|---|
| 76 | //fistp dword ptr[esp+4]
|
|---|
| 77 | compiler.codeGenerator.PutOld(
|
|---|
| 78 | (char)0xDB,
|
|---|
| 79 | (char)0x5C,
|
|---|
| 80 | (char)0x24,
|
|---|
| 81 | (char)0x04
|
|---|
| 82 | );
|
|---|
| 83 |
|
|---|
| 84 | //fldcw word ptr[esp]
|
|---|
| 85 | compiler.codeGenerator.PutOld(
|
|---|
| 86 | (char)0xD9,
|
|---|
| 87 | (char)0x2C,
|
|---|
| 88 | (char)0x24
|
|---|
| 89 | );
|
|---|
| 90 |
|
|---|
| 91 | //add esp,4
|
|---|
| 92 | compiler.codeGenerator.op_add_esp(4);
|
|---|
| 93 | }
|
|---|
| 94 | else if( resultType.IsSingle() ){
|
|---|
| 95 | //fld dword ptr[esp]
|
|---|
| 96 | compiler.codeGenerator.op_fld_ptr_esp(DEF_SINGLE);
|
|---|
| 97 |
|
|---|
| 98 | //sub esp,4
|
|---|
| 99 | compiler.codeGenerator.op_sub_esp(4);
|
|---|
| 100 |
|
|---|
| 101 | //fnstcw word ptr[esp]
|
|---|
| 102 | compiler.codeGenerator.PutOld(
|
|---|
| 103 | (char)0xD9,
|
|---|
| 104 | (char)0x3C,
|
|---|
| 105 | (char)0x24
|
|---|
| 106 | );
|
|---|
| 107 |
|
|---|
| 108 | //mov ax,word ptr[esp]
|
|---|
| 109 | compiler.codeGenerator.op_mov_RM( sizeof(short), REG_EAX, REG_ESP, 0, MOD_BASE );
|
|---|
| 110 |
|
|---|
| 111 | //or ah,0Ch
|
|---|
| 112 | compiler.codeGenerator.PutOld(
|
|---|
| 113 | (char)0x80,
|
|---|
| 114 | (char)0xCC,
|
|---|
| 115 | (char)0x0C
|
|---|
| 116 | );
|
|---|
| 117 |
|
|---|
| 118 | //mov word ptr[esp-2],ax
|
|---|
| 119 | compiler.codeGenerator.op_mov_MR( sizeof(short), REG_EAX, REG_ESP, -2, MOD_BASE_DISP8 );
|
|---|
| 120 |
|
|---|
| 121 | //fldcw word ptr[esp-2]
|
|---|
| 122 | compiler.codeGenerator.PutOld(
|
|---|
| 123 | (char)0xD9,
|
|---|
| 124 | (char)0x6C,
|
|---|
| 125 | (char)0x24,
|
|---|
| 126 | (char)0xFE
|
|---|
| 127 | );
|
|---|
| 128 |
|
|---|
| 129 | //fistp dword ptr[esp+4]
|
|---|
| 130 | compiler.codeGenerator.PutOld(
|
|---|
| 131 | (char)0xDB,
|
|---|
| 132 | (char)0x5C,
|
|---|
| 133 | (char)0x24,
|
|---|
| 134 | (char)0x04
|
|---|
| 135 | );
|
|---|
| 136 |
|
|---|
| 137 | //fldcw word ptr[esp]
|
|---|
| 138 | compiler.codeGenerator.PutOld(
|
|---|
| 139 | (char)0xD9,
|
|---|
| 140 | (char)0x2C,
|
|---|
| 141 | (char)0x24
|
|---|
| 142 | );
|
|---|
| 143 |
|
|---|
| 144 | //add esp,4
|
|---|
| 145 | compiler.codeGenerator.op_add_esp(4);
|
|---|
| 146 | }
|
|---|
| 147 | else if( resultType.Is64() ){
|
|---|
| 148 | //pop eax
|
|---|
| 149 | compiler.codeGenerator.op_pop(REG_EAX);
|
|---|
| 150 |
|
|---|
| 151 | //add esp,4
|
|---|
| 152 | compiler.codeGenerator.op_add_esp(4);
|
|---|
| 153 |
|
|---|
| 154 | //push eax
|
|---|
| 155 | compiler.codeGenerator.op_push(REG_EAX);
|
|---|
| 156 | }
|
|---|
| 157 |
|
|---|
| 158 | //pop eax
|
|---|
| 159 | compiler.codeGenerator.op_pop(REG_EAX);
|
|---|
| 160 | }
|
|---|
| 161 |
|
|---|
| 162 | void Opcode_Func_CUDbl(const char *Parameter){
|
|---|
| 163 | Type resultType;
|
|---|
| 164 | if( !NumOpe(Parameter,Type(),resultType) ){
|
|---|
| 165 | return;
|
|---|
| 166 | }
|
|---|
| 167 | ChangeTypeToLong(resultType.GetBasicType());
|
|---|
| 168 |
|
|---|
| 169 | //pop eax
|
|---|
| 170 | compiler.codeGenerator.op_pop(REG_EAX);
|
|---|
| 171 |
|
|---|
| 172 | //push 0
|
|---|
| 173 | compiler.codeGenerator.op_push_V( 0 );
|
|---|
| 174 |
|
|---|
| 175 | //push eax
|
|---|
| 176 | compiler.codeGenerator.op_push(REG_EAX);
|
|---|
| 177 |
|
|---|
| 178 | //fild qword ptr[esp]
|
|---|
| 179 | compiler.codeGenerator.op_fld_ptr_esp(DEF_INT64);
|
|---|
| 180 |
|
|---|
| 181 | //add esp,8
|
|---|
| 182 | compiler.codeGenerator.op_add_esp(8);
|
|---|
| 183 | }
|
|---|
| 184 | void Opcode_Func_Len(const char *Parameter){
|
|---|
| 185 | BOOL bArrayHead;
|
|---|
| 186 |
|
|---|
| 187 | const char *tempParm=Parameter;
|
|---|
| 188 | char temporary[VN_SIZE];
|
|---|
| 189 | char temp2[32];
|
|---|
| 190 | Type type;
|
|---|
| 191 | if( !GetVarType(Parameter,type,0) ){
|
|---|
| 192 | sprintf(temporary,"_System_DummyStr2=%s",Parameter);
|
|---|
| 193 | OpcodeCalc(temporary);
|
|---|
| 194 |
|
|---|
| 195 | lstrcpy(temp2,"_System_DummyStr2");
|
|---|
| 196 | tempParm=temp2;
|
|---|
| 197 |
|
|---|
| 198 | type.SetType( DEF_OBJECT, compiler.GetObjectModule().meta.GetClasses().GetStringClassPtr() );
|
|---|
| 199 | }
|
|---|
| 200 |
|
|---|
| 201 | if( type.IsStringClass() ){
|
|---|
| 202 | //Stringオブジェクトの場合
|
|---|
| 203 | sprintf(temporary,"%s.Length",tempParm);
|
|---|
| 204 |
|
|---|
| 205 | int reg=REG_RAX;
|
|---|
| 206 | NumOpe(temporary,Type(),Type());
|
|---|
| 207 |
|
|---|
| 208 | //pop eax
|
|---|
| 209 | compiler.codeGenerator.op_pop(REG_EAX);
|
|---|
| 210 |
|
|---|
| 211 | return;
|
|---|
| 212 | }
|
|---|
| 213 |
|
|---|
| 214 | Subscripts subscripts;
|
|---|
| 215 | RELATIVE_VAR RelativeVar;
|
|---|
| 216 | if(!GetVarOffsetReadOnly(tempParm,&RelativeVar,type,&subscripts)) return;
|
|---|
| 217 |
|
|---|
| 218 | if(type.GetBasicType()&FLAG_PTR){
|
|---|
| 219 | type.SetBasicType( type.GetBasicType() & ( ~FLAG_PTR ) );
|
|---|
| 220 |
|
|---|
| 221 | bArrayHead=1;
|
|---|
| 222 | }
|
|---|
| 223 | else bArrayHead=0;
|
|---|
| 224 |
|
|---|
| 225 | int typeSize = type.GetSize();
|
|---|
| 226 |
|
|---|
| 227 | if(bArrayHead) typeSize*=JumpSubScripts(subscripts);
|
|---|
| 228 |
|
|---|
| 229 | //mov eax,typeSize
|
|---|
| 230 | compiler.codeGenerator.op_mov_RV( REG_EAX, typeSize );
|
|---|
| 231 | }
|
|---|
| 232 |
|
|---|
| 233 | void _Opcode_Func_AddressOf( const char *methodInstanceName, const UserProc &userProc )
|
|---|
| 234 | {
|
|---|
| 235 | if( userProc.IsVirtual() ){
|
|---|
| 236 | ///////////////////////////////
|
|---|
| 237 | // 仮想関数の場合
|
|---|
| 238 | // thisポインタをrcxにコピー
|
|---|
| 239 | ///////////////////////////////
|
|---|
| 240 |
|
|---|
| 241 | const CClass *pobj_c;
|
|---|
| 242 |
|
|---|
| 243 | char ObjectName[VN_SIZE];
|
|---|
| 244 | ReferenceKind referenceKind;
|
|---|
| 245 | SplitObjectName( methodInstanceName, ObjectName, referenceKind );
|
|---|
| 246 |
|
|---|
| 247 | if(ObjectName[0]){
|
|---|
| 248 | if(lstrcmpi(ObjectName,"Super")==0) goto InClassMember;
|
|---|
| 249 | else{
|
|---|
| 250 | RELATIVE_VAR RelativeVar;
|
|---|
| 251 | Type type;
|
|---|
| 252 | if(!GetVarOffsetReadOnly(ObjectName,&RelativeVar,type)) return;
|
|---|
| 253 | SetVarPtrToEax(&RelativeVar);
|
|---|
| 254 |
|
|---|
| 255 | //mov ecx,eax
|
|---|
| 256 | compiler.codeGenerator.op_mov_RR(REG_ECX,REG_EAX);
|
|---|
| 257 |
|
|---|
| 258 | //参照タイプが整合しているかをチェック
|
|---|
| 259 | if( !( type.IsObject() && referenceKind == RefDot
|
|---|
| 260 | || type.IsObjectPtr() && referenceKind == RefPointer ) )
|
|---|
| 261 | {
|
|---|
| 262 | compiler.errorMessenger.Output(104,ObjectName,cp);
|
|---|
| 263 | }
|
|---|
| 264 |
|
|---|
| 265 | if(type.IsObjectPtr()){
|
|---|
| 266 | //mov ecx,dword ptr[ecx]
|
|---|
| 267 | compiler.codeGenerator.op_mov_RM(sizeof(long),REG_ECX,REG_ECX,0,MOD_BASE);
|
|---|
| 268 | }
|
|---|
| 269 | }
|
|---|
| 270 | }
|
|---|
| 271 | else{
|
|---|
| 272 | InClassMember:
|
|---|
| 273 | //自身のオブジェクトのThisポインタをrcxにコピー
|
|---|
| 274 | SetThisPtrToReg(REG_RCX);
|
|---|
| 275 |
|
|---|
| 276 | pobj_c = &compiler.GetCompilingClass();
|
|---|
| 277 | }
|
|---|
| 278 |
|
|---|
| 279 |
|
|---|
| 280 | int vtblIndex;
|
|---|
| 281 | if( pobj_c->IsInterface() )
|
|---|
| 282 | {
|
|---|
| 283 | // インターフェイスメソッド呼び出し
|
|---|
| 284 |
|
|---|
| 285 | int offset_vtbl = compiler.GetObjectModule().meta.GetClasses().GetInterfaceInfoClassPtr()->GetMemberOffset( "__vtbl" );
|
|---|
| 286 |
|
|---|
| 287 |
|
|---|
| 288 | // vtblのポインタを取得
|
|---|
| 289 | //mov edx,dword ptr[ecx+offset_vtbl]
|
|---|
| 290 | compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EDX, REG_ECX, offset_vtbl, MOD_BASE_DISP8 );
|
|---|
| 291 |
|
|---|
| 292 | int offset_this = compiler.GetObjectModule().meta.GetClasses().GetInterfaceInfoClassPtr()->GetMemberOffset( "__this" );
|
|---|
| 293 |
|
|---|
| 294 |
|
|---|
| 295 |
|
|---|
| 296 | // インターフェイスの場合は更に__thisを取得する
|
|---|
| 297 | //mov rcx,qword ptr[rcx+offset_this]
|
|---|
| 298 | compiler.codeGenerator.op_mov_RM( sizeof(long), REG_ECX, REG_ECX, offset_this, MOD_BASE_DISP8 );
|
|---|
| 299 |
|
|---|
| 300 | int vtblMasterListIndex;
|
|---|
| 301 | pobj_c->GetVtblMasterListIndexAndVtblIndex( &userProc, vtblMasterListIndex, vtblIndex );
|
|---|
| 302 | if( vtblMasterListIndex != 0 )
|
|---|
| 303 | {
|
|---|
| 304 | compiler.errorMessenger.OutputFatalError();
|
|---|
| 305 | }
|
|---|
| 306 | }
|
|---|
| 307 | else if( pobj_c->IsComInterface() )
|
|---|
| 308 | {
|
|---|
| 309 | // COMインターフェイス メソッド呼び出し
|
|---|
| 310 |
|
|---|
| 311 | //仮想関数(オブジェクトメソッド)呼び出し
|
|---|
| 312 | // pObj -> vtbl1 -> func1
|
|---|
| 313 | // -> func2
|
|---|
| 314 | // -> func3
|
|---|
| 315 |
|
|---|
| 316 | int vtblMasterListIndex;
|
|---|
| 317 | pobj_c->GetVtblMasterListIndexAndVtblIndex( &userProc, vtblMasterListIndex, vtblIndex );
|
|---|
| 318 |
|
|---|
| 319 | // vtblのポインタを取得
|
|---|
| 320 | //mov edx,dword ptr[ecx]
|
|---|
| 321 | compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EDX, REG_ECX, 0, MOD_BASE );
|
|---|
| 322 | }
|
|---|
| 323 | else
|
|---|
| 324 | {
|
|---|
| 325 | //仮想関数(オブジェクトメソッド)呼び出し
|
|---|
| 326 | // pObj -> vtbl_master_list -> vtbl1 -> func1
|
|---|
| 327 | // -> func2
|
|---|
| 328 | // -> func3
|
|---|
| 329 | // -> vtbl2 -> func1
|
|---|
| 330 | // -> func2
|
|---|
| 331 | // -> func3
|
|---|
| 332 |
|
|---|
| 333 | int vtblMasterListIndex;
|
|---|
| 334 | pobj_c->GetVtblMasterListIndexAndVtblIndex( &userProc, vtblMasterListIndex, vtblIndex );
|
|---|
| 335 |
|
|---|
| 336 | // vtblマスターリストのポインタを取得
|
|---|
| 337 | //mov edx,dword ptr[ecx+sizeof(com_vtbl)]
|
|---|
| 338 | compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EDX, REG_ECX, PTR_SIZE, MOD_BASE_DISP8 );
|
|---|
| 339 |
|
|---|
| 340 | // vtblのポインタを取得
|
|---|
| 341 | //mov edx,dword ptr[edx+vtblMasterListIndex]
|
|---|
| 342 | compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EDX, REG_EDX, vtblMasterListIndex*PTR_SIZE, MOD_BASE_DISP32 );
|
|---|
| 343 | }
|
|---|
| 344 |
|
|---|
| 345 | //mov eax,dword ptr[edx+func_index]
|
|---|
| 346 | if( vtblIndex * PTR_SIZE <= 0x7F )
|
|---|
| 347 | {
|
|---|
| 348 | compiler.codeGenerator.op_mov_RM(sizeof(long),REG_EAX,REG_EDX,vtblIndex*PTR_SIZE,MOD_BASE_DISP8);
|
|---|
| 349 | }
|
|---|
| 350 | else{
|
|---|
| 351 | compiler.codeGenerator.op_mov_RM(sizeof(long),REG_EAX,REG_EDX,vtblIndex*PTR_SIZE,MOD_BASE_DISP32);
|
|---|
| 352 | }
|
|---|
| 353 | }
|
|---|
| 354 | else{
|
|---|
| 355 | //一般の関数
|
|---|
| 356 |
|
|---|
| 357 | //mov eax,ProcAddr
|
|---|
| 358 | compiler.codeGenerator.op_addressof( REG_EAX, &userProc );
|
|---|
| 359 | }
|
|---|
| 360 |
|
|---|
| 361 | userProc.Using();
|
|---|
| 362 | }
|
|---|
| 363 | void Opcode_CreateDelegate( const CClass &dgClass, const char *methodInstanceName, const UserProc &userProc )
|
|---|
| 364 | {
|
|---|
| 365 | /////////////////////////////////////////////////////////////////
|
|---|
| 366 | // 関数ポインタをpush
|
|---|
| 367 | /////////////////////////////////////////////////////////////////
|
|---|
| 368 |
|
|---|
| 369 | //push AddressOf(userProc)
|
|---|
| 370 | _Opcode_Func_AddressOf( methodInstanceName, userProc );
|
|---|
| 371 | compiler.codeGenerator.op_push( REG_EAX );
|
|---|
| 372 |
|
|---|
| 373 |
|
|---|
| 374 | if( userProc.GetMethod().IsDynamic() )
|
|---|
| 375 | {
|
|---|
| 376 | /////////////////////////////////////////////////////////////////
|
|---|
| 377 | // オブジェクト ポインタをpush
|
|---|
| 378 | /////////////////////////////////////////////////////////////////
|
|---|
| 379 |
|
|---|
| 380 | // オブジェクト名を取得
|
|---|
| 381 | char objectName[VN_SIZE];
|
|---|
| 382 | char memberName[VN_SIZE];
|
|---|
| 383 | char *thisPtrName = "This";
|
|---|
| 384 | Type type;
|
|---|
| 385 | if( SplitMemberName( methodInstanceName, objectName, memberName ) )
|
|---|
| 386 | {
|
|---|
| 387 | if( GetVarType( objectName, type, false ) )
|
|---|
| 388 | {
|
|---|
| 389 | thisPtrName = objectName;
|
|---|
| 390 | }
|
|---|
| 391 | }
|
|---|
| 392 |
|
|---|
| 393 | // オブジェクト ポインタを取得
|
|---|
| 394 | RELATIVE_VAR relativeVar;
|
|---|
| 395 | GetVarOffsetReadOnly( thisPtrName, &relativeVar, type );
|
|---|
| 396 | if( !type.IsObject() )
|
|---|
| 397 | {
|
|---|
| 398 | extern int cp;
|
|---|
| 399 | compiler.errorMessenger.Output(1,NULL,cp);
|
|---|
| 400 | return;
|
|---|
| 401 | }
|
|---|
| 402 |
|
|---|
| 403 | SetVarPtrToEax( &relativeVar );
|
|---|
| 404 |
|
|---|
| 405 | //mov eax,dword ptr[eax]
|
|---|
| 406 | compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EAX, 0, MOD_BASE );
|
|---|
| 407 |
|
|---|
| 408 | //push eax
|
|---|
| 409 | compiler.codeGenerator.op_push( REG_EAX );
|
|---|
| 410 | }
|
|---|
| 411 |
|
|---|
| 412 |
|
|---|
| 413 | /////////////////////////////////////////////////////////////////
|
|---|
| 414 | // call _CreateDynamicDelegate/_CreateStaticDelegate
|
|---|
| 415 | /////////////////////////////////////////////////////////////////
|
|---|
| 416 |
|
|---|
| 417 | std::vector<const UserProc *> subs;
|
|---|
| 418 | if( userProc.GetMethod().IsDynamic() )
|
|---|
| 419 | {
|
|---|
| 420 | dgClass.GetStaticMethods().Enum( "_CreateDynamicDelegate", subs );
|
|---|
| 421 | }
|
|---|
| 422 | else
|
|---|
| 423 | {
|
|---|
| 424 | dgClass.GetStaticMethods().Enum( "_CreateStaticDelegate", subs );
|
|---|
| 425 | }
|
|---|
| 426 |
|
|---|
| 427 | // call _CreateDynamicDelegate
|
|---|
| 428 | compiler.codeGenerator.op_call( subs[0] );
|
|---|
| 429 | }
|
|---|
| 430 | void Opcode_Func_AddressOf( const char *name, const Type &baseType, bool isCallOn, Type &resultType )
|
|---|
| 431 | {
|
|---|
| 432 | extern int cp;
|
|---|
| 433 |
|
|---|
| 434 | const Parameters *pBaseParams = NULL;
|
|---|
| 435 | const Type *pBaseReturnType = NULL;
|
|---|
| 436 | if( baseType.IsProcPtr() )
|
|---|
| 437 | {
|
|---|
| 438 | // 左辺で関数ポインタを要求されているとき
|
|---|
| 439 | const ProcPointer *pTempProcPointer = compiler.GetObjectModule().meta.GetProcPointers()[baseType.GetIndex()];
|
|---|
| 440 | pBaseParams = &pTempProcPointer->Params();
|
|---|
| 441 | pBaseReturnType = &pTempProcPointer->ReturnType();
|
|---|
| 442 | }
|
|---|
| 443 | else if( baseType.IsDelegate() )
|
|---|
| 444 | {
|
|---|
| 445 | // 左辺でデリゲートを要求されているとき
|
|---|
| 446 | const Delegate *pTempDelegate = &compiler.GetObjectModule().meta.ToDelegate( baseType.GetClass() );
|
|---|
| 447 | pBaseParams = &pTempDelegate->Params();
|
|---|
| 448 | pBaseReturnType = &pTempDelegate->ReturnType();
|
|---|
| 449 | }
|
|---|
| 450 |
|
|---|
| 451 | const UserProc *pUserProc;
|
|---|
| 452 | if( pBaseParams && pBaseReturnType )
|
|---|
| 453 | {
|
|---|
| 454 | //左辺の型にのっとり、オーバーロードを解決
|
|---|
| 455 |
|
|---|
| 456 | std::vector<const UserProc *> subs;
|
|---|
| 457 | GetOverloadSubHash( name, subs );
|
|---|
| 458 | if( subs.size() == 0 ){
|
|---|
| 459 | compiler.errorMessenger.Output(27,name,cp);
|
|---|
| 460 | return;
|
|---|
| 461 | }
|
|---|
| 462 |
|
|---|
| 463 | //オーバーロードを解決
|
|---|
| 464 | pUserProc=OverloadSolution( name, subs, *pBaseParams, Type(), Type() );
|
|---|
| 465 |
|
|---|
| 466 | if( isCallOn )
|
|---|
| 467 | {
|
|---|
| 468 | // コード生成を伴う場合はエラーチェックを行う
|
|---|
| 469 |
|
|---|
| 470 | if( baseType.IsDelegate() )
|
|---|
| 471 | {
|
|---|
| 472 | // デリゲート
|
|---|
| 473 | // 共変戻り値、反変引数をサポート
|
|---|
| 474 | if( !(
|
|---|
| 475 | pBaseParams->Equals( pUserProc->Params(), true )
|
|---|
| 476 | && ( pBaseReturnType->Equals( pUserProc->ReturnType() ) || pBaseReturnType->IsCovariant( pUserProc->ReturnType() ) )
|
|---|
| 477 | ) )
|
|---|
| 478 | {
|
|---|
| 479 | compiler.errorMessenger.Output(67, name, cp );
|
|---|
| 480 | }
|
|---|
| 481 | }
|
|---|
| 482 | else
|
|---|
| 483 | {
|
|---|
| 484 | // 関数ポインタ
|
|---|
| 485 | if( !(
|
|---|
| 486 | pBaseParams->Equals( pUserProc->Params() )
|
|---|
| 487 | && pBaseReturnType->Equals( pUserProc->ReturnType() )
|
|---|
| 488 | ) )
|
|---|
| 489 | {
|
|---|
| 490 | compiler.errorMessenger.Output(66, name, cp );
|
|---|
| 491 | }
|
|---|
| 492 | }
|
|---|
| 493 | }
|
|---|
| 494 |
|
|---|
| 495 | if(!pUserProc){
|
|---|
| 496 | compiler.errorMessenger.Output(27,name,cp);
|
|---|
| 497 | return;
|
|---|
| 498 | }
|
|---|
| 499 | }
|
|---|
| 500 | else{
|
|---|
| 501 | pUserProc=GetSubHash(name);
|
|---|
| 502 | if(!pUserProc){
|
|---|
| 503 | compiler.errorMessenger.Output(27,name,cp);
|
|---|
| 504 | return;
|
|---|
| 505 | }
|
|---|
| 506 | }
|
|---|
| 507 |
|
|---|
| 508 | if( baseType.IsDelegate() )
|
|---|
| 509 | {
|
|---|
| 510 | if( isCallOn )
|
|---|
| 511 | {
|
|---|
| 512 | // デリゲートのとき
|
|---|
| 513 | Opcode_CreateDelegate( baseType.GetClass(), name, *pUserProc );
|
|---|
| 514 | }
|
|---|
| 515 | resultType = baseType;
|
|---|
| 516 | }
|
|---|
| 517 | else
|
|---|
| 518 | {
|
|---|
| 519 | if( isCallOn )
|
|---|
| 520 | {
|
|---|
| 521 | // 関数ポインタのとき
|
|---|
| 522 | _Opcode_Func_AddressOf( name, *pUserProc );
|
|---|
| 523 | }
|
|---|
| 524 | resultType.SetBasicType( DEF_PTR_VOID );
|
|---|
| 525 | }
|
|---|
| 526 | }
|
|---|
| 527 | void Opcode_Func_SizeOf( const std::string &typeName )
|
|---|
| 528 | {
|
|---|
| 529 | Type tempType;
|
|---|
| 530 | if( !compiler.StringToType( typeName, tempType ) ){
|
|---|
| 531 | compiler.errorMessenger.Output(3,typeName,cp);
|
|---|
| 532 | return;
|
|---|
| 533 | }
|
|---|
| 534 |
|
|---|
| 535 | //mov eax,size
|
|---|
| 536 | compiler.codeGenerator.op_mov_RV( REG_EAX, compiler.SizeOf( tempType ) );
|
|---|
| 537 | }
|
|---|
| 538 | void Opcode_Func_ClassSizeOf( const std::string &typeName )
|
|---|
| 539 | {
|
|---|
| 540 | Type tempType;
|
|---|
| 541 | if( !compiler.StringToType( typeName, tempType ) ){
|
|---|
| 542 | compiler.errorMessenger.Output(3,typeName,cp);
|
|---|
| 543 | return;
|
|---|
| 544 | }
|
|---|
| 545 |
|
|---|
| 546 | if( !tempType.IsObject() )
|
|---|
| 547 | {
|
|---|
| 548 | compiler.errorMessenger.Output(1,typeName,cp);
|
|---|
| 549 | return;
|
|---|
| 550 | }
|
|---|
| 551 |
|
|---|
| 552 | //mov eax,size
|
|---|
| 553 | compiler.codeGenerator.op_mov_RV( REG_EAX, tempType.GetClass().GetSize() );
|
|---|
| 554 | }
|
|---|
| 555 | void Opcode_Func_VarPtr( const char *Parameter, Type &resultType, bool isCallOn ){
|
|---|
| 556 | if( isCallOn == false ){
|
|---|
| 557 | // 戻り値の型を取得するだけ
|
|---|
| 558 |
|
|---|
| 559 | //変数のアドレスを取得
|
|---|
| 560 | if(!GetVarType( Parameter, resultType, true )) return;
|
|---|
| 561 |
|
|---|
| 562 | resultType.PtrLevelUp();
|
|---|
| 563 |
|
|---|
| 564 | return;
|
|---|
| 565 | }
|
|---|
| 566 |
|
|---|
| 567 | RELATIVE_VAR RelativeVar;
|
|---|
| 568 |
|
|---|
| 569 | //変数のアドレスを取得
|
|---|
| 570 | if(!GetVarOffsetReadOnly( Parameter, &RelativeVar, resultType )) return;
|
|---|
| 571 |
|
|---|
| 572 | int beforeType = resultType.GetBasicType();
|
|---|
| 573 |
|
|---|
| 574 | resultType.PtrLevelUp();
|
|---|
| 575 |
|
|---|
| 576 | SetVarPtrToEax(&RelativeVar);
|
|---|
| 577 | }
|
|---|
| 578 | void Opcode_Func_ObjPtr( const char *Parameter, Type &resultType, bool isCallOn ){
|
|---|
| 579 | if( isCallOn == false ){
|
|---|
| 580 | // 戻り値の型を取得するだけ
|
|---|
| 581 |
|
|---|
| 582 | //変数のアドレスを取得
|
|---|
| 583 | if(!GetVarType( Parameter, resultType, true )) return;
|
|---|
| 584 |
|
|---|
| 585 | resultType.PtrLevelUp();
|
|---|
| 586 |
|
|---|
| 587 | return;
|
|---|
| 588 | }
|
|---|
| 589 |
|
|---|
| 590 | RELATIVE_VAR RelativeVar;
|
|---|
| 591 |
|
|---|
| 592 | //変数のアドレスを取得
|
|---|
| 593 | if(!GetVarOffsetReadOnly( Parameter, &RelativeVar, resultType )) return;
|
|---|
| 594 |
|
|---|
| 595 | int beforeType = resultType.GetBasicType();
|
|---|
| 596 |
|
|---|
| 597 | resultType.PtrLevelUp();
|
|---|
| 598 |
|
|---|
| 599 | SetVarPtrToEax(&RelativeVar);
|
|---|
| 600 |
|
|---|
| 601 | if( lstrcmpi( Parameter, "This" )==0 ){
|
|---|
| 602 | // Thisの場合は特別にオブジェクトポインタが返ってくるので、何もせずに抜ける
|
|---|
| 603 | }
|
|---|
| 604 | else if( beforeType == DEF_OBJECT ){
|
|---|
| 605 | //参照をオブジェクトポインタに変更
|
|---|
| 606 |
|
|---|
| 607 | //mov eax,dword ptr[eax]
|
|---|
| 608 | compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EAX, 0, MOD_BASE );
|
|---|
| 609 | }
|
|---|
| 610 | else{
|
|---|
| 611 | compiler.errorMessenger.Output(134,NULL,cp );
|
|---|
| 612 | }
|
|---|
| 613 | }
|
|---|
| 614 |
|
|---|
| 615 | void Opcode_Func_delegate_call( const char *paramsStr, Type &resultType, bool isDynamicCall, bool isCallOn )
|
|---|
| 616 | {
|
|---|
| 617 | if( isCallOn )
|
|---|
| 618 | {
|
|---|
| 619 | int i = 0;
|
|---|
| 620 | char methodPtrParamStr[VN_SIZE];
|
|---|
| 621 | i = GetOneParameter( paramsStr, i, methodPtrParamStr );
|
|---|
| 622 |
|
|---|
| 623 | char objPtrValueStr[VN_SIZE]="";
|
|---|
| 624 | if( isDynamicCall )
|
|---|
| 625 | {
|
|---|
| 626 | i = GetOneParameter( paramsStr, i, objPtrValueStr );
|
|---|
| 627 | }
|
|---|
| 628 |
|
|---|
| 629 | Opcode_CallDelegate( compiler.GetObjectModule().meta.ToDelegate( compiler.GetCompilingClass() ), methodPtrParamStr, objPtrValueStr, paramsStr + i );
|
|---|
| 630 | }
|
|---|
| 631 |
|
|---|
| 632 | resultType = compiler.GetCompilingUserProc().ReturnType();
|
|---|
| 633 | }
|
|---|
| 634 | void Opcode_Func_System_Get_Bp()
|
|---|
| 635 | {
|
|---|
| 636 | //mov eax,ebp
|
|---|
| 637 | compiler.codeGenerator.op_mov_RR(REG_EAX,REG_EBP);
|
|---|
| 638 | }
|
|---|
| 639 | void Opcode_Func_System_Get_Sp()
|
|---|
| 640 | {
|
|---|
| 641 | //mov eax,esp
|
|---|
| 642 | compiler.codeGenerator.op_mov_RR(REG_EAX,REG_ESP);
|
|---|
| 643 | }
|
|---|
| 644 |
|
|---|
| 645 | void Opcode_Func_System_GetComVtbl( const char *parameter )
|
|---|
| 646 | {
|
|---|
| 647 | Type classType;
|
|---|
| 648 | compiler.StringToType( parameter, classType );
|
|---|
| 649 |
|
|---|
| 650 | // mov eax,com_vtbl
|
|---|
| 651 | compiler.codeGenerator.op_mov_RV_com_vtbl( REG_EAX, &classType.GetClass() );
|
|---|
| 652 | }
|
|---|
| 653 | void Opcode_Func_System_GetVtblList( const char *parameter )
|
|---|
| 654 | {
|
|---|
| 655 | Type classType;
|
|---|
| 656 | compiler.StringToType( parameter, classType );
|
|---|
| 657 |
|
|---|
| 658 | // mov eax,com_vtbl
|
|---|
| 659 | compiler.codeGenerator.op_mov_RV_vtbl( REG_EAX, &classType.GetClass() );
|
|---|
| 660 | }
|
|---|
| 661 | void Opcode_Func_System_GetDefaultConstructor( const char *parameter )
|
|---|
| 662 | {
|
|---|
| 663 | Type classType;
|
|---|
| 664 | compiler.StringToType( parameter, classType );
|
|---|
| 665 |
|
|---|
| 666 | if( classType.GetClass().GetConstructorMethod() )
|
|---|
| 667 | {
|
|---|
| 668 | //mov eax,ProcAddr
|
|---|
| 669 | compiler.codeGenerator.op_addressof( REG_EAX, &classType.GetClass().GetConstructorMethod()->GetUserProc() );
|
|---|
| 670 | }
|
|---|
| 671 | else
|
|---|
| 672 | {
|
|---|
| 673 | // デフォルトコンストラクタを持たない
|
|---|
| 674 |
|
|---|
| 675 | //xor eax,eax
|
|---|
| 676 | compiler.codeGenerator.op_zero_reg( REG_EAX );
|
|---|
| 677 | }
|
|---|
| 678 | }
|
|---|
| 679 | void Opcode_Func_System_GetDestructor( const char *parameter )
|
|---|
| 680 | {
|
|---|
| 681 | Type classType;
|
|---|
| 682 | compiler.StringToType( parameter, classType );
|
|---|
| 683 |
|
|---|
| 684 | //mov eax,ProcAddr
|
|---|
| 685 | compiler.codeGenerator.op_addressof( REG_EAX, &classType.GetClass().GetDestructorMethod()->GetUserProc() );
|
|---|
| 686 | }
|
|---|
| 687 |
|
|---|
| 688 | void Opcode_Func_GetPtrData(const char *Parameter,const int type){
|
|---|
| 689 | Type tempType;
|
|---|
| 690 | if( !NumOpe(Parameter,Type(),tempType) ){
|
|---|
| 691 | return;
|
|---|
| 692 | }
|
|---|
| 693 | if(!tempType.IsWhole()){
|
|---|
| 694 | compiler.errorMessenger.Output(11,Parameter,cp);
|
|---|
| 695 | return;
|
|---|
| 696 | }
|
|---|
| 697 | ChangeTypeToLong(tempType.GetBasicType());
|
|---|
| 698 |
|
|---|
| 699 | if(type==DEF_DOUBLE){
|
|---|
| 700 | //pop eax
|
|---|
| 701 | compiler.codeGenerator.op_pop(REG_EAX);
|
|---|
| 702 |
|
|---|
| 703 | //fld qword ptr[eax]
|
|---|
| 704 | compiler.codeGenerator.PutOld(
|
|---|
| 705 | (char)0xDD,
|
|---|
| 706 | (char)0x00
|
|---|
| 707 | );
|
|---|
| 708 | }
|
|---|
| 709 | else if(type==DEF_SINGLE||type==DEF_DWORD){
|
|---|
| 710 | //pop eax
|
|---|
| 711 | compiler.codeGenerator.op_pop(REG_EAX);
|
|---|
| 712 |
|
|---|
| 713 | //mov eax,dword ptr[eax]
|
|---|
| 714 | compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EAX, 0, MOD_BASE );
|
|---|
| 715 | }
|
|---|
| 716 | else if(type==DEF_QWORD){
|
|---|
| 717 | //pop ecx
|
|---|
| 718 | compiler.codeGenerator.op_pop(REG_ECX);
|
|---|
| 719 |
|
|---|
| 720 | //mov eax,dword ptr[ecx]
|
|---|
| 721 | compiler.codeGenerator.op_mov_RM(sizeof(long),REG_EAX,REG_ECX,0,MOD_BASE);
|
|---|
| 722 |
|
|---|
| 723 | //mov edx,dword ptr[ecx+sizeof(long)]
|
|---|
| 724 | compiler.codeGenerator.op_mov_RM(sizeof(long),REG_EDX,REG_ECX,sizeof(long),MOD_BASE_DISP8);
|
|---|
| 725 | }
|
|---|
| 726 | else if(type==DEF_WORD){
|
|---|
| 727 | //pop ebx
|
|---|
| 728 | compiler.codeGenerator.op_pop(REG_EBX);
|
|---|
| 729 |
|
|---|
| 730 | //xor eax,eax
|
|---|
| 731 | compiler.codeGenerator.op_xor_RR(REG_EAX);
|
|---|
| 732 |
|
|---|
| 733 | //mov ax,word ptr[ebx]
|
|---|
| 734 | compiler.codeGenerator.op_mov_RM( sizeof(short), REG_EAX, REG_EBX, 0, MOD_BASE );
|
|---|
| 735 | }
|
|---|
| 736 | else if(type==DEF_BYTE){
|
|---|
| 737 | //pop ebx
|
|---|
| 738 | compiler.codeGenerator.op_pop(REG_EBX);
|
|---|
| 739 |
|
|---|
| 740 | //xor eax,eax
|
|---|
| 741 | compiler.codeGenerator.op_xor_RR(REG_EAX);
|
|---|
| 742 |
|
|---|
| 743 | //mov al,byte ptr[ebx]
|
|---|
| 744 | compiler.codeGenerator.op_mov_RM( sizeof(char), REG_EAX, REG_EBX, 0, MOD_BASE );
|
|---|
| 745 | }
|
|---|
| 746 | }
|
|---|
| 747 |
|
|---|
| 748 | bool Opcode_CallFunc( const char *Parameter, const int FuncNum, const Type &baseType, Type &resultType, bool isCallOn )
|
|---|
| 749 | {
|
|---|
| 750 | switch(FuncNum){
|
|---|
| 751 | case FUNC_FIX:
|
|---|
| 752 | if( isCallOn ) Opcode_Func_Fix(Parameter);
|
|---|
| 753 | resultType.SetBasicType( DEF_LONG );
|
|---|
| 754 | break;
|
|---|
| 755 | case FUNC_CUDBL:
|
|---|
| 756 | if( isCallOn ) Opcode_Func_CUDbl(Parameter);
|
|---|
| 757 | resultType.SetBasicType( DEF_DOUBLE );
|
|---|
| 758 | break;
|
|---|
| 759 | case FUNC_LEN:
|
|---|
| 760 | if( isCallOn ) Opcode_Func_Len(Parameter);
|
|---|
| 761 | resultType.SetBasicType( DEF_LONG );
|
|---|
| 762 | break;
|
|---|
| 763 | case FUNC_ADDRESSOF:
|
|---|
| 764 | Opcode_Func_AddressOf( Parameter, baseType, isCallOn, resultType );
|
|---|
| 765 | break;
|
|---|
| 766 | case FUNC_SIZEOF:
|
|---|
| 767 | if( isCallOn ) Opcode_Func_SizeOf(Parameter);
|
|---|
| 768 | resultType.SetBasicType( DEF_LONG );
|
|---|
| 769 | break;
|
|---|
| 770 | case FUNC_CLASS_SIZEOF:
|
|---|
| 771 | if( isCallOn ) Opcode_Func_ClassSizeOf(Parameter);
|
|---|
| 772 | resultType.SetBasicType( DEF_LONG );
|
|---|
| 773 | break;
|
|---|
| 774 | case FUNC_VARPTR:
|
|---|
| 775 | Opcode_Func_VarPtr( Parameter, resultType, isCallOn );
|
|---|
| 776 | break;
|
|---|
| 777 | case FUNC_OBJPTR:
|
|---|
| 778 | Opcode_Func_ObjPtr( Parameter, resultType, isCallOn );
|
|---|
| 779 | break;
|
|---|
| 780 | case FUNC_DELEGATE_DYNAMICMETHOD_CALL:
|
|---|
| 781 | Opcode_Func_delegate_call( Parameter, resultType, true, isCallOn );
|
|---|
| 782 | break;
|
|---|
| 783 | case FUNC_DELEGATE_STATICMETHOD_CALL:
|
|---|
| 784 | Opcode_Func_delegate_call( Parameter, resultType, false, isCallOn );
|
|---|
| 785 | break;
|
|---|
| 786 | case FUNC_SYSTEM_GET_NOW_SCOPE_CATCH_ADDRESS:
|
|---|
| 787 | if( isCallOn ) Exception::Opcode_Func_System_GetNowScopeCatchAddress();
|
|---|
| 788 | resultType.SetBasicType( DEF_PTR_VOID );
|
|---|
| 789 | break;
|
|---|
| 790 | case FUNC_SYSTEM_GET_NOW_SCOPE_FINALLY_ADDRESS:
|
|---|
| 791 | if( isCallOn ) Exception::Opcode_Func_System_GetNowScopeFinallyAddress();
|
|---|
| 792 | resultType.SetBasicType( DEF_PTR_VOID );
|
|---|
| 793 | break;
|
|---|
| 794 | case FUNC_SYSTEM_GET_BP:
|
|---|
| 795 | if( isCallOn ) Opcode_Func_System_Get_Bp();
|
|---|
| 796 | resultType.SetBasicType( DEF_LONG );
|
|---|
| 797 | break;
|
|---|
| 798 | case FUNC_SYSTEM_GET_SP:
|
|---|
| 799 | if( isCallOn ) Opcode_Func_System_Get_Sp();
|
|---|
| 800 | resultType.SetBasicType( DEF_LONG );
|
|---|
| 801 | break;
|
|---|
| 802 | case FUNC_SYSTEM_GET_COM_VTBL:
|
|---|
| 803 | if( isCallOn ) Opcode_Func_System_GetComVtbl( Parameter );
|
|---|
| 804 | resultType.SetBasicType( DEF_PTR_VOID );
|
|---|
| 805 | break;
|
|---|
| 806 | case FUNC_SYSTEM_GET_VTBL_LIST:
|
|---|
| 807 | if( isCallOn ) Opcode_Func_System_GetVtblList( Parameter );
|
|---|
| 808 | resultType.SetBasicType( DEF_PTR_VOID );
|
|---|
| 809 | break;
|
|---|
| 810 | case FUNC_SYSTEM_GET_DEFAULT_CONSTRUCTOR:
|
|---|
| 811 | if( isCallOn ) Opcode_Func_System_GetDefaultConstructor( Parameter );
|
|---|
| 812 | resultType.SetBasicType( DEF_PTR_VOID );
|
|---|
| 813 | break;
|
|---|
| 814 | case FUNC_SYSTEM_GET_DESTRUCTOR:
|
|---|
| 815 | if( isCallOn ) Opcode_Func_System_GetDestructor( Parameter );
|
|---|
| 816 | resultType.SetBasicType( DEF_PTR_VOID );
|
|---|
| 817 | break;
|
|---|
| 818 |
|
|---|
| 819 | case FUNC_GETDOUBLE:
|
|---|
| 820 | if( isCallOn ) Opcode_Func_GetPtrData(Parameter,DEF_DOUBLE);
|
|---|
| 821 | resultType.SetBasicType( DEF_DOUBLE );
|
|---|
| 822 | break;
|
|---|
| 823 | case FUNC_GETSINGLE:
|
|---|
| 824 | if( isCallOn ) Opcode_Func_GetPtrData(Parameter,DEF_SINGLE);
|
|---|
| 825 | resultType.SetBasicType( DEF_SINGLE );
|
|---|
| 826 | break;
|
|---|
| 827 | case FUNC_GETQWORD:
|
|---|
| 828 | if( isCallOn ) Opcode_Func_GetPtrData(Parameter,DEF_QWORD);
|
|---|
| 829 | resultType.SetBasicType( DEF_QWORD );
|
|---|
| 830 | break;
|
|---|
| 831 | case FUNC_GETDWORD:
|
|---|
| 832 | if( isCallOn ) Opcode_Func_GetPtrData(Parameter,DEF_DWORD);
|
|---|
| 833 | resultType.SetBasicType( DEF_DWORD );
|
|---|
| 834 | break;
|
|---|
| 835 | case FUNC_GETWORD:
|
|---|
| 836 | if( isCallOn ) Opcode_Func_GetPtrData(Parameter,DEF_WORD);
|
|---|
| 837 | resultType.SetBasicType( DEF_WORD );
|
|---|
| 838 | break;
|
|---|
| 839 | case FUNC_GETBYTE:
|
|---|
| 840 | if( isCallOn ) Opcode_Func_GetPtrData(Parameter,DEF_BYTE);
|
|---|
| 841 | resultType.SetBasicType( DEF_BYTE );
|
|---|
| 842 | break;
|
|---|
| 843 | default:
|
|---|
| 844 | return false;
|
|---|
| 845 | }
|
|---|
| 846 | return true;
|
|---|
| 847 | }
|
|---|