public static unsafe ThunksHeap?CreateThunksHeap(IntPtr commonStubAddress) { try { ThunksHeap newHeap = new ThunksHeap(commonStubAddress); if (newHeap._nextAvailableThunkPtr != IntPtr.Zero) { return(newHeap); } } catch (Exception) { } return(null); }
internal static unsafe IntPtr GetCastableObjectDispatchCellThunk(EEType *pInstanceType, IntPtr pDispatchCell) { IntPtr pTargetCode = CacheLookup(s_ThunkBasedDispatchCellTargets, pDispatchCell); if (pTargetCode != default(IntPtr)) { return(pTargetCode); } InternalCalls.RhpAcquireCastCacheLock(); { // Look in the cache again after taking the lock pTargetCode = CacheLookup(s_ThunkBasedDispatchCellTargets, pDispatchCell); if (pTargetCode != default(IntPtr)) { return(pTargetCode); } // Allocate a new thunk. Failure to allocate one will result in a fail-fast. We don't return nulls from this API. if (s_thunksHeap == null) { s_thunksHeap = ThunksHeap.CreateThunksHeap(InternalCalls.RhpGetCastableObjectDispatch_CommonStub()); if (s_thunksHeap == null) { EH.FallbackFailFast(RhFailFastReason.InternalError, null); } } pTargetCode = s_thunksHeap.AllocateThunk(); if (pTargetCode == IntPtr.Zero) { EH.FallbackFailFast(RhFailFastReason.InternalError, null); } s_thunksHeap.SetThunkData(pTargetCode, pDispatchCell, InternalCalls.RhpGetCastableObjectDispatchHelper_TailCalled()); AddToThunkCache(pDispatchCell, pTargetCode); } InternalCalls.RhpReleaseCastCacheLock(); return(pTargetCode); }
public static object RhCreateThunksHeap(IntPtr commonStubAddress) { return(ThunksHeap.CreateThunksHeap(commonStubAddress)); }
public static unsafe ThunksHeap CreateThunksHeap(IntPtr commonStubAddress) { try { ThunksHeap newHeap = new ThunksHeap(commonStubAddress); if (newHeap._nextAvailableThunkPtr != IntPtr.Zero) return newHeap; } catch { } return null; }