diff options
author | dotnet-bot <dotnet-bot@microsoft.com> | 2015-10-01 00:47:24 +0300 |
---|---|---|
committer | Scott Mosier <smosier@microsoft.com> | 2015-10-01 00:47:24 +0300 |
commit | ad0323ab91a7b1469b42ca5457ddd631b94294fe (patch) | |
tree | 88fae57e1ec3aae90288463dc07e58f7aebc1de8 /src/Native/Runtime/CachedInterfaceDispatch.h | |
parent | 6763d16387778f126ec510c0421783952602f8f7 (diff) |
Initial population of CoreRT Runtime files.
Diffstat (limited to 'src/Native/Runtime/CachedInterfaceDispatch.h')
-rw-r--r-- | src/Native/Runtime/CachedInterfaceDispatch.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/Native/Runtime/CachedInterfaceDispatch.h b/src/Native/Runtime/CachedInterfaceDispatch.h new file mode 100644 index 000000000..596c0d705 --- /dev/null +++ b/src/Native/Runtime/CachedInterfaceDispatch.h @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// +// ==--== +// +// Shared (non-architecture specific) portions of a mechanism to perform interface dispatch using an alternate +// mechanism to VSD that does not require runtime generation of code. +// +// ============================================================================ + +#ifdef FEATURE_CACHED_INTERFACE_DISPATCH + +bool InitializeInterfaceDispatch(); +void ReclaimUnusedInterfaceDispatchCaches(); + +// Interface dispatch caches contain an array of these entries. An instance of a cache is paired with a stub +// that implicitly knows how many entries are contained. These entries must be aligned to twice the alignment +// of a pointer due to the synchonization mechanism used to update them at runtime. +struct InterfaceDispatchCacheEntry +{ + EEType * m_pInstanceType; // Potential type of the object instance being dispatched on + void * m_pTargetCode; // Method to dispatch to if the actual instance type matches the above +}; + +// The interface dispatch cache itself. As well as the entries we include the cache size (since logic such as +// cache miss processing needs to determine this value in a synchronized manner, so it can't be contained in +// the owning interface dispatch indirection cell) and a list entry used to link the caches in one of a couple +// of lists related to cache reclamation. +#pragma warning(push) +#pragma warning(disable:4200) // nonstandard extension used: zero-sized array in struct/union +struct InterfaceDispatchCell; +struct InterfaceDispatchCache +{ + InterfaceDispatchCacheHeader m_cacheHeader; + union + { + InterfaceDispatchCache * m_pNextFree; // next in free list +#ifndef _AMD64_ + InterfaceDispatchCell * m_pCell; // pointer back to interface dispatch cell - not used for AMD64 +#endif + }; + UInt32 m_cEntries; + InterfaceDispatchCacheEntry m_rgEntries[]; +}; +#pragma warning(pop) + +#endif // FEATURE_CACHED_INTERFACE_DISPATCH |