From 793e2148f671348164e21e986c85500488cdf5c8 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Thu, 8 Oct 2015 09:55:35 -0700 Subject: [PATCH] Switch to protojit.dll Change ILToNative to use the standalone JIT (protojit.dll) build from CoreCLR repo --- src/JitInterface/src/CorInfoBase.cs | 123 +++++++++--------- src/JitInterface/src/CorInfoHelpFunc.cs | 3 + src/JitInterface/src/CorInfoImpl.cs | 4 +- src/JitInterface/src/CorInfoTypes.cs | 6 + .../src/ThunkGenerator/ThunkInput.txt | 4 +- src/JitInterface/src/ThunkGenerator/corinfo.h | 84 ++++++++++-- src/JitInterface/src/ThunkGenerator/corjit.h | 18 ++- 7 files changed, 165 insertions(+), 77 deletions(-) diff --git a/src/JitInterface/src/CorInfoBase.cs b/src/JitInterface/src/CorInfoBase.cs index a8f1430fd55..2a955011ccf 100644 --- a/src/JitInterface/src/CorInfoBase.cs +++ b/src/JitInterface/src/CorInfoBase.cs @@ -221,6 +221,8 @@ unsafe partial class CorInfoImpl [UnmanagedFunctionPointerAttribute(CallingConvention.ThisCall)] delegate byte* _findNameOfToken(IntPtr _this, CORINFO_MODULE_STRUCT_* moduleHandle, mdToken token, byte* szFQName, UIntPtr FQNameCapacity); [UnmanagedFunctionPointerAttribute(CallingConvention.ThisCall)] + [return: MarshalAs(UnmanagedType.I1)]delegate bool _getSystemVAmd64PassStructInRegisterDescriptor(IntPtr _this, CORINFO_CLASS_STRUCT_* structHnd, SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr); + [UnmanagedFunctionPointerAttribute(CallingConvention.ThisCall)] delegate int _getIntConfigValue(IntPtr _this, String name, int defaultValue); [UnmanagedFunctionPointerAttribute(CallingConvention.ThisCall)] delegate short* _getStringConfigValue(IntPtr _this, String name); @@ -339,8 +341,8 @@ unsafe partial class CorInfoImpl protected IntPtr CreateUnmanagedInstance() { - IntPtr * vtable = (IntPtr *)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 162); - Object[] keepalive = new Object[162]; + IntPtr * vtable = (IntPtr *)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 163); + Object[] keepalive = new Object[163]; _keepalive = keepalive; @@ -659,177 +661,180 @@ protected IntPtr CreateUnmanagedInstance() var d104 = new _findNameOfToken(findNameOfToken); vtable[104] = Marshal.GetFunctionPointerForDelegate(d104); keepalive[104] = d104; - var d105 = new _getIntConfigValue(getIntConfigValue); + var d105 = new _getSystemVAmd64PassStructInRegisterDescriptor(getSystemVAmd64PassStructInRegisterDescriptor); vtable[105] = Marshal.GetFunctionPointerForDelegate(d105); keepalive[105] = d105; - var d106 = new _getStringConfigValue(getStringConfigValue); + var d106 = new _getIntConfigValue(getIntConfigValue); vtable[106] = Marshal.GetFunctionPointerForDelegate(d106); keepalive[106] = d106; - var d107 = new _freeStringConfigValue(freeStringConfigValue); + var d107 = new _getStringConfigValue(getStringConfigValue); vtable[107] = Marshal.GetFunctionPointerForDelegate(d107); keepalive[107] = d107; - var d108 = new _getThreadTLSIndex(getThreadTLSIndex); + var d108 = new _freeStringConfigValue(freeStringConfigValue); vtable[108] = Marshal.GetFunctionPointerForDelegate(d108); keepalive[108] = d108; - var d109 = new _getInlinedCallFrameVptr(getInlinedCallFrameVptr); + var d109 = new _getThreadTLSIndex(getThreadTLSIndex); vtable[109] = Marshal.GetFunctionPointerForDelegate(d109); keepalive[109] = d109; - var d110 = new _getAddrOfCaptureThreadGlobal(getAddrOfCaptureThreadGlobal); + var d110 = new _getInlinedCallFrameVptr(getInlinedCallFrameVptr); vtable[110] = Marshal.GetFunctionPointerForDelegate(d110); keepalive[110] = d110; - var d111 = new _getAddrModuleDomainID(getAddrModuleDomainID); + var d111 = new _getAddrOfCaptureThreadGlobal(getAddrOfCaptureThreadGlobal); vtable[111] = Marshal.GetFunctionPointerForDelegate(d111); keepalive[111] = d111; - var d112 = new _getHelperFtn(getHelperFtn); + var d112 = new _getAddrModuleDomainID(getAddrModuleDomainID); vtable[112] = Marshal.GetFunctionPointerForDelegate(d112); keepalive[112] = d112; - var d113 = new _getFunctionEntryPoint(getFunctionEntryPoint); + var d113 = new _getHelperFtn(getHelperFtn); vtable[113] = Marshal.GetFunctionPointerForDelegate(d113); keepalive[113] = d113; - var d114 = new _getFunctionFixedEntryPoint(getFunctionFixedEntryPoint); + var d114 = new _getFunctionEntryPoint(getFunctionEntryPoint); vtable[114] = Marshal.GetFunctionPointerForDelegate(d114); keepalive[114] = d114; - var d115 = new _getMethodSync(getMethodSync); + var d115 = new _getFunctionFixedEntryPoint(getFunctionFixedEntryPoint); vtable[115] = Marshal.GetFunctionPointerForDelegate(d115); keepalive[115] = d115; - var d116 = new _getLazyStringLiteralHelper(getLazyStringLiteralHelper); + var d116 = new _getMethodSync(getMethodSync); vtable[116] = Marshal.GetFunctionPointerForDelegate(d116); keepalive[116] = d116; - var d117 = new _embedModuleHandle(embedModuleHandle); + var d117 = new _getLazyStringLiteralHelper(getLazyStringLiteralHelper); vtable[117] = Marshal.GetFunctionPointerForDelegate(d117); keepalive[117] = d117; - var d118 = new _embedClassHandle(embedClassHandle); + var d118 = new _embedModuleHandle(embedModuleHandle); vtable[118] = Marshal.GetFunctionPointerForDelegate(d118); keepalive[118] = d118; - var d119 = new _embedMethodHandle(embedMethodHandle); + var d119 = new _embedClassHandle(embedClassHandle); vtable[119] = Marshal.GetFunctionPointerForDelegate(d119); keepalive[119] = d119; - var d120 = new _embedFieldHandle(embedFieldHandle); + var d120 = new _embedMethodHandle(embedMethodHandle); vtable[120] = Marshal.GetFunctionPointerForDelegate(d120); keepalive[120] = d120; - var d121 = new _embedGenericHandle(embedGenericHandle); + var d121 = new _embedFieldHandle(embedFieldHandle); vtable[121] = Marshal.GetFunctionPointerForDelegate(d121); keepalive[121] = d121; - var d122 = new _getLocationOfThisType(getLocationOfThisType); + var d122 = new _embedGenericHandle(embedGenericHandle); vtable[122] = Marshal.GetFunctionPointerForDelegate(d122); keepalive[122] = d122; - var d123 = new _getPInvokeUnmanagedTarget(getPInvokeUnmanagedTarget); + var d123 = new _getLocationOfThisType(getLocationOfThisType); vtable[123] = Marshal.GetFunctionPointerForDelegate(d123); keepalive[123] = d123; - var d124 = new _getAddressOfPInvokeFixup(getAddressOfPInvokeFixup); + var d124 = new _getPInvokeUnmanagedTarget(getPInvokeUnmanagedTarget); vtable[124] = Marshal.GetFunctionPointerForDelegate(d124); keepalive[124] = d124; - var d125 = new _GetCookieForPInvokeCalliSig(GetCookieForPInvokeCalliSig); + var d125 = new _getAddressOfPInvokeFixup(getAddressOfPInvokeFixup); vtable[125] = Marshal.GetFunctionPointerForDelegate(d125); keepalive[125] = d125; - var d126 = new _canGetCookieForPInvokeCalliSig(canGetCookieForPInvokeCalliSig); + var d126 = new _GetCookieForPInvokeCalliSig(GetCookieForPInvokeCalliSig); vtable[126] = Marshal.GetFunctionPointerForDelegate(d126); keepalive[126] = d126; - var d127 = new _getJustMyCodeHandle(getJustMyCodeHandle); + var d127 = new _canGetCookieForPInvokeCalliSig(canGetCookieForPInvokeCalliSig); vtable[127] = Marshal.GetFunctionPointerForDelegate(d127); keepalive[127] = d127; - var d128 = new _GetProfilingHandle(GetProfilingHandle); + var d128 = new _getJustMyCodeHandle(getJustMyCodeHandle); vtable[128] = Marshal.GetFunctionPointerForDelegate(d128); keepalive[128] = d128; - var d129 = new _getCallInfo(getCallInfo); + var d129 = new _GetProfilingHandle(GetProfilingHandle); vtable[129] = Marshal.GetFunctionPointerForDelegate(d129); keepalive[129] = d129; - var d130 = new _canAccessFamily(canAccessFamily); + var d130 = new _getCallInfo(getCallInfo); vtable[130] = Marshal.GetFunctionPointerForDelegate(d130); keepalive[130] = d130; - var d131 = new _isRIDClassDomainID(isRIDClassDomainID); + var d131 = new _canAccessFamily(canAccessFamily); vtable[131] = Marshal.GetFunctionPointerForDelegate(d131); keepalive[131] = d131; - var d132 = new _getClassDomainID(getClassDomainID); + var d132 = new _isRIDClassDomainID(isRIDClassDomainID); vtable[132] = Marshal.GetFunctionPointerForDelegate(d132); keepalive[132] = d132; - var d133 = new _getFieldAddress(getFieldAddress); + var d133 = new _getClassDomainID(getClassDomainID); vtable[133] = Marshal.GetFunctionPointerForDelegate(d133); keepalive[133] = d133; - var d134 = new _getVarArgsHandle(getVarArgsHandle); + var d134 = new _getFieldAddress(getFieldAddress); vtable[134] = Marshal.GetFunctionPointerForDelegate(d134); keepalive[134] = d134; - var d135 = new _canGetVarArgsHandle(canGetVarArgsHandle); + var d135 = new _getVarArgsHandle(getVarArgsHandle); vtable[135] = Marshal.GetFunctionPointerForDelegate(d135); keepalive[135] = d135; - var d136 = new _constructStringLiteral(constructStringLiteral); + var d136 = new _canGetVarArgsHandle(canGetVarArgsHandle); vtable[136] = Marshal.GetFunctionPointerForDelegate(d136); keepalive[136] = d136; - var d137 = new _emptyStringLiteral(emptyStringLiteral); + var d137 = new _constructStringLiteral(constructStringLiteral); vtable[137] = Marshal.GetFunctionPointerForDelegate(d137); keepalive[137] = d137; - var d138 = new _getFieldThreadLocalStoreID(getFieldThreadLocalStoreID); + var d138 = new _emptyStringLiteral(emptyStringLiteral); vtable[138] = Marshal.GetFunctionPointerForDelegate(d138); keepalive[138] = d138; - var d139 = new _setOverride(setOverride); + var d139 = new _getFieldThreadLocalStoreID(getFieldThreadLocalStoreID); vtable[139] = Marshal.GetFunctionPointerForDelegate(d139); keepalive[139] = d139; - var d140 = new _addActiveDependency(addActiveDependency); + var d140 = new _setOverride(setOverride); vtable[140] = Marshal.GetFunctionPointerForDelegate(d140); keepalive[140] = d140; - var d141 = new _GetDelegateCtor(GetDelegateCtor); + var d141 = new _addActiveDependency(addActiveDependency); vtable[141] = Marshal.GetFunctionPointerForDelegate(d141); keepalive[141] = d141; - var d142 = new _MethodCompileComplete(MethodCompileComplete); + var d142 = new _GetDelegateCtor(GetDelegateCtor); vtable[142] = Marshal.GetFunctionPointerForDelegate(d142); keepalive[142] = d142; - var d143 = new _getTailCallCopyArgsThunk(getTailCallCopyArgsThunk); + var d143 = new _MethodCompileComplete(MethodCompileComplete); vtable[143] = Marshal.GetFunctionPointerForDelegate(d143); keepalive[143] = d143; - var d144 = new _getMemoryManager(getMemoryManager); + var d144 = new _getTailCallCopyArgsThunk(getTailCallCopyArgsThunk); vtable[144] = Marshal.GetFunctionPointerForDelegate(d144); keepalive[144] = d144; - var d145 = new _allocMem(allocMem); + var d145 = new _getMemoryManager(getMemoryManager); vtable[145] = Marshal.GetFunctionPointerForDelegate(d145); keepalive[145] = d145; - var d146 = new _reserveUnwindInfo(reserveUnwindInfo); + var d146 = new _allocMem(allocMem); vtable[146] = Marshal.GetFunctionPointerForDelegate(d146); keepalive[146] = d146; - var d147 = new _allocUnwindInfo(allocUnwindInfo); + var d147 = new _reserveUnwindInfo(reserveUnwindInfo); vtable[147] = Marshal.GetFunctionPointerForDelegate(d147); keepalive[147] = d147; - var d148 = new _allocGCInfo(allocGCInfo); + var d148 = new _allocUnwindInfo(allocUnwindInfo); vtable[148] = Marshal.GetFunctionPointerForDelegate(d148); keepalive[148] = d148; - var d149 = new _yieldExecution(yieldExecution); + var d149 = new _allocGCInfo(allocGCInfo); vtable[149] = Marshal.GetFunctionPointerForDelegate(d149); keepalive[149] = d149; - var d150 = new _setEHcount(setEHcount); + var d150 = new _yieldExecution(yieldExecution); vtable[150] = Marshal.GetFunctionPointerForDelegate(d150); keepalive[150] = d150; - var d151 = new _setEHinfo(setEHinfo); + var d151 = new _setEHcount(setEHcount); vtable[151] = Marshal.GetFunctionPointerForDelegate(d151); keepalive[151] = d151; - var d152 = new _logMsg(logMsg); + var d152 = new _setEHinfo(setEHinfo); vtable[152] = Marshal.GetFunctionPointerForDelegate(d152); keepalive[152] = d152; - var d153 = new _doAssert(doAssert); + var d153 = new _logMsg(logMsg); vtable[153] = Marshal.GetFunctionPointerForDelegate(d153); keepalive[153] = d153; - var d154 = new _reportFatalError(reportFatalError); + var d154 = new _doAssert(doAssert); vtable[154] = Marshal.GetFunctionPointerForDelegate(d154); keepalive[154] = d154; - var d155 = new _allocBBProfileBuffer(allocBBProfileBuffer); + var d155 = new _reportFatalError(reportFatalError); vtable[155] = Marshal.GetFunctionPointerForDelegate(d155); keepalive[155] = d155; - var d156 = new _getBBProfileData(getBBProfileData); + var d156 = new _allocBBProfileBuffer(allocBBProfileBuffer); vtable[156] = Marshal.GetFunctionPointerForDelegate(d156); keepalive[156] = d156; - var d157 = new _recordCallSite(recordCallSite); + var d157 = new _getBBProfileData(getBBProfileData); vtable[157] = Marshal.GetFunctionPointerForDelegate(d157); keepalive[157] = d157; - var d158 = new _recordRelocation(recordRelocation); + var d158 = new _recordCallSite(recordCallSite); vtable[158] = Marshal.GetFunctionPointerForDelegate(d158); keepalive[158] = d158; - var d159 = new _getRelocTypeHint(getRelocTypeHint); + var d159 = new _recordRelocation(recordRelocation); vtable[159] = Marshal.GetFunctionPointerForDelegate(d159); keepalive[159] = d159; - var d160 = new _getModuleNativeEntryPointRange(getModuleNativeEntryPointRange); + var d160 = new _getRelocTypeHint(getRelocTypeHint); vtable[160] = Marshal.GetFunctionPointerForDelegate(d160); keepalive[160] = d160; - var d161 = new _getExpectedTargetArchitecture(getExpectedTargetArchitecture); + var d161 = new _getModuleNativeEntryPointRange(getModuleNativeEntryPointRange); vtable[161] = Marshal.GetFunctionPointerForDelegate(d161); keepalive[161] = d161; + var d162 = new _getExpectedTargetArchitecture(getExpectedTargetArchitecture); + vtable[162] = Marshal.GetFunctionPointerForDelegate(d162); + keepalive[162] = d162; IntPtr instance = Marshal.AllocCoTaskMem(sizeof(IntPtr)); *(IntPtr**)instance = vtable; diff --git a/src/JitInterface/src/CorInfoHelpFunc.cs b/src/JitInterface/src/CorInfoHelpFunc.cs index 2de90dcfc25..60cad987f01 100644 --- a/src/JitInterface/src/CorInfoHelpFunc.cs +++ b/src/JitInterface/src/CorInfoHelpFunc.cs @@ -357,6 +357,9 @@ which is the right helper to use to allocate an object of a given type. */ CORINFO_HELP_LOOP_CLONE_CHOICE_ADDR, // Return the reference to a counter to decide to take cloned path in debug stress. CORINFO_HELP_DEBUG_LOG_LOOP_CLONING, // Print a message that a loop cloning optimization has occurred in debug mode. + CORINFO_HELP_THROW_ARGUMENTEXCEPTION, // throw ArgumentException + CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION, // throw ArgumentOutOfRangeException + CORINFO_HELP_COUNT, } } diff --git a/src/JitInterface/src/CorInfoImpl.cs b/src/JitInterface/src/CorInfoImpl.cs index 53947bd89f0..a43e18a20f6 100644 --- a/src/JitInterface/src/CorInfoImpl.cs +++ b/src/JitInterface/src/CorInfoImpl.cs @@ -47,7 +47,7 @@ public CorInfoImpl(Compilation compilation) _comp = CreateUnmanagedInstance(); - string clrjitPath = AppContext.BaseDirectory + "\\clrjit.dll"; + string clrjitPath = AppContext.BaseDirectory + "\\protojit.dll"; IntPtr jit = LoadLibraryEx(clrjitPath, new IntPtr(0), 0x1300); IntPtr proc = GetProcAddress(jit, "getJit"); @@ -1019,6 +1019,8 @@ uint getMethodHash(IntPtr _this, CORINFO_METHOD_STRUCT_* ftn) byte* findNameOfToken(IntPtr _this, CORINFO_MODULE_STRUCT_* moduleHandle, mdToken token, byte* szFQName, UIntPtr FQNameCapacity) { throw new NotImplementedException(); } + bool getSystemVAmd64PassStructInRegisterDescriptor(IntPtr _this, CORINFO_CLASS_STRUCT_* structHnd, SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr) + { throw new NotImplementedException(); } int getIntConfigValue(IntPtr _this, String name, int defaultValue) { throw new NotImplementedException(); } short* getStringConfigValue(IntPtr _this, String name) diff --git a/src/JitInterface/src/CorInfoTypes.cs b/src/JitInterface/src/CorInfoTypes.cs index 6dd5ac6c430..4baf48779ff 100644 --- a/src/JitInterface/src/CorInfoTypes.cs +++ b/src/JitInterface/src/CorInfoTypes.cs @@ -382,6 +382,7 @@ public enum CORINFO_CALLINFO_FLAGS CORINFO_CALLINFO_VERIFICATION = 0x0008, // Gets extra verification information. CORINFO_CALLINFO_SECURITYCHECKS = 0x0010, // Perform security checks. CORINFO_CALLINFO_LDFTN = 0x0020, // Resolving target of LDFTN + CORINFO_CALLINFO_ATYPICAL_CALLSITE = 0x0040, // Atypical callsite that cannot be disassembled by delay loading helper } // Bit-twiddling of contexts assumes word-alignment of method handles and type handles @@ -555,6 +556,7 @@ public enum CORINFO_ACCESS_FLAGS CORINFO_ACCESS_SET = 0x0200, // Field set (stfld) CORINFO_ACCESS_ADDRESS = 0x0400, // Field address (ldflda) CORINFO_ACCESS_INIT_ARRAY = 0x0800, // Field use for InitializeArray + CORINFO_ACCESS_ATYPICAL_CALLSITE = 0x4000, // Atypical callsite that cannot be disassembled by delay loading helper CORINFO_ACCESS_INLINECHECK = 0x8000, // Return fieldFlags and fieldAccessor only. Used by JIT64 during inlining. } @@ -746,6 +748,7 @@ public enum CorJitAllocMemFlag { CORJIT_ALLOCMEM_DEFAULT_CODE_ALIGN = 0x00000000, // The code will be use the normal alignment CORJIT_ALLOCMEM_FLG_16BYTE_ALIGN = 0x00000001, // The code will be 16-byte aligned + CORJIT_ALLOCMEM_FLG_RODATA_16BYTE_ALIGN = 0x00000002, // The read-only data will be 16-byte aligned } public enum CorJitFuncKind @@ -1087,6 +1090,9 @@ public unsafe struct CORINFO_FIELD_INFO }; + public struct SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR + { + }; // DEBUGGER DATQA public enum BoundaryTypes diff --git a/src/JitInterface/src/ThunkGenerator/ThunkInput.txt b/src/JitInterface/src/ThunkGenerator/ThunkInput.txt index 3ca583502f9..2afa2d7d700 100644 --- a/src/JitInterface/src/ThunkGenerator/ThunkInput.txt +++ b/src/JitInterface/src/ThunkGenerator/ThunkInput.txt @@ -137,6 +137,7 @@ CORINFO_CLASS_HANDLE*,ref CORINFO_CLASS_STRUCT_* CORINFO_ARG_LIST_HANDLE,CORINFO_ARG_LIST_STRUCT_* CORINFO_VARARGS_HANDLE,IntPtr CORINFO_CONTEXT_HANDLE,CORINFO_CONTEXT_STRUCT* +SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR*,SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* ICorDebugInfo::OffsetMapping*,OffsetMapping* ICorDebugInfo::ILVarInfo**,ILVarInfo** @@ -258,6 +259,7 @@ FUNCTIONS const char* getMethodName(CORINFO_METHOD_HANDLE ftn, const char **moduleName); unsigned getMethodHash(CORINFO_METHOD_HANDLE ftn); size_t findNameOfToken(CORINFO_MODULE_HANDLE moduleHandle,mdToken token, char * szFQName,size_t FQNameCapacity); + bool getSystemVAmd64PassStructInRegisterDescriptor(CORINFO_CLASS_HANDLE structHnd, SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr); int getIntConfigValue(const wchar_t *name, int defaultValue); wchar_t *getStringConfigValue(const wchar_t *name); void freeStringConfigValue(wchar_t *value); @@ -282,7 +284,7 @@ FUNCTIONS bool canGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig); CORINFO_JUST_MY_CODE_HANDLE getJustMyCodeHandle(CORINFO_METHOD_HANDLE method, CORINFO_JUST_MY_CODE_HANDLE**ppIndirection); void GetProfilingHandle(BOOL *pbHookFunction, void **pProfilerHandle, BOOL *pbIndirectedHandles); - void getCallInfo(CORINFO_RESOLVED_TOKEN * pResolvedToken, CORINFO_RESOLVED_TOKEN * pConstrainedResolvedToken, CORINFO_METHOD_HANDLE callerHandle, CORINFO_CALLINFO_FLAGS flags, CORINFO_CALL_INFO *pResult); + void getCallInfo(CORINFO_RESOLVED_TOKEN * pResolvedToken, CORINFO_RESOLVED_TOKEN_PTR pConstrainedResolvedToken, CORINFO_METHOD_HANDLE callerHandle, CORINFO_CALLINFO_FLAGS flags, CORINFO_CALL_INFO *pResult); BOOL canAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CLASS_HANDLE hInstanceType); BOOL isRIDClassDomainID(CORINFO_CLASS_HANDLE cls); unsigned getClassDomainID (CORINFO_CLASS_HANDLE cls, void **ppIndirection); diff --git a/src/JitInterface/src/ThunkGenerator/corinfo.h b/src/JitInterface/src/ThunkGenerator/corinfo.h index 9fdfd87afc8..e0004a59486 100644 --- a/src/JitInterface/src/ThunkGenerator/corinfo.h +++ b/src/JitInterface/src/ThunkGenerator/corinfo.h @@ -189,6 +189,57 @@ TODO: Talk about initializing strutures before use #include #include +// For System V on the CLR type system number of registers to pass in and return a struct is the same. +#define SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS 2 +#define SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_RETURN_IN_REGISTERS SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS +#define SYSTEMV_MAX_STRUCT_BYTES_TO_PASS_IN_REGISTERS 16 + +// System V struct passing +// The Classification types are described in the ABI spec at http://www.x86-64.org/documentation/abi.pdf +enum SystemVClassificationType : unsigned __int8 +{ + SystemVClassificationTypeUnknown = 0, + SystemVClassificationTypeStruct = 1, + SystemVClassificationTypeNoClass = 2, + SystemVClassificationTypeMemory = 3, + SystemVClassificationTypeInteger = 4, + SystemVClassificationTypeIntegerReference = 5, + SystemVClassificationTypeSSE = 6, + // SystemVClassificationTypeSSEUp = Unused, // Not supported by the CLR. + // SystemVClassificationTypeX87 = Unused, // Not supported by the CLR. + // SystemVClassificationTypeX87Up = Unused, // Not supported by the CLR. + // SystemVClassificationTypeComplexX87 = Unused, // Not supported by the CLR. + SystemVClassificationTypeMAX = 7, +}; + + +struct SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR +{ + SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR() + { + Initialize(); + } + + bool canPassInRegisters; + unsigned int eightByteCount; + SystemVClassificationType eightByteClassifications[SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS]; + unsigned int eightByteSizes[SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS]; + unsigned int eightByteOffsets[SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS]; + + // Members + void Initialize() + { + canPassInRegisters = false; + eightByteCount = 0; + + for (int i = 0; i < SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS; i++) + { + eightByteClassifications[i] = SystemVClassificationTypeUnknown; + eightByteSizes[i] = 0; + eightByteOffsets[i] = 0; + } + } +}; // CorInfoHelpFunc defines the set of helpers (accessed via the ICorDynamicInfo::getHelperFtn()) // These helpers can be called by native code which executes in the runtime. @@ -545,9 +596,16 @@ enum CorInfoHelpFunc CORINFO_HELP_LOOP_CLONE_CHOICE_ADDR, // Return the reference to a counter to decide to take cloned path in debug stress. CORINFO_HELP_DEBUG_LOG_LOOP_CLONING, // Print a message that a loop cloning optimization has occurred in debug mode. +#ifndef RYUJIT_CTPBUILD + CORINFO_HELP_THROW_ARGUMENTEXCEPTION, // throw ArgumentException + CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION, // throw ArgumentOutOfRangeException +#endif + CORINFO_HELP_COUNT, }; +#define CORINFO_HELP_READYTORUN_ATYPICAL_CALLSITE 0x40000000 + //This describes the signature for a helper method. enum CorInfoHelpSig { @@ -1057,6 +1115,7 @@ enum CORINFO_ACCESS_FLAGS CORINFO_ACCESS_SET = 0x0200, // Field set (stfld) CORINFO_ACCESS_ADDRESS = 0x0400, // Field address (ldflda) CORINFO_ACCESS_INIT_ARRAY = 0x0800, // Field use for InitializeArray + CORINFO_ACCESS_ATYPICAL_CALLSITE = 0x4000, // Atypical callsite that cannot be disassembled by delay loading helper CORINFO_ACCESS_INLINECHECK= 0x8000, // Return fieldFlags and fieldAccessor only. Used by JIT64 during inlining. }; @@ -1705,6 +1764,7 @@ enum CORINFO_CALLINFO_FLAGS CORINFO_CALLINFO_VERIFICATION = 0x0008, // Gets extra verification information. CORINFO_CALLINFO_SECURITYCHECKS = 0x0010, // Perform security checks. CORINFO_CALLINFO_LDFTN = 0x0020, // Resolving target of LDFTN + CORINFO_CALLINFO_ATYPICAL_CALLSITE = 0x0040, // Atypical callsite that cannot be disassembled by delay loading helper }; enum CorInfoIsAccessAllowedResult @@ -1969,7 +2029,12 @@ enum { LCL_FINALLY_MARK = 0xFC }; // FC = "Finally Call" #define CORINFO_PAGE_SIZE 0x1000 // the page size on the machine // @TODO: put this in the CORINFO_EE_INFO data structure + +#ifndef FEATURE_PAL #define MAX_UNCHECKED_OFFSET_FOR_NULL_OBJECT ((32*1024)-1) // when generating JIT code +#else // !FEATURE_PAL +#define MAX_UNCHECKED_OFFSET_FOR_NULL_OBJECT ((OS_PAGE_SIZE / 2) - 1) +#endif // !FEATURE_PAL typedef void* CORINFO_MethodPtr; // a generic method pointer @@ -1978,18 +2043,11 @@ struct CORINFO_Object CORINFO_MethodPtr *methTable; // the vtable for the object }; -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4200) // disable zero-sized array warning -#endif struct CORINFO_String : public CORINFO_Object { unsigned stringLen; - const wchar_t chars[0]; // actually of variable size + const wchar_t chars[1]; // actually of variable size }; -#ifdef _MSC_VER -#pragma warning(pop) -#endif struct CORINFO_Array : public CORINFO_Object { @@ -3332,6 +3390,12 @@ class ICorStaticInfo size_t FQNameCapacity /* IN */ ) = 0; + // returns whether the struct is enregisterable. Only valid on a System V VM. Returns true on success, false on failure. + virtual bool getSystemVAmd64PassStructInRegisterDescriptor( + /* IN */ CORINFO_CLASS_HANDLE structHnd, + /* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr + ) = 0; + #if !defined(RYUJIT_CTPBUILD) /*************************************************************************/ // @@ -3357,9 +3421,9 @@ class ICorStaticInfo // to return the string values to the runtime for deletion. // this avoid leaking the memory in the JIT. virtual void freeStringConfigValue( - wchar_t *value + __in_z wchar_t *value ) = 0; -#endif // RYUJIT_CTPBUILD +#endif // !RYUJIT_CTPBUILD }; /***************************************************************************** diff --git a/src/JitInterface/src/ThunkGenerator/corjit.h b/src/JitInterface/src/ThunkGenerator/corjit.h index fca22311dd6..a470d5bff8a 100644 --- a/src/JitInterface/src/ThunkGenerator/corjit.h +++ b/src/JitInterface/src/ThunkGenerator/corjit.h @@ -300,8 +300,14 @@ enum CorJitAllocMemFlag { CORJIT_ALLOCMEM_DEFAULT_CODE_ALIGN = 0x00000000, // The code will be use the normal alignment CORJIT_ALLOCMEM_FLG_16BYTE_ALIGN = 0x00000001, // The code will be 16-byte aligned + CORJIT_ALLOCMEM_FLG_RODATA_16BYTE_ALIGN = 0x00000002, // The read-only data will be 16-byte aligned }; +inline CorJitAllocMemFlag operator |(CorJitAllocMemFlag a, CorJitAllocMemFlag b) +{ + return static_cast(static_cast(a) | static_cast(b)); +} + enum CorJitFuncKind { CORJIT_FUNC_ROOT, // The main/root function (always id==0) @@ -356,12 +362,12 @@ extern "C" ICorJitCompiler* __stdcall getJit(); #if !defined(RYUJIT_CTPBUILD) // Update this one -SELECTANY const GUID JITEEVersionIdentifier = { /* 8e31af35-be80-4484-a91a-b096a08a49fe */ - 0x8e31af35, - 0xbe80, - 0x4484, - { 0xa9, 0x1a, 0xb0, 0x96, 0xa0, 0x8a, 0x49, 0xfe } - }; +SELECTANY const GUID JITEEVersionIdentifier = { /* f7be09f3-9ca7-42fd-b0ca-f97c0499f5a3 */ + 0xf7be09f3, + 0x9ca7, + 0x42fd, + {0xb0, 0xca, 0xf9, 0x7c, 0x04, 0x99, 0xf5, 0xa3} +}; #else // Leave this one alone