Commit Graph
643 Commits
Author SHA1 Message Date
Viktor Hofer 20e8f905d0 Don't use Targets* helper properties in libs (#64500)
* Don't use Targets* helper properties in libs projs

This change makes it possible to migrate 200+ (ref+src) projects to use
TargetFramework instead of TargetFrameworks which avoids the additional
outer build evaluation and invocation which ultimately makes the overall
build faster.

Targets* properties (i.e. TargetsWindows, TargetsAnyOS, TargetsUnix,
etc.) rely on the TargetFramework property which usually are set
inside a project. The TargetFramework property is only
available before a project specifies it if it's explicitly set in a props
file or if the project is cross-targeting and the outer-build dispatches
into the inner-build. During the dispatch, the TargetFramework property
is passed in as a global property.

Until now that behavior wasn't a problem because every libraries project
cross-targeted (by setting the TargetFrameworks property) even though
many only include a single TargetFramework (i.e. NetCoreAppCurrent).

To allow projects to use the TargetFramework property instead of
TargetFrameworks, the Targets* helper properties can't be calculated
anymore early in a props file as the TargetFramework property isn't set
at that time.

In general, the guidance by the SDK/msbuild team is to not read from the
TargetFramework property before the project sets it
(in a property group). That effectively means that the TargetFramework
property shouldn't be used in props files at all.

Therefore these helper properties can't be used anymore for property
conditions and I'm replacing their usage with TargetPlatformIdentifier
comparisons for both properties and items.
In nearly all cases, the Targets* helper properties can be replaced with
TargetPlatformIdentifier checks on items and in the few cases where
TargetsUnix or TargetsLinux marks multiple tfms as compatible, the exact
tfms must be used instead for the TargetPlatformIdentifier comparison.

Whenever a project needs to condition properties on the platform, I'm
first setting the TargetPlatformIdentifier the same way the SDK sets it
so that the SDK later doesn't need to set it again to avoid the
additional expensive msbuild function call.

* Use TargetFramework singular to avoid outer builds

