| 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 | int typeSize = tempType.GetSize(); | 
|---|
| 536 |  | 
|---|
| 537 | //mov eax,size | 
|---|
| 538 | compiler.codeGenerator.op_mov_RV( REG_EAX, typeSize ); | 
|---|
| 539 | } | 
|---|
| 540 | void Opcode_Func_ClassSizeOf( const std::string &typeName ) | 
|---|
| 541 | { | 
|---|
| 542 | Type tempType; | 
|---|
| 543 | if( !compiler.StringToType( typeName, tempType ) ){ | 
|---|
| 544 | compiler.errorMessenger.Output(3,typeName,cp); | 
|---|
| 545 | return; | 
|---|
| 546 | } | 
|---|
| 547 |  | 
|---|
| 548 | int typeSize = ( tempType.IsObject() ) ? | 
|---|
| 549 | tempType.GetClass().GetSize() : tempType.GetSize(); | 
|---|
| 550 |  | 
|---|
| 551 | //mov eax,size | 
|---|
| 552 | compiler.codeGenerator.op_mov_RV( REG_EAX, typeSize ); | 
|---|
| 553 | } | 
|---|
| 554 | void Opcode_Func_VarPtr( const char *Parameter, Type &resultType, bool isCallOn ){ | 
|---|
| 555 | if( isCallOn == false ){ | 
|---|
| 556 | // 戻り値の型を取得するだけ | 
|---|
| 557 |  | 
|---|
| 558 | //変数のアドレスを取得 | 
|---|
| 559 | if(!GetVarType( Parameter, resultType, true )) return; | 
|---|
| 560 |  | 
|---|
| 561 | resultType.PtrLevelUp(); | 
|---|
| 562 |  | 
|---|
| 563 | return; | 
|---|
| 564 | } | 
|---|
| 565 |  | 
|---|
| 566 | RELATIVE_VAR RelativeVar; | 
|---|
| 567 |  | 
|---|
| 568 | //変数のアドレスを取得 | 
|---|
| 569 | if(!GetVarOffsetReadOnly( Parameter, &RelativeVar, resultType )) return; | 
|---|
| 570 |  | 
|---|
| 571 | int beforeType = resultType.GetBasicType(); | 
|---|
| 572 |  | 
|---|
| 573 | resultType.PtrLevelUp(); | 
|---|
| 574 |  | 
|---|
| 575 | SetVarPtrToEax(&RelativeVar); | 
|---|
| 576 | } | 
|---|
| 577 | void Opcode_Func_ObjPtr( const char *Parameter, Type &resultType, bool isCallOn ){ | 
|---|
| 578 | if( isCallOn == false ){ | 
|---|
| 579 | // 戻り値の型を取得するだけ | 
|---|
| 580 |  | 
|---|
| 581 | //変数のアドレスを取得 | 
|---|
| 582 | if(!GetVarType( Parameter, resultType, true )) return; | 
|---|
| 583 |  | 
|---|
| 584 | resultType.PtrLevelUp(); | 
|---|
| 585 |  | 
|---|
| 586 | return; | 
|---|
| 587 | } | 
|---|
| 588 |  | 
|---|
| 589 | RELATIVE_VAR RelativeVar; | 
|---|
| 590 |  | 
|---|
| 591 | //変数のアドレスを取得 | 
|---|
| 592 | if(!GetVarOffsetReadOnly( Parameter, &RelativeVar, resultType )) return; | 
|---|
| 593 |  | 
|---|
| 594 | int beforeType = resultType.GetBasicType(); | 
|---|
| 595 |  | 
|---|
| 596 | resultType.PtrLevelUp(); | 
|---|
| 597 |  | 
|---|
| 598 | SetVarPtrToEax(&RelativeVar); | 
|---|
| 599 |  | 
|---|
| 600 | if( lstrcmpi( Parameter, "This" )==0 ){ | 
|---|
| 601 | // Thisの場合は特別にオブジェクトポインタが返ってくるので、何もせずに抜ける | 
|---|
| 602 | } | 
|---|
| 603 | else if( beforeType == DEF_OBJECT ){ | 
|---|
| 604 | //参照をオブジェクトポインタに変更 | 
|---|
| 605 |  | 
|---|
| 606 | //mov eax,dword ptr[eax] | 
|---|
| 607 | compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EAX, 0, MOD_BASE ); | 
|---|
| 608 | } | 
|---|
| 609 | else{ | 
|---|
| 610 | compiler.errorMessenger.Output(134,NULL,cp ); | 
|---|
| 611 | } | 
|---|
| 612 | } | 
|---|
| 613 |  | 
|---|
| 614 | void Opcode_Func_delegate_call( const char *paramsStr, Type &resultType, bool isDynamicCall, bool isCallOn ) | 
|---|
| 615 | { | 
|---|
| 616 | if( isCallOn ) | 
|---|
| 617 | { | 
|---|
| 618 | int i = 0; | 
|---|
| 619 | char methodPtrParamStr[VN_SIZE]; | 
|---|
| 620 | i = GetOneParameter( paramsStr, i, methodPtrParamStr ); | 
|---|
| 621 |  | 
|---|
| 622 | char objPtrValueStr[VN_SIZE]=""; | 
|---|
| 623 | if( isDynamicCall ) | 
|---|
| 624 | { | 
|---|
| 625 | i = GetOneParameter( paramsStr, i, objPtrValueStr ); | 
|---|
| 626 | } | 
|---|
| 627 |  | 
|---|
| 628 | Opcode_CallDelegate( compiler.GetObjectModule().meta.ToDelegate( compiler.GetCompilingClass() ), methodPtrParamStr, objPtrValueStr, paramsStr + i ); | 
|---|
| 629 | } | 
|---|
| 630 |  | 
|---|
| 631 | resultType = compiler.GetCompilingUserProc().ReturnType(); | 
|---|
| 632 | } | 
|---|
| 633 | void Opcode_Func_System_Get_Bp() | 
|---|
| 634 | { | 
|---|
| 635 | //mov eax,ebp | 
|---|
| 636 | compiler.codeGenerator.op_mov_RR(REG_EAX,REG_EBP); | 
|---|
| 637 | } | 
|---|
| 638 | void Opcode_Func_System_Get_Sp() | 
|---|
| 639 | { | 
|---|
| 640 | //mov eax,esp | 
|---|
| 641 | compiler.codeGenerator.op_mov_RR(REG_EAX,REG_ESP); | 
|---|
| 642 | } | 
|---|
| 643 |  | 
|---|
| 644 | void Opcode_Func_System_GetComVtbl( const char *parameter ) | 
|---|
| 645 | { | 
|---|
| 646 | Type classType; | 
|---|
| 647 | compiler.StringToType( parameter, classType ); | 
|---|
| 648 |  | 
|---|
| 649 | // mov eax,com_vtbl | 
|---|
| 650 | compiler.codeGenerator.op_mov_RV_com_vtbl( REG_EAX, &classType.GetClass() ); | 
|---|
| 651 | } | 
|---|
| 652 | void Opcode_Func_System_GetVtblList( const char *parameter ) | 
|---|
| 653 | { | 
|---|
| 654 | Type classType; | 
|---|
| 655 | compiler.StringToType( parameter, classType ); | 
|---|
| 656 |  | 
|---|
| 657 | // mov eax,com_vtbl | 
|---|
| 658 | compiler.codeGenerator.op_mov_RV_vtbl( REG_EAX, &classType.GetClass() ); | 
|---|
| 659 | } | 
|---|
| 660 | void Opcode_Func_System_GetDefaultConstructor( const char *parameter ) | 
|---|
| 661 | { | 
|---|
| 662 | Type classType; | 
|---|
| 663 | compiler.StringToType( parameter, classType ); | 
|---|
| 664 |  | 
|---|
| 665 | if( classType.GetClass().GetConstructorMethod() ) | 
|---|
| 666 | { | 
|---|
| 667 | //mov eax,ProcAddr | 
|---|
| 668 | compiler.codeGenerator.op_addressof( REG_EAX, &classType.GetClass().GetConstructorMethod()->GetUserProc() ); | 
|---|
| 669 | } | 
|---|
| 670 | else | 
|---|
| 671 | { | 
|---|
| 672 | // デフォルトコンストラクタを持たない | 
|---|
| 673 |  | 
|---|
| 674 | //xor eax,eax | 
|---|
| 675 | compiler.codeGenerator.op_zero_reg( REG_EAX ); | 
|---|
| 676 | } | 
|---|
| 677 | } | 
|---|
| 678 | void Opcode_Func_System_GetDestructor( const char *parameter ) | 
|---|
| 679 | { | 
|---|
| 680 | Type classType; | 
|---|
| 681 | compiler.StringToType( parameter, classType ); | 
|---|
| 682 |  | 
|---|
| 683 | //mov eax,ProcAddr | 
|---|
| 684 | compiler.codeGenerator.op_addressof( REG_EAX, &classType.GetClass().GetDestructorMethod()->GetUserProc() ); | 
|---|
| 685 | } | 
|---|
| 686 |  | 
|---|
| 687 | void Opcode_Func_GetPtrData(const char *Parameter,const int type){ | 
|---|
| 688 | Type tempType; | 
|---|
| 689 | if( !NumOpe(Parameter,Type(),tempType) ){ | 
|---|
| 690 | return; | 
|---|
| 691 | } | 
|---|
| 692 | if(!tempType.IsWhole()){ | 
|---|
| 693 | compiler.errorMessenger.Output(11,Parameter,cp); | 
|---|
| 694 | return; | 
|---|
| 695 | } | 
|---|
| 696 | ChangeTypeToLong(tempType.GetBasicType()); | 
|---|
| 697 |  | 
|---|
| 698 | if(type==DEF_DOUBLE){ | 
|---|
| 699 | //pop eax | 
|---|
| 700 | compiler.codeGenerator.op_pop(REG_EAX); | 
|---|
| 701 |  | 
|---|
| 702 | //fld qword ptr[eax] | 
|---|
| 703 | compiler.codeGenerator.PutOld( | 
|---|
| 704 | (char)0xDD, | 
|---|
| 705 | (char)0x00 | 
|---|
| 706 | ); | 
|---|
| 707 | } | 
|---|
| 708 | else if(type==DEF_SINGLE||type==DEF_DWORD){ | 
|---|
| 709 | //pop eax | 
|---|
| 710 | compiler.codeGenerator.op_pop(REG_EAX); | 
|---|
| 711 |  | 
|---|
| 712 | //mov eax,dword ptr[eax] | 
|---|
| 713 | compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EAX, 0, MOD_BASE ); | 
|---|
| 714 | } | 
|---|
| 715 | else if(type==DEF_QWORD){ | 
|---|
| 716 | //pop ecx | 
|---|
| 717 | compiler.codeGenerator.op_pop(REG_ECX); | 
|---|
| 718 |  | 
|---|
| 719 | //mov eax,dword ptr[ecx] | 
|---|
| 720 | compiler.codeGenerator.op_mov_RM(sizeof(long),REG_EAX,REG_ECX,0,MOD_BASE); | 
|---|
| 721 |  | 
|---|
| 722 | //mov edx,dword ptr[ecx+sizeof(long)] | 
|---|
| 723 | compiler.codeGenerator.op_mov_RM(sizeof(long),REG_EDX,REG_ECX,sizeof(long),MOD_BASE_DISP8); | 
|---|
| 724 | } | 
|---|
| 725 | else if(type==DEF_WORD){ | 
|---|
| 726 | //pop ebx | 
|---|
| 727 | compiler.codeGenerator.op_pop(REG_EBX); | 
|---|
| 728 |  | 
|---|
| 729 | //xor eax,eax | 
|---|
| 730 | compiler.codeGenerator.op_xor_RR(REG_EAX); | 
|---|
| 731 |  | 
|---|
| 732 | //mov ax,word ptr[ebx] | 
|---|
| 733 | compiler.codeGenerator.op_mov_RM( sizeof(short), REG_EAX, REG_EBX, 0, MOD_BASE ); | 
|---|
| 734 | } | 
|---|
| 735 | else if(type==DEF_BYTE){ | 
|---|
| 736 | //pop ebx | 
|---|
| 737 | compiler.codeGenerator.op_pop(REG_EBX); | 
|---|
| 738 |  | 
|---|
| 739 | //xor eax,eax | 
|---|
| 740 | compiler.codeGenerator.op_xor_RR(REG_EAX); | 
|---|
| 741 |  | 
|---|
| 742 | //mov al,byte ptr[ebx] | 
|---|
| 743 | compiler.codeGenerator.op_mov_RM( sizeof(char), REG_EAX, REG_EBX, 0, MOD_BASE ); | 
|---|
| 744 | } | 
|---|
| 745 | } | 
|---|
| 746 |  | 
|---|
| 747 | bool Opcode_CallFunc( const char *Parameter, const int FuncNum, const Type &baseType, Type &resultType, bool isCallOn ) | 
|---|
| 748 | { | 
|---|
| 749 | switch(FuncNum){ | 
|---|
| 750 | case FUNC_FIX: | 
|---|
| 751 | if( isCallOn ) Opcode_Func_Fix(Parameter); | 
|---|
| 752 | resultType.SetBasicType( DEF_LONG ); | 
|---|
| 753 | break; | 
|---|
| 754 | case FUNC_CUDBL: | 
|---|
| 755 | if( isCallOn ) Opcode_Func_CUDbl(Parameter); | 
|---|
| 756 | resultType.SetBasicType( DEF_DOUBLE ); | 
|---|
| 757 | break; | 
|---|
| 758 | case FUNC_LEN: | 
|---|
| 759 | if( isCallOn ) Opcode_Func_Len(Parameter); | 
|---|
| 760 | resultType.SetBasicType( DEF_LONG ); | 
|---|
| 761 | break; | 
|---|
| 762 | case FUNC_ADDRESSOF: | 
|---|
| 763 | Opcode_Func_AddressOf( Parameter, baseType, isCallOn, resultType ); | 
|---|
| 764 | break; | 
|---|
| 765 | case FUNC_SIZEOF: | 
|---|
| 766 | if( isCallOn ) Opcode_Func_SizeOf(Parameter); | 
|---|
| 767 | resultType.SetBasicType( DEF_LONG ); | 
|---|
| 768 | break; | 
|---|
| 769 | case FUNC_CLASS_SIZEOF: | 
|---|
| 770 | if( isCallOn ) Opcode_Func_ClassSizeOf(Parameter); | 
|---|
| 771 | resultType.SetBasicType( DEF_LONG ); | 
|---|
| 772 | break; | 
|---|
| 773 | case FUNC_VARPTR: | 
|---|
| 774 | Opcode_Func_VarPtr( Parameter, resultType, isCallOn ); | 
|---|
| 775 | break; | 
|---|
| 776 | case FUNC_OBJPTR: | 
|---|
| 777 | Opcode_Func_ObjPtr( Parameter, resultType, isCallOn ); | 
|---|
| 778 | break; | 
|---|
| 779 | case FUNC_DELEGATE_DYNAMICMETHOD_CALL: | 
|---|
| 780 | Opcode_Func_delegate_call( Parameter, resultType, true, isCallOn ); | 
|---|
| 781 | break; | 
|---|
| 782 | case FUNC_DELEGATE_STATICMETHOD_CALL: | 
|---|
| 783 | Opcode_Func_delegate_call( Parameter, resultType, false, isCallOn ); | 
|---|
| 784 | break; | 
|---|
| 785 | case FUNC_SYSTEM_GET_NOW_SCOPE_CATCH_ADDRESS: | 
|---|
| 786 | if( isCallOn ) Exception::Opcode_Func_System_GetNowScopeCatchAddress(); | 
|---|
| 787 | resultType.SetBasicType( DEF_PTR_VOID ); | 
|---|
| 788 | break; | 
|---|
| 789 | case FUNC_SYSTEM_GET_NOW_SCOPE_FINALLY_ADDRESS: | 
|---|
| 790 | if( isCallOn ) Exception::Opcode_Func_System_GetNowScopeFinallyAddress(); | 
|---|
| 791 | resultType.SetBasicType( DEF_PTR_VOID ); | 
|---|
| 792 | break; | 
|---|
| 793 | case FUNC_SYSTEM_GET_BP: | 
|---|
| 794 | if( isCallOn ) Opcode_Func_System_Get_Bp(); | 
|---|
| 795 | resultType.SetBasicType( DEF_LONG ); | 
|---|
| 796 | break; | 
|---|
| 797 | case FUNC_SYSTEM_GET_SP: | 
|---|
| 798 | if( isCallOn ) Opcode_Func_System_Get_Sp(); | 
|---|
| 799 | resultType.SetBasicType( DEF_LONG ); | 
|---|
| 800 | break; | 
|---|
| 801 | case FUNC_SYSTEM_GET_COM_VTBL: | 
|---|
| 802 | if( isCallOn ) Opcode_Func_System_GetComVtbl( Parameter ); | 
|---|
| 803 | resultType.SetBasicType( DEF_PTR_VOID ); | 
|---|
| 804 | break; | 
|---|
| 805 | case FUNC_SYSTEM_GET_VTBL_LIST: | 
|---|
| 806 | if( isCallOn ) Opcode_Func_System_GetVtblList( Parameter ); | 
|---|
| 807 | resultType.SetBasicType( DEF_PTR_VOID ); | 
|---|
| 808 | break; | 
|---|
| 809 | case FUNC_SYSTEM_GET_DEFAULT_CONSTRUCTOR: | 
|---|
| 810 | if( isCallOn ) Opcode_Func_System_GetDefaultConstructor( Parameter ); | 
|---|
| 811 | resultType.SetBasicType( DEF_PTR_VOID ); | 
|---|
| 812 | break; | 
|---|
| 813 | case FUNC_SYSTEM_GET_DESTRUCTOR: | 
|---|
| 814 | if( isCallOn ) Opcode_Func_System_GetDestructor( Parameter ); | 
|---|
| 815 | resultType.SetBasicType( DEF_PTR_VOID ); | 
|---|
| 816 | break; | 
|---|
| 817 |  | 
|---|
| 818 | case FUNC_GETDOUBLE: | 
|---|
| 819 | if( isCallOn ) Opcode_Func_GetPtrData(Parameter,DEF_DOUBLE); | 
|---|
| 820 | resultType.SetBasicType( DEF_DOUBLE ); | 
|---|
| 821 | break; | 
|---|
| 822 | case FUNC_GETSINGLE: | 
|---|
| 823 | if( isCallOn ) Opcode_Func_GetPtrData(Parameter,DEF_SINGLE); | 
|---|
| 824 | resultType.SetBasicType( DEF_SINGLE ); | 
|---|
| 825 | break; | 
|---|
| 826 | case FUNC_GETQWORD: | 
|---|
| 827 | if( isCallOn ) Opcode_Func_GetPtrData(Parameter,DEF_QWORD); | 
|---|
| 828 | resultType.SetBasicType( DEF_QWORD ); | 
|---|
| 829 | break; | 
|---|
| 830 | case FUNC_GETDWORD: | 
|---|
| 831 | if( isCallOn ) Opcode_Func_GetPtrData(Parameter,DEF_DWORD); | 
|---|
| 832 | resultType.SetBasicType( DEF_DWORD ); | 
|---|
| 833 | break; | 
|---|
| 834 | case FUNC_GETWORD: | 
|---|
| 835 | if( isCallOn ) Opcode_Func_GetPtrData(Parameter,DEF_WORD); | 
|---|
| 836 | resultType.SetBasicType( DEF_WORD ); | 
|---|
| 837 | break; | 
|---|
| 838 | case FUNC_GETBYTE: | 
|---|
| 839 | if( isCallOn ) Opcode_Func_GetPtrData(Parameter,DEF_BYTE); | 
|---|
| 840 | resultType.SetBasicType( DEF_BYTE ); | 
|---|
| 841 | break; | 
|---|
| 842 | default: | 
|---|
| 843 | return false; | 
|---|
| 844 | } | 
|---|
| 845 | return true; | 
|---|
| 846 | } | 
|---|