summaryrefslogtreecommitdiff
path: root/src/System.Private.CoreLib/src/System/RtType.cs
AgeCommit message (Collapse)AuthorFilesLines
2019-01-20Use List<T>.ToArray() in places (#22101)Ben Adams1-15/+8
* Use ReadOnlySpan.ToArray in places * Use List.ToArray * Don't take .Length in to local and use as loop condition
2019-01-20Cleanup array related FCalls (#22097)Jan Kotas1-10/+2
* Cleanup Array FCalls * Disable outdated CoreFX tests https://github.com/dotnet/corefx/pull/34700
2019-01-05(C#7) Use pattern matching `is` rather than `as` with null check (#21828)Ben Adams1-3/+1
* Use pattern matching `is` rather than `as` with null check
2019-01-05Remove redundant unsafe contexts (#21826)Ben Adams1-17/+17
2019-01-03Reflection performance tweaks & cleanup (#21737)Jan Kotas1-17/+33
- 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.
2019-01-02Replace Array.Copy(src, dst, int) calls with Array.Copy(src, 0, dst, 0, int) ↵Stephen Toub1-1/+1
(#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.
2019-01-01strlen to managed code and vectorize (#21729)Ben Adams1-2/+4
2018-12-31Improve MdUtf8String (#21720)Ben Adams1-57/+16
* Move MdUtf8String::EqualsCaseSensitive to managed code * Move MdUtf8String.ToString to safe code * Use Encoding.UTF8.GetString
2018-12-04Merge pull request #21356 from stephentoub/xmlcommentsStephen Toub1-1/+1
Fix lots of malformed XML comments
2018-12-04Fix lots of malformed XML commentsStephen Toub1-1/+1
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.
2018-12-01Rename CorElementType enum members to match the others definitions (#21324)Jan Kotas1-14/+14
2018-11-19Cleanup RtType.cs codeHugh Bellamy1-549/+285
2018-11-19Fix Type.GetInterface for null namespace and non-null interface namespaceHugh Bellamy1-1/+1
2018-11-04Optimization: Reduce many array allocations in GetCustomAtttributes()'s ↵Nick Craver1-1/+12
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.
2018-11-03Cleanup and improve name formatting in reflection (#20781)Jan Kotas1-43/+18
* Delete internal Array.UnsafeCreateInstance method * Delete binary serialization specific type name formatting * Use ValueStringBuilder to format method names in reflection
2018-10-29Unhelpful error when Activator.CreateInstance can't find default constructor ↵Andrew Au1-2/+7
(#20491)
2018-10-23Merge pull request #20497 from AaronRobinsonMSFT/additional_com_testsAaron Robinson1-6/+193
Support for IDispatch
2018-10-23JIT: recover types from helper calls and more (#20447)Andy Ayers1-0/+4
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.
2018-10-23Add support for IDispatch in CoreCLRAaron Robinson1-6/+193
Reduce some TypeInfo API cruft Throw exception on non-Windows ABIs for value types
2018-08-20Mark more structs as readonly (#19557)Ben Adams1-7/+7
2018-08-11Make RuntimeType sealed and deleted support for introspection only loads ↵Jan Kotas1-32/+3
(#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.
2018-08-10Don't early terminate on null for 64bit NR HashCode (#19331)Ben Adams1-1/+1
* 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
2018-06-24Simply type names in Corelib (#18623)Stephen Toub1-45/+45
2018-05-21Code cleanup and formatting for System.Memory files. (#17451)Ahson Khan1-45/+45
* 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
2018-05-08Rename mscorlib to System.Private.Corelib (#17926)Maryam Ariyan1-0/+5186
* diff from just renaming folder mscorlib to System.Private.CoreLib * Updating build.proj to reflect name change Fixes: #17905