Use TargetFramework instead of TargetFrameworks property whenever a
projects only targets a single target framework. This avoid unnecessary
outer builds and evaluations and makes the build faster.
2022-02-12 13:07:16 +01:00
Stephen Toub 3ae87395f6 Initial roll out of !! (#64720)
* Bump version of C# compiler

This should be reverted when arcade brings in a new enough compiler.

* Fix a few new warnings from updating compiler

* Enable IDE0190 to employ parameter null checking

* Initial roll out of !!

* Fix more compiler warnings from upgrade, plus some test fixes / reverts

* Fix a few more tests

* Disable profiling test
2022-02-08 16:06:59 -05:00
Viktor Hofer 64f3bae738 Consume renamed TargetFramework package (#64670)
* Consume renamed TargetFramework package

* Rename CoreLibs generator parent dir

Projects under src/libraries/ which are located under a "gen" directory
are automatically treated as source generator projects. Because the
CoreLib generator was placed under a different directory "generators",
it was treated as a RuntimeAssembly which gets binplaced into the
runtime path. The runtime tests then take the assemblies from there and
copy them into their CORE_ROOT directory.

Renaming the CoreLib source generators parent directory fixes that so
that it is treated as source generator and it brings consistency into
src/libraries.
2022-02-03 15:32:50 +01:00
Adam Sitnik 2074477643 Remove some of the unused resource strings (#64379) 2022-01-27 19:21:12 +01:00
Egor Bogatov 442a42147e Faster IndexOf for substrings (#63285)
* Improve "lastChar == firstChar" case, also, use IndexOf directly if value.Length == 1

* Try plain IndexOf first, to optimize cases where even first char of value is never met

* add 1-byte implementation

* copyrights

* fix copy-paste mistake

* Initial LastIndexOf impl

* More efficient LastIndexOf

* fix bug in Char version (we need two clear two lowest bits in the mask) & temporarily remove AdvSimd impl

* use ResetLowestSetBit

* Fix bug

* Add two-byte LastIndexOf

* Fix build

* Minor optimizations

* optimize cases with two-byte/two-char values

* Remove gotos, fix build

* fix bug in LastIndexOf

* Make sure String.LastIndexOf is optimized

* Use xplat simd helpers - implicit ARM support

* fix arm

* Delete \

* Use Vector128.IsHardwareAccelerated

* Fix build

* Use IsAllZero

* Address feedback

* Address feedback

* micro-optimization, do-while is better here since mask is guaranteed to be non-zero

* Address feedabc

* Use clever trick I borrowed from IndexOfAny for trailing elements

* give up on +1 bump for SequenceCompare

* Clean up

* Clean up

* fix build

* Add debug asserts

* Clean up: give up on the unrolled trick - too little value from code bloat

* Add a test

* Fix build

* Add byte-specific test

* Fix build

* Update IndexOfSequence.byte.cs
2022-01-25 13:54:35 -05:00
Eric StJohn 1d751ba856 Update XUnit to 2.4.2-pre.22 (#63948)
* Update to Xunit build 2.4.2-pre.13

Also pick up latest pre-release of analyzers

* Disambiguate calls to Assert.Equals(double,double,int)

Xunit added a new Assert overload that caused a lot of ambiguous calls.
https://github.com/xunit/xunit/issues/2393

Workaround by casting to double.

* Fix new instances of xUnit2000 diagnostic

* Workaround xUnit2002 issue with implicit cast

Works around https://github.com/xunit/xunit/issues/2395

* Disable xUnit2014 diagnostic

This diagnostic forces the use of Assert.ThrowsAsync for any async method,
however in our case we may want to test that a method will throw
synchronously to avoid regressing that behavior by moving to the async
portion of the method.

* Use AssertExtensions to test for null ArgumentException.ParamName

Workaround https://github.com/xunit/xunit/issues/2396

* Update to Xunit 2.4.2-pre.22

* Fix another ArugmentException.ParamName == null assert
2022-01-20 10:35:50 -08:00
Marek Safar 6de7147b92 Enable IDE0059 analyzer: Unnecessary assignment of a value (#63340) 2022-01-12 18:10:45 +01:00
3745e3829e Vectorize SpanHelpers<T>.IndexOf (#60974)
Co-authored-by: Günther Foidl <[email protected]>
Co-authored-by: Dan Moseley <[email protected]>
2021-11-22 19:21:26 +01:00
Viktor Hofer 0964be0ae9 Update slngen and solution files (#60871)
Update slngen tooling to latest stable version and solution files since
a lot changed since the last time they were updated:
- NET7 (removal of older TFMs)
- Source Generators
2021-10-26 21:23:54 +02:00
Aaron Robinson 53e8c7c3b6 Reflection Invoke share more coreclr/mono (#60270)
* Remove ActiveIssues from some mono tests.

* Convert INVOCATION_FLAGS enum to repo style casing.

* Rename various files to match partial class style.
2021-10-16 09:18:44 -07:00
LateApexEarlySpeedandJeff Handley 6890b50863 lateapexearlyspeed-issue-30778 Create method: TryReadExact(). (#57921)
* lateapexearlyspeed-issue-30778 Create method: TryReadExact().

* issue-30778 Add test for SequenceReader.TryReadExact().

* issue-30778 Fix comment: format return xml doc.

Co-authored-by: Jeff Handley <[email protected]>

Co-authored-by: Jeff Handley <[email protected]>
2021-10-12 22:53:11 -07:00
Egor Bogatov 025c84dd00 Fix genCodeForInitBlkUnroll for x86 (#59873) 2021-10-04 22:19:25 +03:00
Krzysztof Wicher 8f12df6f3f disable System.SpanTests.SpanTests.FillNativeBytes (#59563) 2021-09-24 11:03:37 -04:00
Andrii Kurdiumov 5588f94924 Remove usused rd.xml files (#59201)
Closes #51112
2021-09-16 16:53:54 -06:00
Viktor Hofer 36b6247cc7 Update solution files for correct ordering of elements (#58655)
With the newest udpate of slngen, the order of elements (configuration, folders, etc.) is in sync with how Visual Studio arranges them.
Also the order is now deterministic.

Based on that, updating all solution files to have the correct ordering of elements. This change also unblocks adding CI protection for
making sure that solution files are up-to-date in regards to their dependencies as slngen is now generating the files deterministically.
2021-09-04 00:16:15 +02:00
Sergey AndreenkoandDavid Wrighton bc7081e81d Fix VN incorrect optimizations with a new JitEEInterface function. (#57282)
* Add/return tests.

* improve the test naming.

* Add a new JitEE method.

with a naive implementation so far.

* Handle generically dissimilar type concerns as well as handle derived type case in the managed compiler

* Fix the field and Unsafe issues.

* fix some failures.

It appeared that we have many trees where we generate unique VN for rhs and don't inform `fgValueNumberBlockAssignment` about it.
For example, for
```
N005 ( 10,  8) [000033] -A--G---R---              *  ASG       struct (copy)
N004 (  3,  2) [000031] D------N----              +--*  LCL_VAR   struct<eightByteStruct, 8> V01 loc1         d:2
N003 (  6,  5) [000030] n---G-------              \--*  IND       struct
N002 (  3,  3) [000043] ------------                 \--*  ADDR      byref
N001 (  3,  2) [000044] -------N----                    \--*  LCL_VAR   struct<largeStruct, 32> V00 loc0         u:6 (last use)
```
we will generate unique rhs but then `fgValueNumberBlockAssignment` will still try to work it as with a non-unique one.

* Fix an oooold bug in VN.

For a tree like:
```
N005 ( 11, 10) [001400] -A------R----             *  ASG       long
N004 (  6,  5) [001401] *------N-----             +--*  IND       long
N003 (  3,  3) [001402] -------------             |  \--*  ADDR      byref  Zero Fseq[_00]
N002 (  3,  2) [001403] U------N-----             |     \--*  LCL_VAR   struct<System.Runtime.Intrinsics.Vector128`1[Byte], 16> V45 tmp38        ud:3->4
N001 (  1,  1) [001404] -------------             \--*  LCL_VAR   long   V69 tmp62        u:2 (last use)
```
SSA was working correctly and printing that `001403` is using SSA-3 and defining SSA-4. However, this code, for some reason, was writing result as a define for SSA-3.

* Add new test cases and a fix for them.

* correct a test copy paste

* response review.

Co-authored-by: David Wrighton <[email protected]>
2021-08-24 02:59:39 -07:00
Adam Sitnik d7a7898845 Fix Length for ReadOnlySequence created out of sliced Memory owned by MemoryManager (#57479) 2021-08-16 20:12:38 +02:00
Viktor Hofer b12fa3b572 Strong name key id cleanup and pkg testing move (#57044)
* Move src/libraries/pkg/test to src/libraries/testPackages

* Remove default StrongNameKeyId Open properties
2021-08-09 19:20:11 +02:00
Adam Sitnik 200d03e289 see if GetArrayDataReference_NullInput_ThrowsNullRef passes on tvOS now, fixes #36885 (#56724) 2021-08-02 19:22:16 +02:00
Petr Onderka 95ef79a599 Corrected terminology in SequencePosition documentation (#56693) 2021-08-02 10:40:30 +02:00
Viktor Hofer a6b9a63f35 Update libraries solution and NuGet.config files (#56430)
* Update slngen and invocation

* Update NuGet.config files

* Update solution files with slngen
2021-07-28 18:44:17 +02:00
Stephen Toub f3fedf9f48 Add Debug.Assert/Write{Line}If interpolated overloads 2021-07-13 10:11:51 -04:00
Stephen Toub adad29284f Add Span.TryWrite, StringBuilder.Append, and String.Create interpolated strings support 2021-07-13 10:11:51 -04:00
Günther Foidl 738b09bee3 Use inline Vector{128|256}.Create for constants (#54827)
* Used VectorXYZ.Create for constants in Base64

* Used VectorXYZ.Create for constants in BitArray

* Remove conditional compilation

It's only built for NetCoreAppCurrent, so no need to special case older runtimes.
2021-07-12 16:53:50 +00:00
Levi Broderick ad41de4096 Add string.ReplaceLineEndings and MemoryExtensions.EnumerateLines (#53115) 2021-06-07 13:29:51 -07:00
Levi Broderick 5a1b8223da Reduce worst-case alg complexity of MemoryExtensions.IndexOfAny (#53652) 2021-06-03 22:48:54 -07:00
Levi Broderick 3e1ddb05cd Add MemoryMarshal.GetArrayDataReference(Array) (#53562) 2021-06-03 00:46:51 -07:00
Levi Broderick b759ac9716 Expose Array.Clear(Array) as public API (#53388) 2021-05-27 21:08:53 -07:00
Levi Broderick 73162b445f Reintroduce EnumerateRunes tests (#53114) 2021-05-24 09:33:06 +02:00
5297337e5b [iOS][libraries] Skip failing iOS tests with ActiveIssues and proj level skips (#51491)
In effort to assess the state of the iOS library tests, a number of tests will be skipped

Test suites that crash, hang, or have a significant number of failures (mostly 20+ failing unique test methods) are skipped on at the `tests.proj` level. Otherwise, `[ActiveIssue]` attributes have been attached to either the individual test methods that fail or the entire class if the whole test class fails. Any pre-existing `ActiveIssue` attribute associated with iOS had been reassessed to either remain or be closed.

A few test suites have been skipped because they fail with some form of `PlatformNotSupportedException`. `[SkipOnPlatform]` attributes are attached to the failing test methods.

All of the Issues can be tracked at https://github.com/dotnet/runtime/projects/48#column-9236436

The ActiveIssues and `tests.proj` exclusions have been tested on https://github.com/dotnet/runtime/pull/49917 as well.

-----------
This PR makes the following changes in the following files:
`src/libraries/System.IO.Ports/tests/System.IO.Ports.Tests.csproj` - Removed `$(NetCoreAppCurrent)-iOS` from target frameworks as it is stated to currently only supported on Windows.

`src/libraries/tests.proj` - Update the test suites that need to be skipped at the project level, reducing the number and categorizing as a skip due to PNSE, a skip due to numerous failures, and a skip due to the suite crashing.

The remaining files changed are either:
`[ActiveIssue("<issue-url>", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]`
`[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Not supported on iOS or tvOS.")]`

Co-authored-by: Mitchell Hwang <[email protected]>
Co-authored-by: Tammy Qiu <[email protected]>
2021-05-12 17:40:55 +02:00
Kuinox 3297e7e018 Now that we dont leak the SequencePosition flags anymore, we dont need to bitmask the arguments before processing. (#49921) 2021-05-08 21:01:01 -07:00
Zoltan Varga 8f3ac9bac0 [mono] Add a null check to Array.GetRawArrayData (), its needed on platforms (#52355)
which use explicit null checks.

Fixes https://github.com/dotnet/runtime/issues/50960.
2021-05-06 04:36:37 -04:00
Ankit JainandLarry Ewing fa7c6a93a8 [wasm][aot] Disable failing AOT tests, to get a green build (#51724)
Co-authored-by: Larry Ewing <[email protected]>
2021-04-27 01:55:45 -04:00
df6da13870 Add Array.GetMaxLength<T> (#43301)
* Add Array.GetMaxLength<T> implementation.

* Implement Array.MaxLength and fix all remaining references

* Apply suggestions from code review

Co-authored-by: Jan Kotas <[email protected]>

* Apply suggestions from code review

Co-authored-by: Jan Kotas <[email protected]>

* Update src/libraries/System.Collections/tests/Generic/Stack/Stack.Generic.Tests.cs

Co-authored-by: Jan Kotas <[email protected]>

Co-authored-by: Stephen Toub <[email protected]>
Co-authored-by: Jan Kotas <[email protected]>
2021-04-17 08:08:56 -04:00
Levi Broderick fbd3b980d9 Optimize Span<T>.Fill implementation (#51365) 2021-04-17 01:29:50 -07:00
Stephen Toub 0c793920f6 Clean up string formatting in a variety of places (#50267)
Mostly just replacing string.Format calls with equivalent interpolated string uses.  In some cases, I replaced lots of string creations with a StringBuilder or equivalent.
2021-04-04 23:16:23 -04:00
Ulrich Weigand 11bd0defb0 Big-endian fix: Base64Encoder (#49814)
* Take byte order into accout when packing characters into an int
2021-03-19 07:54:19 -07:00
Kuinox 29dbd3249f ReadOnlySequence: Don't leak the flags that are on _startInteger and _endInteger. (#47969)
* ReadOnlySequence: Don't leak the flags that are on _startInteger and _endInteger.

* Typo fix.

* Added more tests + review fixes.
2021-03-17 10:16:30 +01:00
Ulrich Weigand 21d8418a93 Big-endian test case fixes: System.Memory tests (#49690)
* Fix endian assumptions in preparing input byte patterns

* Enable tests that were disabled on big-endian systems
2021-03-16 09:45:24 -04:00
Stephen Toub 831c061e03 Add new MemoryExtensions.SequenceEqual overloads (#48677)
* Add new MemoryExtensions.SequenceEqual overloads

* Use MemoryExtensions.SequenceEqual in Enumerable.SequenceEqual

* Use MemoryExtensions.SequenceEqual in a few more places
2021-02-26 14:21:44 -05:00
Stephen Toub 66a5cd79d7 Enable SequenceMarshal to be trimmed from default Blazor wasm app (#47879) 2021-02-04 22:36:58 -05:00
Stephen Toub 2b0e2785e5 Use [NotNullWhen(true)] in more places (#47598)
* Use [NotNullWhen(true)] in more places

Did a quick search/audit for methods that returned bool and took nullable object as the first input, and added [NotNullWhen(true)] where it was obviously correct.

* Address PR feedback
2021-01-30 06:09:28 -05:00
Stephen Toub a10c2e6ebd Add MemoryMarshal.CreateReadOnlySpanFromNullTerminated (#47539) 2021-01-29 22:42:17 -05:00
Steve Harter 5175f6d139 Avoid OutOfMemoryException in some test environments (#45710) 2021-01-07 17:54:01 -06:00
Jan Kotas 10381a2cdc Find&Replace coreclr/src -> coreclr (#45761) 2020-12-08 10:40:17 -08:00
Günther Foidl 1a1ad94328 Removed thread-safety from SequenceReader (#45437)
As it's a ref-struct and thus stack-only there's no need to have any guarantees for thread-safety and atomicity.
2020-12-02 10:20:48 +01:00
xtqqczzeandStephen Toub 1edc35f851 Use AsSpan/AsMemory (start, length) (#45310)
* Use AsSpan(start, length)

Replace `AsSpan().Slice(start, length)` with `AsSpan(start, length)`

* Use AsMemory(start, length)

Replace `AsMemory().Slice(start, length)` with `AsMemory(start, length)`

* Apply suggestions from code review

Co-authored-by: Stephen Toub <[email protected]>

Co-authored-by: Stephen Toub <[email protected]>
2020-11-30 06:26:17 -05:00
Viktor Hofer ed295782bf Add workflow to update solution files with SlnGen and update them initially (#44703)
* Add slngen infra

* Update all solution files
2020-11-17 18:23:30 +01:00
Stephen Toub 7b93881c6c Delete stale comment about dotnet/roslyn#30797 2020-11-08 21:17:20 -05:00
Stephen Toub e8339af091 Remove some unnecessary unsafe usage (#43430) 2020-10-16 22:24:20 -04:00