Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

Merge nmirror to master - #1671

Merged
jkotas merged 8 commits into
masterfrom
nmirror
Aug 18, 2016
Merged

jkotas merged 8 commits into
masterfrom
nmirror

Conversation

@jkotas

@jkotas jkotas commented Aug 18, 2016

Copy link
Copy Markdown
Member

No description provided.

Atsushi Kanamori and others added 8 commits August 17, 2016 10:27
If RuntimeCustomAttributeData.ToString() intercepted
a MissingMetadataException, it fell back to Object.ToString()
(via "base.ToString()").

Unfortunately, the incoming CustomAttributeData class
overrides Object.ToString() with a non-pay-for-play-safe
version of RuntimeCustomAttributeData.ToString().
(Perhaps in Project N, we'll choose to have to
thunk up to R.Core to run the pay-for-play-safe version
instead.)

Either way we decide, that would be a counterproductive
fallback, to say the least.

So rather than trusting "base", we'll directly implement
what we already know Object.ToString() does: namely,
GetType().ToString().
Another preparatory change for Reflection restoration.
….GetCustomerAttribute<>

The Reflection Invoke logic gets tripped by the existence of enum parameters with default values in the method. NUTC generates reflection templates using the enum type , but Reflection searches for templates using the underlying type of the enum (in that case, type of int). These 2 parts of the system end up not agreeing with each other on the correct type of the parameter, and the Reflection Invoke operation ends up failing and not finding a template because of that.

[tfs-changeset: 1622806]
…r 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]
…tr as key, and make it more difficult for such problems to appear in our runtime again

- Make IntPtr and UIntPtr IEquatable<IntPtr>. This allows the EqualityComparer<T> to do the right thing for regular usage of Dictionary<TKey, TValue>
- Constrain TKey in LowLevelDictionary<TKey, TValue> over IEquatable<TKey>
  - This allows the use of IEquatable in a performant manner. (In particular, it already had logic to use IEquatable, but since it didn't have a constraint, that use itself would cause two boxes.
  - Ensure's we don't accidentally have this problem again with some other random structure type and LowLevelDictionary<>
- As a follow-on to the LowLevelDictionary<TKey, TValue> change to make TKey constrained
  - Make GenericMethodDescriptorInfo IEquatable, and move the custom comparer logic into the structure directly.
  - Same with OpenMethodResolver
  - Make RuntimeTypeHandle IEquatable, and remove pre-existing EqualityComparer implementation from the type loader
  - Make TypeDesc IEquatable
  - Make CallConversionInfo IEquatable
  - Make IAsyncLocal IEquatable
  - Unfortunately, TimeZoneInfo takes advantage of the custom comparer logic that I removed as part of this change. As a result, maintaining the custom comparer changes requires making a custom structure wrapper for string that performs the correct form of case insensitive comparison.

[tfs-changeset: 1623030]
@jkotas
jkotas merged commit e22417d into master Aug 18, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants