platform/upstream/dotnet/runtime.git
3 years agosignable single file apps on mac (#46558)
Vladimir Sadov [Thu, 14 Jan 2021 00:02:49 +0000 (16:02 -0800)]
signable single file apps on mac (#46558)

* extend the __LINKEDIT. section to cover the single-exe metadata.

* codesign test

3 years agoMacOS-arm64 Fix libdebugshim search path (#46932)
Steve MacLean [Wed, 13 Jan 2021 23:51:44 +0000 (18:51 -0500)]
MacOS-arm64 Fix libdebugshim search path (#46932)

3 years agoPhase 1 of refactoring pgo data pipeline (#46638)
David Wrighton [Wed, 13 Jan 2021 22:40:56 +0000 (14:40 -0800)]
Phase 1 of refactoring pgo data pipeline (#46638)

Phase 1 of replacing existing infrastructure around handling of pgo data with more flexible schema based approach.

The schema based approach allows the JIT to define the form of data needed for instrumentation.
- The schema associates 4 32bit integers with each data collection point (ILOffset, InstrumentationKind, Count, and Other)
  - Rich meaning is attached to InstrumentationKind, and Count
    - InstrumentationKind defines the size and layout of individual instrumentation data items
    - Count allows a single schema item to be repeated
  - ILOffset and Other are not processed in any specific way by the infrastructure

Changes part of this phase
- PgoManager holds arbitrary amount of pgo data instead of a slab
  - Aware of collectible assemblies
  - Match with pgo data utilizes hash of IL body in addition to IL size information for greater accuracy in match
- JIT no longer uses block count apis, and instead uses schema based apis
  - JIT now explicitly defines the shape of data collected for both basic block and type probes
  - The rest of the system handles that without deep knowledge of what those formats are
- Text file format for pgo data updated
- Existing IBC infrastructure adjusted to speak in terms of schema concept
- Uncompressed and binary encoded implementation of Pgo schema handling
- Update SuperPMI to handle new apis

Future Changes for static Pgo
- Move Pgo type handle histogram processing into JIT
- Extract Pgo data from process using Event infrastructure
- Triggers for controlling Pgo data extraction
- Instrumented Pgo processing as part of dotnet-pgo tool
- Pgo data flow in crossgen2

3 years agoFix sync issue in profiler tests (#46907)
David Mason [Wed, 13 Jan 2021 21:37:18 +0000 (13:37 -0800)]
Fix sync issue in profiler tests (#46907)

3 years agoRewrite ARM64 IJW bootstrap thunk assembly. (#46933)
Jeremy Koritzinsky [Wed, 13 Jan 2021 21:30:15 +0000 (13:30 -0800)]
Rewrite ARM64 IJW bootstrap thunk assembly. (#46933)

* Rewrite ARM64 IJW bootstrap thunk.

* Fix alignment.

3 years ago[wasm] Add support for AOT profiling, and add a `browser-profile` sample (#45910)
Tammy Qiu [Wed, 13 Jan 2021 20:25:35 +0000 (15:25 -0500)]
[wasm] Add support for AOT profiling, and add a `browser-profile` sample (#45910)

* Enable AOT Profiler

* Add a `browser-profile` sample

* Clean up Makefile add AotInterp mode to MonoAotMode

* move the shared make logic to wasm.mk

Co-authored-by: Steve Pfister <steveisok@users.noreply.github.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
3 years ago[wasm][debugger][tests] Refactor test harness to support simpler test code (#44987)
Ankit Jain [Wed, 13 Jan 2021 19:25:28 +0000 (14:25 -0500)]
[wasm][debugger][tests] Refactor test harness to support simpler test code (#44987)

* [wasm][debugger] Move DevToolsQueue to a separate file

* Move Inspector to separate file, mv Support.cs=>DebuggerTest.cs

* [wasm][debugger][tests] Some improvements to DevToolsQueue

- `Pump` -> `TryPump`
- use a ConcurrentQueue instead of a List, for tracking the pending
requests.

DevToolsClient:
- use DevToolsQueue, and remove the redundant code.
- Wake up the runloop when a new send task gets added

* [wasm][debugger] Check Proxy's client_initiated_close early

- this allows the proxy to shutdown quicker, and not have to wait for
the other tasks to get scheduled.

- Fixes the issue of chrome processes left around.

* [wasm][debugger][tests] Inspector - handle event being received before a waiter

.. gets added.

This handles the case where `NotifyOf` gets invoked before a
corresponding `WaitFor` gets called.

* [wasm][debugger][tests] Refactor test harness to support simpler test code

Problem:

- Currently, test methods must call `insp.Ready(..)` with a
callback. And `Ready` takes care of the init, and shutdown for
the proxy, and browser.

- But this means that we have to repeat that boiler plate code in all
the test methods. And the stack traces are deeply nested.

- Instead, we want to have the *test method* contain only the test
specific code.

Solution:

- we want to do that by using xunit's `IAsyncLifetime`, with
methods:
- `InitializeAsync` - setup proxy+browser here
- `DisposeAsync` - shutdown

- This would mean that when the *test method* runs, it already has
everything set up, so the code can be just specific to the actual test.

Implementation:

- Improve DevToolsClient's RunLoop, to support this
- Tries to handle shutdown/close requests explicitly, and not throw
errors in such cases

- Adds a `RunLoopStopped` event, which gets invoked with the reason due
to which it stopped. Eg - Exception getting thrown, cancellation,
shutdown request etc.

- With `insp.Ready(..)`, the whole setup (launch proxy, browser,
run test code) happens from the same *test method*. But here we
are doing it at separate times, from different methods, and it's
all async.
- IOW, there are multiple places where failure can
happen, and we need to explicitly propogate that, and
fail the appropriate listeners/tasks/etc
-> causing the test to correctly fail.

Note: This does not change *any* actual test code! The `Ready` method is
adjusted to use the new init/shutdown bits.
Subsequent commits will make the test changes.

* [wasm][debugger][tests] Port some tests to the simpler test harness bits

We add a `SingleSessionTestBase` class, which implements
`IAsyncLifetime` to init/shutdown the proxy+browser outside the test
methods.

And port `HarnessTests`, and `SteppingTests` to that.

Added a few more tests to `HarnessTests`, to check for common cases like
test methods throwing exceptions, or timing out, or commands failing
etc.
- This is needed because with the older `insp.Ready` API, the
whole thing was called from the test method, so failures would
correctly fail the test.

- But now we do these things in separate steps, so failing the
test requires a bit more work in the harness.

Note: I didn't port all the tests in one go, to make the review a bit
simpler. A subsequent PR can move rest of the tests over, and do some
cleanup that it would afford.

* [wasm][debugger][tests] Fix race in ExceptionThrownInJSOutOfBand test

Fix the race where the `Runtime.exceptionThrown` message can be received
before the test calls `WaitFor`, causing it to get missed.

* [wasm][debugger] Formatting fixes on the changes

* Remove unncessary AssertHelpers.ThrowsAsync

Suggested by @lewing !

* [wasm][debugger][tests] Fix a race when sending messages

DevToolsClient.Send adds to `pending_ops`, which can happen while the
list is being modified in `RunLoop`.

Fix: Since, we need to modify it outside `RunLoop` only when a new send
task is available, we can let `RunLoop` itself add it to the list. And use
a taskCompletionSource to wake up the loop.

3 years agoAdd comments about _singleBufferHandleState to SocketsAsyncEventArgs.Windows.cs ...
Stephen Toub [Wed, 13 Jan 2021 18:49:39 +0000 (13:49 -0500)]
Add comments about _singleBufferHandleState to SocketsAsyncEventArgs.Windows.cs (#46923)

3 years agoFix MS.NETCore.App.Bundle on osx-arm64 (#46878)
Steve MacLean [Wed, 13 Jan 2021 18:07:04 +0000 (13:07 -0500)]
Fix MS.NETCore.App.Bundle on osx-arm64 (#46878)

3 years agoEnable host tests on OSX (#46640)
Vladimir Sadov [Wed, 13 Jan 2021 18:01:53 +0000 (10:01 -0800)]
Enable host tests on OSX (#46640)

* Enable host tests on OSX

* initialize Ssl shim on demand

* fix OpenSsl.Tests

* partial modifier

* fixed Cryptography.Algorithms

* first to dlopen libssl wins

3 years agoSet official build value to false (#46834)
Drew Scoggins [Wed, 13 Jan 2021 17:43:58 +0000 (09:43 -0800)]
Set official build value to false (#46834)

* Set official build value to false

* Add pr trigger

* Remove PR

3 years agoAdding support for ReciprocalEstimate and ReciprocalSqrtEstimate (#46692)
Tanner Gooding [Wed, 13 Jan 2021 17:09:10 +0000 (09:09 -0800)]
Adding support for ReciprocalEstimate and ReciprocalSqrtEstimate (#46692)

* Adding support for ReciprocalEstimate and ReciprocalSqrtEstimate

* Adding basic documentation comments to the new Math.ReciprocalEstimate functions

* Increasing the epsilon for estimated functions to account for ARM64 only doing a single Newton-Raphson iteration

3 years agoDon't assume presence of MonoResolveUnmanagedDllUsingEvent method (#46917)
Marek Safar [Wed, 13 Jan 2021 16:27:13 +0000 (17:27 +0100)]
Don't assume presence of MonoResolveUnmanagedDllUsingEvent method (#46917)

Follow up change missing in #46323

Fixes #46908

3 years ago[master] Update dependencies from dotnet/xharness dotnet/runtime-assets dotnet/llvm...
dotnet-maestro[bot] [Wed, 13 Jan 2021 15:31:58 +0000 (16:31 +0100)]
[master] Update dependencies from dotnet/xharness dotnet/runtime-assets dotnet/llvm-project dotnet/icu (#46853)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
3 years agoUse stackalloc in RSAPkcs1X509SignatureGenerator.BuildPublicKey (#46893)
Stephen Toub [Wed, 13 Jan 2021 14:48:00 +0000 (09:48 -0500)]
Use stackalloc in RSAPkcs1X509SignatureGenerator.BuildPublicKey (#46893)

Just an unnecessary allocation.  The AsnEncodedData ctor makes a copy regardless of whether the input is a span or an array, so may as well avoid allocating another array on top of that.

3 years ago[master] Update dependencies from mono/linker (#46906)
dotnet-maestro[bot] [Wed, 13 Jan 2021 13:38:23 +0000 (14:38 +0100)]
[master] Update dependencies from mono/linker (#46906)

Microsoft.NET.ILLink.Tasks
 From Version 6.0.0-alpha.1.21061.5 -> To Version 6.0.0-alpha.1.21063.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
3 years agoTry to fix #19803 (#37156)
monojenkins [Wed, 13 Jan 2021 12:36:30 +0000 (07:36 -0500)]
Try to fix #19803 (#37156)

My previous unsuccessful pull request   https://github.com/mono/mono/pull/19804
I have improved the logic so that the code is more systematic

Co-authored-by: alexger97 <alexger97@users.noreply.github.com>
3 years agoSpecify a GUID for the IL SDK and expose it to slngen (#46877)
Viktor Hofer [Wed, 13 Jan 2021 11:04:13 +0000 (12:04 +0100)]
Specify a GUID for the IL SDK and expose it to slngen (#46877)

* Specify a GUID for the IL SDK and expose it to slngen

3 years agoFix Mono Windows x64 SIMD support. (#46812)
Johan Lorensson [Wed, 13 Jan 2021 08:15:43 +0000 (09:15 +0100)]
Fix Mono Windows x64 SIMD support. (#46812)

3 years agoFix sig inst (#46886)
Bruce Forstall [Wed, 13 Jan 2021 06:27:01 +0000 (20:27 -1000)]
Fix sig inst (#46886)

* Fix 32-bit platform handling of CORINFO_SIG_INST

Previous code was reading an array of pointers as an array of
8-byte elements, leading to some cases of reading beyond
allocated memory and causing access violations. Convert remaining
cases to properly serialized/deserialized pointers.

This is a follow-up to #46604.

Moves all Agnostic types to their own file, agnostic.h, so MethodContext
and CompileResult can share helpers with the same types (previously,
they each had a copy of AgnosticCORINFO_SIG_INFO).

* Remove duplicate types

* Convert CompileResult to use common CORINFO_SIG_INFO functions

Add CrSigInstHandleMap to store handle map for CompileResults.

* Change JIT/EE GUID

SuperPMI format has changed, so change the GUID.

3 years agoMono: use shared StartHelper object (#46896)
Aleksey Kliger (λgeek) [Wed, 13 Jan 2021 06:16:53 +0000 (01:16 -0500)]
Mono: use shared StartHelper object (#46896)

* Revert "Partial rollback of #46244 to workaround #46389 (#46390)"

This reverts commit 43d07801e94c3c302ed61852fff11ddbdff515a4.

* [threads] Check for null longlived thread data

This might happen on netcore if the managed Thread constructor throws an
exception before calling InitInternal.  In that case the finalizer may see a
partially initialized object.

3 years agoUpdate TraceEvent version (#46655)
Sung Yoon Whang [Wed, 13 Jan 2021 05:00:19 +0000 (21:00 -0800)]
Update TraceEvent version (#46655)

* update TraceEvent version

* remove MicrosoftDiagnosticsTracingTraceEventPackageVersion and consolidate using TraceEventVersion

* Fix profiler test

3 years agoHarmonize ReceiveMessageFrom tests and bring them back to Inner Loop (#46862)
Anton Firszov [Wed, 13 Jan 2021 02:38:46 +0000 (03:38 +0100)]
Harmonize ReceiveMessageFrom tests and bring them back to Inner Loop (#46862)

* extend SocketTestHelper

* SocketHelperMemoryNativeTask: implement UDP methods

* unified test for ReceiveSentMessages_Success

* oops, these overloads are not here yet

* ReceiveSentMessages_ReuseEventArgs_Success

* altering bufferMode does not work on Linux

* remove ReceiveMessageFromAsync.cs

* use AssertExtensions.SequenceEqual

3 years agoJIT: jump threading (#46257)
Andy Ayers [Wed, 13 Jan 2021 01:28:46 +0000 (17:28 -0800)]
JIT: jump threading (#46257)

Optimize branches where a branch outcome is fully determined by a dominating
branch, and both true and false values can reach the dominated branch.

3 years agoSmall PoliCheck fix (#46876)
Juan Hoyos [Wed, 13 Jan 2021 01:02:00 +0000 (17:02 -0800)]
Small PoliCheck fix (#46876)

3 years ago[wasm] Disable `System.Diagnostics.Tests.ActivityTests.IdGenerationInternalParent...
Ankit Jain [Tue, 12 Jan 2021 23:57:43 +0000 (18:57 -0500)]
[wasm] Disable `System.Diagnostics.Tests.ActivityTests.IdGenerationInternalParent` (#46875)

throws `System.PlatformNotSupportedException : Cannot wait on monitors on this runtime.`

Partially fixes https://github.com/dotnet/runtime/issues/46768

3 years agoImplement System.Runtime.InteropServices.CLong/CULong/NFloat (#46401)
Jeremy Koritzinsky [Tue, 12 Jan 2021 23:28:54 +0000 (15:28 -0800)]
Implement System.Runtime.InteropServices.CLong/CULong/NFloat (#46401)

* Implement managed side of CLong/CULong/NFloat.

* Make CLong, CULong, and NFloat intrinsically handled correctly by the JIT.

* Add framework tests for CLong, CULong, and NFloat.

* Add interop test of CLong to validate calling convention semantics.

* Update CULong.cs

* Fix implicit conversions.

* Fix overflow and equality test failures.

* Fix formatting.

* Fix formatting and add function header.

* Add doc comments.

* Don't throw on float out of range. Rename tests.

* Rewrite EqualsTest implementations more straightforward.

* Fix NFloat tests.

* Use .Equals instead of ==

* Use ToString directly instead of hard coding the expected value.

* Update the emitted assembly stub's thiscall retbuf support for x86 to account for the new native exchange types.

* Add sizeof tests.

* Add test with struct containing CLong.

* Disable ThisCallTest on Mono due to #46820

* validate type name.

3 years ago[wasm] Simplify, and refactor `WasmApp.targets`, and wasm projects (#46772)
Ankit Jain [Tue, 12 Jan 2021 23:24:59 +0000 (18:24 -0500)]
[wasm] Simplify, and refactor `WasmApp.targets`, and wasm projects (#46772)

Refactor `WasmApp.targets` to:

1. Move duplicated properties, targets from the various wasm projects to a common location
2. Split `WasmApp.targets` into:
     a. `WasmApp.InTree.props`, and `WasmApp.props`
     b. `WasmApp.InTree.targets`, and `WasmApp.Targets`

- The props/targets split makes this similar to a SDK
- `WasmApp.{props, targets}` - have the core bits to build a wasm app, but don't have anything specific to the `dotnet/runtime` tree
- `WasmApp.InTree.{props, targets}` - have bits to facilitate local builds in `dotnet/runtime`, eg. to use a local build of the runtime pack

This simplifies project files a lot. And sets things up for being able to have a wasm SDK, and be able to use them to build wasm apps outside the tree.

Note: In case of the *InTree* files, they depend on runtime specific properties being set, like `$(ArtifactsBinDir)` which are set in inherited `Directory.Build*` files, which tend to override properties even if they are already set. Due to this, in some cases we have to import `*InTree*` files after the inherited ones, and set some properties before, and some after importing `Directory.Build.*`.

* [wasm] WasmAppBuilder: add new input for extra files to deploy

.. to the bundle. This eliminates the need to hack it in with
aftertargets.

* [wasm] samples: Extract the common bits to Directory.Build.*

- Also, introduce WasmApp.props, to have some of the property defaults
  that aren't specific to the samples

* [wasm] samples: no need to add cs files manually

* [wasm] Extract common bits from wasm FunctionalTests to Directory.Build*

* [wasm] Add WasmApp.InTree.{props,targets}

The *InTree* files have the properties/targets required to build within
the tree. The main `WasmApp.{props,targets}` should be on the way to
becoming useful outside the tree.

* [wasm] Update debugger-tests to use the InTree targets

* [wasm] Add  to debugger tests, consistent with other make targets

* [wasm] use TrickRuntimePackLocation target only if applicable

* [wasm] add EMSDK_PATH default value for wasm projects

* [wasm] Move RebuildWasmAppBuilder to InTree.targets

* [wasm] Simplify functionalTests project files

* [wasm] Fix tests in src/tests run with WasmTestRunner

* little cleanup

* Address review feedback from @mdh1418

* add comment

* [wasm] update build/README.md

* Add comment for InTree* files

* [wasm] sample - move some non-debug properties to D.B.props

* [wasm] Move CopySampleAppToHelix* to InTree.targets

3 years agoAdd RequiresAssemblyFilesAttribute (#46824)
Mateo Torres-Ruiz [Tue, 12 Jan 2021 22:20:07 +0000 (14:20 -0800)]
Add RequiresAssemblyFilesAttribute (#46824)

* Add RequiresAssemblyFilesAttribute

* Apply suggestions from code review

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
3 years agoPublish hostfxr static library. (#46787)
Sean Hall [Tue, 12 Jan 2021 21:34:24 +0000 (15:34 -0600)]
Publish hostfxr static library. (#46787)

3 years agoAdding support for Math/MathF.SinCos (#46551)
Tanner Gooding [Tue, 12 Jan 2021 20:50:43 +0000 (12:50 -0800)]
Adding support for Math/MathF.SinCos (#46551)

* Adding support for Math/MathF.SinCos

* Fix the handling of sincos on __APPLE__

* Adjusting the SinCos internal call to work on all platforms

* Mark the public SinCos as intrinsic and ensure it is handled in gentree

* Dropping the NI_System_Math_SinCos intrinsic as it requires more extensive changes

* Removing unnecessary casts from the COMSingle and COMDouble SinCos calls

3 years agoFix Ilasm Round Trip script by adding retry logic (#46765)
Brian Sullivan [Tue, 12 Jan 2021 20:33:42 +0000 (12:33 -0800)]
Fix Ilasm Round Trip script by adding retry logic (#46765)

* Fix Ilasm Round Trip script by adding retry logic
Fix bash syntax
Update bash syntax to use while true

* Fix bash syntax error missing then

* bash - increment ilasm_count

3 years agoUpdate packageindex for 5.0 servicing release (#46866)
Viktor Hofer [Tue, 12 Jan 2021 19:55:41 +0000 (20:55 +0100)]
Update packageindex for 5.0 servicing release (#46866)

3 years agoFix SAPI error code mappings (#46841)
Dan Moseley [Tue, 12 Jan 2021 19:38:07 +0000 (11:38 -0800)]
Fix SAPI error code mappings (#46841)

* Fix PKT

* Fix SAPI errors

* Disable test as appropriate

* enable more tests to fail to get messages

* reenable tests

* Update src/libraries/System.Speech/tests/SpeechRecognizerTests.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agoFix link (#46864)
Bruce Forstall [Tue, 12 Jan 2021 18:07:56 +0000 (08:07 -1000)]
Fix link (#46864)

3 years agoRemove Microsoft.DotNet.RemoteExecutor from library test linker inclusions (#46814)
Mitchell Hwang [Tue, 12 Jan 2021 18:06:14 +0000 (13:06 -0500)]
Remove Microsoft.DotNet.RemoteExecutor from library test linker inclusions (#46814)

Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
3 years agoResolve ILLink warnings in System.Reflection.TypeExtensions (#46786)
Eric Erhardt [Tue, 12 Jan 2021 16:25:37 +0000 (10:25 -0600)]
Resolve ILLink warnings in System.Reflection.TypeExtensions (#46786)

* Resolve ILLink warnings in System.Reflection.TypeExtensions

Contributes to #45623

* Update API Compat baseline for Type.GetMembers() attribute change.

3 years agoEnsure console is initialized before writing to stdout (#46852)
Eirik Tsarpalis [Tue, 12 Jan 2021 14:36:46 +0000 (14:36 +0000)]
Ensure console is initialized before writing to stdout (#46852)

3 years ago[master] Update dependencies from dotnet/runtime dotnet/xharness (#46804)
dotnet-maestro[bot] [Tue, 12 Jan 2021 12:19:27 +0000 (13:19 +0100)]
[master] Update dependencies from dotnet/runtime dotnet/xharness (#46804)

* Update dependencies from https://github.com/dotnet/xharness build 20210111.2

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.20630.1 -> To Version 1.0.0-prerelease.21061.2

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

Microsoft.NETCore.ILAsm , runtime.native.System.IO.Ports , Microsoft.NETCore.DotNetHost , Microsoft.NET.Sdk.IL , Microsoft.NETCore.DotNetHostPolicy , System.Runtime.CompilerServices.Unsafe , System.Text.Json
 From Version 6.0.0-alpha.1.21053.3 -> To Version 6.0.0-alpha.1.21060.3

* Update dependencies from https://github.com/dotnet/xharness build 20210111.3

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.20630.1 -> To Version 1.0.0-prerelease.21061.3

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
3 years ago[master] Update dependencies from mono/linker (#46805)
dotnet-maestro[bot] [Tue, 12 Jan 2021 12:12:05 +0000 (13:12 +0100)]
[master] Update dependencies from mono/linker (#46805)

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

Microsoft.NET.ILLink.Tasks
 From Version 6.0.0-alpha.1.21057.1 -> To Version 6.0.0-alpha.1.21061.1

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

Microsoft.NET.ILLink.Tasks
 From Version 6.0.0-alpha.1.21057.1 -> To Version 6.0.0-alpha.1.21061.2

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

Microsoft.NET.ILLink.Tasks
 From Version 6.0.0-alpha.1.21057.1 -> To Version 6.0.0-alpha.1.21061.3

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

Microsoft.NET.ILLink.Tasks
 From Version 6.0.0-alpha.1.21057.1 -> To Version 6.0.0-alpha.1.21061.4

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

Microsoft.NET.ILLink.Tasks
 From Version 6.0.0-alpha.1.21057.1 -> To Version 6.0.0-alpha.1.21061.5

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
3 years agoFix couple of races in EventPipe C library. (#46193)
Johan Lorensson [Tue, 12 Jan 2021 10:37:07 +0000 (11:37 +0100)]
Fix couple of races in EventPipe C library. (#46193)

Fix primarily two main issues triggering races related to ref counting on
EventPipeThread.

First was an incorrect mapping of hash map add method in CoreClr shim.
Intent of this method was a add_replace, but CoreClr shim ended up with
Add implementation. That could result in unreferenced threads being added
into thread_sequence_number_map, that on free would release the ref count
creating unbalance, triggering EventPipeThreads to be terminated to soon.

There is also a theoretical race (don't know if it has been hit) that
manifests when we end up adding threads into thread_sequence_number_map
instead of replacing an existing already ref counted item. If we add,
then we will hit the same race, so added a fix making sure we detect
this case and correctly makes an addref to the thread. This potential
issue exists in C++ version of EventPipe library as well.

The other issue triggering another race related to ref counted threads.
The streaming thread in C library used ep_thread_get_or_create to get a
reference to itself. This will create an EventPipeThread
instance in TLS, but it will also add thread into global thread list.
Since the streaming thread doesn’t do additional writes of events it
will not get a thread session state, meaning that it will keep its original
ref count. This opens up a race when the TLS destructor decrements
the reference count, and another thread disabling a session. The
thread that disables the session will get a copy of all running threads,
but if the thread running TLS destructor managed to be the first
hitting ref count down to 0, but other thread will beat it taking
locks protecting list, the thread with refcount == 0 will still
be in the list copy, meaning the other thread will end up with a
potentially freed object on its thread list copy.

I made two fixes for this issue, first, don’t use ep_thread_get_or_create
from streaming thread, since there is an ability to get hold of
runtime specific thread object, that will eliminate the race between
a thread added into EventPipe, but not writing events, so it won’t have
an thread session state holding an additional ref count. Second, since
the race is still there due to the spit between ref count and lock
protecting the list, I also made a change in the C library, moving the
register/unregister on the list into the ep_thread_get_or_create (register)
and TLS destructor (unregister), meaning that the list will track live
threads currently using EventPipe library, and the EventPipeThread
object is still ref counted, meaning that it still can outlive the
lifetime of the physical thread.

Doing this split close the potential race condition (and even fix the
scenario if we kept the streaming thread added into the global thread list).
This hypothetical race condition exists in C++ library as well but might
have been mitigated by ref counting thread session state and making sure
the TLS destructor won’t race with a thread doing disable since thread
session state ref count will be held past par of disable that could race.

3 years agoFix threading issue in MulticoreJit (#46783)
Dong-Heon Jung [Tue, 12 Jan 2021 06:29:51 +0000 (15:29 +0900)]
Fix threading issue in MulticoreJit (#46783)

Fix https://github.com/dotnet/runtime/issues/46778 issue

3 years agofallback to GetAddrInfoW if GetAddrInfoExW fails (#45816)
Tomas Weinfurt [Tue, 12 Jan 2021 06:15:51 +0000 (22:15 -0800)]
fallback to GetAddrInfoW if GetAddrInfoExW fails (#45816)

* fallback to GetAddrInfoW if GetAddrInfoExW fails

* Update src/libraries/System.Net.NameResolution/src/System/Net/Dns.cs

Co-authored-by: Cory Nelson <phrosty@gmail.com>
* Update src/libraries/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* feedback from review

* update fakes

* attempt to fix telemetry

* remofe forced telemetry

* fix spelling

* improve duration precision

* task refactor

* update fakes again

* rename function

Co-authored-by: Cory Nelson <phrosty@gmail.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
3 years agoAlign inner loops (#44370)
Kunal Pathak [Tue, 12 Jan 2021 04:54:18 +0000 (20:54 -0800)]
Align inner loops (#44370)

* Detect inner loop and add 10 bytes of padding at the beginning

* generate nop in previous blocks

* TODO: figure out if anything needs to be done in optCanonicalizeLoop

* Add COMPlus_JitAlignLoopMinBlockWeight and COMPlus_JitAlignLoopMaxCodeSize

- Add 2 variables to control which loops get aligned
- Moved padding after the conditional/unconditional jump of previous block

* Reuse AlignLoops flag for dynamic loop alignment

* Detect back edge and count no. of instructions before doing loop alignment

* fix bugs

* propagate the basic block flag

* Switch from instrCount to codeSize

* JitAlignLoopWith32BPadding

* Add emitLoopAlign32Bytes()

* wip

* Add logic to avoid emitting nop if not needed

* fix a condition

* Several things:

- Replaced JitAlignLoopWith32BPadding with JitAlignLoopBoundary
- Added JitAlignLoopForJcc
- Added logging of boundary and point where instruction splitting happpens
- Add logic to take into consideration JCC.

* Added JitAlignLoopAdaptive algorithm

* wip

* revert emitarm64.cpp changes

* fix errors during merge

* fix build errors

* refactoring and cleanup

* refactoring and build errors fix

* jit format

* one more build error

* Add emitLoopAlignAdjustments()

* Update emitLoopAlignAdjustments to just include loopSize calc

* Remove #ifdef ADAPTIVE_LOOP_ALIGNMENT

* Code cleanup

* minor fixes

* Fix issues:
- Make sure all `align` instructions for non-adaptive fall under same IG
- Convert some variables to `unsigned short`
- Fixed the maxPadding amount for adaptive alignment calculation

* Other fixes

* Remove align_loops flag from coreclr

* Review feedback

- Do not align loop if it has call
- Created `emitSetLoopBackEdge()` to isolate `emitCurIG` inside emitter class
- Created `emitOutputAlign()` to move the align instruction output logic
- Renamed emitVariableeLoopAlign() to emitLongLoopAlign()
- Created `optIdentifyLoopsForAlignment()` to identify loops that need alignment
- Added comments at various places

* jit format

* Add FEATURE_LOOP_ALIGN

* remove special case for align

* Do not propagate BBF_LOOP_ALIGN in certain cases

* Introduce instrDescAlign and emitLastAlignedIgNum

* Several changes:

- Perform accurate padding size before outputting align instruction
- During outputting, just double check if the padding needed matches to what was calculated.
- If at any time, instruction sizes are over-estimated before the last align instruction,
  then compensate them by adding NOP.
- As part of above step, do not perform encoding "VEX prefix shortening" if there is align
  instruction in future.
- Fix edge cases where because of loop cloning or resolution phase of register allocator, the
  loops are marked such that they cover the loops that are already mark for alignment. Fix by
  resetting their IGF_LOOP_ALIGN flag.
- During loop size calculation, if the last IG also has `align` flag, then do not take into account
  the align instruction's size because they are reserved for the next loop.

* jit format

* fix issue related to needLabel

* align memory correctly in superpmi

* Few more fixes:

- emitOffsAdj takes into account for any mis-prediction of jump. If we compensate that mis-prediction, that off that adjustment.
- Record the lastAlignIG only for valid non-zero align instructions

* minor JITDUMP messages

* Review comments

* missing check

* Mark the last align IG the one that has non-zero padding

* More review comments

* Propagate BBF_LOOP_ALIGN for compacting blocks

* Handle ALIGN_LOOP flag for loops that are unrolled

* jit format

* Loop size upto last back-edge instead of first back-edge

* Take loop weight in consideration

* remove align flag if loop is no longer valid

* Adjust loop block weight to 4 instead of 8

* missing space after rebase

* fix the enum values after rebase

* review feedback

* Add missing #ifdef DEBUG

3 years agoGtneg mul divoptimizations (#45604)
Alex Covington [Tue, 12 Jan 2021 02:30:28 +0000 (18:30 -0800)]
Gtneg mul divoptimizations (#45604)

* GT_NEG optimization for multiplication and division

* Distribute negation over parenthetical multiplication or division.

* Removing duplicate logic that I had put in accidently.

* Check overflow and other conditions before performing morph

* Resolved merge conflict and cleanup morph.cpp

* Formatting morph.cpp

* Returning tree after performing smpop again to fix flags

* Formatting

* Added check for optimizations, formatting.

* Using gtIsActiveCSE_Candidate instead of fgGlobalMorph

* Update src/coreclr/jit/morph.cpp

Co-authored-by: Sergey Andreenko <seandree@microsoft.com>
* Formatting

* delete formatting changes.

* Add a test.

* Change the conditions a bit.

* Better names for the tests.

Co-authored-by: Sergey Andreenko <seandree@microsoft.com>
3 years agoR2RDump improvements (#46833)
Simon Nattress [Tue, 12 Jan 2021 02:20:04 +0000 (18:20 -0800)]
R2RDump improvements (#46833)

* Fix handling of module override token in signature parser. When the override is present, a new SignatureDecoder is created and used as the decoder for the final signature with the fixup kind (and module override flag which is stored in the upper bit of the fixup kind byte) already parsed. This causes the remainder of the signature to be parsed as a full R2R signature which is now missing the fixup type.
* Instead of creating a new decoder when a module override is present, set up the initial decoder's metadata reader in the constructor by detecting the module override up front.
* Fix `TryLocateNativeReadyToRunHeader` to swallow `BadImageFormatException` and return true / false whether the image has a native R2R header (for composite images).
* Running R2RDump on IL assemblies with no R2R now emits an error message that the assembly is not R2R instead of an unhelpful error about some RVA offset conversion failing.

3 years agoRemove unnecessary .sln file in System.Runtime.Serialization.Formatters (#46839)
Eric Erhardt [Tue, 12 Jan 2021 02:17:20 +0000 (20:17 -0600)]
Remove unnecessary .sln file in System.Runtime.Serialization.Formatters (#46839)

3 years agoResolve ILLink warnings in System.Reflection.DispatchProxy (#46715)
Eric Erhardt [Tue, 12 Jan 2021 00:35:47 +0000 (18:35 -0600)]
Resolve ILLink warnings in System.Reflection.DispatchProxy (#46715)

* Resolve ILLink warnings in System.Reflection.DispatchProxy

I also took this chance to remove unnecessary GetTypeInfo() calls, since some of them needed to be removed.

Contributes to #45623

* Update annotations for PR feedback.

Remove DynamicallyAccessedMemberTypes.All from the interface and base class types. If unused members are trimmed, this won't cause problems with DispatchProxy.

* Add a trimming test for DispatchProxy since we are suppressing ILLinker warnings.

3 years agoQuiet the output from emsdk_env.sh to make the build less verbose. (#46780)
Zoltan Varga [Tue, 12 Jan 2021 00:33:07 +0000 (19:33 -0500)]
Quiet the output from emsdk_env.sh to make the build less verbose. (#46780)

* Quiet the output from emsdk_env.sh to make the build less verbose.

* Quiet mono-cil-strip as well.

3 years agoDisable Speech Tests on Mono. (#46828)
Johan Lorensson [Mon, 11 Jan 2021 22:27:13 +0000 (23:27 +0100)]
Disable Speech Tests on Mono. (#46828)

Mono on netcore doesn't support COM wrappers that System.Speech depends
on. Disable System.Speech.Tests on Mono.

3 years agoNo need to handle COR_E_STACKOVERFLOW when waiting for GC. (#46733)
Vladimir Sadov [Mon, 11 Jan 2021 21:44:55 +0000 (13:44 -0800)]
No need to handle COR_E_STACKOVERFLOW when waiting for GC. (#46733)

* remove TSNC_WaitUntilGCFinished, noone checks for it

* remove TS_BlockGCForSO, the secenario no longer can happen.

* unused flag related to user-requested thread suspension

3 years agoImprove OidLookup.ToLookup perf, in particular for X509Certificate2.Extensions (...
Stephen Toub [Mon, 11 Jan 2021 21:00:26 +0000 (16:00 -0500)]
Improve OidLookup.ToLookup perf, in particular for X509Certificate2.Extensions (#46819)

* Avoid OidLookup.ToOid call per extension in X509Certificate2.Extensions

`X509Certificate2.Extensions` invokes `CertificatePal.Extensions`, which in turn creates the extensions collection, invoking `new Oid(string)` for each.  This in turn calls `OidLookup.ToOid` in order to gather the friendly name, even though in many situations, no one actually cares about the friendly name.  We can instead call `new Oid(string, null)`, which makes the friendly name lazily initialized on first use, saving the `OidLookup.ToOid` call when it's not needed, and significantly reducing the time to call Extensions (in particular when the predefined OID lookup tables don't contain the OID for an extension and when it can't be found on lookup).

* Allow OidLookup.ToOid to cache failure

ToOid has a cache, but it only caches successful results.  If ToOid fails to find the relevant OID, nothing is cached, which makes the failure path very expensive, as every ToOid call for that OID takes the slow path.  This lets it be cached.

3 years agoFix PostEvictionCallbacks bug (#46807)
Adam Sitnik [Mon, 11 Jan 2021 20:06:05 +0000 (21:06 +0100)]
Fix PostEvictionCallbacks bug  (#46807)

* add a failing test

* fix the actual bug (this was not a CacheEntry but a CacheEntryTokens instance here)

3 years agofix SslStreamCertificateContext.Create with partial chain (#46664)
Tomas Weinfurt [Mon, 11 Jan 2021 19:32:11 +0000 (11:32 -0800)]
fix SslStreamCertificateContext.Create with partial chain (#46664)

* fix SslStreamCertificateContext.Create with partial chain

* add test with long partial chain

3 years ago[Mono] Initial metadata update support (#45612)
Aleksey Kliger (λgeek) [Mon, 11 Jan 2021 18:13:10 +0000 (13:13 -0500)]
[Mono] Initial metadata update support (#45612)

* Initial metadata-update prototype

Co-Authored-By: Bernhard Urban-Forster <lewurm@gmail.com>
* Add metadata-update.{c,h} to CMakeLists.txt

* Add icall to corelib

* Add console and browser metadata update samples

   Both samples depend on the roslynildiff tool which should be specified with a RoslynILDiffFullPath property in the .csproj files for the projects.

* Add README for mbr samples

* [build] Add initial runtime support for MonoMetadataUpdate property

   In the runtime defines cmake ENABLE_METADATA_UPDATE option and sets a preprocessor flag.

   In System.Private.CoreLib, defines FEATURE_METADATA_UPDATE and uses it to throw a NotSupportedException from LoadMetadataUpdate

* [runtime] ifdef out metadata updates if not enabled

   Also move execution engine initialization into the main update function and use a MonoError to signal failures (such as if interp inlining is not turned off) instead of asserting at startup.

* [wasm] set log mask to metadata-update

* [mbr] Add InjectUpdate fn to sample

* [metadata-update] don't merge heaps

* Don't make entrypoint public yet

* Add LoadMetadataUpdate to linker descriptor

* [wasm] add default Makefile variable value

* fix mono/mono CI

   don't try to run enc tests yet since they depend on roslynildiff

* remove mono/mono/tests/enc

   Will add as runtime tests in a future PR

* [metadata-update] Add per-thread exposed generation

   A thread has to voluntarily roll up to the latest published generation in order to see updates.

   - Roll up to the latest published generation when attaching a thread
   - The updater thread sees the allocated unpublished generation

* [mbr] Fixup console sample

   Use a single changing testfile

* [metadata-update] delete unused method

* [mbr] Use 2 threads in console sample

* [metadata-update] Respect exposed generation in MethdDef RVA lookups

* [interp] Expose latest metadata update before transforming methods

* [mbr] Update samples after rebase

   Use the WasmApp.targets

* [metadata-update] Don't fail after the first unsupported edit

   Log all the unsupported edits, then cancel the update

* [metadata_update] Keep track of logical table sizes for deltas

   Keep track of inserted/modified rows for each table in each delta. This will help to use a simpler algorithm to locate effective table rows by keeping track of the logical number of rows in the appended tables

* [metadata-update] Use a GList for MonoImage:delta_image

   We're going to need to walk backwards from the latest published delta

* [metadata-update] add effective table lookup debug output

* Address review feedback

* [interp] Save top interp frame at MINT_SAFEPOINT to ThreadContext

   Give metadata updates a peek at the interp frames since the LMF so that it can copy the InterpMethods that are currently executing

   This only works with hybrid and full coop suspend.  Preemptive suspend will need another mechanism.

* [mbr] Extend console sample

   Add a busy thread to demonstrate that interp frames since the last managed frame are visible to the metadata update mechanism and the active method bodies are copied before being invalidated.

* [interp] Check mono_polling_required at safepoint

Co-authored-by: Bernhard Urban-Forster <lewurm@gmail.com>
3 years agoissue-46477 Fix issue about checking last char in datetime string. (#46614)
LateApexEarlySpeed [Mon, 11 Jan 2021 17:36:26 +0000 (01:36 +0800)]
issue-46477 Fix issue about checking last char in datetime string. (#46614)

* issue-46477 Fix issue about checking last char in datetime string.

* issue-46477 Fix comment: Add more tests with timezone part.

3 years agoJIT: suppress edge weight second computation pass (#46779)
Andy Ayers [Mon, 11 Jan 2021 16:27:00 +0000 (08:27 -0800)]
JIT: suppress edge weight second computation pass (#46779)

Follow up to #45615.

We compute edge weights twice. Make sure we either enable or suppress
both the computations.

3 years ago[wasm] Fix running on browsers missing SharedArrayBuffer (#46784)
Ankit Jain [Mon, 11 Jan 2021 16:24:39 +0000 (11:24 -0500)]
[wasm] Fix running on browsers missing SharedArrayBuffer (#46784)

Recently we added:

    `BINDING.mono_sab_supported: typeof SharedArrayBuffer !== "undefined"`

.. which is meant to guard use of `SharedArrayBuffer` on browsers that
don't support it. But the final dotnet.js seems to check this at build
time itself, and converts the above to:

    `BINDING.mono_sab_supported: true`

.. which causes errors on Safari (for example):

```
[Error] Unhandled Promise Rejection: ReferenceError: Can't find variable: SharedArrayBuffer
onPendingRequestComplete (dotnet.js:1:149348)
processFetchResponseBuffer (dotnet.js:1:149582)
processFetchResponseBuffer
promiseReactionJob
```

Instead, we can use the type check directly.

3 years agoUse Math.DivRem instead of / % in BigInteger if dividend and divisor are trivial...
Ivan Kochurkin [Mon, 11 Jan 2021 15:41:37 +0000 (18:41 +0300)]
Use Math.DivRem instead of / % in BigInteger if dividend and divisor are trivial (#45230) (#46711)

3 years agoSimplify Uri UnicodeEquivalent helper (#46747)
Miha Zupan [Mon, 11 Jan 2021 15:17:15 +0000 (16:17 +0100)]
Simplify Uri UnicodeEquivalent helper (#46747)

3 years agoFix the position of the comment (#46806)
hopeko [Mon, 11 Jan 2021 14:29:31 +0000 (22:29 +0800)]
Fix the position of the comment (#46806)

3 years agoMinor refactoring to collections (#46506)
Shreyas Jejurkar [Mon, 11 Jan 2021 13:10:38 +0000 (18:40 +0530)]
Minor refactoring to collections (#46506)

* Minor refactoring to collections
1. Removed unwanted casting.
2. Added condition for Clear() method for SortedDictionary.

* Addressed PR feedback.
Removed unwated Clear condition.

* Addressed PR feedback.
1. Fixed spacing.

3 years ago[mono] Add DISABLE_NONBLITTABLE for non-blittable marshaling (#46444)
Ryan Lucia [Mon, 11 Jan 2021 13:05:54 +0000 (08:05 -0500)]
[mono] Add DISABLE_NONBLITTABLE for non-blittable marshaling (#46444)

This flag is not set by default on any platforms, but long-term it should be useful on wasm with the pinvoke generator work being done by the interop team.

This flag reduces around 13k in dotnet.wasm as of today (12/29/2020). However, that is a fairly low-end measurement because this PR only focused on the pinvoke marshaling rather than the full functionality. The structure of our marshaling callbacks means that even with icall linking, a lot of marshaling code will be kept around and unused, including all the string marshaling.

To solve this, we can either give up on the ilgen functionality being in a separate library so it gets linked our normally or we can just have this flag cover marshaling functionality as a whole. I've split that part off into a followup PR since it's more likely to be contested, but I implemented the latter option (and also disable things like certain JIT icalls for the same reason). We also will want analyzers set up before this is useful, so hopefully this solution is fine in combination with an extra analyzer for the marshaling methods in question?

3 years agoFix Mono Windows x64 crash blocking CI Windows x64 Release job. (#46573)
Johan Lorensson [Mon, 11 Jan 2021 07:42:51 +0000 (08:42 +0100)]
Fix Mono Windows x64 crash blocking CI Windows x64 Release job. (#46573)

After upgrade to later msvc version on CI boots, see
https://github.com/dotnet/runtime/issues/45524 for details,
Window x64 Release builds started to crash on libraries tests.

After investigation it turns out that new msvc compiler handles an
expression different compared to how it was handled in previous version.

After upgrade of msvc, the expression:

int _amd64_width_temp = ((guint64)(imm) == (guint64)(int)(guint64)(imm));

implemented in amd64_mov_reg_imm and then called from tramp-amd64.c@500
was transformed into an always true expression by compiler:

amd64_mov_reg_imm (code, AMD64_R11, (guint8*)mono_get_rethrow_preserve_exception_addr ());
lea rcx,[rethrow_preserve_exception_func (07FFB9E33A590h)]
mov word ptr [rbx+0Dh],0BB41h
mov byte ptr [rbx+0Fh],cl
mov rax,rcx
shr eax,8
mov byte ptr [rbx+10h],al
mov rax,rcx
shr eax,10h
shr ecx,18h
mov byte ptr [rbx+11h],al
lea rax,[rbx+13h]
mov byte ptr [rbx+12h],cl

as seen above, the condition and handling of a 64-bit imm has been
dropped by compiler.

This cause issues when the imm is a 64-bit value since it will always gets
truncated into 32-bit imm and in this case it was a pointer to a function
within coreclr.dll (mono_get_rethrow_preserve_exception_addr)
loaded located at higher address (using more than 32-bit).

This is most likely a regression issue in compiler for this specific
construction. I tried simpler construction (using same type conversion) on
both old and new compiler version and then it makes the right optimization.

Fix is to switch to a macro already available in amd64-codegen (amd64_is_imm32)
detecting if an imm needs a 32-bit or 64-bit sized value. This will be
correctly optimized by new msvc compiler and even if this is a work around
for a what seems to be a optimization bug in the compiler, it is still
cleaner and better describes the intent than current code.

Fix also re-enable Windows x64 Release CI test lane.

3 years agoDisable the test (#46752)
Jan Jahoda [Mon, 11 Jan 2021 01:09:52 +0000 (02:09 +0100)]
Disable the test (#46752)

Co-authored-by: Jan Jahoda <jajahoda@.microsoft.com>
3 years agoAdd recursion / thread interaction guard in LogInfoForFatalError (#46561)
Tomáš Rylek [Sun, 10 Jan 2021 21:06:44 +0000 (22:06 +0100)]
Add recursion / thread interaction guard in LogInfoForFatalError (#46561)

Based on local instrumentation I introduced while investigating
issues related to the switch-over to compile System.Private.CoreLib
using Crossgen2 I'm proposing to harden fatal exception handling
against nested and concurrent fatal error occurrences.

Thanks

Tomas

3 years agoFix the allocation of the acfg->cfgs array, it would have an incorrect size when...
Zoltan Varga [Sat, 9 Jan 2021 21:44:16 +0000 (16:44 -0500)]
Fix the allocation of the acfg->cfgs array, it would have an incorrect size when using profiled AOT. (#46781)

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

3 years ago[master] Update dependencies from dotnet/runtime-assets dotnet/arcade (#46744)
dotnet-maestro[bot] [Sat, 9 Jan 2021 15:57:05 +0000 (15:57 +0000)]
[master] Update dependencies from dotnet/runtime-assets dotnet/arcade (#46744)

[master] Update dependencies from dotnet/runtime-assets dotnet/arcade

3 years agoFix parsing of JIT-EE version GUID (#46773)
Bruce Forstall [Sat, 9 Jan 2021 00:03:11 +0000 (14:03 -1000)]
Fix parsing of JIT-EE version GUID (#46773)

With https://github.com/dotnet/runtime/pull/46116, a copy of the
actual first line of the GUID definition was added as a comment.
Unfortunately, the superpmi.py GUID parser was finding that one
instead of the actual GUID. Fix the parser to match from the
beginning of the line.

3 years agoHTTP/3: Fix decoding trailing headers (#46734)
James Newton-King [Fri, 8 Jan 2021 21:46:50 +0000 (10:46 +1300)]
HTTP/3: Fix decoding trailing headers (#46734)

3 years agoDisable some Speech tests on Server Core (#46756)
Dan Moseley [Fri, 8 Jan 2021 20:58:27 +0000 (12:58 -0800)]
Disable some Speech tests on Server Core (#46756)

3 years agoadd shutdown guard to profiler tests (#46739)
David Mason [Fri, 8 Jan 2021 20:05:41 +0000 (12:05 -0800)]
add shutdown guard to profiler tests (#46739)

3 years agoFix void returns in llvmonly runtime invokes. (#46735)
Zoltan Varga [Fri, 8 Jan 2021 19:03:42 +0000 (14:03 -0500)]
Fix void returns in llvmonly runtime invokes. (#46735)

3 years agoAdding System.Math overloads for nint/nuint (#46647)
Tanner Gooding [Fri, 8 Jan 2021 18:27:22 +0000 (10:27 -0800)]
Adding System.Math overloads for nint/nuint (#46647)

* Adding System.Math overloads for nint/nuint

* Adding a missing cast

* Fixing the Clamp_NInt and Clamp_NUInt tests to work with the provided MemberData

3 years agoControl Crossgen2 optimizations with DebuggableAttribute (#44514)
Simon Nattress [Fri, 8 Jan 2021 18:15:30 +0000 (10:15 -0800)]
Control Crossgen2 optimizations with DebuggableAttribute (#44514)

* Assemblies compiled in debug configuration use the `System.Diagnostics.DebuggableAttribute` to indicate optimizations are disabled.
* Match Crossgen 1's behavior and respect this setting if no explicit optimization arguments are passed in.
* Add `-Od` switch to disable optimizations since now the default behavior of Crossgen2 is to optimize release-built assemblies.
* Fix runtime assert when checking the GC ref map for multi-dimensional array's intrinsic `Address` method on x86. `Address` has a custom calling convention which always requires the extra param type in the signature. The extra shared generic check is too restrictive and doesn't match what we tell the JIT the signature is in https://github.com/dotnet/runtime/blob/4b8d10154c39b1f56424d4ba2068a3150d90d475/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs#L500.

3 years agoShare ICU culture init for unix/win with validation (#46660)
Adeel Mujahid [Fri, 8 Jan 2021 17:50:00 +0000 (19:50 +0200)]
Share ICU culture init for unix/win with validation (#46660)

3 years agoFix inconistent minus sign with different culture (#46588)
Buyaa [Fri, 8 Jan 2021 17:40:24 +0000 (09:40 -0800)]
Fix inconistent minus sign with different culture (#46588)

* Fix inconistent minus sign with different culture

3 years agoEnsure stack size is computed for stdcall name mangling (#46722)
Jan Kotas [Fri, 8 Jan 2021 17:32:15 +0000 (09:32 -0800)]
Ensure stack size is computed for stdcall name mangling (#46722)

Fixes #46667

3 years agoMake const variables internal to be used by other classes (#46693)
Justin Kotalik [Fri, 8 Jan 2021 16:49:48 +0000 (08:49 -0800)]
Make const variables internal to be used by other classes (#46693)

3 years agoUse signals for activation injection on macOS (#46657)
Jan Vorlicek [Fri, 8 Jan 2021 16:34:37 +0000 (17:34 +0100)]
Use signals for activation injection on macOS (#46657)

This change moves macOS activation injection to the signal plan like it
works on other Unix platforms. The reason is that the activation injection
using thread suspension and thread redirection with helper frame can
collide with signal handlers on the same thread and result in a corrupted
stack frame. The issue can be reproduced by sending signals to the
.NET process from some other process while the .NET process is doing
a lot of GCs.

3 years agoAdd missing BrotliStream methods to ref file (#46726)
Carlos Sanchez [Fri, 8 Jan 2021 15:43:07 +0000 (07:43 -0800)]
Add missing BrotliStream methods to ref file (#46726)

Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
3 years ago[browser] White space clean up. (#46743)
Kenneth Pouncey [Fri, 8 Jan 2021 15:37:37 +0000 (16:37 +0100)]
[browser] White space clean up. (#46743)

- Fix the white space in the file to keep VSC from creating noise every time the file is touched.
- Does not change any functioning code.

3 years agoRemove System.Runtime.Remoting.Contexts.Context, its not used anymore on netcore...
Zoltan Varga [Fri, 8 Jan 2021 14:59:02 +0000 (09:59 -0500)]
Remove System.Runtime.Remoting.Contexts.Context, its not used anymore on netcore. (#46691)

3 years agoUpdate dependencies from https://github.com/mono/linker build 20210107.1 (#46695)
dotnet-maestro[bot] [Fri, 8 Jan 2021 14:13:41 +0000 (14:13 +0000)]
Update dependencies from https://github.com/mono/linker build 20210107.1 (#46695)

[master] Update dependencies from mono/linker

3 years ago[interp] Move from stack based to fully local var based design (#46037)
monojenkins [Fri, 8 Jan 2021 11:55:18 +0000 (06:55 -0500)]
[interp] Move from stack based to fully local var based design (#46037)

Instead of having instructions that push and pop from the stack, every instruction has explicit dreg and sregs.

While the purpose of this PR is mainly to make it easier to implement more advanced optimization in the future, it also has noticeable performance implications. The code is simplified because we no longer need to update and save the SP. However, the code for each instruction is bloated due to the addition of explicit source and destination offsets. This is counteracted by the reduction of the total number of instructions, since ldloc/stloc and moves become redundant and they are mostly optimized away, even in this implementation state. Here are the total number of executed opcodes as part of running the corlib test suite with the interp https://gist.github.com/BrzVlad/d62f504930b75cba4b870e6dbd947e90.

Co-authored-by: BrzVlad <BrzVlad@users.noreply.github.com>
3 years ago[browser][docs] Add docs for running outerloop and browser instance (#46737)
Kenneth Pouncey [Fri, 8 Jan 2021 09:49:38 +0000 (10:49 +0100)]
[browser][docs] Add docs for running outerloop and browser instance (#46737)

* [browser][docs] Add testing docs for running outerloop and browser instance

* Add information for GitHub interface.

3 years ago[browser][bindings] Fix error with SharedArrayBuffer when used as a backing view...
Kenneth Pouncey [Fri, 8 Jan 2021 04:33:24 +0000 (05:33 +0100)]
[browser][bindings] Fix error with SharedArrayBuffer when used as a backing view. (#46625)

* Add code to check for a backing ArrayBuffer as well as a backing SharedBuffer.

- Resolves the error `"Object '...' is not a typed array"`

* Add other Slice methods per documentation of JavaScript docs

- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer/slice

* Add tests for SharedArrayBuffer.

* Address review comment about unused usings

* Address review comments.

* Address review comments for unnecessary mod in commit

* Add back whitespace

* Modify comment description as per review comment

* Address support for SharedArrayBuffer which fails under Firefox.

* Revert "Address support for SharedArrayBuffer which fails under Firefox."

This reverts commit f817638f897b2c558c49a80ac47f044683c58911.

* Address support for SharedArrayBuffer which fails under Firefox.  Without all the whitespace changes.

3 years agoPort System.Speech to .NET Core (#45941)
Dan Moseley [Fri, 8 Jan 2021 03:04:13 +0000 (19:04 -0800)]
Port System.Speech to .NET Core (#45941)

* Initial sources, with banners

* Run the code formatter

* Fix hang in XUnit due to failing to complete all AsyncOperation-s

* Remove reflection over RegistryKey

* Add ref and packaging

* Add tests

* Add sln

* Fix CS1584

* Fix CA1823

* Fix CA1834

* Unnecessary suppressions

* Fix SA1028

* Fix CA1507

* Fix CA1810

* Fix CA1825

* Fix CA1825

* Unnecessary suppressions

* Fix CA1805

* Fix IDE0004

* Fix IDE0090

* Remove CAS

* Remove tabs and dead code

* Unnecessary suppressions

* Fix SA1212

* Fix SA1121

* Disable SA1129

* Fix SA1206

* Fix SA1518

* Fix SA1617

* Fix SA1001

* Fix CS0618

* Remove unnecessary comments

* Remove unnecessary whitespace

* Remove low value xml doc comments

* Unused usings

* dead files

* Remove CAS

* More junk

* Fix obvious original bug

* Remove/insert newlines

* Remove reference to old design document

* Fix spacing

* Fix typo name

* Fix file casing

* Remove dead code

* Add to compat pack

* Remove AppDomain etc

* Fix casing of .NET

* Remove low value XML docs

* Remove code that relies on compiling assemblies

* Fix inadvertently removed padding

* Use EDI to preserve stack when rethrowing

* Fix misaligned resource ID's to match sperror.h

* Skip SpeechRecognitionEngine tests if no installed recognizers

* Fix misformatted string bug

* Logging for CI error

* Fix NRE trying to map phonemes for voice for culture for which we do not have phoneme map

* Fix 153 spelling errors in comments using `Visual Studio Spell Checker`

* Remove extraneous file

* Fix spacing

* Fix project reference

* Reorder properties in csproj

* Change from netcoreapp2.0 to netcoreapp2.1

* Update src/libraries/System.Speech/pkg/System.Speech.pkgproj

Co-authored-by: Jose Perez Rodriguez <joperezr@microsoft.com>
* Add build error for targeting netcoreapp2.0

* Suppress new error during packaging testing

* Update System.Speech.targets

* Remove ref comments

* Update pkgproj

* Remove placeholder

Co-authored-by: Jose Perez Rodriguez <joperezr@microsoft.com>
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
3 years agoRemove incorrectly added ActiveIssue (#46680)
Aleksey Kliger (λgeek) [Fri, 8 Jan 2021 02:36:46 +0000 (21:36 -0500)]
Remove incorrectly added ActiveIssue (#46680)

https://github.com/mono/mono/issues/15029 was fixed by
https://github.com/dotnet/runtime/pull/44081, but
https://github.com/dotnet/runtime/pull/43407 incorrectly re-added the ActiveIssue.

3 years agoGlob include files based on project extension (VS) (#46702)
Viktor Hofer [Fri, 8 Jan 2021 01:20:13 +0000 (02:20 +0100)]
Glob include files based on project extension (VS) (#46702)

* Glob include files based on project extension (VS)

* Update Directory.Build.targets

* Update Directory.Build.targets

* Update Directory.Build.targets

3 years agoResolve ILLink warnings in System.Text.RegularExpressions (#46687)
Eric Erhardt [Fri, 8 Jan 2021 00:16:51 +0000 (18:16 -0600)]
Resolve ILLink warnings in System.Text.RegularExpressions (#46687)

* Add DynamicallyAccessedMembers All to TypeBuilder and EnumBuilder CreateType methods.

Contributes to #45623

3 years agoDisable System.ComponentModel.Composition on Mono (#46699)
Aleksey Kliger (λgeek) [Fri, 8 Jan 2021 00:14:26 +0000 (19:14 -0500)]
Disable System.ComponentModel.Composition on Mono (#46699)

Active issue is https://github.com/mono/mono/issues/16417

There seems to be some kind of System.Reflection.Emit concurrency problem here

3 years agoImprove SuperPMI handling of CORINFO_SIG_INST handle arrays (#46604)
Bruce Forstall [Fri, 8 Jan 2021 00:13:49 +0000 (14:13 -1000)]
Improve SuperPMI handling of CORINFO_SIG_INST handle arrays (#46604)

* Improve SuperPMI handling of CORINFO_SIG_INST handle arrays

CORINFO_SIG_INST, used by the CORINFO_SIG_INFO struct, contains
two pointers to arrays of handles. SuperPMI was saving/restoring
these assuming 8-byte pointers. This worked fine for same-bitness
record/playback (although on 32-bit it saved/restored twice as
much data as it should, reading beyond the actual arrays when
saving). However, when recording on 32-bit and replaying on 64-bit,
this didn't work.

Change the CORINFO_SIG_INST recording to record the handle arrays
in a new dense DWORDLONG map, SigInstHandleMap, in "agnostic" format (64-bit pointers),
and store an index into this map to the base of the array. The handle array
can then be serialized/deserialized properly for cross-bitness scenarios.
The map contains only unique array sequences, which is required so when
we look up an array we find the unique map index.

Create helpers for all the CORINFO_SIG_INST related serialization/deserialization/
dump/formatting.

Also, implement record/playback of getExpectedTargetArchitecture().

Added "-simple" option to "mcs -dump" to not print the function name/signature
for a method context. Useful for debugging problems where constructing that
name/signature causes mcs crashes/asserts.

Record on arm, playback on x64, using cross-compiler, now works.

* Change the JIT/EE GUID

The JIT/EE interface hasn't changed, but the SuperPMI data format
has changed incompatibly, so force a recollection that won't be
confused with the old collections.

* Fix non-Windows build

3 years agoResolve easy ILLink warnings from InteropServices, ObjectModel, Drawing.Primitives...
Eric Erhardt [Fri, 8 Jan 2021 00:10:46 +0000 (18:10 -0600)]
Resolve easy ILLink warnings from InteropServices, ObjectModel, Drawing.Primitives (#46605)

* Resolve ILLink warnings in System.Runtime.InteropServices
* Resolve ILLink warnings in System.ObjectModel
* Resolve ILLink warnings in System.Drawing.Primitives

Contributes to #45623

* Remove suppression no longer needed with the latest ILLinker.

* Annotate ComEventInterfaceAttribute.EventProvider to make it trim compatible.

3 years agoDelete DateTime FCalls and switch to fully managed implementation (#46690)
Jan Kotas [Fri, 8 Jan 2021 00:06:20 +0000 (16:06 -0800)]
Delete DateTime FCalls and switch to fully managed implementation (#46690)

3 years agoAvoid OutOfMemoryException in some test environments (#45710)
Steve Harter [Thu, 7 Jan 2021 23:54:01 +0000 (17:54 -0600)]
Avoid OutOfMemoryException in some test environments (#45710)

3 years agoUse faster Guid/Name lookup for EventSource (#45745)
Ben Adams [Thu, 7 Jan 2021 23:18:27 +0000 (23:18 +0000)]
Use faster Guid/Name lookup for EventSource (#45745)

3 years agoAllow early prop to undertand how R2R creates arrays (#42831)
nathan-moore [Thu, 7 Jan 2021 22:57:58 +0000 (17:57 -0500)]
Allow early prop to undertand how R2R creates arrays (#42831)

3 years agoChange FeedbackSize on Rijndael wrappers to delegate to implementation.
Kevin Jones [Thu, 7 Jan 2021 22:44:07 +0000 (17:44 -0500)]
Change FeedbackSize on Rijndael wrappers to delegate to implementation.

The FeedbackSize on RijndaelManaged and RijndaelImplementation were not
accurately reflecting the feedback size that the actual implementation
was using. The FeedbackSize would report 128, however the implementation
defaults to 8, so CFB8 is actually what was being used.

Likewise, the setter for FeedbackSize on the Rijndael types had no
effect. The implementation's default feedback size of 8 would always
be used.

3 years agoReduce CacheEntry size (#45962)
Adam Sitnik [Thu, 7 Jan 2021 19:57:33 +0000 (20:57 +0100)]
Reduce CacheEntry size (#45962)

* reduce the size of CacheEntry instance by 2xsizeof(int)

* remove _lock field and use "this" for locking instead

* move _expirationTokenRegistrations, _postEvictionCallbacks and _expirationTokens to separate type to reduce the typical cache entry size

* apply code review suggestion: don't use Enum.HasFlag

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Apply suggestions from code review

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>