platform/upstream/dotnet/runtime.git
2 years agoFaster IndexOf for substrings (#63285)
Egor Bogatov [Tue, 25 Jan 2022 18:54:35 +0000 (21:54 +0300)]
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

2 years agoAdd ref field runtime feature indication (#64167)
Aaron Robinson [Tue, 25 Jan 2022 18:15:47 +0000 (13:15 -0500)]
Add ref field runtime feature indication (#64167)

* Add ref field runtime feature indication

Co-authored-by: Stephen Toub <stoub@microsoft.com>
2 years agoOnly send to Helix for rolling build, due to small Helix queue (#64274)
Jo Shields [Tue, 25 Jan 2022 17:52:36 +0000 (12:52 -0500)]
Only send to Helix for rolling build, due to small Helix queue (#64274)

2 years agoTake ARMv6 out of PlatformGroup All (#64267)
Jo Shields [Tue, 25 Jan 2022 16:50:09 +0000 (11:50 -0500)]
Take ARMv6 out of PlatformGroup All (#64267)

* Take ARMv6 out of PlatformGroup All, CoreCLR assumes this means full support

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
2 years agoCorrect JsonNode.Root doc (#64238)
Steve Harter [Tue, 25 Jan 2022 16:40:34 +0000 (10:40 -0600)]
Correct JsonNode.Root doc (#64238)

2 years agoSkip tests using AsyncIO in FileSystemAclExtensionsTests where it's not supported...
Steve Pfister [Tue, 25 Jan 2022 15:37:06 +0000 (07:37 -0800)]
Skip tests using AsyncIO in FileSystemAclExtensionsTests where it's not supported (#64212)

The mono runtime does not yet support AsyncIO on Windows and there were some tests failing on CI because of it.
Fixes #64221

2 years agoUse lower call count threshold for tiering in debug builds (#60945)
Koundinya Veluri [Tue, 25 Jan 2022 14:47:22 +0000 (06:47 -0800)]
Use lower call count threshold for tiering in debug builds (#60945)

* Use lower call count threshold for tiering in debug builds

To exercise more paths during tests, see https://github.com/dotnet/runtime/pull/60886

2 years ago[ILVerify] Fix casting check for arrays of generic parameters with class constraints...
Jan Kotas [Tue, 25 Jan 2022 14:37:01 +0000 (06:37 -0800)]
[ILVerify] Fix casting check for arrays of generic parameters with class constraints (#64259)

Fixes #63999

2 years agoAdd the exception set for `ObjGetType` (#64106)
SingleAccretion [Tue, 25 Jan 2022 14:35:28 +0000 (17:35 +0300)]
Add the exception set for `ObjGetType` (#64106)

* Model NRE for ObjGetType

* Add tests

2 years agoImprove Regex handling of anchors (#64177)
Stephen Toub [Tue, 25 Jan 2022 14:30:24 +0000 (09:30 -0500)]
Improve Regex handling of anchors (#64177)

* Improve Regex handling of anchors

- Extend search for leading anchor to support alternations.  This means that an expression like `^abc|^def` will now observe the leading `^` whereas previously it didn't.
- Add a FindFirstChar optimization that jumps to the right position for a pattern that matches a computeable max length and ends with an end anchor.

* Address PR feedback

2 years agoDelete unused ApiCompat baseline files (#64190)
Viktor Hofer [Tue, 25 Jan 2022 12:09:57 +0000 (13:09 +0100)]
Delete unused ApiCompat baseline files (#64190)

* Delete unused ApiCompat baseline files

* Delete ApiCompatBaseline.netfx.netstandardOnly.txt

* Remove manual .NETFramework baseline validation

* Delete ApiCompatBaseline.netcoreapp.netfx461.ignore.txt

* Delete ApiCompatBaseline.netcoreapp.netfx461.txt

2 years ago[main] Update dependencies from dotnet/runtime dotnet/llvm-project (#64205)
dotnet-maestro[bot] [Tue, 25 Jan 2022 11:11:58 +0000 (12:11 +0100)]
[main] Update dependencies from dotnet/runtime dotnet/llvm-project (#64205)

* Update dependencies from https://github.com/dotnet/runtime build 20220123.5

Microsoft.NETCore.ILAsm , Microsoft.NETCore.DotNetHostPolicy , Microsoft.NETCore.DotNetHost , Microsoft.NETCore.App.Runtime.win-x64 , System.Runtime.CompilerServices.Unsafe , runtime.native.System.IO.Ports , Microsoft.NET.Sdk.IL , System.Text.Json
 From Version 7.0.0-alpha.1.22066.4 -> To Version 7.0.0-alpha.1.22073.5

* Update dependencies from https://github.com/dotnet/llvm-project build 20220123.1

runtime.win-x64.Microsoft.NETCore.Runtime.ObjWriter , runtime.win-arm64.Microsoft.NETCore.Runtime.ObjWriter , runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.ObjWriter , runtime.osx.11.0-arm64.Microsoft.NETCore.Runtime.ObjWriter , runtime.linux-x64.Microsoft.NETCore.Runtime.ObjWriter , runtime.linux-musl-x64.Microsoft.NETCore.Runtime.ObjWriter , runtime.linux-musl-arm64.Microsoft.NETCore.Runtime.ObjWriter , runtime.linux-arm64.Microsoft.NETCore.Runtime.ObjWriter
 From Version 1.0.0-alpha.1.22070.1 -> To Version 1.0.0-alpha.1.22073.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoFix PAL_wprintf for wide characters (#64181)
Adeel Mujahid [Tue, 25 Jan 2022 10:00:20 +0000 (12:00 +0200)]
Fix PAL_wprintf for wide characters (#64181)

2 years agoMake sure that shared memory object name meets the length requirements (#64099)
Adam Sitnik [Tue, 25 Jan 2022 07:15:55 +0000 (08:15 +0100)]
Make sure that shared memory object name meets the length requirements (#64099)

Co-authored-by: Stephen Toub <stoub@microsoft.com>
2 years agoMake XmlSerializer.Generator targets incremental (#64191)
Viktor Hofer [Tue, 25 Jan 2022 07:15:27 +0000 (08:15 +0100)]
Make XmlSerializer.Generator targets incremental (#64191)

* Make XmlSerializer.Generator targets incremental

Adding inputs and outputs to make XmlSerializer.Generator incremental

2 years agoCatch UnicodeEncodeErrors (#64251)
Kunal Pathak [Tue, 25 Jan 2022 05:49:56 +0000 (21:49 -0800)]
Catch UnicodeEncodeErrors (#64251)

2 years agoUpdate main branding to preview2 (#64219)
Santiago Fernandez Madero [Tue, 25 Jan 2022 01:28:03 +0000 (17:28 -0800)]
Update main branding to preview2 (#64219)

2 years agoAndroid remove backward timezones (#64028)
Mitchell Hwang [Mon, 24 Jan 2022 23:46:52 +0000 (18:46 -0500)]
Android remove backward timezones (#64028)

Fixes #63693

It was discovered that Android produces duplicate TimeZone DisplayNames among all timezone IDs in GetSystemTimeZones. These duplicate DisplayNames occur across TimeZone IDs that are aliases, where all except one are backward timezone IDs.

If a name is changed, put its old spelling in the 'backward' file

From the Android TimeZone data file tzdata, it isn't obvious which TimeZone IDs are backward (I find it strange that they're included in the first place), however we discovered that on some versions of Android, there is an adjacent file tzlookup.xml that can aid us in determining which TimeZone IDs are "current" (not backward).

This PR aims to utilize tzlookup.xml when it exists and post-filter's the Populated TimeZone IDs in the AndroidTzData instance by removing IDs and their associated information (byteoffset and length) from the AndroidTzData instance if it is not found in tzlookup.xml. This is using the assumption that all non-backward TimeZone IDs make it to the tzlookup.xml file.

This PR also adds a new TimeZoneInfo Test to check whether or not there are duplicate DisplayNames in GetSystemTimeZones

2 years agoupdate generation_allocation_size correctly for SIP regions (#64176)
Maoni Stephens [Mon, 24 Jan 2022 23:21:21 +0000 (15:21 -0800)]
update generation_allocation_size correctly for SIP regions (#64176)

SIP regions need to update the corresponding generation's generation_allocation_size and since this can be more than 1 gen older than the region's gen, we need to make all generation's alloc size get updated.

2 years agoUpdate tests to expect RemoteExecutor to check exit code (#64133)
Elinor Fung [Mon, 24 Jan 2022 22:57:42 +0000 (14:57 -0800)]
Update tests to expect RemoteExecutor to check exit code (#64133)

2 years agoPut back FindCaseSensitivePrefix regex alternation support (#64204)
Stephen Toub [Mon, 24 Jan 2022 22:05:04 +0000 (17:05 -0500)]
Put back FindCaseSensitivePrefix regex alternation support (#64204)

* Put back FindCaseSensitivePrefix alternation support

* Fix the bug from the initial version, and add more comments

2 years agoFix remote unwind (#64220)
Jan Vorlicek [Mon, 24 Jan 2022 21:58:47 +0000 (22:58 +0100)]
Fix remote unwind (#64220)

The _OOP_find_proc_info was setting only a couple of members of the
unw_dyn_info_t instance on stack. So the remaining ones had random
values. The load_offset was a recently added member to the struct.
When we have updated libunwind, this change came in. The load_offset was
random and that has broken unwindign as this offset is subtracted from
the IP when looking up unwind info.

The fix clears the whole struct. I have verified that the issue we had no
longer happens with the fix.

2 years agoPort Mono to Raspberry Pi, ship as new linux-armv6 RID (#62594)
Jo Shields [Mon, 24 Jan 2022 21:29:57 +0000 (16:29 -0500)]
Port Mono to Raspberry Pi, ship as new linux-armv6 RID (#62594)

* Initial ARMv6 arch addition. Builds mono runtime, not CoreCLR (Mono already supports the CPU arch subset used by Raspberry Pi, whilst porting CoreCLR to e.g. VFPv2 would be major work)
* Build small clr subset on ARMv6, it's needed for SDK and we want to check it works

2 years agoInstall v8 and Prebuild wasm (#64100)
Fan Yang [Mon, 24 Jan 2022 20:10:22 +0000 (15:10 -0500)]
Install v8 and Prebuild wasm (#64100)

2 years ago[Android][libs] Enable Internal.Console.Write in System.Private.CoreLib (#63949)
Mitchell Hwang [Mon, 24 Jan 2022 20:06:56 +0000 (15:06 -0500)]
[Android][libs] Enable Internal.Console.Write in System.Private.CoreLib (#63949)

* [Android][libs] Enable Internal.Console.Write in System.Private.CoreLib

* [docs] Add debugging System.Private.CoreLib Internal.Console.Write

* Elaborate on debugging corelib log

* Address feedback

2 years agoDon't reference .NETFramework shims in libraries product or test composition (#64193)
Viktor Hofer [Mon, 24 Jan 2022 19:32:43 +0000 (20:32 +0100)]
Don't reference .NETFramework shims in libraries product or test composition (#64193)

* Don't reference .NETFramework shims

Stop referencing .NETFramework shims in libraries ref or source projects as those are supplementary and shouldn't impact the product composition.

2 years agoEnsure that we aren't accidentally generating instructions for unsupported ISAs ...
Tanner Gooding [Mon, 24 Jan 2022 19:01:19 +0000 (11:01 -0800)]
Ensure that we aren't accidentally generating instructions for unsupported ISAs (#64140)

* Assert that the ISA of the set intrinsic ID is supported

* Ensure gtNewSimdCmpOpAllNode and gtNewSimdCmpOpAnyNode don't generate AVX2 instructions when not supported

* Ensure codegen for Vector128.Dot when SSSE3 is disabled is correct

* Update src/coreclr/jit/hwintrinsiccodegenarm64.cpp

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Ensure Vector256.Sum has a check for AVX2

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years agoBump Intellisensense package version to latest from `dotnet7-transport` (#63352)
Carlos Sanchez [Mon, 24 Jan 2022 18:40:18 +0000 (10:40 -0800)]
Bump Intellisensense package version to latest from `dotnet7-transport` (#63352)

2 years agoAdd executable bit to tizen sh files (#64216)
Gleb Balykov [Mon, 24 Jan 2022 18:21:44 +0000 (21:21 +0300)]
Add executable bit to tizen sh files (#64216)

2 years agoUse the static HashData(Stream) method in more places
Kevin Jones [Mon, 24 Jan 2022 17:52:58 +0000 (12:52 -0500)]
Use the static HashData(Stream) method in more places

2 years agoRespond to feedback in GenerateMultiTargetRoslynComponentTargetsFile (#63943)
Eric Erhardt [Mon, 24 Jan 2022 16:42:15 +0000 (10:42 -0600)]
Respond to feedback in GenerateMultiTargetRoslynComponentTargetsFile (#63943)

* Respond to feedback in GenerateMultiTargetRoslynComponentTargetsFile

Two small follow up changes from #58446

- Fix a type-o that breaks incremental build. Forgot to use MSBuild property syntax
- Instead of having the infrastructure hard-code removing 'Abstractions', packages can set their own Disable source gen property name.

* PR feedback

2 years agoDelete stale reference in System.Drawing.Primitives (#64202)
Stephen Toub [Mon, 24 Jan 2022 15:33:04 +0000 (10:33 -0500)]
Delete stale reference in System.Drawing.Primitives (#64202)

2 years ago[mono] Temporarily disable two tests that fail on arm64 LLVM FullAOT. (#64180)
imhameed [Mon, 24 Jan 2022 15:28:49 +0000 (10:28 -0500)]
[mono] Temporarily disable two tests that fail on arm64 LLVM FullAOT. (#64180)

2 years agoImplement IEquatable<T> on value types overriding Equals (and enable CA1066/1077...
Stephen Toub [Mon, 24 Jan 2022 14:43:25 +0000 (09:43 -0500)]
Implement IEquatable<T> on value types overriding Equals (and enable CA1066/1077) (#63690)

2 years agoDrop support for .NET 5 SDK (#64186)
Michal Strehovský [Mon, 24 Jan 2022 14:28:06 +0000 (23:28 +0900)]
Drop support for .NET 5 SDK (#64186)

We had to duplicate a lot of Microsoft.NET.ILLink.targets logic.

2 years agoAdd missing handle function enter/return macros (#64061)
Joshua Peterson [Mon, 24 Jan 2022 14:15:38 +0000 (09:15 -0500)]
Add missing handle function enter/return macros (#64061)

The mono_field_static_get_value method uses a handle, but did not set up
enter/exit macros properly, so this handle was leaked.

Some code in Unity calls this embedding API method pretty often, which
can lead to the mark stack overflowing in the GC code.

2 years agoIgnoring leading dot when comparing cookie domains (#64038)
Katya Sokolova [Mon, 24 Jan 2022 14:02:05 +0000 (15:02 +0100)]
Ignoring leading dot when comparing cookie domains (#64038)

* ignoring leading dot when comparin cookie domain

* Simplify cookie comparing logic to equality and moving it to CookieComparer to fix the build

* Domain comparing optimizarion and more unit tests

* small check optimization

* Renaming method

2 years agoReduce buffer size used in XmlReader when using Async mode (#63459)
Christopher Moore [Mon, 24 Jan 2022 12:53:54 +0000 (12:53 +0000)]
Reduce buffer size used in XmlReader when using Async mode (#63459)

The current choice of AsyncBufferSize resulted in the character buffer in the XmlTextReader being allocated on the Large Object Heap (LOH)

Fixes https://github.com/dotnet/runtime/issues/61459

2 years agoExclusively use GitHub teams for Libraries area mentions (#64199)
Jeff Handley [Mon, 24 Jan 2022 10:48:35 +0000 (02:48 -0800)]
Exclusively use GitHub teams for Libraries area mentions (#64199)

2 years agoOnboard new Triage & PR Boards (#64198)
Eirik Tsarpalis [Mon, 24 Jan 2022 10:23:01 +0000 (10:23 +0000)]
Onboard new Triage & PR Boards (#64198)

2 years agoUse kebab-case in FB automation labels (#64048)
Eirik Tsarpalis [Mon, 24 Jan 2022 09:58:24 +0000 (09:58 +0000)]
Use kebab-case in FB automation labels (#64048)

2 years agoUpdate zip extraction to never throw any exceptions when the LastWriteTime update...
Eaton Zveare [Mon, 24 Jan 2022 09:14:20 +0000 (04:14 -0500)]
Update zip extraction to never throw any exceptions when the LastWriteTime update fails (#63912)

2 years ago[main] Update dependencies from dotnet/arcade dotnet/icu dotnet/xharness dotnet/emsdk...
dotnet-maestro[bot] [Mon, 24 Jan 2022 09:08:44 +0000 (10:08 +0100)]
[main] Update dependencies from dotnet/arcade dotnet/icu dotnet/xharness dotnet/emsdk (#64098)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoTune FP CSEs live across a call better (#63903)
SingleAccretion [Mon, 24 Jan 2022 08:55:05 +0000 (11:55 +0300)]
Tune FP CSEs live across a call better (#63903)

The problem was that the comparison of a weighted refcount,
which usually has the order of hundreds or tens, with a small
digit like "4" was too weak and missed some cases where we
were still trying to CSE cheaps floats across calls and ending
up with lots of stack shuffling.

Fix this by using different tuning parameters, namely the costs
estimated for the uses and defs (increase them to account for
the spills and reloads).

2 years ago Fix FileSystemAclExtensions.Create when passing a null FileSecurity (#61297)
Carlos Sanchez [Mon, 24 Jan 2022 08:54:11 +0000 (00:54 -0800)]
 Fix FileSystemAclExtensions.Create when passing a null FileSecurity (#61297)

* Make FileSecurity parameter nullable.

* Add missing ArgumentException message for FileMode.Append.

* Refactor tests to ensure FileSecurity is tested with all FileMode and FileSystemRights combinations. Separate special cases.

* Remove exception that throws when FileSecurity is null.
Ensure we have logic that can create a FileHandle when FileSecurity is null.
Fix bug where FileShare.Inheritable causes IOException because it is being unexpectedly passed to the P/Invoke (it should just be saved in the SECURITY_ATTRIBUTES struct).
Add documentation to mention this parameter as optional.
Ensure all exceptions match exactly what we have in .NET Framework, with simpler logic.

* Address suggestions

Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
2 years agoAdd blsr (#63545)
Wraith [Mon, 24 Jan 2022 08:53:39 +0000 (08:53 +0000)]
Add blsr (#63545)

2 years agoFix one source of perf regression in GCHeap::Alloc. This impacts the System.Collectio...
Peter Sollich [Mon, 24 Jan 2022 08:24:38 +0000 (09:24 +0100)]
Fix one source of perf regression in GCHeap::Alloc. This impacts the System.Collections.CtorFromCollectionNonGeneric<Int32> family of benchmarks. (#64091)

These benchmarks manage to make GCHeap::Alloc into a hotspot, so the call to IsHeapPointer() at the end matters for performance.

2 years agoPort MD4 managed implementation from mono/mono (#62074)
Maxim Lipnin [Mon, 24 Jan 2022 08:04:22 +0000 (11:04 +0300)]
Port MD4 managed implementation from mono/mono (#62074)

Porting MD4 managed implementation from mono/mono (MD4.cs and MD4Managed.cs).

It adds:
- an internal class in the System.Net.Security with a single HashData method for now;
- a set of related MD 4 unit tests to System.Net.Security.Unit.Tests project.

2 years agoRe-enable failing long path test (#64113)
Dan Moseley [Mon, 24 Jan 2022 07:54:36 +0000 (00:54 -0700)]
Re-enable failing long path test (#64113)

2 years agoAllow generating Dwarf version 5 (#63988)
Michal Strehovský [Mon, 24 Jan 2022 05:39:27 +0000 (14:39 +0900)]
Allow generating Dwarf version 5 (#63988)

Contributes to https://github.com/dotnet/runtimelab/issues/1738.

2 years agoTitle and message resources should be enforced to exist to prevent printing empty...
Tlakaelel Axayakatl Ceja [Mon, 24 Jan 2022 02:09:41 +0000 (18:09 -0800)]
Title and message resources should be enforced to exist to prevent printing empty messages (#64151)

Sync ILLink.Shared folder with the latest version in dotnet/linker main branch

List of changes include:
- Enforce title and message resources to exist to prevent printing empty messages
- All diagnostics produced by linker now have a DiagnosticId, a title and a message
- Schema for xml link attributes file

- Added a readme file to the ILLink.Shared project to keep track of the commit is being used from dotnet/linker

2 years agoImplement hash and HMAC stream one shots
Kevin Jones [Sun, 23 Jan 2022 23:23:24 +0000 (18:23 -0500)]
Implement hash and HMAC stream one shots

This implements hashing and HMAC statics for streams. Additionally,
"LiteHmac" and "LiteHash" were introduced. The existing HMAC and hash
provider functionality do some bookkeeping we don't need for resetting.
Since we do not need to use these hash handles after the digest has
been finalized, resetting is unnecessary work. For HMAC, that also means
keeping a copy of the key around for some implementations which we don't
need to do.

The LiteHash and LiteHmac types are implemented as structs with a common
interface. To avoid boxing, generics are used and constrained to the interface
where possible.

The Browser implementation just defers to the existing HashDispenser rather
than do anything novel.

The HashProviderCng is somewhat specialized in its ability to reset. It did
up-front check to determine if the platform supported reusable hash providers,
and further had a single implementation for HMAC and Digests. The current
Lite hash design requires that they remain separate types.

2 years agoAdd alignment to mapped field stream (#63305)
David Wrighton [Sun, 23 Jan 2022 22:25:26 +0000 (14:25 -0800)]
Add alignment to mapped field stream (#63305)

* Align MappeFieldDataStream at 8 byte boundary

* Add test to verify that the mapped field rva data blob is aligned to ManagedPEBuilder.MappedFieldDataAlignment

* Only align when the mapped field data is of size not equal to 0

2 years agoUpdate NativeAOT codegen and Crossgen2 for CreateSpan (#63977)
David Wrighton [Sun, 23 Jan 2022 22:23:32 +0000 (14:23 -0800)]
Update NativeAOT codegen and Crossgen2 for CreateSpan (#63977)

- Make sure FieldRVA pointers remain aligned as required by the code generator
  - Use the same Packing Size approach as the IL Linker will use (See jbevain/cecil#817 for details)
  - Compilers that generate CreateSpan will need to follow that trick to be compatible with rewriters.
- Provide ECMA spec augment describing packing size detail

2 years agoSpmi replay asmdiffs mac os arm64 (#64119)
Egor Chesakov [Sun, 23 Jan 2022 22:07:40 +0000 (14:07 -0800)]
Spmi replay asmdiffs mac os arm64 (#64119)

* Split unix-arm64 into linux-arm64 and osx-arm64 in src/coreclr/scripts/superpmi-replay.proj

* Split unix-arm64 into linux-arm64 and osx-arm64 in src/coreclr/scripts/superpmi-asmdiffs.proj

* Add all subdirectories of $(SuperPMIDirectory) as PMIPATH in src/coreclr/scripts/superpmi-collect.proj

2 years agoAdd runtime support for `ref` fields (#63985)
Aaron Robinson [Sun, 23 Jan 2022 14:39:24 +0000 (09:39 -0500)]
Add runtime support for `ref` fields (#63985)

* Add mono and coreclr runtime support for ref fields

* Update Reflection.Emit tests to validate ref fields.

Add test for TypedReference as a ref field.

2 years agoDispose LdapConnections used by ValidateCredentials (#62036)
Julius Hardt [Sun, 23 Jan 2022 01:32:42 +0000 (02:32 +0100)]
Dispose LdapConnections used by ValidateCredentials (#62036)

Ensure that cached LdapConnection instances created by
PrincipalContext.ValidateCredentials are disposed when
the corresponding PrincipalContext is disposed.

Fix #62035

2 years agoExtra tests for assembly name parser. (#64022)
Vladimir Sadov [Sat, 22 Jan 2022 22:57:43 +0000 (14:57 -0800)]
Extra tests for assembly name parser. (#64022)

* Dead code in native assembly name parsing

* disallow `\u` escaping in assembly names

* misc cleanup

* forward slash is illegal escaped or not

* ignore "language" attribute in assembly name ("culture" must be used)

* duplicate attributes are ok if unrecognized (just add tests)

* drop support for "custom" blob attribute

* drop support for publickey[token]=neutral ("null" must be used)

* ignore unknown assembly name attributes in mono (compat)

* disallow \0 anywhere in the assembly name

* disallow \0 in assembly names on mono (compat)

* only check for embedded nulls when parsing

* fix mono build

* make GCC happy

* couple test scenarios for publickey vs. publickeytoken (CoreRT parser might trip on these)

* produce errors on duplicate known attributes in mono

2 years agoFix MultiByteToWideChar call in pal (#64146)
Adeel Mujahid [Sat, 22 Jan 2022 20:24:54 +0000 (22:24 +0200)]
Fix MultiByteToWideChar call in pal (#64146)

2 years agoUpdating unit tests for DirectoryServices.AccountManagement (#56670)
Floris Westerman [Sat, 22 Jan 2022 15:44:23 +0000 (16:44 +0100)]
Updating unit tests for DirectoryServices.AccountManagement (#56670)

Removing old, redundant unit tests that were actually never executed

Migrating old tests to new test infrastructure with configurable LDAP/AD
connections

2 years agoDisable NJulianRuleTest test crashing in CI (#64142)
Stephen Toub [Sat, 22 Jan 2022 14:19:39 +0000 (09:19 -0500)]
Disable NJulianRuleTest test crashing in CI (#64142)

2 years agoRelax assert in ApplyEditAndContinue (#64132)
Jan Kotas [Sat, 22 Jan 2022 07:56:14 +0000 (23:56 -0800)]
Relax assert in ApplyEditAndContinue (#64132)

Fixes #64070

2 years agoFixing update issue with multivalued properties #34267 (#56696)
Floris Westerman [Sat, 22 Jan 2022 07:31:21 +0000 (08:31 +0100)]
Fixing update issue with multivalued properties #34267 (#56696)

* Add custom attribute test

* Adding test demonstrating issue #34267

* Solution for issue #34267

Replacing all values in property with the new collection, instead of just
appending new values, leaving old values in place.

* Incorporate review feedback

Changing the variable name

2 years agopipelines: Add wasm jobs (#64109)
Ankit Jain [Sat, 22 Jan 2022 07:10:06 +0000 (02:10 -0500)]
pipelines: Add wasm jobs (#64109)

2 years agoAdd COMWrappers to crossgen (#63969)
Andy Gocke [Sat, 22 Jan 2022 06:59:57 +0000 (22:59 -0800)]
Add COMWrappers to crossgen (#63969)

2 years agoExtract SuperPMI into a separate component (#64035)
Michal Strehovský [Fri, 21 Jan 2022 23:55:56 +0000 (08:55 +0900)]
Extract SuperPMI into a separate component (#64035)

Allows building the runtime without SPMI.

`build.cmd clr` will still build SPMI.
`build.cmd clr.native` will still build SPMI.
`build.cmd clr.runtime` will no longer build SPMI.

This is mostly motivated by NativeAOT subset builds where SPMI contributes to 10% of the native build time (nativeaot CorecLR subset builds pretty quickly compared to full CoreCLR).

2 years agoIgnore conversion exceptions during dictionary construction (#63792)
Pavel Ivanov [Fri, 21 Jan 2022 23:39:21 +0000 (04:39 +0500)]
Ignore conversion exceptions during dictionary construction (#63792)

2 years agoDelete `GT_DYN_BLK` (#63026)
SingleAccretion [Fri, 21 Jan 2022 23:24:10 +0000 (02:24 +0300)]
Delete `GT_DYN_BLK` (#63026)

* Import GT_STORE_DYN_BLK directly

* Delete GT_DYN_BLK

* DynBlk -> StoreDynBlk

* Add some tests

* Mark tests Pri-1

* Rebase and fix build

* Bring back the odd early return

2 years ago[mono] Cleanup trailing whitespace. (#64112)
Zoltan Varga [Fri, 21 Jan 2022 23:10:37 +0000 (18:10 -0500)]
[mono] Cleanup trailing whitespace. (#64112)

2 years agoEnable nullable annotations for Microsoft.Extensions.Configuration.UserSecrets (...
Maksym Koshovyi [Fri, 21 Jan 2022 23:10:23 +0000 (01:10 +0200)]
Enable nullable annotations for Microsoft.Extensions.Configuration.UserSecrets (#63700)

2 years ago[Group 2] Enable nullable annotations for `Microsoft.Extensions.DependencyInjection...
Maksym Koshovyi [Fri, 21 Jan 2022 23:09:11 +0000 (01:09 +0200)]
[Group 2] Enable nullable annotations for `Microsoft.Extensions.DependencyInjection` (#63836)

* Annotate src

* Update ResolverBuilder.Build

* Update RunOnEmptyStackCore

* ILEmitResolverBuilderContext constructor

* Remove setter

* Add assert

2 years agoAddress-expose locals under complex local addresses in block morphing (#63100)
SingleAccretion [Fri, 21 Jan 2022 22:46:22 +0000 (01:46 +0300)]
Address-expose locals under complex local addresses in block morphing (#63100)

* Handle complex local addresses in block morphing

In block morphing, "addrSpill" is used when the destination or source
represent indirections of "complex" addresses. Unfortunately, some trees
in the form of "IND(ADDR(LCL))" fall into this category.

If such an "ADDR(LCL)" is used as an "addrSpill", the underlying local
*must* be marked as address-exposed. Block morphing was using a very
simplistic test for when that needs to happen, essentially only recognizing
"ADDR(LCL_VAR/FLD)". But it is possible to have a more complicated pattern
as "PrepareDst/Src" uses "IsLocalAddrExpr" to recognize indirect stores
to locals.

Currently it appears impossible to get a mismatch here as morph transforms
"IND(ADD(ADDR(LCL_VAR), OFFSET))" into "LCL_FLD" (including for TYP_STRUCT
indirections), but this is a very fragile invariant. Transforming TYP_STRUCT
GT_FIELDs into GT_OBJs instead of GT_INDs breaks it, for example.

Fix this by address-exposing the local obtained via "IsLocalAddrExpr".

* Add a TODO-CQ for LCL_FLD usage

2 years agoRemove enable drawing on unix switch (#64084)
Santiago Fernandez Madero [Fri, 21 Jan 2022 21:40:27 +0000 (13:40 -0800)]
Remove enable drawing on unix switch (#64084)

* Remove enable drawing on unix switch

* Update some tests and not run tests that need Drawing on non Windows

* PR Feedback, just turn off the switch

2 years agoMake ApiCompat.proj incrementally buildable (#64037)
Viktor Hofer [Fri, 21 Jan 2022 21:39:07 +0000 (22:39 +0100)]
Make ApiCompat.proj incrementally buildable (#64037)

* Make ApiCompat.proj incrementally buildable

In https://github.com/dotnet/runtime/pull/64000, I noticed that ApiCompat.proj never builds incrementally. Even though the RunApiCompat target has Inputs and Outputs, those aren't defined too late inside the target to have any effect. Moving them out and declare the generated response file as an output.

Also simplifying some msbuild logic and renaming some properties as underscore prefixes in project files don't make sense if the property isn't reserved in any way.

* Update ApiCompat.proj

2 years agoRevert "Enable System.Text.Json tests on netfx (#63803)" (#64108)
Andy Gocke [Fri, 21 Jan 2022 21:32:37 +0000 (13:32 -0800)]
Revert "Enable System.Text.Json tests on netfx (#63803)" (#64108)

This reverts commit 34794bc5f2bcdbaa9057bb07b8764e2bb6a411a2.

2 years agoUpdate format script permissions so it can be called on Unix systems directly. (...
Jeremy Koritzinsky [Fri, 21 Jan 2022 21:32:26 +0000 (13:32 -0800)]
Update format script permissions so it can be called on Unix systems directly. (#64107)

2 years agoHandle embedded assignments in copy propagation (#63447)
SingleAccretion [Fri, 21 Jan 2022 21:08:44 +0000 (00:08 +0300)]
Handle embedded assignments in copy propagation (#63447)

* Clean things up a little

Delete redundant conditions, use "LclVarDsc*", rename locals for clarity.

* Delete a redundant condition

For actual def nodes, GTF_VAR_CAST will never be set, it is
only set in "optNarrowTree" for uses.

For "def nodes" that are actually uses (parameters), the VNs
will never match anyway.

* Handle embedded assignments in copy propagation

Previously, as the comments in copy propagation tell us, it
did not handle "intervening", or not-top-level definitions of
locals, instead opting to maintain a dedicated kill set of them.

This is obviously a CQ problem, but also a TP one, as it meant
there had to be a second pass over the statement's IR, where
the definitions would be pushed on the stack.

This change does away with that, instead pushing new definitions
as they are encountered in execution order, and simultaneously
propagating on uses. Notably, this means the code now needs to
look at the real definition nodes, i. e. ASGs, not the LHS locals,
as those are encountered first in canonical execution order, i. e.
for a tree like:

```
  ASG
    LCL_VAR V00 "def"
    ADD
      LCL_VAR V00
      LCL_VAR V00
```

Were we to use the "def" as the definition point, we would wrongly
push it as the definition on the stack, even as the assignments
itself hasn't happened yet at that point.

There are nice diffs with this change, all resulting from unblocked
propagations, and mostly coming from setup arguments under calls.

* Simplify optIsSsaLocal

2 years agoDo not set GTF_NO_CSE for sources of block copies (#63462)
SingleAccretion [Fri, 21 Jan 2022 21:02:55 +0000 (00:02 +0300)]
Do not set GTF_NO_CSE for sources of block copies (#63462)

It is not necessary, the compiler fully supports locals
on the RHS of a struct assignment. Not marking these results
in a CQ improvement, from struct (including SIMD) CSEs and
global constant propagation into promoted fields.

2 years agoRefactor optimizing morph for commutative operations (#63251)
SingleAccretion [Fri, 21 Jan 2022 20:58:20 +0000 (23:58 +0300)]
Refactor optimizing morph for commutative operations (#63251)

* Create "fgOptimizeCommutativeArithmetic"

And just move code from "fgMorphSmpOp" to it.

Just one diff: better comma throw propagation in an ILGEN method.

* Refactor the function

Split it into specialized variants for each operator,
delete redundant code, fix up one case of wrong typing
for a constant in the MUL -> SHIFT optimization.

One CSE diff due to different VNs because of the typing
change for the constant (int -> long).

Many text diffs: "mov x3, 5" => "mov w3, 5".

2 years agoRegexNode cleanup (#64074)
Stephen Toub [Fri, 21 Jan 2022 20:10:28 +0000 (15:10 -0500)]
RegexNode cleanup (#64074)

No functional changes, just code cleanup:
- Move node types into a RegexNodeKind enum
- Rename some of the kinds to make them more descriptive
- Rename node.Next to node.Parent to better describe its purpose
- Add a bunch of comments about node kinds

2 years agoEnsure several helper intrinsics are correctly imported and handled (#63972)
Tanner Gooding [Fri, 21 Jan 2022 19:46:21 +0000 (11:46 -0800)]
Ensure several helper intrinsics are correctly imported and handled (#63972)

* Ensure several helper intrinsics are correctly imported and handled

* Ensure that Sum for TYP_INT/UINT on Arm64 is correctly handled

* Respond to PR feedback and ensure ExtractMostSignificantBits for Vector64<int/uint> on Arm64 also uses AddPairwise

* Applying formatting patch

* Ensure the clsHnd is correct

* Fix the remaining musl failures

* Ensure that we aren't sign-extending TYP_BYTE (System.SByte) for ExtractMostSignificantBits

* Ensure an assert is correct on x64

* Ensure Vector64<int/uint>.Dot on Arm64 uses AddPairwise, not AddAcross

* Apply formatting patch

2 years agoFixed IsFloatPositiveZero from returning 'true' on non-constant double operands ...
Will Smith [Fri, 21 Jan 2022 19:44:37 +0000 (11:44 -0800)]
Fixed IsFloatPositiveZero from returning 'true' on non-constant double operands (#64083)

* Fixed IsFloatPositiveZero from returning 'true' on non-constant double operands

* Update src/coreclr/jit/gentree.h

Co-authored-by: Egor Bogatov <egorbo@gmail.com>
Co-authored-by: Egor Bogatov <egorbo@gmail.com>
2 years ago[wasm][debugger] Apply changes on wasm using sdb protocol. (#63705)
Thays Grazia [Fri, 21 Jan 2022 18:10:04 +0000 (15:10 -0300)]
[wasm][debugger] Apply changes on wasm using sdb protocol. (#63705)

* Apply changes on wasm using sdb protocol.

* conflict

* Merge conflict.

* Fix merge

* Fix compilation error.

2 years agoAvoid additional local created for delegate invocations (#63796)
Jakob Botsch Nielsen [Fri, 21 Jan 2022 17:25:32 +0000 (18:25 +0100)]
Avoid additional local created for delegate invocations (#63796)

Very often 'this' is already a local and we can avoid creating another
local.

2 years agoILVerify: Handle readonly references in ldfld (#64077)
Jan Kotas [Fri, 21 Jan 2022 16:22:51 +0000 (08:22 -0800)]
ILVerify: Handle readonly references in ldfld (#64077)

* ILVerify: Handle readonly references in ldfld

Fixes #63953

* Fix test name

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
2 years agoFix crash when VS4Mac is debugging VS4Mac arm64 (#64085)
Mike McLaughlin [Fri, 21 Jan 2022 14:09:07 +0000 (06:09 -0800)]
Fix crash when VS4Mac is debugging VS4Mac arm64 (#64085)

Fix crash when VS4Mac is debugging VS4Mac arm64

Issue: https://github.com/dotnet/runtime/issues/64011

2 years ago[main] Update dependencies from 5 repositories (#64002)
dotnet-maestro[bot] [Fri, 21 Jan 2022 13:44:23 +0000 (14:44 +0100)]
[main] Update dependencies from 5 repositories (#64002)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Přemek Vysoký <premek.vysoky@microsoft.com>
2 years agoAdd StringSyntaxAttribute.Json (#64081)
Stephen Toub [Fri, 21 Jan 2022 12:44:36 +0000 (07:44 -0500)]
Add StringSyntaxAttribute.Json (#64081)

2 years agoInitial WASI support prototype (#63890)
Steve Sanderson [Fri, 21 Jan 2022 09:41:24 +0000 (09:41 +0000)]
Initial WASI support prototype (#63890)

2 years agoFix broken callstacks in interpreter on MonoVM. (#60338)
Johan Lorensson [Fri, 21 Jan 2022 09:31:08 +0000 (10:31 +0100)]
Fix broken callstacks in interpreter on MonoVM. (#60338)

* Fix some broken callstacks in interpreter.

* Fix build error.

2 years agoMake ILLink validation steps in libs incrementally buildable (#64041)
Viktor Hofer [Fri, 21 Jan 2022 09:09:24 +0000 (10:09 +0100)]
Make ILLink validation steps in libs incrementally buildable (#64041)

* Make ILLink validation steps in libs incrementally buildable

Both the illink-oob and the illink-sharedframework targets don't define Inputs and Outputs which makes them run during no-op incremental builds. This change defines Inputs and Outputs based on what's used during the target's execution so that if the input assemblies or the illink assembly itself haven't changed, the step will be skipped.

Also renaming properties and items to make them more readable and consistent. As these target files are "extensions" of the src.proj file and aren't shared anywhere, they can be treated like logic inside a project file and hence prefixing properties and items with an underscore "_" isn't necessary.

2 years agoImplement System.Runtime.CompilerServices.DisabledRuntimeMarshallingAttribute on...
Jeremy Koritzinsky [Fri, 21 Jan 2022 08:10:01 +0000 (00:10 -0800)]
Implement System.Runtime.CompilerServices.DisabledRuntimeMarshallingAttribute on CoreCLR-family of runtimes/type systems (#63320)

* Add the DisableRuntimeMarshallingAttribute to the build.

* Add initial test suite

* Implement support in IL stubs for the "disabled runtime marshalling" feature.

* Add testing for inlining IL stubs.

* Block SetLastError and LCID support when DisableRuntimeMarshallingAttribute is applied.

* Bump NativeAOT-only R2R version header (missed previously)

* Implement support in crossgen2 and NativeAOT

* Clean up the test tree and update the tests to fail more reliably when bugs are present.

Fix a bug that was uncovered when the tests were refactored.

* Fix NativeAOT and clean up crossgen2

* Add a test for NoPreserveSig with DisableRuntimeMarshalling

* Assign hr in SUCCEEDED macro.

* PR feedback.

* Block varargs in disabled marshalling mode.

* Fix typo

* Block types that have a field that is auto-layout somewhere in their layout.

* Fix typo

* Revert the AutoLayoutOrHasAutoLayoutFIeld check in the "marshalling enabled" case

* Only set scope when it isn't null (it's null for some cases).

* Fix narrowing conversion failure.

* First pass simple implementation in Mono

* Fix assert to still work for the built-in marshalling system

* S_FALSE is a thing

* Fix type load failures caused by eager type handle loading.

* Get MethodILScope from the calling method when available (this covers all cases where we need it)

* Add const modifier.

* Try 2 to fix const modifiers

* Fix compilation of NativeAOT jitinterface

* Fix type lookup in Mono

* Use try_get model for getting the attribute type in the case of failure. Fix mono implementation for looking up the attribute.

* Handle void and generic instantiations

* Update auto-layout check to check recursively in layout.

* Enhance test suite with more tests for UnmanagedCallersOnly, generics, and the like. Fix AutoLayout test.

* Fix IL and a few typos

* Set a value in the padding for easier debugging.

* Create sig->marshalling_disabled to track when marshalling is disabled, which is separate from the concept of "is this signature a P/Invoke"

* Fix running test suite on Mono + Mini JIT

* Fix recursive type load failure by only checking the "has auto-layout or field with auto-layout" for value types.

* Fix mono windows build.

* Feedback from Michal.

* Fix bug in EcmaAssembly.HasAssemblyCustomAttribute

* Make the runtime flavor check in the wrapper generator case-invariant

* Use helper method since various different platforms/configurations throw different exceptions for these scenarios.

* Fix AutoLayout test refactor and use a dummy value for the padding field in both enabled and disabled scenarios.

* Add an explicit test for using enums as they're a little weird and needed some special-casing.

* Fix build-time test filtering in xunit wrapper generator.

* Fix some x86-specific issues

* Add a nice big comment block.

* Fix x86

* Refactor tests so we can skip one on Mono since Char->char lossy conversion is not supported.

* Disable test in issues.targets until an alternative solution is reached.

* Add another SkipOnMono attribute in the "Enabled" test suite.

* Apply UnmangedFunctionPointerAttribute to help hint to the Mono LLVM AOT compiler to compile the managed->native thunks at aot-time

* Unify on "runtime marshalling" terminology

* Clean up unused usings.

* Address Jan's feedback except for applying the attribute to CoreLib.

* PR feedback.

* Mono throws an InvalidProgramException for varargs

* Fix copy-paste issue.

* Make sure we use the P/Invoke's Module and not the caller's module when deciding if runtime marshalling is enabled for a varargs P/Invoke call.

* Handle how LLVM AOT reports the failure to handle varargs (EEE)

2 years agodon't Flush readonly MemoryMappedViewAccessor on disposal (#63794)
Adam Sitnik [Fri, 21 Jan 2022 08:08:03 +0000 (09:08 +0100)]
don't Flush readonly MemoryMappedViewAccessor on disposal (#63794)

* don't Flush if it's impossible to write

* address code review feedback: apply same optimization to MemoryMappedViewStream

2 years agoIntroduce RandomAccess.SetLength (#63992)
Adam Sitnik [Fri, 21 Jan 2022 08:06:46 +0000 (09:06 +0100)]
Introduce RandomAccess.SetLength (#63992)

2 years agoUpdate the macOS CoreCLR building documentation. (#63932)
Kevin Jones [Fri, 21 Jan 2022 07:26:05 +0000 (02:26 -0500)]
Update the macOS CoreCLR building documentation. (#63932)

This updates the documentation to refer to the up-to-date location of
requirements and prerequisites.

2 years agoAdd pmi_path argument to superpmi.py script and use it in the superpmi-collect pipeli...
Egor Chesakov [Fri, 21 Jan 2022 03:23:21 +0000 (19:23 -0800)]
Add pmi_path argument to superpmi.py script and use it in the superpmi-collect pipeline. (#63983)

* Add -pmi_path argument to superpmi.py collect command and use it to set PMIPATH environment variable in src/coreclr/scripts/superpmi.py

* Set pmi_path to $(SuperPMIDirectory)\crossgen2

* Print a warning if -pmi_path or -pmi_location is specified while --pmi is not in src/coreclr/scripts/superpmi.py

* Move setting of PMIPATH environment variable under `if self.coreclr_args.pmi is True:` in src/coreclr/scripts/superpmi.py

* Move pmi argument validation to setup_args() in src/coreclr/scripts/superpmi.py

* Clone root_env if we are going to set PMIPATH environment variable in src/coreclr/scripts/superpmi.py

2 years agoRemove commented code (#63869)
Wrzucher [Fri, 21 Jan 2022 01:44:30 +0000 (07:44 +0600)]
Remove commented code (#63869)

2 years agoAllow CreateScalarUnsafe to be directly contained by hwintrinsics that support scalar...
Tanner Gooding [Fri, 21 Jan 2022 01:23:24 +0000 (17:23 -0800)]
Allow CreateScalarUnsafe to be directly contained by hwintrinsics that support scalar loads (#62407)

* Ensure that floating-point constants can be contained by hardware intrinsics

* Allow CreateScalarUnsafe to be directly contained by hwintrinsics that support scalar loads

* Rename IsContainableHWIntrinsicOp to TryGetContainableHWIntrinsicOp and improve handling

* Ensure that NI_AVX2_BroadcastScalarToVector128/256 are properly tracked as MaybeMemoryLoad

* Applying formatting patch

* Ensure a few other "maybe memory" and special memory operand size cases are handled

* Applying formatting patch

2 years agoEnable some browser legs on the extra-platforms pipeline (#64065)
Santiago Fernandez Madero [Fri, 21 Jan 2022 00:47:27 +0000 (16:47 -0800)]
Enable some browser legs on the extra-platforms pipeline (#64065)

* Enable some browser legs on the extra-platforms pipeline

* Flow platform parameter from helix queues templates

* Fix another condition

2 years agoLog message of unexpected exception in ThrowsAny (#64064)
Dan Moseley [Fri, 21 Jan 2022 00:14:54 +0000 (17:14 -0700)]
Log message of unexpected exception in ThrowsAny (#64064)

* Log message of unexpected exception in ThrowsAny

* Update AssertExtensions.cs