From: danmosemsft Date: Mon, 13 Feb 2017 04:25:22 +0000 (-0800) Subject: Remove commethodrental X-Git-Tag: submit/tizen/20210909.063632~11030^2~8090^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=680506a05f5303d09348a9e11ee1475553053f09;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Remove commethodrental Commit migrated from https://github.com/dotnet/coreclr/commit/54a687af2ab167060392ea95dd2f8fac643c6880 --- diff --git a/src/coreclr/src/vm/commethodrental.cpp b/src/coreclr/src/vm/commethodrental.cpp deleted file mode 100644 index 0a5c011..0000000 --- a/src/coreclr/src/vm/commethodrental.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -//////////////////////////////////////////////////////////////////////////////// - - - -#include "common.h" -#include "commethodrental.h" -#include "corerror.h" - -#ifdef FEATURE_METHOD_RENTAL -// SwapMethodBody -// This method will take the rgMethod as the new function body for a given method. -// - -void QCALLTYPE COMMethodRental::SwapMethodBody(EnregisteredTypeHandle cls, INT32 tkMethod, LPVOID rgMethod, INT32 iSize, INT32 flags, QCall::StackCrawlMarkHandle stackMark) -{ - QCALL_CONTRACT; - - BEGIN_QCALL; - - BYTE *pNewCode = NULL; - MethodDesc *pMethodDesc; - ReflectionModule *module; - ICeeGen* pGen; - ULONG methodRVA; - HRESULT hr; - - if ( cls == NULL) - { - COMPlusThrowArgumentNull(W("cls")); - } - - MethodTable *pMethodTable = TypeHandle::FromPtr(cls).GetMethodTable(); - PREFIX_ASSUME(pMethodTable != NULL); - module = (ReflectionModule *) pMethodTable->GetModule(); - pGen = module->GetCeeGen(); - - Assembly* caller = SystemDomain::GetCallersAssembly( stackMark ); - - _ASSERTE( caller != NULL && "Unable to get calling assembly" ); - _ASSERTE( module->GetCreatingAssembly() != NULL && "ReflectionModule must have a creating assembly to be used with method rental" ); - - if (module->GetCreatingAssembly() != caller) - { - COMPlusThrow(kSecurityException); - } - - // Find the methoddesc given the method token - pMethodDesc = MemberLoader::FindMethod(pMethodTable, tkMethod); - if (pMethodDesc == NULL) - { - COMPlusThrowArgumentException(W("methodtoken"), NULL); - } - if (pMethodDesc->GetMethodTable() != pMethodTable || pMethodDesc->GetNumGenericClassArgs() != 0 || pMethodDesc->GetNumGenericMethodArgs() != 0) - { - COMPlusThrowArgumentException(W("methodtoken"), W("Argument_TypeDoesNotContainMethod")); - } - hr = pGen->AllocateMethodBuffer(iSize, &pNewCode, &methodRVA); - if (FAILED(hr)) - COMPlusThrowHR(hr); - - if (pNewCode == NULL) - { - COMPlusThrowOM(); - } - - // - // if method desc is pointing to the post-jitted native code block, - // we want to recycle this code block - - // @todo: SEH handling. Will we need to support a method that can throw exception - // If not, add an assertion to make sure that there is no SEH contains in the method header. - - // @todo: figure out a way not to copy the code block. - - // @todo: add link time security check. This function can be executed only if fully trusted. - - // copy the new function body to the buffer - memcpy(pNewCode, (void *) rgMethod, iSize); - - // add the starting address of the il blob to the il blob hash table - // we need to find this information from out of process for debugger inspection - // APIs so we have to store this information where we can get it later - module->SetDynamicIL(mdToken(tkMethod), TADDR(pNewCode), FALSE); - - // Reset the methoddesc back to unjited state - pMethodDesc->Reset(); - - if (flags) - { - // JITImmediate -#if _DEBUG - COR_ILMETHOD* ilHeader = pMethodDesc->GetILHeader(TRUE); - _ASSERTE(((BYTE *)ilHeader) == pNewCode); -#endif - COR_ILMETHOD_DECODER header((COR_ILMETHOD *)pNewCode, pMethodDesc->GetMDImport(), NULL); - - // minimum validation on the correctness of method header - if (header.GetCode() == NULL) - COMPlusThrowHR(VLDTR_E_MD_BADHEADER); - -#ifdef FEATURE_INTERPRETER - pMethodDesc->MakeJitWorker(&header, CORJIT_FLAGS(CORJIT_FLAGS::CORJIT_FLAG_MAKEFINALCODE)); -#else // !FEATURE_INTERPRETER - pMethodDesc->MakeJitWorker(&header, CORJIT_FLAGS()); -#endif // !FEATURE_INTERPRETER - } - - // add feature:: - // If SQL is generating class with inheritance hierarchy, we may need to - // check the whole vtable to find duplicate entries. - - END_QCALL; - -} // COMMethodRental::SwapMethodBody - - -#endif // FEATURE_METHOD_RENTAL diff --git a/src/coreclr/src/vm/commethodrental.h b/src/coreclr/src/vm/commethodrental.h deleted file mode 100644 index 0523af2..0000000 --- a/src/coreclr/src/vm/commethodrental.h +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -//////////////////////////////////////////////////////////////////////////////// - - - -#ifndef _COMMETHODRENTAL_H_ -#define _COMMETHODRENTAL_H_ - -#include "excep.h" -#include "fcall.h" - -#ifdef FEATURE_METHOD_RENTAL -// COMMethodRental -// This class implements SwapMethodBody for our MethodRenting story -class COMMethodRental -{ -public: - - // COMMethodRental.SwapMethodBody -- this function will swap an existing method body with - // a new method body - // - static - void QCALLTYPE SwapMethodBody(EnregisteredTypeHandle cls, INT32 tkMethod, LPVOID rgMethod, INT32 iSize, INT32 flags, QCall::StackCrawlMarkHandle stackMark); -}; -#endif // FEATURE_METHOD_RENTAL - -#endif //_COMMETHODRENTAL_H_ diff --git a/src/coreclr/src/vm/mscorlib.cpp b/src/coreclr/src/vm/mscorlib.cpp index 5d8531e..608cacd 100644 --- a/src/coreclr/src/vm/mscorlib.cpp +++ b/src/coreclr/src/vm/mscorlib.cpp @@ -31,7 +31,8 @@ #include "comdelegate.h" #include "customattribute.h" #include "comdynamic.h" -#include "commethodrental.h" +#include "excep.h" +#include "fcall.h" #include "nlsinfo.h" #include "calendardata.h" #include "commodule.h"