Age | Commit message (Collapse) | Author | Files | Lines |
|
* Use ReadOnlySpan.ToArray in places
* Use List.ToArray
* Don't take .Length in to local and use as loop condition
|
|
* Cleanup Array FCalls
* Disable outdated CoreFX tests
https://github.com/dotnet/corefx/pull/34700
|
|
* Use pattern matching `is` rather than `as` with null check
|
|
|
|
- Delete internal "Unsafe" field getters/setters. They performance was very close (within 10%) of the regular getters/setters.
- Made a few performance tweaks in reflection to make reflection faster overall. The regular field getters/setters are faster than what the unsafe ones used to be with this change.
|
|
(#21756)
The former calls GetLowerBound(0) on both src and dst, which is unnecessary when the arrays are T[] and thus always have a lower bound of 0.
|
|
|
|
* Move MdUtf8String::EqualsCaseSensitive to managed code
* Move MdUtf8String.ToString to safe code
* Use Encoding.UTF8.GetString
|
|
Fix lots of malformed XML comments
|
|
These are causing errors in the source.dot.net build. Turning on DocumentationFile and suppressing 1591, 1573, and 0419, Corelib builds clean after these changes.
|
|
|
|
|
|
|
|
inherited path (#20779)
* Optimization: avoid 2 array allocations in inherited attribute misses
This is a follow-up to many allocations recognized in #20448.
A lot of methods ultimately call through CustomAttributes.GetCustomAttributes(). In the inherited search path (default for most searches above), the inheritance path of a class is traversed, resulting in an array allocation per crawled type, a copy to the overall List<object> and then after that - in current code - an array allocation from that list and a typed array allocation it's copied to.
However, in the common miss case as simple as:
typeof(T).GetCustomAttributes(typeof(TAttr), true);
...and many other overloads, all the same path underneath...
We can avoid the last 2 arrays in the miss case. We have the List<object> to go off of. If that's a zero-entry list, we can return an Array.Empty<TAttr>(). That's effectively what this change does.
While converting the entire attribute pipeline to generics is problematic and has issue since some object[] return abstracts aren't sealed, we can at least somewhat trivially cache an array per attribute type (only one static, ultimately from Array.Empty<T> underneath) and return that for the miss case.
There are far more wins to be had here, but they require more changes.
* Move RuntimeType empty array cache generation to Attribute.CreateAttributeArrayHelper
This exposes Attribute.CreateAttributeArrayHelper to internal and uses it directly on the RuntimeType caching for empty arrays. Though this allocated 1 additional array overall, it's simpler, faster to init, and still is an infinite win over the per-call allocations before this overall changesets.
* CustomAttributes: remove needless array copy in the inherited hit case
This removes a .ToArray() for the sake of Array.Copy() where a simple for loop suffices and removes the allocation. Reversing the "empty" result checks is also just a bit cleaner here.
This also expands the same fix to the MemberInfo path.
Note: should DRY these up too (longstanding issue) - but let's do that in a separate commit for clarity.
* GetCusomAttributes: use ListBuilder<object> for inheritance crawls
This exposes RuntimeType.ListBuilder<T> for internal usage and replaces the List<T> allocation in GetCustomAttributes() paths to reduce allocations and increase performance in the inherited crawl paths (which is the default for many optional-parameter methods in layers above).
Note: there is a subtle behavior depending on previous-null (not possible with a struct now) in AttributeUsageCheck() that I believe still behaves correctly, but could use another set of eyes and a full test suite run to confirm. object[] attributes was removed there simply because it wasn't used before - only cleaning up.
* Attribute caching: use Array.CreateInstance() directly on RuntimeType
This also reverts the CreateAttributeArrayHelper => internal change, since it's no longer needed.
* Ref passing for RuntimeType.ListBuilder<object> & CustomAttribute simplification
This fixes the struct passing duplication and tweaks how we're creating arrays a bit, centralizing the zero-element checks to cover all cases as well as simplify the per-method code to rely on the fact this is happening underneath.
|
|
* Delete internal Array.UnsafeCreateInstance method
* Delete binary serialization specific type name formatting
* Use ValueStringBuilder to format method names in reflection
|
|
(#20491)
|
|
Support for IDispatch
|
|
The jit needs to recover class handles in order to devirtualize and
do other type-based optimizations. This change allows the jit to find
the type for more trees: in particular, helper calls, intrinsics, and
expanded static field accesses.
Also, annotate a few methods to control jit optimization
We don't want to optimize special methods that are used to inform crossgen
about desirable generic instantiations. `CommonlyUsedGenericInstantiations`
was already annotated but `CommonlyUsedWinRTRedirectedInterfaceStubs` wasn't.
And because `RuntimeType` is sealed calls through types are now often
devirtualized. Name lookups on types are frequent, especially on error paths.
The method `GetCachedName` looks like an attractive inline but simply expands
into a larger sequence of two other calls. So block it from being inlined.
|
|
Reduce some TypeInfo API cruft
Throw exception on non-Windows ABIs for value types
|
|
|
|
(#19427)
- Sealed Runtime makes `is RuntimeType` and similar checks faster. These checks are fairly common in reflection.
- Delete support for introspection only loads from the runtime. We do not plan to use in .NET Core. The support for introspection loads inherited from RuntimeType and thus it is incompatible with sealed RuntimeType.
|
|
* Don't early terminate on null for 64bit NR HashCode
* Improved GetNonRandomizedHashCode
* Update message on GetNonRandomizedHashCode
* Consume null terminator rather than special case odd lengths
|
|
|
|
* Fix IDE0034 C# expression can be simplified (use of default)
* Remove unnecessary using statements
* IDE0012 C# Name can be simplified. String -> string
* IDE0041 C# Null check can be simplified
* Fix code formatting (limited to Span/System.Memory files).
* Address PR feedback - IDE0012 Name can be simplified (String -> string)
* Add back the necessary using statements and fix typo
* Fix comment typo and add necessary using statements
|
|
* diff from just renaming folder mscorlib to System.Private.CoreLib
* Updating build.proj to reflect name change
Fixes: #17905
|