From f49eb0db686c4d647dd9e27b44946c5505bb72f4 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Mon, 3 Jun 2019 19:38:02 -0700 Subject: Fix signature mismatch between managed and unmanaged GetCodeInfo signatures (#24932) Fixes #24925 --- .../src/System/Reflection/Emit/DynamicILGenerator.cs | 4 ++-- src/System.Private.CoreLib/src/System/RuntimeHandles.cs | 4 ++-- src/vm/dynamicmethod.cpp | 17 +---------------- src/vm/dynamicmethod.h | 2 -- 4 files changed, 5 insertions(+), 22 deletions(-) diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicILGenerator.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicILGenerator.cs index 9c4e5ca41a..07085d2279 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicILGenerator.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicILGenerator.cs @@ -673,7 +673,7 @@ namespace System.Reflection.Emit CanSkipCSEvaluation = 0x8, } - internal override RuntimeType? GetJitContext(ref int securityControlFlags) + internal override RuntimeType? GetJitContext(out int securityControlFlags) { RuntimeType? typeOwner; @@ -703,7 +703,7 @@ namespace System.Reflection.Emit } internal override byte[] GetCodeInfo( - ref int stackSize, ref int initLocals, ref int EHCount) + out int stackSize, out int initLocals, out int EHCount) { stackSize = m_stackSize; if (m_exceptionHeader != null && m_exceptionHeader.Length != 0) diff --git a/src/System.Private.CoreLib/src/System/RuntimeHandles.cs b/src/System.Private.CoreLib/src/System/RuntimeHandles.cs index ae170d00ff..6555a5a14d 100644 --- a/src/System.Private.CoreLib/src/System/RuntimeHandles.cs +++ b/src/System.Private.CoreLib/src/System/RuntimeHandles.cs @@ -1545,8 +1545,8 @@ namespace System } // ILHeader info - internal abstract RuntimeType GetJitContext(ref int securityControlFlags); - internal abstract byte[] GetCodeInfo(ref int stackSize, ref int initLocals, ref int EHCount); + internal abstract RuntimeType GetJitContext(out int securityControlFlags); + internal abstract byte[] GetCodeInfo(out int stackSize, out int initLocals, out int EHCount); internal abstract byte[] GetLocalsSignature(); internal abstract unsafe void GetEHInfo(int EHNumber, void* exception); internal abstract byte[] GetRawEHInfo(); diff --git a/src/vm/dynamicmethod.cpp b/src/vm/dynamicmethod.cpp index 611a9852d6..afea2a9bd3 100644 --- a/src/vm/dynamicmethod.cpp +++ b/src/vm/dynamicmethod.cpp @@ -1044,20 +1044,6 @@ void LCGMethodResolver::GetJitContext(SecurityControlFlags * securityControlFlag } CONTRACTL_END; GCX_COOP(); - GetJitContextCoop(securityControlFlags, typeOwner); -} - -void LCGMethodResolver::GetJitContextCoop(SecurityControlFlags * securityControlFlags, - TypeHandle *typeOwner) -{ - CONTRACTL { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM();); - PRECONDITION(CheckPointer(securityControlFlags)); - PRECONDITION(CheckPointer(typeOwner)); - } CONTRACTL_END; MethodDescCallSite getJitContext(METHOD__RESOLVER__GET_JIT_CONTEXT, m_managedResolver); @@ -1098,8 +1084,7 @@ BYTE* LCGMethodResolver::GetCodeInfo(unsigned *pCodeSize, unsigned *pStackSize, OBJECTREF resolver = ObjectFromHandle(m_managedResolver); VALIDATEOBJECTREF(resolver); // gc root must be up the stack - DWORD initLocals = 0, EHSize = 0; - unsigned short stackSize = 0; + int32_t stackSize = 0, initLocals = 0, EHSize = 0; ARG_SLOT args[] = { ObjToArgSlot(resolver), diff --git a/src/vm/dynamicmethod.h b/src/vm/dynamicmethod.h index b676c22d54..a1c1d8ee61 100644 --- a/src/vm/dynamicmethod.h +++ b/src/vm/dynamicmethod.h @@ -115,8 +115,6 @@ public: void FreeCompileTimeState(); void GetJitContext(SecurityControlFlags * securityControlFlags, TypeHandle * typeOwner); - void GetJitContextCoop(SecurityControlFlags * securityControlFlags, - TypeHandle * typeOwner); ChunkAllocator* GetJitMetaHeap(); BYTE* GetCodeInfo(unsigned *pCodeSize, unsigned *pStackSize, CorInfoOptions *pOptions, unsigned* pEHSize); -- cgit v1.2.3