platform/upstream/dotnet/runtime.git
22 months agoUse IndexOfAnyValues in MailBnfHelper (#81486)
Stephen Toub [Wed, 1 Feb 2023 22:54:07 +0000 (17:54 -0500)]
Use IndexOfAnyValues in MailBnfHelper (#81486)

22 months agoCopy local intellisense xmls for assemblies with source of truth. (#79134)
Carlos Sanchez [Wed, 1 Feb 2023 22:29:00 +0000 (14:29 -0800)]
Copy local intellisense xmls for assemblies with source of truth. (#79134)

* Copy local intellisense xmls for assemblies with source of truth.

* use UseIntellisenseDocumentationFile instead

* Create intellisense.targets, which contains the Target that defines the set of files to copy, and the Target that copies each of those files into the artifacts/bin/docs folder.
The paths of the files to copy are dynamically defined depending if the assembly IsPackable property is set or not, and if the UseIntellisenseDocumentationFile boolean is set or not.

* Set UseIntellisenseDocumentationFile to true for the 3 assemblies that already have their source of truth in triple slash.

* Delete docs.targets, move package download to Build.proj

* Consume $(XmlDocDir) in Microsoft.NetCore.App.Ref.sfxproj

* Change condition to import intellisense.targets: Use $(IsSourceProject) == true

* Move XmlDocFileRoot to intellisense.targets, address suggestions for collecting xml file.

* Expand condition of CopyDocumentationFileToXmlDocDir to also check if IsNetCoreAppSrc == true.

* Change AfterTargets of CopyDocumentationFileToXmlDocDir from CoreCompile to CopyFilesToOutputDirectory

* Move PackageDownload to intellisense.targets

* Remove Choose+When. Readjust properties for Private.Intellisense files/folders. Fix conditions for doc file swap.

* Rename csproj property to something more clear.

* Default csproj property to true.

* Missed adding the "not previously set" condition for UseIntellisensePackageDocXmlFile in intellisense.targets.

* Remove incorrect condition in CopyDocumentationFileToXmlDocDir.

* Missed property reuse in Condition in sfxproj

* Only evaluate second IntellisensePackageXmlFile if the first one did not acquire any value.

* Move intellisense.targets import from root to libraries, right after the IsNetCoreAppSrc property is declared so we can use it.

* Enable CS1591, skip arcade warning

* Move SkipArcadeNoWarnCS1591 to src/libraries/Directory.Build.props to avoid coreclr failures

* Remove unnecessary slashes in sfxproj

* Move SkipArcadeNoWarn up to the top of src/libraries/Directory.Build.props to ensure it gets loaded before importing arcade.

* Revert Brotli and Vectors csproj changes. Those assemblies are either a partial facade or use PNSE.

* Add target to intellisense.targets that runs as InitialTarget of the current project, and throws errors if the UseIntellisensePackageDocXmlFile is set to false and the assembly is either a partial facade or uses PNSE.

* Improve error message: Mention the problematic property and the offending assembly.

* Added extra condition to verification target to only run when UseIntellisense... is not set to true.
Also moved the initial definition to its own solitary property group right before the verification target runs.

Rename the properties that acquire the value of a file path to "FilePath" instead of just "File", for clarity.

---------

Co-authored-by: smasher164 <akhilindurti@microsoft.com>
Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
22 months agoJIT: Update GTF_GLOB_REF after last-use copy omission (#81430)
Jakob Botsch Nielsen [Wed, 1 Feb 2023 21:34:28 +0000 (22:34 +0100)]
JIT: Update GTF_GLOB_REF after last-use copy omission (#81430)

Morph is responsible for marking accesses of address-exposed locals with
GTF_GLOB_REF, however the last-use copy elision can newly address expose
a preexisting local. This means previous uses that morph already saw
have not had GTF_GLOB_REF added. This updates the JIT to at least add
GTF_GLOB_REF on locals within the same statement as the call. This is
not a complete fix as nothing prevents downstream phases from reordering
the call with uses from earlier statements, but this at least fixes the
one issue we know of right now (which is itself stress-only).

A more complete fix will likely entail moving the identifying of
last-use candidates earlier and address exposing them at that point.
However, that first requires ABI determination to be moved earlier, so
this depends on #76926, which I expect to get to within the near future.

Fix #81049

22 months agoDo not strip resource messages if EventSource would use it (#81466)
Michal Strehovský [Wed, 1 Feb 2023 21:28:43 +0000 (06:28 +0900)]
Do not strip resource messages if EventSource would use it (#81466)

Works around #81459.

22 months agoDo not remove resource messages in Xml tests (#81463)
Michal Strehovský [Wed, 1 Feb 2023 21:28:09 +0000 (06:28 +0900)]
Do not remove resource messages in Xml tests (#81463)

Addresses first bullet of #81455.

Addresses 211 test failures to the tune of:

```
[FAIL] System.Xml.XmlSchemaValidatorApiTests.TCValidateWhitespace_String.WhitespaceInsideElement
System.Xml.Tests.VerifyException : GetManifestResourceStream() failed
   at System.Xml.Tests.ExceptionVerifier..ctor(String assemblyName, ExceptionVerificationFlags flags, ITestOutputHelper output) + 0x4c9
   at System.Xml.XmlSchemaValidatorApiTests.TCValidateWhitespace_String..ctor(ITestOutputHelper output) + 0x48
```

22 months agoMake newly introduced Immutable tests work with AOT. (#81464)
Michal Strehovský [Wed, 1 Feb 2023 21:27:18 +0000 (06:27 +0900)]
Make newly introduced Immutable tests work with AOT. (#81464)

Adds xunit garbage to fix 144 test failures that look like this:

```
[FAIL] System.Collections.Frozen.Tests.FrozenDictionary_Generic_Tests_SimpleStruct_int.LookupItems_AllItemsFoundAsExpected(size: 1024, comparer: NonDefaultEqualityComparer`1 { }, specifySameComparer: True, optimizeForReading: True)
System.NotSupportedException : 'Xunit.Sdk.AssertEqualityComparer`1[System.Collections.Generic.HashSet`1[System.Collections.Generic.KeyValuePair`2[System.Collections.Frozen.Tests.SimpleStruct, System.Int32]]].CompareTypedSets[System.Collections.Generic.KeyValuePair`2[System.Collections.Frozen.Tests.SimpleStruct, System.Int32]](System.Collections.IEnumerable,System.Collections.IEnumerable)' is missing native code. MethodInfo.MakeGenericMethod() is not compatible with AOT compilation. Inspect and fix AOT related warnings that were generated when the app was published. For more information see https://aka.ms/nativeaot-compatibility
   at System.Reflection.Runtime.MethodInfos.RuntimeNamedMethodInfo`1.GetUncachedMethodInvoker(RuntimeTypeInfo[], MemberInfo) + 0x2a
   at System.Reflection.Runtime.MethodInfos.RuntimeNamedMethodInfo`1.MakeGenericMethod(Type[]) + 0x1c0
   at System.Collections.Frozen.Tests.FrozenDictionary_Generic_Tests`2.LookupItems_AllItemsFoundAsExpected(Int32 size, IEqualityComparer`1 comparer, Boolean specifySameComparer, Boolean optimizeForReading) + 0x46d
```

22 months agoChange Source link version number refs to new properties (#81190)
Matt Mitchell [Wed, 1 Feb 2023 20:34:30 +0000 (12:34 -0800)]
Change Source link version number refs to new properties (#81190)

22 months agoFix conditions to bin place msquic.dll for Windows builds. (#81490)
Marie Píchová [Wed, 1 Feb 2023 20:21:00 +0000 (21:21 +0100)]
Fix conditions to bin place msquic.dll for Windows builds. (#81490)

22 months agoEnable in-build signing based on branch (#81496)
Matt Mitchell [Wed, 1 Feb 2023 20:18:26 +0000 (12:18 -0800)]
Enable in-build signing based on branch (#81496)

22 months agoTest merging IL_Conformance (#80597)
Brian Bohe [Wed, 1 Feb 2023 18:25:50 +0000 (15:25 -0300)]
Test merging IL_Conformance (#80597)

* Running ILTransform -n

A few ilproj were moved when deduplicating ilproj names but none of
those include refernces to il files using proj filename (as with
MSBuildProjectName).

* Running ILTransform -ilfile on JIT\IL_Conformance

Some il filenames were renamed to match their respective ilproj and
those ilproj file content were updated to use MSBuildProject
reference as il filenames.

* Running ILTransform -a on JIT/IL_Conformance

Update some assembly names to match il filenames.

* Running ILTransform -prociso on JIT/IL_Conformance

Isolate conv_ovf_i8_i.ilproj.

* Running ILTransform -public

* Running ILTransform -d

* Running ILTransform -ilfact

* Adding JIT/IL_Conformance merge tests wrapper

22 months agoFix ReaderWriterLock when using it in recursive scenarios and multiple instances...
Eduardo Velarde [Wed, 1 Feb 2023 18:03:25 +0000 (10:03 -0800)]
Fix ReaderWriterLock when using it in recursive scenarios and multiple instances on the same thread (#81257)

---------

Co-authored-by: Eduardo Manuel Velarde Polar <evelardepola@microsoft.com>
22 months ago[PERF] Remove Android Maui Scenarios from Runtime Repo (#81453)
Parker Bibus [Wed, 1 Feb 2023 17:48:39 +0000 (09:48 -0800)]
[PERF] Remove Android Maui Scenarios from Runtime Repo (#81453)

Remove references to Maui Android testing as the testing for it has moved to the performance repo.

22 months ago[browser] benchmark - generated JSON serializer (#81475)
Pavel Savara [Wed, 1 Feb 2023 17:31:24 +0000 (18:31 +0100)]
[browser] benchmark - generated JSON serializer (#81475)

* generated JSON serializer
* With that we can trim again
* fix console bench
Co-authored-by: Radek Doulik <radek.doulik@gmail.com>
22 months agoRemove ArgumentState "caching" that leaked memory deserialization. (#81473)
madelson [Wed, 1 Feb 2023 16:53:17 +0000 (11:53 -0500)]
Remove ArgumentState "caching" that leaked memory deserialization. (#81473)

* Remove ArgumentState "caching" that leaked memory deserialization.

fix #80933

* Remove now-unused field

22 months agoAvoid unobserved ReadAheadTask exceptions in HttpConnection (#80214)
Miha Zupan [Wed, 1 Feb 2023 16:12:58 +0000 (08:12 -0800)]
Avoid unobserved ReadAheadTask exceptions in HttpConnection (#80214)

* Rework ReadAheadTask impl in HttpConnection

* Handle sync exceptions in PrepareForReuse

* Split proactive EOF reactions out of the PR

* Add a few comments

* Remove the now-unnecessary ExecutionContext.IsFlowSuppressed dance

* PR feedback

22 months agoJIT: Avoid xchg for resolution (#81216)
Jakob Botsch Nielsen [Wed, 1 Feb 2023 10:12:25 +0000 (11:12 +0100)]
JIT: Avoid xchg for resolution (#81216)

LSRA today uses xchg for reg-reg resolution when there are cycles in the
resolution graph. Benchmarks show that xchg is handled much less
efficiently by Intel CPUs than using a few movs with a temporary
register. This PR enables using temporary registers for this kind of
resolution on xarch (it was already enabled for non-xarch
architectures). xchg is still used on xarch if no temporary register is
available.

Additionally this PR adds support for getting a temporary register even
for shared critical edges. Before this change we would spill on
non-xarch for this case.

Finally, we now try to prefer a non callee saved temporary register so
that we don't need to save/restore it in prolog/epilog.

This mostly fixes the string hashcode regressions from #80743.

22 months agoMerge pull request #81450 from tlakollo/SyncILLink
Marek Safar [Wed, 1 Feb 2023 09:47:37 +0000 (10:47 +0100)]
Merge pull request #81450 from tlakollo/SyncILLink

22 months agoEnable packaging of Microsoft.NET.ILLink.Tasks from runtime (#81446)
Tlakaelel Axayakatl Ceja [Wed, 1 Feb 2023 09:41:04 +0000 (01:41 -0800)]
Enable packaging of Microsoft.NET.ILLink.Tasks from runtime (#81446)

Co-authored-by: Tlakollo <tlcejava@microsoft.com>
22 months agoDrop _SampleProject and _SampleAssembly properties (#81421)
Marek Fišera [Wed, 1 Feb 2023 08:39:12 +0000 (09:39 +0100)]
Drop _SampleProject and _SampleAssembly properties (#81421)

22 months agoAdd note on WarningsAsErrors (#81451)
Michal Strehovský [Wed, 1 Feb 2023 08:22:59 +0000 (17:22 +0900)]
Add note on WarningsAsErrors (#81451)

22 months ago[wasm] Enable jiterpreter traces; fix floating point compares (#81417)
Katelyn Gadd [Wed, 1 Feb 2023 06:08:01 +0000 (22:08 -0800)]
[wasm] Enable jiterpreter traces; fix floating point compares (#81417)

This PR enables jiterpreter traces and fixes a bug in the implementation of floating point compares / floating point branches.

22 months agoMerge branch 'main' of ../linker into main
Tlakaelel Axayakatl Ceja [Wed, 1 Feb 2023 01:38:12 +0000 (01:38 +0000)]
Merge branch 'main' of ../linker into main

22 months agoAddress ConfigurationBinder feedback (#81384)
Tarek Mahmoud Sayed [Wed, 1 Feb 2023 00:50:52 +0000 (16:50 -0800)]
Address ConfigurationBinder feedback (#81384)

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
22 months agoBump main branding to .NET 8.0 Preview2 (#81399)
Carlos Sanchez [Wed, 1 Feb 2023 00:29:04 +0000 (16:29 -0800)]
Bump main branding to .NET 8.0 Preview2 (#81399)

* Bump main branding to .NET 8.0 Preview2

* Update the flow now that the version changed

* Manually bump emsdk to preview 2

* Update Versions.props

---------

Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
Co-authored-by: Larry Ewing <lewing@microsoft.com>
22 months agoRemove manual DLL copy from ILCompiler build task (#79783)
Andy Gocke [Tue, 31 Jan 2023 23:04:17 +0000 (15:04 -0800)]
Remove manual DLL copy from ILCompiler build task (#79783)

Rather than manually copying DLLs from the NuGet package directory
we can just set an MSBuild property to copy package dependencies
to the build output. This is also safer since it includes all the
transitive dependencies.

22 months agoDisallow setting Parent on the started Activity (#81394)
Tarek Mahmoud Sayed [Tue, 31 Jan 2023 23:02:39 +0000 (15:02 -0800)]
Disallow setting Parent on the started Activity (#81394)

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

22 months agoNativeAOT: Loop alignment support for xarch (#81206)
Kunal Pathak [Tue, 31 Jan 2023 22:26:42 +0000 (14:26 -0800)]
NativeAOT: Loop alignment support for xarch (#81206)

22 months agoEncode calling convention in mangled function pointer representation (#81122)
Tomáš Rylek [Tue, 31 Jan 2023 20:52:14 +0000 (21:52 +0100)]
Encode calling convention in mangled function pointer representation (#81122)

This fixes the recently introduced issue #81106 tracking Crossgen2
crash due to not being able to distinguish two function pointers
differing only by calling convention (one of the pointers is Static
and the other is Static | UnmanagedCallingConvention).

This change also removes the issues.targets exclusion for the
new function pointer test that Fan Yang had to add to unblock
merging in the test in the first place.

Thanks

Tomas

* Delete superfluous comment per Michal's PR feedback

22 months agoRewrite SpanHelpers.IndexOfNullByte/IndexOfNullCharacter to unmanaged pointers (...
Egor Bogatov [Tue, 31 Jan 2023 19:06:58 +0000 (20:06 +0100)]
Rewrite SpanHelpers.IndexOfNullByte/IndexOfNullCharacter to unmanaged pointers (#81347)

22 months ago[browser][MT] Calling JS functions from workers + config loading (#81273)
Pavel Savara [Tue, 31 Jan 2023 18:07:33 +0000 (19:07 +0100)]
[browser][MT] Calling JS functions from workers + config loading (#81273)

* calling JS functions from workers
* remove workaround
* config loading earlier

22 months agoFix nullability on `IDesignerSerializationProvider.GetSerializer` (#81203)
Lachlan Ennis [Tue, 31 Jan 2023 17:52:29 +0000 (03:52 +1000)]
Fix nullability on `IDesignerSerializationProvider.GetSerializer` (#81203)

* Fix nullability on IDesignerSerializationProvider.GetSerializer

* Add nullability to ref IDesignerSerializationProvider interface

22 months agoMore frozen collection perf, test, and cleanup improvements (#81389)
Stephen Toub [Tue, 31 Jan 2023 17:49:27 +0000 (12:49 -0500)]
More frozen collection perf, test, and cleanup improvements (#81389)

* More frozen collection perf, test, and cleanup improvements

- Changed SmallIntegerFrozenDictionary/Set implementations to be based on `IComparable<>` rather than `IBinaryInteger<>`.  This enables them to be used with comparable types other than integers and also be used in pre-.NET 7 builds, as well as to simplify consuming code. Codegen isn't quite as good for the types it did work with, but it's good enough (and will hopefully improve in the future.
- Removed SmallInt32FrozenDictionary/Set implementations, which as a result of the above changes are no longer needed.
- Rewrote FrozenHashtable.Create to avoid creating so many temporary allocations as part of setting up the hashtable.  It was creating a list per bucket, which on average would be a list per element.  This was not only a lot of allocation but also a significant time sink, with benchmarks showing this can up to halve construction time.
- Sorted some .csproj includes
- A few more tests to improve code coverage. Line coverage for the Frozen namespace is up to 99.1%.

* Address PR feedback

* Apply suggestions from code review

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
---------

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
22 months ago[JIT] X64/ARM64 - `CAST` removals for small types on `ADD`, `SUB`, `MUL`, `AND`,...
Will Smith [Tue, 31 Jan 2023 17:19:06 +0000 (09:19 -0800)]
[JIT] X64/ARM64 - `CAST` removals for small types on `ADD`, `SUB`, `MUL`, `AND`, `OR`, `XOR`, `NOT`, `NEG` (#77874)

22 months agoJIT: Skip LSRA inserted nodes in gcIsWriteBarrierCandidate (#81423)
Jakob Botsch Nielsen [Tue, 31 Jan 2023 16:54:22 +0000 (17:54 +0100)]
JIT: Skip LSRA inserted nodes in gcIsWriteBarrierCandidate (#81423)

gcIsWriteBarrierCandidate is expected to return the same results during
LSRA and during codegen, so it needs to skip GT_COPY and GT_RELOAD
inserted on top of the data node.

Fix #77141
Fix #77143

22 months agoAllow overriding WarningsAsErrors policy with an env variable (#81402)
Michal Strehovský [Tue, 31 Jan 2023 16:25:08 +0000 (01:25 +0900)]
Allow overriding WarningsAsErrors policy with an env variable (#81402)

* Allow overriding WarningsAsErrors policy with an env variable

Placing `WarningsAsErrors=false` in an environment variable will disable the repo policy to waste people's time with frivolous warnings in their inner dev loop.

* Update build.sh

22 months ago[mono][jit] arm64 neon opcodes (#81026)
Jan Dupej [Tue, 31 Jan 2023 16:23:50 +0000 (17:23 +0100)]
[mono][jit] arm64 neon opcodes (#81026)

* [mono] ARM64 NEON opcode encodings, part 1.

* [mono] ARM64 NEON binary encodings, part 2.

* [mono] ARM64 NEON binary encodings, part 3.

* [mono] ARM64 NEON binary encodings, part 5.

* [mono] ARM64 NEON binary encodings, part 6.

* [mono] ARM64 NEON binary encodings, part 7.

* [mono] ARM64 NEON binary encodings, part 8.

* [mono] ARM64 NEON binary encodings, part 9.

* [mono] ARM64 NEON binary encodings, part 10.

* [mono] ARM64 NEON binary encodings, part 11.

* [mono] ARM64 NEON binary encodings, part 12.

* [mono] ARM64 NEON binary encodings, part 13.

* [mono] ARM64 NEON binary encodings, part 14.

* [mono] ARM64 NEON binary encodings, part 16.

* [mono] ARM64 NEON binary encodings, part 17.

* [mono][jit] ARM64/NEON opcode binary encodings, fixes.

22 months agoFix formatting in list-of-diagnostics.md (#81396)
Jeff Handley [Tue, 31 Jan 2023 16:23:29 +0000 (08:23 -0800)]
Fix formatting in list-of-diagnostics.md (#81396)

* Fix formatting in list-of-diagnostics.md

I noticed the page currently renders with dangling `_` characters. This change cleans up the markdown formatting, changing the redundant `*_` to `_` and ensuring each is paried correctly.

I also improved alignment of the suppression table columns.

* Update docs/project/list-of-diagnostics.md

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
22 months ago[main] Update dependencies from dotnet/arcade (#81353)
dotnet-maestro[bot] [Tue, 31 Jan 2023 16:22:16 +0000 (11:22 -0500)]
[main] Update dependencies from dotnet/arcade (#81353)

* Update dependencies from https://github.com/dotnet/arcade build 20230127.1

Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions
 From Version 8.0.0-beta.23076.1 -> To Version 8.0.0-beta.23077.1

* Update dependencies from https://github.com/dotnet/arcade build 20230130.3

Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions
 From Version 8.0.0-beta.23076.1 -> To Version 8.0.0-beta.23080.3

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
22 months agoAdd MCREGs to fix the build for FreeBSD/arm64 (#81397)
Szczepan Ćwikliński [Tue, 31 Jan 2023 15:24:58 +0000 (16:24 +0100)]
Add MCREGs to fix the build for FreeBSD/arm64 (#81397)

* Add MCREGs to fix the build for FreeBSD/arm64

* Use &&

22 months agoJIT: Fix import of TrailingZeroCount on ARM64 (#81419)
Jakob Botsch Nielsen [Tue, 31 Jan 2023 14:52:37 +0000 (15:52 +0100)]
JIT: Fix import of TrailingZeroCount on ARM64 (#81419)

Fix #81366

22 months ago[wasm][debugger][libs] Documentation: How to debug library tests (#77368)
Ilona Tomkowicz [Tue, 31 Jan 2023 13:54:46 +0000 (14:54 +0100)]
[wasm][debugger][libs] Documentation: How to debug library tests (#77368)

* Draft.

* DevTools as IDE instructions.

* VS Code as IDE instructions.

* Correction: `WebRoot` is not required.

* Added: expect long wait & new pic without webRoot

* Renamed as suggested by @pavelsavara.

* The first bp is not automatic, user has to set it on their own.

22 months ago[wasm][libs] Fix `WasmAppHost`, and `AppBundle` for library tests (#77719)
Ilona Tomkowicz [Tue, 31 Jan 2023 13:53:15 +0000 (14:53 +0100)]
[wasm][libs] Fix `WasmAppHost`, and `AppBundle` for library tests (#77719)

* Removed fixed path separator + duplicated `browser-wasm`.

* Working fix.

* Fix for different `OutputPath` conventions.

* Fixing the url printed on the console.

* `ProcessQueryArguments` in test-main.js forces debug to be the 1st arg.

* Removing special case for WBT.

* We cannot skip checking for missing browser-wasm.

* Both runArgs and queryArgs are important when running tests.

* Revert changes in the shipped targets and move them to tests targets.

* Update src/mono/wasm/host/BrowserArguments.cs

Co-authored-by: Ankit Jain <radical@gmail.com>
* Fetch does not work for node<18 => get rid of json.

* Separated runtime args from app args for both hosts.

* Revert 7.0 file.

* Focusing on enabling libs debugging for browser.

* Should have been reverted with dae5d7460c3a23b108e1d141e72c3b0bcdc9d730.

* Fix CI lib tests: avoid referencing undefined properties.

* In all the cases runArgs should be first populated by defaults that can be later overwritten.

* Update src/mono/wasm/test-main.js

Co-authored-by: Ankit Jain <radical@gmail.com>
---------

Co-authored-by: Ankit Jain <radical@gmail.com>
22 months agoEnable CA1859 - Use concrete types when possible for improved performance (#80848)
Marek Safar [Tue, 31 Jan 2023 13:46:51 +0000 (14:46 +0100)]
Enable CA1859 - Use concrete types when possible for improved performance (#80848)

22 months agoImprove Http2Connection buffer management (#79484)
Miha Zupan [Tue, 31 Jan 2023 12:52:05 +0000 (04:52 -0800)]
Improve Http2Connection buffer management (#79484)

* Improve Http2Connection buffer management

* Add a test

* Add a few comments around buffer disposal

22 months agoImprove and dedup GetNonZeroBytes (#81340)
Stephen Toub [Tue, 31 Jan 2023 12:50:56 +0000 (07:50 -0500)]
Improve and dedup GetNonZeroBytes (#81340)

- RsaPaddingProcessor has its own complete copy; that now appears to be an unnecessary duplication.
- If a zero byte is found, the implementation currently looks at the rest of the bytes byte by byte.  We expect 0s to be rare, so copy in bulk instead.

22 months ago[Android] Fix System.IO.MemoryMappedFiles tests (#81368)
Šimon Rozsíval [Tue, 31 Jan 2023 09:41:56 +0000 (10:41 +0100)]
[Android] Fix System.IO.MemoryMappedFiles tests (#81368)

22 months agofix the space in build-job.yml (#81414)
Kunal Pathak [Tue, 31 Jan 2023 08:24:06 +0000 (00:24 -0800)]
fix the space in build-job.yml (#81414)

22 months agoCalculate PackageVersionNet6 off PackageVersionNet7 (#81401)
Larry Ewing [Tue, 31 Jan 2023 03:02:55 +0000 (21:02 -0600)]
Calculate PackageVersionNet6 off PackageVersionNet7 (#81401)

22 months agoUpdate fgGetTopLevelQmark to handle GT_LCL_FLD (#81375)
Tanner Gooding [Tue, 31 Jan 2023 02:55:45 +0000 (18:55 -0800)]
Update fgGetTopLevelQmark to handle GT_LCL_FLD (#81375)

22 months agoFully resolve WasmNativeWorkload and WasmNativeWorkloadAvailable (#81393)
Larry Ewing [Tue, 31 Jan 2023 01:45:57 +0000 (19:45 -0600)]
Fully resolve WasmNativeWorkload and WasmNativeWorkloadAvailable (#81393)

22 months agoNarrow PAL tests for _vsnprintf_s (#81381)
Aaron Robinson [Tue, 31 Jan 2023 01:08:50 +0000 (17:08 -0800)]
Narrow PAL tests for _vsnprintf_s (#81381)

The .NET version of _vsnprintf_s defers to the
system provided printf so reducing the cases
to only what is needed for truncating validation.

22 months agoUse SetupProperties to set properties related to NativeAOT and remove the top-level...
Jackson Schuster [Tue, 31 Jan 2023 00:33:59 +0000 (16:33 -0800)]
Use SetupProperties to set properties related to NativeAOT and remove the top-level defaults (#79233)

22 months agoRe-enable producing call stack from crashreport.json (#81387)
Kunal Pathak [Tue, 31 Jan 2023 00:07:39 +0000 (16:07 -0800)]
Re-enable producing call stack from crashreport.json (#81387)

* Revert "Revert "Produce crashreport.json and use llvm-symbolizer to create stack trace (#77578)" (#81379)"

This reverts commit 3c76e140da9539e1fc0e0a44af0af3e01ceca920.

* Add nativeSymbols only for PRs

22 months agoInline resource strings in the compiler (#80896)
Michal Strehovský [Mon, 30 Jan 2023 23:53:42 +0000 (08:53 +0900)]
Inline resource strings in the compiler (#80896)

On a high level:
* When we're looking at IL to do substitutions, we additionally look for calls to `SR.SomeResourceName`. These are generated properties (generated by a piece of code in Arcade) that basically just do `GetResourceString(nameof(SomeResourceName))`. We look up what the resource string is (in the manifest resource) and replace the call with the looked up string literal.
* We also keep track of calls to `SR.GetResourceString`. Seeing this in the graph means that the optimization was defeated - someone bypassed the generated accessors. If we see one, we add dependency graph node to the graph that represent the manifest resource that has the string.
* When generating managed resources we skip over the one that has the strings unless the above dependency node is in the graph. This allows optimizing away the resource blobs if all accesses were inlined.

22 months agoJIT: build pred lists before instrumentation (#81288)
Andy Ayers [Mon, 30 Jan 2023 23:25:58 +0000 (15:25 -0800)]
JIT: build pred lists before instrumentation (#81288)

Move pred list building to just before instrumentation (and just after
importation -- we are getting very close to the front of the phase list now).

The block and edge count instrumenters were both using cheap preds to keep
track of some relocated count probes. Revise this so they can use the regular
pred lists. Also rework both approaches so their `RelocateProbes` methods are
fairly similar and perhaps could be unified one day.

Contributes to #80193.

22 months agoRevert "Produce crashreport.json and use llvm-symbolizer to create stack trace (...
Kunal Pathak [Mon, 30 Jan 2023 21:42:46 +0000 (13:42 -0800)]
Revert "Produce crashreport.json and use llvm-symbolizer to create stack trace (#77578)" (#81379)

This reverts commit ff987dc063e954d5b88a14b28ca54c1a25f01294.

22 months ago[wasm][debugger] Fix firefox tests (#81364)
Thays Grazia [Mon, 30 Jan 2023 19:32:47 +0000 (16:32 -0300)]
[wasm][debugger] Fix firefox tests (#81364)

* Fix firefox tests

* fix debugger tests on firefox

* fix firefox debugger tests

* remove unrelated change

* adressing radical comments

22 months ago[wasm][debugger] Default null columnNumber to 0 (#81336)
Larry Ewing [Mon, 30 Jan 2023 18:11:10 +0000 (12:11 -0600)]
[wasm][debugger] Default null columnNumber to 0 (#81336)

* Default null columnNumber to 0

* Fix compilation

* adding test case

---------

Co-authored-by: Thays Grazia <thaystg@gmail.com>
22 months agoOptimize the SqlGuid struct (#72549)
Michał Petryka [Mon, 30 Jan 2023 17:35:49 +0000 (18:35 +0100)]
Optimize the SqlGuid struct (#72549)

* Optimize the SqlGuid struct

Optimizes the SqlGuid struct according to the idea
from #51836.

* Update SQLGuid.cs

* Apply suggestions

* Update SQLGuid.cs

* Update SQLGuid.cs

* Update ref assembly

* Update System.Data.Common.cs

* Apply suggestions

* Update SQLGuid.cs

* Update SQLGuid.cs

* Update SQLGuid.cs

* Add a comment about binary serialization

* Expand on the comment for backwards-compatible binary serialization

---------

Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
22 months agoRemove additional null-check from ActivityCreationOptions (#81351)
Vladimir Chirikov [Mon, 30 Jan 2023 16:49:11 +0000 (19:49 +0300)]
Remove additional null-check from ActivityCreationOptions (#81351)

22 months ago[wasm] Misc fixes (#81320)
Ankit Jain [Mon, 30 Jan 2023 16:43:38 +0000 (11:43 -0500)]
[wasm] Misc fixes (#81320)

* [wasm] Catch warnings in wasm template project builds

This will help catch warnings like the ones fixed in https://github.com/dotnet/runtime/pull/77704

* [wasm][debugger] tests: fix warning

`[18:17:44] warn: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[16] The WebRootPath was not found: /datadisks/disk1/work/B4180A14/w/992108AB/e/DebuggerTestSuite/wwwroot.  Static files may be unavailable.`

22 months agoJIT: Avoid creating stores to dead fields in block morphing (#81095)
Jakob Botsch Nielsen [Mon, 30 Jan 2023 14:40:17 +0000 (15:40 +0100)]
JIT: Avoid creating stores to dead fields in block morphing (#81095)

Fix #80498

22 months agoUpdate dependencies from https://github.com/dotnet/arcade build 20230127.1 (dotnet...
dotnet-maestro[bot] [Mon, 30 Jan 2023 13:59:09 +0000 (13:59 +0000)]
Update dependencies from https://github.com/dotnet/arcade build 20230127.1 (dotnet/linker#3195)

[main] Update dependencies from dotnet/arcade

Commit migrated from https://github.com/dotnet/linker/commit/c4b2869923dfd9a9f49799f6373ef34e622e8564

22 months agoDelete HeapEnableTerminationOnCorruption setting (#81343)
Jan Kotas [Mon, 30 Jan 2023 13:38:53 +0000 (05:38 -0800)]
Delete HeapEnableTerminationOnCorruption setting (#81343)

HeapEnableTerminationOnCorruption is enabled by default for subsystem major version 6 that we have set for our binaries. Also delete intranet link to a document that does not exist anymore.

22 months agoRe-enable OneLocBuild (#81296)
Viktor Hofer [Mon, 30 Jan 2023 12:38:12 +0000 (13:38 +0100)]
Re-enable OneLocBuild (#81296)

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

22 months agoIcu wasi package (#81345)
Meri Khamoyan [Mon, 30 Jan 2023 12:25:10 +0000 (16:25 +0400)]
Icu wasi package (#81345)

Update icu packages for wasi-wasm

22 months agofix fgMorphArgs for stress mode (#81346)
Egor Bogatov [Mon, 30 Jan 2023 12:14:41 +0000 (13:14 +0100)]
fix fgMorphArgs for stress mode (#81346)

22 months agoMore thoroughly check for function pointers (#81344)
Michal Strehovský [Mon, 30 Jan 2023 11:52:26 +0000 (20:52 +0900)]
More thoroughly check for function pointers (#81344)

Fixes #81117.

22 months ago[Android] Fix SslStream IsMutuallyAuthenticated on Android API 21-27
Šimon Rozsíval [Mon, 30 Jan 2023 10:02:08 +0000 (11:02 +0100)]
[Android] Fix SslStream IsMutuallyAuthenticated on Android API 21-27

22 months agoAdd reflection path for ActivatorUtilities.CreateFactory (#81262)
James Newton-King [Mon, 30 Jan 2023 08:57:02 +0000 (16:57 +0800)]
Add reflection path for ActivatorUtilities.CreateFactory (#81262)

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Fixes https://github.com/dotnet/runtime/issues/81258

22 months agoChange Nullability annotation on `ISelectionService.PrimarySelection` (#81254)
Lachlan Ennis [Mon, 30 Jan 2023 03:23:56 +0000 (13:23 +1000)]
Change Nullability annotation on `ISelectionService.PrimarySelection` (#81254)

* Change Nullability on ISelectionService.PrimarySelection

* Add nullability to ref ISelectionService interface

22 months agoDisable function pointer test for crossgen due to a bug (#81286)
Fan Yang [Mon, 30 Jan 2023 01:22:46 +0000 (20:22 -0500)]
Disable function pointer test for crossgen due to a bug (#81286)

22 months agoEliminate a bounds check in `NumberBuffer` (#81039)
xtqqczze [Mon, 30 Jan 2023 01:22:17 +0000 (01:22 +0000)]
Eliminate a bounds check in `NumberBuffer` (#81039)

* Eliminate a bounds check in `NumberBuffer`

* Add AggressiveInlining

22 months ago[main] Update dependencies from dotnet/icu dotnet/roslyn-analyzers (#81265)
dotnet-maestro[bot] [Mon, 30 Jan 2023 01:16:51 +0000 (20:16 -0500)]
[main] Update dependencies from dotnet/icu dotnet/roslyn-analyzers (#81265)

* Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20230126.2

Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers
 From Version 3.3.5-beta1.23076.1 -> To Version 3.3.5-beta1.23076.2

* Update dependencies from https://github.com/dotnet/icu build 20230127.1

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 8.0.0-alpha.1.23076.1 -> To Version 8.0.0-alpha.1.23077.1

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
22 months agoFixing a comment attached to DEFAULT_UNROLL_LOOP_MAX_ITERATION_COUNT (#81300)
Tanner Gooding [Sun, 29 Jan 2023 17:12:48 +0000 (09:12 -0800)]
Fixing a comment attached to DEFAULT_UNROLL_LOOP_MAX_ITERATION_COUNT (#81300)

* Fixing a comment attached to DEFAULT_UNROLL_LOOP_MAX_ITERATION_COUNT

* Update src/coreclr/jit/compiler.h

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
---------

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
22 months agoUse IndexOf in RsaPaddingProcessor.FillNonZeroBytes (#81327)
Stephen Toub [Sun, 29 Jan 2023 16:03:01 +0000 (11:03 -0500)]
Use IndexOf in RsaPaddingProcessor.FillNonZeroBytes (#81327)

22 months agoPublish `UpDownCounter` and `ObservableUpDownCounter` Events for System.Diagnostics...
kkeirstead [Sun, 29 Jan 2023 00:56:15 +0000 (16:56 -0800)]
Publish `UpDownCounter` and `ObservableUpDownCounter` Events for System.Diagnostics.Metrics (#81041)

Add support for publishing UpDownCounter (and Observable...) - also added in the missing testing for this.

22 months ago[wasm] Update emsdk dependency to `8.0.0-alpha.1.23077.4` (#81312)
Ankit Jain [Sat, 28 Jan 2023 20:08:27 +0000 (15:08 -0500)]
[wasm] Update emsdk dependency to `8.0.0-alpha.1.23077.4` (#81312)

Added this with `darc add-dependency` this time, instead of a manual
edit.

22 months agoFix use-after-free in EventPipe (#81135)
Jeremy Koritzinsky [Sat, 28 Jan 2023 19:32:52 +0000 (11:32 -0800)]
Fix use-after-free in EventPipe (#81135)

Co-authored-by: Aaron Robinson <arobins@microsoft.com>
Co-authored-by: Elinor Fung <elfung@microsoft.com>
22 months agoRemove `printf` implementation (#81243)
Aaron Robinson [Sat, 28 Jan 2023 16:43:56 +0000 (08:43 -0800)]
Remove `printf` implementation (#81243)

* Remove PAL_printf and PAL_vprintf

Replace implementation of file related printfs using the
platform implementation (PAL_fprintf and PAL_vfprintf).

Remove tests for PAL_printf, PAL_vprintf, PAL_fprintf and
PAL_vfprintf since they are all now supplied by the platform.

* Remove underlying printf impl

Left _vsnprintf_s tests to ensure the _TRUNCATE
logic is validated.

22 months agoPropagate cancellation tokens to TrySetCanceled in Dataflow (#80978)
Stephen Toub [Sat, 28 Jan 2023 16:04:49 +0000 (11:04 -0500)]
Propagate cancellation tokens to TrySetCanceled in Dataflow (#80978)

* Propagate cancellation tokens to TrySetCanceled in Dataflow

When the System.Threading.Tasks.Dataflow library was originally written, CancellationTokenSource's TrySetCanceled didn't have an overload that allowed passing in the CancellationToken that was the cause of the cancellation. Now it does, and we no longer build for target platforms that lack the needed overload.  Thus we can update the library to propagate it everywhere that's relevant.  In some cases, to do this well we do need to rely on a newer CancellationToken.Register overload that accepts a delegate which accepts a token, so there's a little bit of ifdef'ing involved still.

While doing this, I also took the opportunity to sprinkle some `static`s onto lambdas, since I was already doing so for some lambdas as part of this fix.

* Fix pipelines handling of cancellation token

Flush operations were synchronously throwing an exception if cancellation was requested prior to the operation.  Cancellation exceptions should always be propagated out through the returned task.

* Fix pre-cancellation in QuicStream.WriteAsync

Cancellation exceptions should flow out through the returned task, not synchronously.

22 months ago[wasm][mt] Don't call Module.removeRunDependency in workers (#81311)
Aleksey Kliger (λgeek) [Sat, 28 Jan 2023 13:22:52 +0000 (08:22 -0500)]
[wasm][mt] Don't call Module.removeRunDependency in workers (#81311)

Fixes a sporadic hang that depends on the order in which webworkers get initialized.

The way `removeRunDependency` works is that it decrements a counter (incremented by `addRunDependency`) and when the counter hits 0 it runs a callback that runs `run`.

The problem is that on workers there are no other dependencies, so `removeRunDependency("wasm_pre_init_essential")` ticks the counter down to 0 and calls `run`.

The second problem is that `run` on a worker short-circuits most of the logic and just calls `readyPromiseResolve`, `initRuntime` and `postMessage` and returns.

So the worker posts a message back to the main thread that it is loaded.

Then the main body of dotnet.js in the worker calls `run` a second time. And we send a second `postMessage`.

So the main thread receives 2 "loaded" message for each worker in the pool.

That messes up the counter in `instantiateWasmPThreadWorkerPool` which is waiting for every fresh worker to send just 1 message before allowing the main thread to continue.

As a result, by the time the main thread runs some user code, only half the workers have loaded.

Depending on the timing, that could mean that if the main thread attempts to start a new pthread, that pthread might be in a worker that hasn't loaded the runtime yet.  In that case, the pthread start function doesn't get called, and the main thread hangs in Mono's `create_thread()` helper waiting for the `start_info->registered` semaphore that will never be posted.

22 months ago[mono][wasm] Avoid passing the icall name/c function name to mono_register_jit_icall_...
Zoltan Varga [Sat, 28 Jan 2023 09:54:07 +0000 (04:54 -0500)]
[mono][wasm] Avoid passing the icall name/c function name to mono_register_jit_icall_info () on wasm. (#81293)

It creates unused string literals.

22 months ago[mono] Clean up StackTrace/StackFrame icalls. (#81303)
Zoltan Varga [Sat, 28 Jan 2023 09:53:46 +0000 (04:53 -0500)]
[mono] Clean up StackTrace/StackFrame icalls. (#81303)

* Register them normally in icall-def.h instead of calling
  mono_add_internal_call ().
* Remove unused Mono.Runtime::mono_runtime_install_handlers
  icall registration.
* Use ObjectHandleOnStack to pass/return objects.
* Move some of the logic to icall.c.

22 months ago[mono] Use mono_is_sre functions instead of checking class names in more places....
Zoltan Varga [Sat, 28 Jan 2023 04:01:39 +0000 (23:01 -0500)]
[mono] Use mono_is_sre functions instead of checking class names in more places. (#81305)

22 months agoFix the error condition for objcopy (#81304)
Adeel Mujahid [Sat, 28 Jan 2023 03:14:08 +0000 (05:14 +0200)]
Fix the error condition for objcopy (#81304)

22 months ago[workloads] Add Current to the name of the workload manifest (#80401)
Steve Pfister [Sat, 28 Jan 2023 02:32:42 +0000 (21:32 -0500)]
[workloads] Add Current to the name of the workload manifest (#80401)

https://github.com/dotnet/sdk/commit/f5cb7e3c3eb631d13a1bdc6033f399cf8a1ceadb introduced a change that would make `microsoft.net.workload.mono.toolchain` an outdated id in order to work around manifest errors when older previews of the .NET 7 SDK were installed. The unfortunate side effect of this change meant the name of the runtime manifest needs to be changed.

On the main branch, the manifest id will now contain current in the name for the .net version being developed.

Co-authored-by: Ankit Jain <radical@gmail.com>
22 months agoForbid creation of non-faulting null-check nodes. (#77078)
Julie Lee [Sat, 28 Jan 2023 02:02:21 +0000 (18:02 -0800)]
Forbid creation of non-faulting null-check nodes. (#77078)

* Forbid creation of non-faulting null-check nodes.

* Skip null check if op1 cannot be null.

* x86 bug fix for Skip gtChangeOperToNullCheck if it cannot be null.

* Fix Arm64 AVE: Do not lower indir when NOP.

* formatting fix.

* Arm64 regression bug fix that removes const bool for a variable.

* Preserve const and shorten expression.

* Fix format.

* Addressed code review feedback

* Forbid creation of non-faulting nullcheck node: Addressed feedback

* Forbid creation of non-faulting null-check nodes: Remove duplicate codes that was supposed to be deleted.

22 months ago[mono][jit] Improve handling of the ldtoken+ltoken+Type::op_Equal optimization. ...
Zoltan Varga [Sat, 28 Jan 2023 01:41:56 +0000 (20:41 -0500)]
[mono][jit] Improve handling of the ldtoken+ltoken+Type::op_Equal optimization. (#81277)

Previously, only comparisons with gshared types were handled, but if gsharing
is disabled, its possible to run into cases where both ldtoken calls product
a concrete type.

22 months agoFix x86 clrgc loading (#81176)
Andrew Au [Fri, 27 Jan 2023 23:43:56 +0000 (15:43 -0800)]
Fix x86 clrgc loading (#81176)

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
22 months agoReduce the size of HttpRequestMessage and HttpRequestHeaders (#81251)
Miha Zupan [Fri, 27 Jan 2023 23:04:39 +0000 (15:04 -0800)]
Reduce the size of HttpRequestMessage and HttpRequestHeaders (#81251)

* Reduce the size of HttpRequestMessage and HttpRequestHeaders

* Assert that the request message can't transition from Disposed to non-Disposed

22 months ago[wasm] Pin the sdk version to avoid a regression (#81301)
Ankit Jain [Fri, 27 Jan 2023 22:56:38 +0000 (17:56 -0500)]
[wasm] Pin the sdk version to avoid a regression (#81301)

.. in manifest ordering in `IncludedWorkloadManifests.txt` caused by
https://github.com/dotnet/installer/pull/15346/commits/717f422202f5fb3494e8f79f96e3a27e83fc72c0
, which the workload causing relinking to break in WBT.

The version with the bug is : 8.0.100-alpha.1.23077.4

22 months agoRevert "Fix generic parameter data flow validation in NativeAOT (#80956)" (#81259)
Michal Strehovský [Fri, 27 Jan 2023 21:55:33 +0000 (06:55 +0900)]
Revert "Fix generic parameter data flow validation in NativeAOT (#80956)" (#81259)

This reverts commit aa5e31310ef892995e7832f30acf8d78bfd0f5c2.

22 months ago[browser][MT] conditional revert of wasm imports optimization (#81275)
Pavel Savara [Fri, 27 Jan 2023 21:32:00 +0000 (22:32 +0100)]
[browser][MT] conditional revert of wasm imports optimization (#81275)

* conditional revert of https://github.com/dotnet/runtime/pull/79466

* feedback

22 months agoJIT: Switch tailcall implicit byref optimization to use last use information (#81033)
Jakob Botsch Nielsen [Fri, 27 Jan 2023 20:52:04 +0000 (21:52 +0100)]
JIT: Switch tailcall implicit byref optimization to use last use information (#81033)

The last use information is more general in most cases (for example, the
old logic cannot allow the optimization when there are previous field
writes to the implicit byref). In addition the old logic can interact
with the new last-use copy elision optimization in an incorrect way.

Fix #81019

22 months agoChange the default loop unroll limit to 4 (#80353)
Tanner Gooding [Fri, 27 Jan 2023 20:46:26 +0000 (12:46 -0800)]
Change the default loop unroll limit to 4 (#80353)

* Change the default loop unroll limit to 4

* Remove verification testing for two complex tests involving both loop unrolling and large amounts of dead code elimination

22 months agoEnsure various scalar cross platform helper APIs are handled directly as intrinsic...
Tanner Gooding [Fri, 27 Jan 2023 20:46:04 +0000 (12:46 -0800)]
Ensure various scalar cross platform helper APIs are handled directly as intrinsic (#80789)

* Ensure various scalar cross platform helper APIs are handled directly as intrinsic

* Small refactoring to lookupNamedIntrinsic and impIntrinsic to improve TP

22 months agoMake System.Reflection.Emit public types abstract (#78544)
Buyaa Namnan [Fri, 27 Jan 2023 20:35:56 +0000 (12:35 -0800)]
Make System.Reflection.Emit public types abstract (#78544)

* Add abstract AssemblyBuilder

* Create managed RuntimeAssemblyBuilder

* Add RuntimeAssemblyBuilder to the build

* Boilerplate for RuntimeAssemblyBuilder

* Emit Assembly record

* Fixups after rebase

* Add temporary ReflectionEmitLoadContext

* Factor out RuntimeModuleBuilder

* Abstract TypeBuilder and EventBuilder

* Refactor PropertyBuilder

* Refactor EnumBuilder

* Refactor FieldBuilder

* Refactor ConstructorBuilder and MethodBuilder

* Move suppressions into the common file

---------

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
22 months agoTarget lower glibc for Linux arm64 (#80939)
Sven Boemer [Fri, 27 Jan 2023 20:31:02 +0000 (12:31 -0800)]
Target lower glibc for Linux arm64 (#80939)

This uses new cross-build images that target Ubuntu 16.04,
lowering the glibc requirements. The initial change is only for
Linux arm64, to match what we plan to do in .NET 7. The 8.0
change will let us validate the PGO instrumentation, which
happens in official builds, but not in PR jobs.

22 months agoAdd MemoryExtensions.Count (#80662)
Sandro Bollhalder [Fri, 27 Jan 2023 20:24:05 +0000 (21:24 +0100)]
Add MemoryExtensions.Count (#80662)

* Add MemoryExtensions.Count

* add test cases

* fix implementation

* fix review comments part I

* more tests

* return 0 if value is Empty

* Address PR feedback

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>