platform/upstream/dotnet/runtime.git
3 years agoSpeed up SuperPMI (#49962)
Bruce Forstall [Sun, 21 Mar 2021 22:07:04 +0000 (15:07 -0700)]
Speed up SuperPMI (#49962)

SuperPMI logging was doing a lot of work even if no log output was
asked for. For example, there are LogDebug() calls in the recordRelocation
path that were doing all the printf work and memory allocation even though
we were not logging anything.

Add a fast-path return to avoid all this unnecessary work.

3 years agoAdd comment for GCDesc::GetNumPointers (#49951)
Jan Kotas [Sun, 21 Mar 2021 22:05:58 +0000 (15:05 -0700)]
Add comment for GCDesc::GetNumPointers (#49951)

3 years agoFix release build infinite loop (#49943)
Bruce Forstall [Sun, 21 Mar 2021 21:56:54 +0000 (14:56 -0700)]
Fix release build infinite loop (#49943)

The problem manifested as an infinite loop during the StackLevelSetter phase
in the release build SuperPMI replay of the tests, but also occurs as a
normal release build test run of the varargsupport.il test.

The issue is we had corrupt LIR gtPrev links, with a cycle. The problem had
nothing to do with StackLevelSetter -- it just happened to be the first phase
that iterated in reverse over the gtPrev links.

The corruption was introduced in the importer, in
`verConvertBBToThrowVerificationException`. It required a verification failure
in a filter (possibly also catch) clause where the JIT would throw away the
currently imported code and convert the block to a call to the verification
failure helper.

This was a classic case of important, functional code being under `#ifdef DEBUG`
that is needed in non-DEBUG as well.

The result was we would end up adding an `ASG(LCL_VAR, CATCH_ARG)` to the statement
list twice, with the same `CATCH_ARG` node.

Fixes #45580

3 years ago[Wasm][AOT] Add the ability to the display the native stack frames (#49828)
Thays Grazia [Sun, 21 Mar 2021 19:49:58 +0000 (16:49 -0300)]
[Wasm][AOT] Add the ability to the display the native stack frames (#49828)

* Another approach for PR #45124

* After discussion with @radical, decided to add this comment and use mono_runtime_printf_err.

3 years agoRemove unnecessary property setting in corerun. (#49950)
Aaron Robinson [Sun, 21 Mar 2021 17:03:52 +0000 (10:03 -0700)]
Remove unnecessary property setting in corerun. (#49950)

* Remove unnecessary property setting in corerun.

* Remove unused get_envvar_as_boolean()

3 years agoAdd a CustomConstantAttribute test (#49748) (#49767)
Sychev Vadim [Sun, 21 Mar 2021 08:06:25 +0000 (11:06 +0300)]
Add a CustomConstantAttribute test (#49748) (#49767)

There is a test the custom constant attribute assigns the default value to Type.Missing parameter.

3 years agoFix release builds with latest VS dogfood (#49948)
Jan Kotas [Sun, 21 Mar 2021 05:08:16 +0000 (22:08 -0700)]
Fix release builds with latest VS dogfood (#49948)

Apply workaround recommended by VC++ team

3 years agoDelete unnecessary linker options (#49938)
Jan Kotas [Sun, 21 Mar 2021 02:10:42 +0000 (19:10 -0700)]
Delete unnecessary linker options (#49938)

3 years agoResolve new ILLink warnings in Microsoft.Extensions.DependencyInjection (#49887)
Eric Erhardt [Sun, 21 Mar 2021 01:06:29 +0000 (20:06 -0500)]
Resolve new ILLink warnings in Microsoft.Extensions.DependencyInjection (#49887)

* Resolve new ILLink warnings in Microsoft.Extensions.DependencyInjection

These two new warnings came in because of:

1. #48823
2. #47938

* Use GetProperty.

3 years agoApple Silicon Fix EEJitManager::CleanupCodeHeaps() (#49942)
Steve MacLean [Sun, 21 Mar 2021 00:42:59 +0000 (20:42 -0400)]
Apple Silicon Fix EEJitManager::CleanupCodeHeaps() (#49942)

3 years agoUpdate dependencies from https://github.com/dotnet/xharness build 20210319.2 (#49934)
dotnet-maestro[bot] [Sat, 20 Mar 2021 17:16:56 +0000 (17:16 +0000)]
Update dependencies from https://github.com/dotnet/xharness build 20210319.2 (#49934)

[main] Update dependencies from dotnet/xharness

3 years agoUpdate dependencies from https://github.com/mono/linker build 20210319.4 (#49935)
dotnet-maestro[bot] [Sat, 20 Mar 2021 16:38:47 +0000 (12:38 -0400)]
Update dependencies from https://github.com/mono/linker build 20210319.4 (#49935)

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.2.21169.2 -> To Version 6.0.100-preview.2.21169.4

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
3 years agoFix incorrect GTF_CALL_M_SPECIAL_INTRINSIC usage (#49911)
Egor Bogatov [Sat, 20 Mar 2021 15:51:16 +0000 (18:51 +0300)]
Fix incorrect GTF_CALL_M_SPECIAL_INTRINSIC usage (#49911)

* Fix incorrect GTF_CALL_M_SPECIAL_INTRINSIC usage

* Update importer.cpp

3 years agoFix a typo in `safemath.h` (#49933)
SingleAccretion [Sat, 20 Mar 2021 13:16:59 +0000 (16:16 +0300)]
Fix a typo in `safemath.h` (#49933)

3 years agoGate UnsupportedEnum_TestData on Ref.Emit (#49925)
Michal Strehovský [Sat, 20 Mar 2021 11:10:06 +0000 (12:10 +0100)]
Gate UnsupportedEnum_TestData on Ref.Emit (#49925)

These types are reflection emitted and will be null without ref emit.

3 years agoRemove duplicate lines for the src/coreclr/debug folder exception in .gitignore ...
Anton Firszov [Sat, 20 Mar 2021 08:01:46 +0000 (09:01 +0100)]
Remove duplicate lines for the src/coreclr/debug folder exception in .gitignore (#49749)

* remove unused duplicate in .gitignore

* delete "!pal/prebuilt/idl/*_i.c"

3 years agoUpdate shared HTTP/3 code to latest spec (#49848)
James Newton-King [Sat, 20 Mar 2021 06:08:31 +0000 (19:08 +1300)]
Update shared HTTP/3 code to latest spec (#49848)

3 years agoFix Time Zones Adjustment Rules on Linux (#49733)
Tarek Mahmoud Sayed [Sat, 20 Mar 2021 04:29:13 +0000 (21:29 -0700)]
Fix Time Zones Adjustment Rules on Linux (#49733)

3 years agoFix and simplify GCDescs for collectible types (#49791)
Jan Kotas [Sat, 20 Mar 2021 03:10:31 +0000 (20:10 -0700)]
Fix and simplify GCDescs for collectible types (#49791)

Fixes #49684

3 years agoFix CMake detection and DefaultSubsets (#49919)
Anton Lapounov [Sat, 20 Mar 2021 02:43:49 +0000 (19:43 -0700)]
Fix CMake detection and DefaultSubsets (#49919)

3 years ago[wasm] Use `g_printerr` to emit errors in mini-wasm.c, so they show up wit… (#49838)
Ankit Jain [Sat, 20 Mar 2021 00:46:42 +0000 (20:46 -0400)]
[wasm] Use `g_printerr` to emit errors in mini-wasm.c, so they show up wit… (#49838)

* [wasm] Use g_error to emit errors in mini-wasm.c, so they show up with traces in js console

* address review feedback

vargaz: printf in JIT code is mapped to the platform logging operation, so this one can stay as it is.

* Use g_printerr instead of g_error, as suggested by feedback

3 years agoAdd ADVSIMD64 optimizations for System.Text.Encodings.Web (#49847)
Levi Broderick [Sat, 20 Mar 2021 00:33:05 +0000 (17:33 -0700)]
Add ADVSIMD64 optimizations for System.Text.Encodings.Web (#49847)

3 years agoMove default interfaces spec to common ecma335 addenda location (#49914)
David Wrighton [Fri, 19 Mar 2021 23:19:58 +0000 (16:19 -0700)]
Move default interfaces spec to common ecma335 addenda location (#49914)

3 years ago[main] Update dependencies from mono/linker (#49821)
dotnet-maestro[bot] [Fri, 19 Mar 2021 22:23:53 +0000 (23:23 +0100)]
[main] Update dependencies from mono/linker (#49821)

* Update dependencies from https://github.com/mono/linker build 20210318.1

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.2.21167.1 -> To Version 6.0.100-preview.2.21168.1

* Update dependencies from https://github.com/mono/linker build 20210319.1

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.2.21167.1 -> To Version 6.0.100-preview.2.21169.1

* Update mono/linker to 6.0.100-preview.2.21169.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
3 years agoUse EVP_PKEY for RSA key generation
Jeremy Barton [Fri, 19 Mar 2021 22:05:41 +0000 (15:05 -0700)]
Use EVP_PKEY for RSA key generation

3 years agoFix incremental build R2R of System.Private.CoreLib (#49894)
David Wrighton [Fri, 19 Mar 2021 21:06:19 +0000 (14:06 -0700)]
Fix incremental build R2R of System.Private.CoreLib (#49894)

- Add dependency on newly compiled crossgen2 binaries
- Will force recompile of S.P.C if the ready to run compiler changes in addition to recompiling if S.P.C changes

3 years agoDisable Github45929 regression test (#49882)
Manish Godse [Fri, 19 Mar 2021 21:04:14 +0000 (14:04 -0700)]
Disable Github45929 regression test (#49882)

* Disable Github45929 regression test

It has been intermittently failing on a few test runs. Will enable once fixed.

* Fix extra '/'

3 years agodon't init tracked temps without GC fields. (#49879)
Sergey Andreenko [Fri, 19 Mar 2021 20:37:07 +0000 (13:37 -0700)]
don't init tracked temps without GC fields. (#49879)

The diffs are in D:\Sergey\logs\diff.liveness.txt

3 years agoGive AOT mono package arch identifiers (#49893)
Drew Scoggins [Fri, 19 Mar 2021 20:22:55 +0000 (13:22 -0700)]
Give AOT mono package arch identifiers (#49893)

3 years agoRevise UnnamedOptionsManager to avoid allocation in ctor (#49883)
Stephen Toub [Fri, 19 Mar 2021 19:36:43 +0000 (15:36 -0400)]
Revise UnnamedOptionsManager to avoid allocation in ctor (#49883)

3 years agoEnable building repo on Windows ARM64 (#49864)
Anton Lapounov [Fri, 19 Mar 2021 18:39:20 +0000 (11:39 -0700)]
Enable building repo on Windows ARM64 (#49864)

3 years agoSupport open delegate for Nullable<> (#42837)
amos402 [Fri, 19 Mar 2021 18:35:02 +0000 (02:35 +0800)]
Support open delegate for Nullable<> (#42837)

* Support open delegate for Nullable<>

* Disable new tests on Mono

Co-authored-by: David Wrighton <davidwr@microsoft.com>
3 years ago[crossgen2] Fix memory leak in _corInfoImpls. (#49764)
t-mustafin [Fri, 19 Mar 2021 18:32:58 +0000 (21:32 +0300)]
[crossgen2] Fix memory leak in _corInfoImpls. (#49764)

* [crossgen2] Implement Dispose in Compilation.

_corInfoImpls elements keeps _compilation reference which keeps reference to whole table _corInfoImpls. The circular referene together with issue #12255 potentionally leads to memory leak in crossgen2 if that table is created more than once. Dispose() method clears the table and prevents memory leak.

Signed-off-by: Timur Mustafin <t.mustafin@partner.samsung.com>
* Update src/coreclr/tools/aot/crossgen2/Program.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
3 years agoRegression test for #49826 (#49870)
Tomáš Rylek [Fri, 19 Mar 2021 18:32:36 +0000 (11:32 -0700)]
Regression test for #49826 (#49870)

This can only be merged in after #49854 fixing the bug is merged in.

Thanks

Tomas

3 years agoCrossgen2-related CoreCLR test infra fixes (#49867)
Tomáš Rylek [Fri, 19 Mar 2021 18:31:38 +0000 (11:31 -0700)]
Crossgen2-related CoreCLR test infra fixes (#49867)

(*) When compiling tests with Crossgen2, use optimizations by default
like Crossgen1 does.

(*) Don't use large version bubble when Crossgen2-compiling
the framework. While at some point this had value as preparatory
testing for composite mode, it's not a shipping scenario right now
and it was hiding the codegen bug causing the issue

https://github.com/dotnet/runtime/issues/49826

in System.Text.Json.

Thanks

Tomas

3 years ago[browser][wasm] Fix provision-wasm build error (#49863)
Kenneth Pouncey [Fri, 19 Mar 2021 17:48:26 +0000 (18:48 +0100)]
[browser][wasm] Fix provision-wasm build error (#49863)

```
cd emsdk && ./emsdk install `cat emscripten-version.txt`
cat: emscripten-version.txt: No such file or directory
```

3 years ago[AndroidCrypto] Implement Root (read-only) and CurrentUser/My certificate stores...
Elinor Fung [Fri, 19 Mar 2021 17:24:26 +0000 (10:24 -0700)]
[AndroidCrypto] Implement Root (read-only) and CurrentUser/My certificate stores (#48862)

3 years agoRemove unused variables in test build scripts (#49837)
Elinor Fung [Fri, 19 Mar 2021 17:23:02 +0000 (10:23 -0700)]
Remove unused variables in test build scripts (#49837)

3 years agoRemove unnecessary suppressions of IL2060 (#49843)
Eric Erhardt [Fri, 19 Mar 2021 17:11:28 +0000 (12:11 -0500)]
Remove unnecessary suppressions of IL2060  (#49843)

* Remove unnecessary suppressions of IL2060

These suppressions are no longer necessary with the latest trimmer version.

Fix #49486

3 years agoResolving ILLink warnings on System.Private.Xml (Part 1) (#49413)
Jose Perez Rodriguez [Fri, 19 Mar 2021 16:51:20 +0000 (09:51 -0700)]
Resolving ILLink warnings on System.Private.Xml (Part 1) (#49413)

* Resolving ILLink warnings on System.Private.Xml (Part 1)

* Only annotate the unsafe Load overload methods from XslCompiledTransform type

* Address feedback and fix one more warning

* Update src/libraries/System.Private.Xml/src/System/Xml/Xsl/Runtime/EarlyBoundInfo.cs

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
* PR Feedback

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
3 years agoIntroduce `iossimulator` RIDs, and convert as needed (#49305)
Jo Shields [Fri, 19 Mar 2021 16:24:10 +0000 (12:24 -0400)]
Introduce `iossimulator` RIDs, and convert as needed (#49305)

Previously, we have had four iOS RIDs:

iOS-arm
iOS-arm64
iOS-x86
iOS-x64

Apple has never shipped an iOS device with an x86 or x64 processor. Instead, the x86/x64 RIDs have meant "iOS simulator with these arches" as opposed to "iOS with these arches". Amongst other things, that means building against a DIFFERENT SDK, iPhoneSimulator.platform vs iPhoneOS.platform

In the Apple Silicon future, the iOS simulator is now an ARM64 binary - so we need:

iOS-arm
iOS-arm64
iOS-arm64, but built against the simulator SDK not the device SDK
iOS-x86
iOS-x64
Clearly, there's a problem.

The solution is to move the simulators to a different RID, to avoid the overloading issue:

iOS-arm
iOS-arm64
iOSSimulator-arm64
iOSSimulator-x86
iOSSimulator-x64

This PR introduces the new entries in the RID graph, moves our existing iOS-x{86,64} to iOS-sim-x{86,64}, adds a new iOS-arm64.

The above also applies for tvOS, with a smaller set of OSes:

tvOS-arm64
tvOSSimulator-arm64
tvOSSimulator-x64

Ref: #48216

3 years agoAvoid use of incorrect instantation argumens when checking for constraint satisfactio...
David Wrighton [Fri, 19 Mar 2021 15:58:58 +0000 (08:58 -0700)]
Avoid use of incorrect instantation argumens when checking for constraint satisfaction (#47258)

- The constraint processing logic in the runtime conflates the idea of constraint checking on open, closed over concrete types, and closed over non-concrete types
- This change adds a tweak to avoid using an instantiation context that isn't related to the type variable being instantiated

Fixes issue #45600 and adds a regression test from the customer.

3 years agoFix signature generation for devirtualization (#49854)
David Wrighton [Fri, 19 Mar 2021 15:51:00 +0000 (08:51 -0700)]
Fix signature generation for devirtualization (#49854)

- Crossgen2 computes its signatures from slightly different data than the VM does
- Tweak the jit interface to specify that the resolved token comes from devirtualization to detect this special case
  - The extra tokenType information  is ignored by the VM
- Pass the devirtualization specified owning type through when necessary
  - Check that it meets the requirements of being defined on a a derived type from the method target

3 years agoUse arm jit for armel in crossgen2, and build the matching bits on all architectures...
David Wrighton [Fri, 19 Mar 2021 15:49:33 +0000 (08:49 -0700)]
Use arm jit for armel in crossgen2, and build the matching bits on all architectures (#49734)

- Use arm jit for armel in crossgen2, and build the matching bits on all architectures

3 years agostruct improvement, part1: create more LCL_FLD (#48377)
Sergey Andreenko [Fri, 19 Mar 2021 15:37:51 +0000 (08:37 -0700)]
struct improvement, part1: create more LCL_FLD (#48377)

* Add additional tests.

* Use LclFld when copy to/from promoted from/to an unpromoted struct/block.

* Response review.

3 years agoSlimmer IOptions<T> (#49852)
David Fowler [Fri, 19 Mar 2021 15:16:51 +0000 (08:16 -0700)]
Slimmer IOptions<T> (#49852)

* Slimmer IOptions<T>
- Use a Lazy instead of the IOptionsCache (which is a concurrent dictionary)

3 years ago[main] Update dependencies from dotnet/xharness (#49865)
dotnet-maestro[bot] [Fri, 19 Mar 2021 15:02:27 +0000 (16:02 +0100)]
[main] Update dependencies from dotnet/xharness (#49865)

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.21165.2 -> To Version 1.0.0-prerelease.21169.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
3 years agoBig-endian fix: ResourceReader.AllocateStringForNameIndex (#49811)
Ulrich Weigand [Fri, 19 Mar 2021 14:56:27 +0000 (15:56 +0100)]
Big-endian fix: ResourceReader.AllocateStringForNameIndex (#49811)

* Byte-swap characters read from memory-mapped resources
  on big-endian systems

3 years agoBig-endian fix: System.Reflection.Metadata BlobBuilder/BlobWriter (#49812)
Ulrich Weigand [Fri, 19 Mar 2021 14:55:37 +0000 (15:55 +0100)]
Big-endian fix: System.Reflection.Metadata BlobBuilder/BlobWriter (#49812)

* BlobBuilder: do not use Encoding.Unicode.GetBytes but simple
  byte-swaps on big-endian systems (fixes a semantic difference
  to little-endian code w.r.t. surrogate char handling)

* BlobWriter: add big-endian WriteUTF16 code path like BlobBuilder

3 years agoBig-endian fix: Base64Encoder (#49814)
Ulrich Weigand [Fri, 19 Mar 2021 14:54:19 +0000 (15:54 +0100)]
Big-endian fix: Base64Encoder (#49814)

* Take byte order into accout when packing characters into an int

3 years agoAdd clr.iltools subset (#49545)
Ulrich Weigand [Fri, 19 Mar 2021 14:53:10 +0000 (15:53 +0100)]
Add clr.iltools subset (#49545)

* Add new subset to build only the IL tools (ilasm/ildasm)
  (enabled by default)

* New -skipiltools argument to src/coreclr/build-runtime.{cmd,sh}
  (skips building the IL tools if present)

* Actually make -skipjit argument work to not build the JIT & VM

3 years agoBig-endian fix: GUID handling (#49813)
Ulrich Weigand [Fri, 19 Mar 2021 12:00:15 +0000 (13:00 +0100)]
Big-endian fix: GUID handling (#49813)

* Fix Utf8Formatter.Guid on big-endian systems
  (first three fields are stored in native byte order, not always
  little-endian)

* Use Guid constructor in BlobContentId.FromHash to remove
  endian-dependent code accessing the structure directly

3 years agoBig-endian test case fixes: Xoshiro hash (#49709)
Ulrich Weigand [Fri, 19 Mar 2021 11:50:28 +0000 (12:50 +0100)]
Big-endian test case fixes: Xoshiro hash (#49709)

* Skip Xoshiro_AlgorithmBehavesAsExpected on big-endian systems

Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agoBig-endian fix: PEBuilder.CalculateChecksum (#49816)
Ulrich Weigand [Fri, 19 Mar 2021 10:46:08 +0000 (11:46 +0100)]
Big-endian fix: PEBuilder.CalculateChecksum (#49816)

* Always use little-endian encoding to compute checksum

3 years agoBig-endian fix: UnmanagedMemoryAccessor.Write (decimal) (#49815)
Ulrich Weigand [Fri, 19 Mar 2021 10:45:59 +0000 (11:45 +0100)]
Big-endian fix: UnmanagedMemoryAccessor.Write (decimal) (#49815)

* Use TryGetBits to avoid dependency on accessing internal
  fields of decimal type (which would be endian-dependent)

3 years agoUse latest DiaSymReader and support ARM64 host in crossgen2 (#49841)
Anton Lapounov [Fri, 19 Mar 2021 09:56:16 +0000 (02:56 -0700)]
Use latest DiaSymReader and support ARM64 host in crossgen2 (#49841)

3 years agoDisable looking for PaxCtl on non Linux/BSD distros (#49746)
Juan Hoyos [Fri, 19 Mar 2021 08:08:23 +0000 (01:08 -0700)]
Disable looking for PaxCtl on non Linux/BSD distros (#49746)

3 years agoFix SuperPMI replay flags (#49850)
Bruce Forstall [Fri, 19 Mar 2021 06:47:53 +0000 (23:47 -0700)]
Fix SuperPMI replay flags (#49850)

Before this fix, when doing replay (not asmdiffs) of a set of
MCH files, the `-f` arguments would accumulate, one for every
MCH file run so far.

3 years agoEnable the latest managed pgo data (#49793)
David Wrighton [Fri, 19 Mar 2021 04:27:51 +0000 (21:27 -0700)]
Enable the latest managed pgo data (#49793)

- Implementation is parallel to existing ibc handling, so that it can be toggled on/off by adjusting the `UsingToolIbcOptimization` property
- Use the same data for all assemblies produced in current build
- Apply data to release builds only
- Disable mismatch assertions in jit for current state where il mismatches are common

3 years agoFix failures on Windows when more warnings are enabled. (#49194)
Aaron Robinson [Fri, 19 Mar 2021 03:58:07 +0000 (20:58 -0700)]
Fix failures on Windows when more warnings are enabled. (#49194)

* Fix warning for System.IO.Compression.Native when more analysis is enabled.

* Fix warnings in corehost when more analysis is enabled.

3 years agoFix or disable warnings on latest VS dogfood (#49799)
Jan Kotas [Fri, 19 Mar 2021 03:20:53 +0000 (20:20 -0700)]
Fix or disable warnings on latest VS dogfood (#49799)

* Fix or disable warnings on latest VS dogfood

* Delete JIT local warning disables

3 years agoDisable android arm64 tests on PRs (#49844)
Santiago Fernandez Madero [Fri, 19 Mar 2021 02:13:32 +0000 (19:13 -0700)]
Disable android arm64 tests on PRs (#49844)

3 years agoSystem.Text.Encodings.Web refactoring and code modernization (#49373)
Levi Broderick [Fri, 19 Mar 2021 01:14:53 +0000 (18:14 -0700)]
System.Text.Encodings.Web refactoring and code modernization (#49373)

- Unify workhorse implementations across all inbox encoders
- Refactor most unsafe code from TextEncoder workhorse routines into standalone helpers
- Fix bounds check logic in workhorse routines
- SSSE3-optimize central workhorse routine
- Remove vestigial code from the library and unit test project
- Add significant unit test coverage for the workhorse routines and unsafe helpers
- Ref: CVE-2021-26701 (MSRC 62749)

3 years agoUpdate ActivityUserGuide.md (#49818)
Noah Falk [Fri, 19 Mar 2021 00:21:34 +0000 (17:21 -0700)]
Update ActivityUserGuide.md (#49818)

Refer activity guide to the official docs

https://github.com/dotnet/docs/pull/23313 is bringing more enhancements shortly

3 years agoImprove the speed of using COMPlus_JitTimeLogCsv (#49798)
Bruce Forstall [Fri, 19 Mar 2021 00:21:15 +0000 (17:21 -0700)]
Improve the speed of using COMPlus_JitTimeLogCsv (#49798)

* Improve the speed of using COMPlus_JitTimeLogCsv

I noticed that setting this and running a superpmi replay
was super slow. (Btw, note that you must use `--sequential`
in the scenario to avoid parallel writes to the log file).

This change fixes this in a number of ways:
1. The `CycleTimer::CyclesPerSecond()` function does not-trivial
computation to compute its answer. So cache the result.
2. It's expensive to constantly open and close the output file
(once per function). Partially, this is because anti-virus seems to
get involved. So open it once, and keep it open until the JIT
process is shut down.
3. Avoid calling `eeGetMethodFullName()` in DEBUG builds. (Note that
JitTimeLogCsv collects interesting information beyond just per-phase
timings that are also useful for extracting from a CSV file.)

* Fix CachedCyclesPerSecond logging

* Fix clang build break

3 years ago[main] Update dependencies from dotnet/arcade dotnet/icu (#49820)
dotnet-maestro[bot] [Fri, 19 Mar 2021 00:16:04 +0000 (20:16 -0400)]
[main] Update dependencies from dotnet/arcade dotnet/icu (#49820)

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

Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.ApiCompat , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.SharedFramework.Sdk
 From Version 6.0.0-beta.21166.5 -> To Version 6.0.0-beta.21167.3

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

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 6.0.0-preview.3.21165.1 -> To Version 6.0.0-preview.3.21167.1

* Revert changes to publish-using-darc.ps1

Workaround still needed for https://github.com/dotnet/arcade/issues/6987

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Ricardo Arenas <riarenas@microsoft.com>
3 years agoOnly override and set EMSDK_PATH if it is not already set. (#49810)
Kenneth Pouncey [Thu, 18 Mar 2021 20:48:58 +0000 (21:48 +0100)]
Only override and set EMSDK_PATH if it is not already set. (#49810)

3 years agoAdd PipeReader.Create from ReadOnlySequence<byte> (#48369)
Aleksander Heintz [Thu, 18 Mar 2021 19:29:01 +0000 (20:29 +0100)]
Add PipeReader.Create from ReadOnlySequence<byte> (#48369)

Add new factory method to PipeReader to create a PipeReader from a ReadOnlySequence<byte>

3 years ago[mbr] Return -1 if relative index is not in given generation (#49795)
Aleksey Kliger (λgeek) [Thu, 18 Mar 2021 19:14:35 +0000 (15:14 -0400)]
[mbr] Return -1 if relative index is not in given generation (#49795)

Logically after an update is applied, tokens refer to rows in tables that are a
concatenation of all the added rows from every update.  (ie: if the baseline
table 0x23 had 2 rows and then generation 1 an added 3 more rows, an index like 0x05
refers to table 0x23 row 3 from gen 1).

The way the lookup works is that the EnC map table records the logical tokens
of the update.  So for table 0x23 the 3 additions in gen 1 will have entries
like encmap row 5 = 0x23000003, row 6 = 0x23000004, row 7 = 0x23000005, and
then rows for the next table and so on.  The relative index in gen1 of token
0x23000005 then, is the distance of its row (ie row 7) from the first token for
the table (ie row 5), plus 1 (since tokens are 1-based).  So in this case token
0x23000005 corresponds to the 7-5+1 = 3rd row of table 0x23 in the gen1 dmeta image.

The problem is that previously we returns this index-base+1 computation even in
cases where we walked either to the end of the encmap table or past the last
row for the table we care about.

In the case where we walked to the end of the encmap table, the index-base+1
could sometimes return a value that looked like a valid token.  The upshot is
that we looked up an incorrect AssemblyRef (0x23 table) from the wrong
generation.

The updated code returns -1 for all cases where we didn't find an encmap row
for our given token.

Example: https://gist.github.com/lambdageek/cd7ea06bf5004ba884e7979f28623da5

3 years agoUpdate branch from master -> main (#49835)
Drew Scoggins [Thu, 18 Mar 2021 18:41:11 +0000 (11:41 -0700)]
Update branch from master -> main (#49835)

3 years agoAdd ActiveIssue to failing System.Numerics.Tests.Vector3Tests.Vector3DistanceTest...
Jo Shields [Thu, 18 Mar 2021 18:40:13 +0000 (14:40 -0400)]
Add ActiveIssue to failing System.Numerics.Tests.Vector3Tests.Vector3DistanceTest (#49825)

3 years agoAdd 3.1 to package index / validation (#49792)
Eric StJohn [Thu, 18 Mar 2021 18:19:21 +0000 (11:19 -0700)]
Add 3.1 to package index / validation (#49792)

* Add 3.1 inbox assembly versions to package index

* Include netcoreapp3.1 for package validation

3 years agoEnable macOS-arm64 libraries tests on runtime-staging rolling builds (#49445)
Steve MacLean [Thu, 18 Mar 2021 18:03:08 +0000 (14:03 -0400)]
Enable macOS-arm64 libraries tests on runtime-staging rolling builds (#49445)

* Disable failing Apple Silicon Libraries tests

-  Use tests.proj to disable catastrophically failing libraries tests
-  Add ActiveIssues where XUnit didn't crash

* Enable CoreCLR lib tests for Apple Silicon in Runtime-Staging

3 years ago[wasm][AOT] Fix System.Buffers.Tests path (#49785)
Mitchell Hwang [Thu, 18 Mar 2021 17:32:11 +0000 (13:32 -0400)]
[wasm][AOT] Fix System.Buffers.Tests path (#49785)

Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
3 years agoEnhance DynamicallyAccessedMembers Attribute (#49778)
Lakshan Fernando [Thu, 18 Mar 2021 16:51:43 +0000 (09:51 -0700)]
Enhance DynamicallyAccessedMembers Attribute (#49778)

* eh fix

* test change that inadvertently got checked in earlier

* Suppresses the trimmer warning on TypeAnalysis ctor

* Incorporating FB

* Update src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
* Update src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
* Update src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
* Fix DynamicDependency as per PR feedback

* an earlier change got reverted

* fixed proj file netcore app condition check

* fixed NETCORE_ENGINEERING_TELEMETRY build failures

* fixeing another NETCORE_ENGINEERING_TELEMETRY build failures

* Adding RequiresUnreferencedCode to TypeAnalysis ctor instead of suppressing the warning to get FB, not fully fixed

* PR FB and suppressing warnings for safe calls

* propagated the warning all the way up

* CI build break fix for one file

* excluding NativeRTEventSrc from being build in a project

* Missed couple of supppressions on NativeRTEventSrc

* build break fixes

* Enhancement to DynamicallyAccessedMembersAttribute

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
3 years agoAdd Mono AOT Performance runs (#49766)
Drew Scoggins [Thu, 18 Mar 2021 16:46:58 +0000 (09:46 -0700)]
Add Mono AOT Performance runs (#49766)

* Add AOT perf support

* Fix up dependency information

* Fix zipping behavior

* Specify between mono and mono aot

* Fix in another spot

* Cleanup archive

* Last mono cleanup

* Change archive extension to tar.gz

* Fix AOT paths

* Fix mkdir

* Add -p to mkdir

* Add recursive copy

* Fix logic around selecting AOT

* Remove comments

* Add Arm64

* Remove unused variable

3 years agoFileStreamStrategies refactor (#49750)
Adam Sitnik [Thu, 18 Mar 2021 16:35:24 +0000 (17:35 +0100)]
FileStreamStrategies refactor (#49750)

* move all strategy-related types to Strategies subfolder and namespace

* make FileStreamHelpers a partial class, move some cross-platform helper methods there

* rename config switch

* address code review feedback

3 years agoClarify host testing instructions (#49797)
Elinor Fung [Thu, 18 Mar 2021 16:30:37 +0000 (09:30 -0700)]
Clarify host testing instructions (#49797)

3 years agoPrint less confusing message for Mono's FailFast abort (#49802)
Marek Safar [Thu, 18 Mar 2021 16:07:07 +0000 (17:07 +0100)]
Print less confusing message for Mono's FailFast abort (#49802)

3 years agoRemove arcade packaging workaround (#49613)
Viktor Hofer [Thu, 18 Mar 2021 14:29:13 +0000 (15:29 +0100)]
Remove arcade packaging workaround (#49613)

3 years ago[System.Memory.Data] Add `Empty` to `BinaryData` (#49777)
Matt Ellis [Thu, 18 Mar 2021 14:28:31 +0000 (07:28 -0700)]
[System.Memory.Data] Add `Empty` to `BinaryData` (#49777)

This is useful for APIs which return `BinaryData` and want to use a
singleton instead of allocating a new `BinaryData` each
time. Previously, developers would need to create their own static
copy of an empty binary data, now they can just use `Empty`

Fixes #49670

3 years agoUpdate aka.ms links (#48924)
Michelle McDaniel [Thu, 18 Mar 2021 14:22:06 +0000 (07:22 -0700)]
Update aka.ms links (#48924)

* Update aka.ms links

* Temporarily remove the symbols, nethost and badge links

3 years agoAllow for specify return value on System.Linq.Enumerable.*OrDefault methods (#48886)
Foxtrek_64 [Thu, 18 Mar 2021 11:36:40 +0000 (11:36 +0000)]
Allow for specify return value on System.Linq.Enumerable.*OrDefault methods (#48886)

* Fix #20064

* Add API to ref assembly

* Make overloads with defaultValue not nullable

* Add unit tests, simplify implementation

* Add LastOrDefault tests

* Add Queryable tests

* Additional tests. Reformatting TryGet Methods.

* Update src/libraries/System.Linq.Queryable/tests/FirstOrDefaultTests.cs

* Apply suggestions from code review

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
* Fix ref methods

* Further adjust nullability

* Fix more nullables

* fix failing tests

* Restore coding style

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
3 years agoStop building extra installer bundles during PGO build (#49779)
Andy Gocke [Thu, 18 Mar 2021 08:55:17 +0000 (01:55 -0700)]
Stop building extra installer bundles during PGO build (#49779)

* Select only the runtime-internal package and turn off installers

* Remove R2R modifications

3 years ago[main] Update dependencies from dotnet/arcade dotnet/icu dotnet/llvm-project dotnet...
dotnet-maestro[bot] [Thu, 18 Mar 2021 08:22:17 +0000 (09:22 +0100)]
[main] Update dependencies from dotnet/arcade dotnet/icu dotnet/llvm-project dotnet/runtime-assets (#49752)

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

Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.ApiCompat , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.SharedFramework.Sdk
 From Version 6.0.0-beta.21155.1 -> To Version 6.0.0-beta.21166.5

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

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 6.0.0-preview.3.21151.1 -> To Version 6.0.0-preview.3.21165.1

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

runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools
 From Version 9.0.1-alpha.1.21158.1 -> To Version 9.0.1-alpha.1.21165.1

* Update dependencies from https://github.com/dotnet/runtime-assets build 20210312.1

System.ComponentModel.TypeConverter.TestData , System.Drawing.Common.TestData , System.IO.Compression.TestData , System.IO.Packaging.TestData , System.Net.TestData , System.Private.Runtime.UnicodeData , System.Runtime.TimeZoneData , System.Security.Cryptography.X509Certificates.TestData , System.Windows.Extensions.TestData
 From Version 5.0.0-beta.21159.1 -> To Version 6.0.0-beta.21162.1

* re-add publishing workaround

workaround for https://github.com/dotnet/arcade/issues/6987

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Ricardo Arenas <riarenas@microsoft.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
3 years ago[mono] Add all instances from the aot profile when using aot profiles… (#49758)
Zoltan Varga [Thu, 18 Mar 2021 08:20:47 +0000 (04:20 -0400)]
[mono] Add all instances from the aot profile when using aot profiles… (#49758)

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

3 years ago[interp] Actually extend the return value when transitioning back to interp from...
Vlad Brezae [Thu, 18 Mar 2021 05:45:21 +0000 (07:45 +0200)]
[interp] Actually extend the return value when transitioning back to interp from aot/jit (#49789)

3 years ago[AndroidCrypto] Avoid printing JNI exceptions in cases where they are expected (...
Elinor Fung [Thu, 18 Mar 2021 05:30:03 +0000 (22:30 -0700)]
[AndroidCrypto] Avoid printing JNI exceptions in cases where they are expected (#49530)

3 years agoruntime-linker-tests: revert earlier change which added browser offse… (#49774)
Ankit Jain [Thu, 18 Mar 2021 03:25:50 +0000 (23:25 -0400)]
runtime-linker-tests: revert earlier change which added browser offse… (#49774)

3 years agoRemove top-level range check nodes (#49271)
SingleAccretion [Thu, 18 Mar 2021 01:38:37 +0000 (04:38 +0300)]
Remove top-level range check nodes (#49271)

Refactored optRemoveRangeCheck to handle top-level standalone range check nodes.

3 years agoUpdate Microsoft.DiaSymReader.Native package (#49739)
Anton Lapounov [Thu, 18 Mar 2021 01:25:54 +0000 (18:25 -0700)]
Update Microsoft.DiaSymReader.Native package (#49739)

3 years agoAnnotate System.Diagnostics.Process APIs throwing PNSE on iOS/tvOS (#49354)
Maxim Lipnin [Wed, 17 Mar 2021 22:48:13 +0000 (01:48 +0300)]
Annotate System.Diagnostics.Process APIs throwing PNSE on iOS/tvOS (#49354)

* Process.Start

* Remove redundant annotations

* Remove iOS since it's in the default list of supported platforms

* Process.Kill

* Make Process.Kill throw PNSE on iOS/tvOS

* Annotate windows-related implementation of Kill method

3 years ago[main] Update dependencies from mono/linker (#49577)
dotnet-maestro[bot] [Wed, 17 Mar 2021 19:56:33 +0000 (20:56 +0100)]
[main] Update dependencies from mono/linker (#49577)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: Marek Safar <marek.safar@gmail.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
3 years agoAdd runtime MVID checks for composite images (#49668)
Tomáš Rylek [Wed, 17 Mar 2021 19:55:49 +0000 (12:55 -0700)]
Add runtime MVID checks for composite images (#49668)

* Crossgen2 implementation of new MVID R2R section
* Runtime checks for assembly MVIDs against native images
* Basic R2RDump support for dumping the manifest assembly MVID table.
* R2R minor version increment; format spec update

Thanks

Tomas

3 years agoFix incorrect merge suppressing my change to publish CG2 framework (#49666)
Tomáš Rylek [Wed, 17 Mar 2021 19:54:02 +0000 (12:54 -0700)]
Fix incorrect merge suppressing my change to publish CG2 framework (#49666)

As David discovered, I apparently made a merge bug in rebasing my
CG2 framework switch-over change prior to checking in that actually
suppressed CG2 publishing due to losing the property
PublishReadyToRunUseCrossgen2. This change fixes that deficiency.

Thanks

Tomas

3 years agofix typo (#49763)
Eirik Tsarpalis [Wed, 17 Mar 2021 18:55:50 +0000 (18:55 +0000)]
fix typo (#49763)

3 years agoMore tests for FileStream edge cases (#49754)
Adam Sitnik [Wed, 17 Mar 2021 18:53:43 +0000 (19:53 +0100)]
More tests for FileStream edge cases (#49754)

* add StreamConformanceTests to the solution file so we can read source code from VS

* add FileOffsetIsPreservedWhenFileStreamIsCreatedFromSafeFileHandle tests

* add WriteAsyncStartsWherePreviousReadAsyncHasFinished test

3 years ago[wasm] Add a mono_wasm_print_stack_trace () helper function usable during runtime...
Zoltan Varga [Wed, 17 Mar 2021 18:46:37 +0000 (14:46 -0400)]
[wasm] Add a mono_wasm_print_stack_trace () helper function usable during runtime debugging. (#49759)

3 years agoInclude "simple" UTF-8 validation and transcoding logic for interpreted and low-footp...
Pavel Savara [Wed, 17 Mar 2021 18:38:39 +0000 (19:38 +0100)]
Include "simple" UTF-8 validation and transcoding logic for interpreted and low-footprint scenarios (#49372)

3 years agoAddress issue where stress mode testing may not work for this more exhaustive than...
David Wrighton [Wed, 17 Mar 2021 18:28:09 +0000 (11:28 -0700)]
Address issue where stress mode testing may not work for this more exhaustive than usual test (#49736)