mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-09 17:44:48 +09:00
Remove canAccessFamily
This commit is contained in:
parent
0f1e936ec9
commit
8dd7374cd3
18 changed files with 34 additions and 359 deletions
|
@ -3123,9 +3123,6 @@ public:
|
|||
CORINFO_CALL_INFO *pResult
|
||||
) = 0;
|
||||
|
||||
virtual bool canAccessFamily(CORINFO_METHOD_HANDLE hCaller,
|
||||
CORINFO_CLASS_HANDLE hInstanceType) = 0;
|
||||
|
||||
// Returns TRUE if the Class Domain ID is the RID of the class (currently true for every class
|
||||
// except reflection emitted classes and generics)
|
||||
virtual bool isRIDClassDomainID(CORINFO_CLASS_HANDLE cls) = 0;
|
||||
|
|
|
@ -584,10 +584,6 @@ void getCallInfo(
|
|||
CORINFO_CALLINFO_FLAGS flags,
|
||||
CORINFO_CALL_INFO* pResult) override;
|
||||
|
||||
bool canAccessFamily(
|
||||
CORINFO_METHOD_HANDLE hCaller,
|
||||
CORINFO_CLASS_HANDLE hInstanceType) override;
|
||||
|
||||
bool isRIDClassDomainID(
|
||||
CORINFO_CLASS_HANDLE cls) override;
|
||||
|
||||
|
|
|
@ -145,7 +145,6 @@ DEF_CLR_API(canGetCookieForPInvokeCalliSig)
|
|||
DEF_CLR_API(getJustMyCodeHandle)
|
||||
DEF_CLR_API(GetProfilingHandle)
|
||||
DEF_CLR_API(getCallInfo)
|
||||
DEF_CLR_API(canAccessFamily)
|
||||
DEF_CLR_API(isRIDClassDomainID)
|
||||
DEF_CLR_API(getClassDomainID)
|
||||
DEF_CLR_API(getStaticFieldContent)
|
||||
|
|
|
@ -1388,16 +1388,6 @@ void WrapICorJitInfo::getCallInfo(
|
|||
API_LEAVE(getCallInfo);
|
||||
}
|
||||
|
||||
bool WrapICorJitInfo::canAccessFamily(
|
||||
CORINFO_METHOD_HANDLE hCaller,
|
||||
CORINFO_CLASS_HANDLE hInstanceType)
|
||||
{
|
||||
API_ENTER(canAccessFamily);
|
||||
bool temp = wrapHnd->canAccessFamily(hCaller, hInstanceType);
|
||||
API_LEAVE(canAccessFamily);
|
||||
return temp;
|
||||
}
|
||||
|
||||
bool WrapICorJitInfo::isRIDClassDomainID(
|
||||
CORINFO_CLASS_HANDLE cls)
|
||||
{
|
||||
|
|
|
@ -3307,8 +3307,6 @@ namespace Internal.JitInterface
|
|||
return constLookup;
|
||||
}
|
||||
|
||||
private bool canAccessFamily(CORINFO_METHOD_STRUCT_* hCaller, CORINFO_CLASS_STRUCT_* hInstanceType)
|
||||
{ throw new NotImplementedException("canAccessFamily"); }
|
||||
private bool isRIDClassDomainID(CORINFO_CLASS_STRUCT_* cls)
|
||||
{ throw new NotImplementedException("isRIDClassDomainID"); }
|
||||
private uint getClassDomainID(CORINFO_CLASS_STRUCT_* cls, ref void* ppIndirection)
|
||||
|
|
|
@ -2094,21 +2094,6 @@ namespace Internal.JitInterface
|
|||
}
|
||||
}
|
||||
|
||||
[UnmanagedCallersOnly]
|
||||
private static byte _canAccessFamily(IntPtr thisHandle, IntPtr* ppException, CORINFO_METHOD_STRUCT_* hCaller, CORINFO_CLASS_STRUCT_* hInstanceType)
|
||||
{
|
||||
var _this = GetThis(thisHandle);
|
||||
try
|
||||
{
|
||||
return _this.canAccessFamily(hCaller, hInstanceType) ? (byte)1 : (byte)0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
*ppException = _this.AllocException(ex);
|
||||
return default;
|
||||
}
|
||||
}
|
||||
|
||||
[UnmanagedCallersOnly]
|
||||
private static byte _isRIDClassDomainID(IntPtr thisHandle, IntPtr* ppException, CORINFO_CLASS_STRUCT_* cls)
|
||||
{
|
||||
|
@ -2582,7 +2567,7 @@ namespace Internal.JitInterface
|
|||
|
||||
private static IntPtr GetUnmanagedCallbacks()
|
||||
{
|
||||
void** callbacks = (void**)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 174);
|
||||
void** callbacks = (void**)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 173);
|
||||
|
||||
callbacks[0] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, byte>)&_isIntrinsic;
|
||||
callbacks[1] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, uint>)&_getMethodAttribs;
|
||||
|
@ -2725,39 +2710,38 @@ namespace Internal.JitInterface
|
|||
callbacks[138] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, CORINFO_JUST_MY_CODE_HANDLE_**, CORINFO_JUST_MY_CODE_HANDLE_*>)&_getJustMyCodeHandle;
|
||||
callbacks[139] = (delegate* unmanaged<IntPtr, IntPtr*, bool*, void**, bool*, void>)&_GetProfilingHandle;
|
||||
callbacks[140] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, CORINFO_RESOLVED_TOKEN*, CORINFO_METHOD_STRUCT_*, CORINFO_CALLINFO_FLAGS, CORINFO_CALL_INFO*, void>)&_getCallInfo;
|
||||
callbacks[141] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, CORINFO_CLASS_STRUCT_*, byte>)&_canAccessFamily;
|
||||
callbacks[142] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte>)&_isRIDClassDomainID;
|
||||
callbacks[143] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, void**, uint>)&_getClassDomainID;
|
||||
callbacks[144] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_FIELD_STRUCT_*, byte*, int, int, byte, byte>)&_getStaticFieldContent;
|
||||
callbacks[145] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_OBJECT_STRUCT_*, byte*, int, int, byte>)&_getObjectContent;
|
||||
callbacks[146] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_FIELD_STRUCT_*, byte*, CORINFO_CLASS_STRUCT_*>)&_getStaticFieldCurrentClass;
|
||||
callbacks[147] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_SIG_INFO*, void**, IntPtr>)&_getVarArgsHandle;
|
||||
callbacks[148] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_SIG_INFO*, byte>)&_canGetVarArgsHandle;
|
||||
callbacks[149] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_MODULE_STRUCT_*, mdToken, void**, InfoAccessType>)&_constructStringLiteral;
|
||||
callbacks[150] = (delegate* unmanaged<IntPtr, IntPtr*, void**, InfoAccessType>)&_emptyStringLiteral;
|
||||
callbacks[151] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_FIELD_STRUCT_*, void**, uint>)&_getFieldThreadLocalStoreID;
|
||||
callbacks[152] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, CORINFO_CLASS_STRUCT_*, CORINFO_METHOD_STRUCT_*, DelegateCtorArgs*, CORINFO_METHOD_STRUCT_*>)&_GetDelegateCtor;
|
||||
callbacks[153] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, void>)&_MethodCompileComplete;
|
||||
callbacks[154] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, CORINFO_SIG_INFO*, CORINFO_GET_TAILCALL_HELPERS_FLAGS, CORINFO_TAILCALL_HELPERS*, byte>)&_getTailCallHelpers;
|
||||
callbacks[155] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, byte, byte>)&_convertPInvokeCalliToCall;
|
||||
callbacks[156] = (delegate* unmanaged<IntPtr, IntPtr*, InstructionSet, byte, byte>)&_notifyInstructionSetUsage;
|
||||
callbacks[157] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CONST_LOOKUP*, void>)&_updateEntryPointForTailCall;
|
||||
callbacks[158] = (delegate* unmanaged<IntPtr, IntPtr*, AllocMemArgs*, void>)&_allocMem;
|
||||
callbacks[159] = (delegate* unmanaged<IntPtr, IntPtr*, byte, byte, uint, void>)&_reserveUnwindInfo;
|
||||
callbacks[160] = (delegate* unmanaged<IntPtr, IntPtr*, byte*, byte*, uint, uint, uint, byte*, CorJitFuncKind, void>)&_allocUnwindInfo;
|
||||
callbacks[161] = (delegate* unmanaged<IntPtr, IntPtr*, UIntPtr, void*>)&_allocGCInfo;
|
||||
callbacks[162] = (delegate* unmanaged<IntPtr, IntPtr*, uint, void>)&_setEHcount;
|
||||
callbacks[163] = (delegate* unmanaged<IntPtr, IntPtr*, uint, CORINFO_EH_CLAUSE*, void>)&_setEHinfo;
|
||||
callbacks[164] = (delegate* unmanaged<IntPtr, IntPtr*, uint, byte*, IntPtr, byte>)&_logMsg;
|
||||
callbacks[165] = (delegate* unmanaged<IntPtr, IntPtr*, byte*, int, byte*, int>)&_doAssert;
|
||||
callbacks[166] = (delegate* unmanaged<IntPtr, IntPtr*, CorJitResult, void>)&_reportFatalError;
|
||||
callbacks[167] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, PgoInstrumentationSchema**, uint*, byte**, PgoSource*, HRESULT>)&_getPgoInstrumentationResults;
|
||||
callbacks[168] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, PgoInstrumentationSchema*, uint, byte**, HRESULT>)&_allocPgoInstrumentationBySchema;
|
||||
callbacks[169] = (delegate* unmanaged<IntPtr, IntPtr*, uint, CORINFO_SIG_INFO*, CORINFO_METHOD_STRUCT_*, void>)&_recordCallSite;
|
||||
callbacks[170] = (delegate* unmanaged<IntPtr, IntPtr*, void*, void*, void*, ushort, ushort, int, void>)&_recordRelocation;
|
||||
callbacks[171] = (delegate* unmanaged<IntPtr, IntPtr*, void*, ushort>)&_getRelocTypeHint;
|
||||
callbacks[172] = (delegate* unmanaged<IntPtr, IntPtr*, uint>)&_getExpectedTargetArchitecture;
|
||||
callbacks[173] = (delegate* unmanaged<IntPtr, IntPtr*, CORJIT_FLAGS*, uint, uint>)&_getJitFlags;
|
||||
callbacks[141] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte>)&_isRIDClassDomainID;
|
||||
callbacks[142] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, void**, uint>)&_getClassDomainID;
|
||||
callbacks[143] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_FIELD_STRUCT_*, byte*, int, int, byte, byte>)&_getStaticFieldContent;
|
||||
callbacks[144] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_OBJECT_STRUCT_*, byte*, int, int, byte>)&_getObjectContent;
|
||||
callbacks[145] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_FIELD_STRUCT_*, byte*, CORINFO_CLASS_STRUCT_*>)&_getStaticFieldCurrentClass;
|
||||
callbacks[146] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_SIG_INFO*, void**, IntPtr>)&_getVarArgsHandle;
|
||||
callbacks[147] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_SIG_INFO*, byte>)&_canGetVarArgsHandle;
|
||||
callbacks[148] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_MODULE_STRUCT_*, mdToken, void**, InfoAccessType>)&_constructStringLiteral;
|
||||
callbacks[149] = (delegate* unmanaged<IntPtr, IntPtr*, void**, InfoAccessType>)&_emptyStringLiteral;
|
||||
callbacks[150] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_FIELD_STRUCT_*, void**, uint>)&_getFieldThreadLocalStoreID;
|
||||
callbacks[151] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, CORINFO_CLASS_STRUCT_*, CORINFO_METHOD_STRUCT_*, DelegateCtorArgs*, CORINFO_METHOD_STRUCT_*>)&_GetDelegateCtor;
|
||||
callbacks[152] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, void>)&_MethodCompileComplete;
|
||||
callbacks[153] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, CORINFO_SIG_INFO*, CORINFO_GET_TAILCALL_HELPERS_FLAGS, CORINFO_TAILCALL_HELPERS*, byte>)&_getTailCallHelpers;
|
||||
callbacks[154] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, byte, byte>)&_convertPInvokeCalliToCall;
|
||||
callbacks[155] = (delegate* unmanaged<IntPtr, IntPtr*, InstructionSet, byte, byte>)&_notifyInstructionSetUsage;
|
||||
callbacks[156] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CONST_LOOKUP*, void>)&_updateEntryPointForTailCall;
|
||||
callbacks[157] = (delegate* unmanaged<IntPtr, IntPtr*, AllocMemArgs*, void>)&_allocMem;
|
||||
callbacks[158] = (delegate* unmanaged<IntPtr, IntPtr*, byte, byte, uint, void>)&_reserveUnwindInfo;
|
||||
callbacks[159] = (delegate* unmanaged<IntPtr, IntPtr*, byte*, byte*, uint, uint, uint, byte*, CorJitFuncKind, void>)&_allocUnwindInfo;
|
||||
callbacks[160] = (delegate* unmanaged<IntPtr, IntPtr*, UIntPtr, void*>)&_allocGCInfo;
|
||||
callbacks[161] = (delegate* unmanaged<IntPtr, IntPtr*, uint, void>)&_setEHcount;
|
||||
callbacks[162] = (delegate* unmanaged<IntPtr, IntPtr*, uint, CORINFO_EH_CLAUSE*, void>)&_setEHinfo;
|
||||
callbacks[163] = (delegate* unmanaged<IntPtr, IntPtr*, uint, byte*, IntPtr, byte>)&_logMsg;
|
||||
callbacks[164] = (delegate* unmanaged<IntPtr, IntPtr*, byte*, int, byte*, int>)&_doAssert;
|
||||
callbacks[165] = (delegate* unmanaged<IntPtr, IntPtr*, CorJitResult, void>)&_reportFatalError;
|
||||
callbacks[166] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, PgoInstrumentationSchema**, uint*, byte**, PgoSource*, HRESULT>)&_getPgoInstrumentationResults;
|
||||
callbacks[167] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, PgoInstrumentationSchema*, uint, byte**, HRESULT>)&_allocPgoInstrumentationBySchema;
|
||||
callbacks[168] = (delegate* unmanaged<IntPtr, IntPtr*, uint, CORINFO_SIG_INFO*, CORINFO_METHOD_STRUCT_*, void>)&_recordCallSite;
|
||||
callbacks[169] = (delegate* unmanaged<IntPtr, IntPtr*, void*, void*, void*, ushort, ushort, int, void>)&_recordRelocation;
|
||||
callbacks[170] = (delegate* unmanaged<IntPtr, IntPtr*, void*, ushort>)&_getRelocTypeHint;
|
||||
callbacks[171] = (delegate* unmanaged<IntPtr, IntPtr*, uint>)&_getExpectedTargetArchitecture;
|
||||
callbacks[172] = (delegate* unmanaged<IntPtr, IntPtr*, CORJIT_FLAGS*, uint, uint>)&_getJitFlags;
|
||||
|
||||
return (IntPtr)callbacks;
|
||||
}
|
||||
|
|
|
@ -300,7 +300,6 @@ FUNCTIONS
|
|||
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_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);
|
||||
bool getStaticFieldContent(CORINFO_FIELD_HANDLE field, uint8_t *buffer, int bufferSize, int valueOffset, bool ignoreMovableObjects);
|
||||
|
|
|
@ -152,7 +152,6 @@ struct JitInterfaceCallbacks
|
|||
CORINFO_JUST_MY_CODE_HANDLE (* getJustMyCodeHandle)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE method, CORINFO_JUST_MY_CODE_HANDLE** ppIndirection);
|
||||
void (* GetProfilingHandle)(void * thisHandle, CorInfoExceptionClass** ppException, bool* pbHookFunction, void** pProfilerHandle, bool* pbIndirectedHandles);
|
||||
void (* getCallInfo)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken, CORINFO_METHOD_HANDLE callerHandle, CORINFO_CALLINFO_FLAGS flags, CORINFO_CALL_INFO* pResult);
|
||||
bool (* canAccessFamily)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE hCaller, CORINFO_CLASS_HANDLE hInstanceType);
|
||||
bool (* isRIDClassDomainID)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_CLASS_HANDLE cls);
|
||||
unsigned (* getClassDomainID)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_CLASS_HANDLE cls, void** ppIndirection);
|
||||
bool (* getStaticFieldContent)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_FIELD_HANDLE field, uint8_t* buffer, int bufferSize, int valueOffset, bool ignoreMovableObjects);
|
||||
|
@ -1564,16 +1563,6 @@ public:
|
|||
if (pException != nullptr) throw pException;
|
||||
}
|
||||
|
||||
virtual bool canAccessFamily(
|
||||
CORINFO_METHOD_HANDLE hCaller,
|
||||
CORINFO_CLASS_HANDLE hInstanceType)
|
||||
{
|
||||
CorInfoExceptionClass* pException = nullptr;
|
||||
bool temp = _callbacks->canAccessFamily(_thisHandle, &pException, hCaller, hInstanceType);
|
||||
if (pException != nullptr) throw pException;
|
||||
return temp;
|
||||
}
|
||||
|
||||
virtual bool isRIDClassDomainID(
|
||||
CORINFO_CLASS_HANDLE cls)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,6 @@ LWM(AllocPgoInstrumentationBySchema, DWORDLONG, Agnostic_AllocPgoInstrumentation
|
|||
LWM(GetPgoInstrumentationResults, DWORDLONG, Agnostic_GetPgoInstrumentationResults)
|
||||
LWM(AsCorInfoType, DWORDLONG, DWORD)
|
||||
LWM(CanAccessClass, Agnostic_CanAccessClassIn, Agnostic_CanAccessClassOut)
|
||||
LWM(CanAccessFamily, DLDL, DWORD)
|
||||
LWM(CanCast, DLDL, DWORD)
|
||||
LWM(CanGetCookieForPInvokeCalliSig, CanGetCookieForPInvokeCalliSigValue, DWORD)
|
||||
LWM(CanGetVarArgsHandle, CanGetVarArgsHandleValue, DWORD)
|
||||
|
|
|
@ -5897,37 +5897,6 @@ bool MethodContext::repCanGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSi
|
|||
return value != 0;
|
||||
}
|
||||
|
||||
void MethodContext::recCanAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CLASS_HANDLE hInstanceType, bool result)
|
||||
{
|
||||
if (CanAccessFamily == nullptr)
|
||||
CanAccessFamily = new LightWeightMap<DLDL, DWORD>();
|
||||
|
||||
DLDL key;
|
||||
ZeroMemory(&key, sizeof(key)); // Zero key including any struct padding
|
||||
key.A = CastHandle(hCaller);
|
||||
key.B = CastHandle(hInstanceType);
|
||||
|
||||
DWORD value = result ? 1 : 0;
|
||||
CanAccessFamily->Add(key, value);
|
||||
DEBUG_REC(dmpCanAccessFamily(key, value));
|
||||
}
|
||||
void MethodContext::dmpCanAccessFamily(DLDL key, DWORD value)
|
||||
{
|
||||
printf("CanAccessFamily key cal-%016" PRIX64 " inst-%016" PRIX64 ", value %u", key.A, key.B, value);
|
||||
}
|
||||
bool MethodContext::repCanAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CLASS_HANDLE hInstanceType)
|
||||
{
|
||||
DLDL key;
|
||||
ZeroMemory(&key, sizeof(key)); // Zero key including any struct padding
|
||||
key.A = CastHandle(hCaller);
|
||||
key.B = CastHandle(hInstanceType);
|
||||
|
||||
DWORD value = LookupByKeyOrMissNoMessage(CanAccessFamily, key);
|
||||
|
||||
DEBUG_REP(dmpCanAccessFamily(key, value));
|
||||
return value != 0;
|
||||
}
|
||||
|
||||
void MethodContext::recErrorList(const char* error)
|
||||
{
|
||||
if (ErrorList == nullptr)
|
||||
|
|
|
@ -722,10 +722,6 @@ public:
|
|||
void dmpCanGetCookieForPInvokeCalliSig(const CanGetCookieForPInvokeCalliSigValue& key, DWORD value);
|
||||
bool repCanGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig);
|
||||
|
||||
void recCanAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CLASS_HANDLE hInstanceType, bool result);
|
||||
void dmpCanAccessFamily(DLDL key, DWORD value);
|
||||
bool repCanAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CLASS_HANDLE hInstanceType);
|
||||
|
||||
void recErrorList(const char* error);
|
||||
void dmpErrorList(DWORD key, DWORD value);
|
||||
|
||||
|
@ -940,7 +936,7 @@ enum mcPackets
|
|||
//Packet_AreTypesEquivalent = 1,
|
||||
Packet_AsCorInfoType = 2,
|
||||
Packet_CanAccessClass = 3,
|
||||
Packet_CanAccessFamily = 4,
|
||||
//Packet_CanAccessFamily = 4,
|
||||
Packet_CanCast = 5,
|
||||
Packet_PrintMethodName = 6,
|
||||
Packet_CanGetCookieForPInvokeCalliSig = 7,
|
||||
|
|
|
@ -1604,14 +1604,6 @@ void interceptor_ICJI::getCallInfo(
|
|||
});
|
||||
}
|
||||
|
||||
bool interceptor_ICJI::canAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CLASS_HANDLE hInstanceType)
|
||||
{
|
||||
mc->cr->AddCall("canAccessFamily");
|
||||
bool temp = original_ICorJitInfo->canAccessFamily(hCaller, hInstanceType);
|
||||
mc->recCanAccessFamily(hCaller, hInstanceType, temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
// Returns TRUE if the Class Domain ID is the RID of the class (currently true for every class
|
||||
// except reflection emitted classes and generics)
|
||||
bool interceptor_ICJI::isRIDClassDomainID(CORINFO_CLASS_HANDLE cls)
|
||||
|
|
|
@ -1139,14 +1139,6 @@ void interceptor_ICJI::getCallInfo(
|
|||
original_ICorJitInfo->getCallInfo(pResolvedToken, pConstrainedResolvedToken, callerHandle, flags, pResult);
|
||||
}
|
||||
|
||||
bool interceptor_ICJI::canAccessFamily(
|
||||
CORINFO_METHOD_HANDLE hCaller,
|
||||
CORINFO_CLASS_HANDLE hInstanceType)
|
||||
{
|
||||
mcs->AddCall("canAccessFamily");
|
||||
return original_ICorJitInfo->canAccessFamily(hCaller, hInstanceType);
|
||||
}
|
||||
|
||||
bool interceptor_ICJI::isRIDClassDomainID(
|
||||
CORINFO_CLASS_HANDLE cls)
|
||||
{
|
||||
|
|
|
@ -998,13 +998,6 @@ void interceptor_ICJI::getCallInfo(
|
|||
original_ICorJitInfo->getCallInfo(pResolvedToken, pConstrainedResolvedToken, callerHandle, flags, pResult);
|
||||
}
|
||||
|
||||
bool interceptor_ICJI::canAccessFamily(
|
||||
CORINFO_METHOD_HANDLE hCaller,
|
||||
CORINFO_CLASS_HANDLE hInstanceType)
|
||||
{
|
||||
return original_ICorJitInfo->canAccessFamily(hCaller, hInstanceType);
|
||||
}
|
||||
|
||||
bool interceptor_ICJI::isRIDClassDomainID(
|
||||
CORINFO_CLASS_HANDLE cls)
|
||||
{
|
||||
|
|
|
@ -1385,12 +1385,6 @@ void MyICJI::getCallInfo(
|
|||
ThrowException(exceptionCode);
|
||||
}
|
||||
|
||||
bool MyICJI::canAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CLASS_HANDLE hInstanceType)
|
||||
|
||||
{
|
||||
jitInstance->mc->cr->AddCall("canAccessFamily");
|
||||
return jitInstance->mc->repCanAccessFamily(hCaller, hInstanceType);
|
||||
}
|
||||
// Returns TRUE if the Class Domain ID is the RID of the class (currently true for every class
|
||||
// except reflection emitted classes and generics)
|
||||
bool MyICJI::isRIDClassDomainID(CORINFO_CLASS_HANDLE cls)
|
||||
|
|
|
@ -4971,168 +4971,6 @@ BOOL ClassLoader::CanAccessFamily(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
//If instance is an inner class, this also succeeds if the outer class conforms to 8.5.3.2. A nested class
|
||||
//is enclosed inside of the enclosing class' open type. So we need to ignore generic variables. That also
|
||||
//helps us with:
|
||||
/*
|
||||
class Base {
|
||||
protected int m_family;
|
||||
}
|
||||
class Derived<T> : Base {
|
||||
class Inner {
|
||||
public int function(Derived<T> d) {
|
||||
return d.m_family;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//Since the inner T is not the same T as the enclosing T (since accessing generic variables is a CLS rule,
|
||||
//not a CLI rule), we see that as a comparison between Derived<T> and Derived<T'>. CanCastTo rejects that.
|
||||
//Instead we just check against the typedef of the two types. This ignores all generic parameters (formal
|
||||
//or not).
|
||||
|
||||
BOOL CanAccessFamilyVerificationEnclosingHelper(MethodTable * pMTCurrentEnclosingClass,
|
||||
TypeHandle thInstanceClass)
|
||||
{
|
||||
CONTRACTL
|
||||
{
|
||||
THROWS;
|
||||
GC_TRIGGERS;
|
||||
MODE_ANY;
|
||||
}
|
||||
CONTRACTL_END
|
||||
|
||||
_ASSERTE(pMTCurrentEnclosingClass);
|
||||
|
||||
if (thInstanceClass.IsGenericVariable())
|
||||
{
|
||||
//In this case it is a TypeVarTypeDesc (i.e. T). If this access would be legal due to a
|
||||
//constraint:
|
||||
//
|
||||
/*
|
||||
public class My<T>
|
||||
{
|
||||
public class Inner<U> where U : My<T>
|
||||
{
|
||||
public int foo(U u)
|
||||
{
|
||||
return u.field;
|
||||
}
|
||||
}
|
||||
protected int field;
|
||||
}
|
||||
*/
|
||||
//We need to find the generic class constraint. (The above is legal because U must be a My<T> which makes this
|
||||
//legal by 8.5.3.2)
|
||||
// There may only be 1 class constraint on a generic parameter
|
||||
|
||||
// Get the constraints on this generic variable
|
||||
// At most 1 of them is a class constraint.
|
||||
// That class constraint methodtable can go through the normal search for matching typedef logic below
|
||||
TypeVarTypeDesc *tyvar = thInstanceClass.AsGenericVariable();
|
||||
DWORD numConstraints;
|
||||
TypeHandle *constraints = tyvar->GetConstraints(&numConstraints, CLASS_DEPENDENCIES_LOADED);
|
||||
if (constraints == NULL)
|
||||
{
|
||||
// If we did not find a class constraint, we cannot generate a methodtable to search for
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (DWORD i = 0; i < numConstraints; i++)
|
||||
{
|
||||
if (!constraints[i].IsInterface())
|
||||
{
|
||||
// We have found the class constraint on this TypeVarTypeDesc
|
||||
// Recurse on the found class constraint. It is possible that this constraint may also be a TypeVarTypeDesc
|
||||
//class Outer4<T>
|
||||
//{
|
||||
// protected int field;
|
||||
//
|
||||
// public class Inner<U,V> where V:U where U : Outer4<T>
|
||||
// {
|
||||
// public int Method(V param) { return (++param.field); }
|
||||
// }
|
||||
//}
|
||||
return CanAccessFamilyVerificationEnclosingHelper(pMTCurrentEnclosingClass, constraints[i]);
|
||||
}
|
||||
}
|
||||
// If we did not find a class constraint, we cannot generate a methodtable to search for
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
do
|
||||
{
|
||||
MethodTable * pAccessor = pMTCurrentEnclosingClass;
|
||||
//If thInstanceClass is a MethodTable, we should only be doing the TypeDef comparison (see
|
||||
//above).
|
||||
if (!thInstanceClass.IsTypeDesc())
|
||||
{
|
||||
MethodTable *pInstanceMT = thInstanceClass.AsMethodTable();
|
||||
|
||||
// This is a CanCastTo implementation for classes, assuming we should ignore generic instantiation parameters.
|
||||
do
|
||||
{
|
||||
if (pAccessor->HasSameTypeDefAs(pInstanceMT))
|
||||
return TRUE;
|
||||
pInstanceMT = pInstanceMT->GetParentMethodTable();
|
||||
}while(pInstanceMT);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Leave this logic in place for now, as I'm not fully confident it can't happen, and we are very close to RTM
|
||||
// This logic was originally written to handle TypeVarTypeDescs, but those are now handled above.
|
||||
_ASSERTE(FALSE);
|
||||
if (thInstanceClass.CanCastTo(TypeHandle(pAccessor)))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
pMTCurrentEnclosingClass = GetEnclosingMethodTable(pMTCurrentEnclosingClass);
|
||||
}while(pMTCurrentEnclosingClass);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
//This checks the verification only part of the rule above.
|
||||
//From the example above:
|
||||
// GrandChild::function2(Child * o) {
|
||||
// o->protectedField; //This access is illegal.
|
||||
// }
|
||||
// pCurrentClass is GrandChild and pTargetClass is Child. This check is completely unnecessary for statics,
|
||||
// but by legacy convention you can use GrandChild for pTargetClass in that case.
|
||||
|
||||
BOOL ClassLoader::CanAccessFamilyVerification(TypeHandle thCurrentClass,
|
||||
TypeHandle thInstanceClass)
|
||||
{
|
||||
CONTRACTL
|
||||
{
|
||||
THROWS;
|
||||
GC_TRIGGERS;
|
||||
INJECT_FAULT(COMPlusThrowOM(););
|
||||
MODE_ANY;
|
||||
PRECONDITION(!thCurrentClass.IsNull());
|
||||
PRECONDITION(!thCurrentClass.IsTypeDesc());
|
||||
}
|
||||
CONTRACTL_END
|
||||
|
||||
//Check to see if Instance is equal to or derived from pCurrentClass.
|
||||
//
|
||||
//In some cases the type we have for the instance type is actually a TypeVarTypeDesc. In those cases we
|
||||
//need to check against the constraints (You're accessing a member through a 'T' with a type constraint
|
||||
//that makes this legal). For those cases, CanCastTo does what I want.
|
||||
MethodTable * pAccessor = thCurrentClass.GetMethodTable();
|
||||
if (thInstanceClass.CanCastTo(TypeHandle(pAccessor)))
|
||||
return TRUE;
|
||||
|
||||
//TypeDescs don't have methods so only run this on MethodTables.
|
||||
if (!thInstanceClass.IsNull())
|
||||
{
|
||||
return CanAccessFamilyVerificationEnclosingHelper(pAccessor, thInstanceClass);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif // #ifndef DACCESS_COMPILE
|
||||
|
||||
#ifdef DACCESS_COMPILE
|
||||
|
|
|
@ -847,10 +847,6 @@ public:
|
|||
FieldDesc* pOptionalTargetField,
|
||||
const AccessCheckOptions & accessCheckOptions = *AccessCheckOptions::s_pNormalAccessChecks);
|
||||
|
||||
static BOOL CanAccessFamilyVerification(
|
||||
TypeHandle thCurrentClass,
|
||||
TypeHandle thInstanceClass);
|
||||
|
||||
private:
|
||||
// Access check helpers
|
||||
static BOOL CanAccessMethodInstantiation(
|
||||
|
|
|
@ -5573,52 +5573,6 @@ void CEEInfo::getCallInfo(
|
|||
EE_TO_JIT_TRANSITION();
|
||||
}
|
||||
|
||||
bool CEEInfo::canAccessFamily(CORINFO_METHOD_HANDLE hCaller,
|
||||
CORINFO_CLASS_HANDLE hInstanceType)
|
||||
{
|
||||
WRAPPER_NO_CONTRACT;
|
||||
|
||||
bool ret = false;
|
||||
|
||||
//Since this is only for verification, I don't need to do the demand.
|
||||
JIT_TO_EE_TRANSITION();
|
||||
|
||||
TypeHandle targetType = TypeHandle(hInstanceType);
|
||||
TypeHandle accessingType = TypeHandle(GetMethod(hCaller)->GetMethodTable());
|
||||
AccessCheckOptions::AccessCheckType accessCheckOptions = AccessCheckOptions::kNormalAccessibilityChecks;
|
||||
DynamicResolver* pIgnored;
|
||||
BOOL doCheck = TRUE;
|
||||
if (GetMethod(hCaller)->IsDynamicMethod())
|
||||
{
|
||||
//If this is a DynamicMethod, perform the check from the type to which the DynamicMethod was
|
||||
//attached.
|
||||
//
|
||||
//If this is a dynamic method, don't do this check. If they specified SkipVisibilityChecks
|
||||
//(ModifyCheckForDynamicMethod returned false), we should obviously skip the check for the C++
|
||||
//protected rule (since we skipped all the other visibility checks). If they specified
|
||||
//RestrictedSkipVisibilityChecks, then they're a "free" DynamicMethod. This check is meaningless
|
||||
//(i.e. it would always fail). We've already done a demand for access to the member. Let that be
|
||||
//enough.
|
||||
doCheck = ModifyCheckForDynamicMethod(GetMethod(hCaller)->AsDynamicMethodDesc()->GetResolver(),
|
||||
&accessingType, &accessCheckOptions, &pIgnored);
|
||||
if (accessCheckOptions == AccessCheckOptions::kRestrictedMemberAccess
|
||||
|| accessCheckOptions == AccessCheckOptions::kRestrictedMemberAccessNoTransparency
|
||||
)
|
||||
doCheck = FALSE;
|
||||
}
|
||||
|
||||
if (doCheck)
|
||||
{
|
||||
ret = !!ClassLoader::CanAccessFamilyVerification(accessingType, targetType);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = true;
|
||||
}
|
||||
|
||||
EE_TO_JIT_TRANSITION();
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool CEEInfo::isRIDClassDomainID(CORINFO_CLASS_HANDLE cls)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue