Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Sollich <petersol@microsoft.com>2016-08-18 15:16:50 +0300
committerPeter Sollich <petersol@microsoft.com>2016-08-18 15:16:50 +0300
commita49d09a954e2766847bd62bd7ac5423d4e5199a8 (patch)
tree0bd028ceae2d0b493be6bd5ae172fe914e5bc979 /src/Native/Runtime/MiscHelpers.cpp
parent9538bb9c3b588d8272c5a353afa805c55c731ba9 (diff)
Here are the changes to remove generic instance descs from the binder and the runtime.
Overview - here's what generic instance descs were used for and how this functionality is provided now: - They were needed to support generic unification. For the release scenario, this is no longer necessary because global analysis places generics. For the F5 scenario, we will again have generic unification, but it will be done differently and is not in this code review yet. - They were used for GC reporting of statics on generic types. Statics on statically built generic types are now merged into the static GC desc of their containing module. Statics on dynamic types are reported via two new lists on the RuntimeInstance class, one for regular GC statics, the other one for thread statics. - They were also used to hold statics information for dynamically loaded types. This information is now attached to the EEType instead. - Similarly, generic instance descs held information about the open generic type, the instantiation parameter, and the parameter variance information. This information is now also attached to the EEType. Detail notes: - EEType.Constants.cs, EEType.cs, eetype.h, eetype.inl: Provide for attaching generic and static information to eetypes. The latter is only used for dynamic types. - MiscHelpers.cpp, module.cpp, module.h, RuntimeInstance.cpp/.h: Remove GenericInstanceDesc logic, provide equivalent functionality. - rhbinder.h, ZapHeaders.cpp: Bump version number, remove GenericInstanceDesc related fields from module header. - EETypeCreator.cs: logic to set rareFlags appropriately for attached statics. - TypeLoaderEnvironment.StaticsLookup.cs: the logic turned out to be wrong for the TLS index - the binder encoded always zero for the index, which cannot work at runtime. So I changed the binder (see comment below), and I also changed the runtime logic to apply an indirection. For consistency, I did the same for the thread static offset - this isn't necessary now but may become necessary for the F5 scenario. - common.h: Add separateCompilation flag to g_BindOptions as prep work for F5 scenario. - CompactLayoutReader.cpp: for release scenario, merge generic statics and their GC descs early rather than relying on generic instance descs. - MethodTable.h, MakePdb.cpp, MdilModule.cpp/.h: attach "InstantiatedTypeZapNodes" data structure to method table rather than finding it via a hash table lookup. This is just a cleanup change. - MdilModule.cpp/.h: Remove generic instance desc logic, add logic to generate the "GenericComposition" data structure instead, attach that and the generic definition to eetypes, add a rare flag for eetypes with sealed virtuals, add indirection cells where we used to indirect through generic instance descs, remove unused "GetReadonlyBlobNode" method, change encoding of native layout info for thread statics (see comments above for TypeLoaderEnvironment.StaticsLookup.cs). - ZapImage.cpp/.h: remove generic instance desc sections. - various copies of rhbind.exe and rhbindui.dll: these are used to build mrt100_app.dll. The change updates rhbind.exe to put the new version number into the module header of mrt100_app.dll. [tfs-changeset: 1622930]
Diffstat (limited to 'src/Native/Runtime/MiscHelpers.cpp')
-rw-r--r--src/Native/Runtime/MiscHelpers.cpp25
1 files changed, 6 insertions, 19 deletions
diff --git a/src/Native/Runtime/MiscHelpers.cpp b/src/Native/Runtime/MiscHelpers.cpp
index c0225ac18..d8d7aac55 100644
--- a/src/Native/Runtime/MiscHelpers.cpp
+++ b/src/Native/Runtime/MiscHelpers.cpp
@@ -33,7 +33,6 @@
#include "module.h"
#include "eetype.h"
#include "ObjectLayout.h"
-#include "GenericInstance.h"
#include "slist.inl"
#include "eetype.inl"
#include "CommonMacros.inl"
@@ -253,32 +252,20 @@ COOP_PINVOKE_HELPER(UInt8 *, RhGetThreadStaticFieldAddress, (EEType * pEEType, T
// for each dynamically created type with thread statics. The TLS storage size allocated for each type
// is the size of all the thread statics on that type. We use the field offset to get the thread static
// data for that field on the current thread.
- GenericInstanceDesc * pGID = pRuntimeInstance->LookupGenericInstance(pEEType);
- ASSERT(pGID != NULL);
- UInt8* pTlsStorage = ThreadStore::GetCurrentThread()->GetThreadLocalStorageForDynamicType(pGID->GetThreadStaticFieldStartOffset());
+ UInt8* pTlsStorage = ThreadStore::GetCurrentThread()->GetThreadLocalStorageForDynamicType(pEEType->get_DynamicThreadStaticOffset());
ASSERT(pTlsStorage != NULL);
return (pFieldCookie != NULL ? pTlsStorage + pFieldCookie->FieldOffset : pTlsStorage);
}
- else if (!pRuntimeInstance->IsInStandaloneExeMode() && pEEType->IsGeneric())
- {
- // The tricky case is a thread static field on a generic type when we're not in standalone mode. In that
- // case we need to lookup the GenericInstanceDesc for the type to locate its TLS static base
- // offset (which unlike the case below has already been fixed up to account for COFF mode linking). The
- // cookie then contains an offset from that base.
- GenericInstanceDesc * pGID = pRuntimeInstance->LookupGenericInstance(pEEType);
- uiFieldOffset = pGID->GetThreadStaticFieldStartOffset() + pFieldCookie->FieldOffset;
-
- // The TLS index in the GenericInstanceDesc will always be 0 (unless we perform GID unification, which
- // we don't today), so we'll need to get the TLS index from the header of the type's containing module.
- Module * pModule = pRuntimeInstance->FindModuleByReadOnlyDataAddress(pEEType);
- ASSERT(pModule != NULL);
- uiTlsIndex = *pModule->GetModuleHeader()->PointerToTlsIndex;
- }
else
{
// In all other cases the field cookie contains an offset from the base of all Redhawk thread statics
// to the field. The TLS index and offset adjustment (in cases where the module was linked with native
// code using .tls) is that from the exe module.
+
+ // In the separate compilation case, the generic unification logic should assure
+ // that the pEEType parameter passed in is indeed the "winner" of generic unification,
+ // not one of the "losers".
+ // TODO: come up with an assert to check this.
Module * pModule = pRuntimeInstance->FindModuleByReadOnlyDataAddress(pEEType);
if (pModule == NULL)
pModule = pRuntimeInstance->FindModuleByDataAddress(pEEType);