platform/upstream/dotnet/runtime.git
3 years agoDo not pin free object for STRESS_REGIONS (#49547)
Andrew Au [Tue, 16 Mar 2021 19:34:56 +0000 (12:34 -0700)]
Do not pin free object for STRESS_REGIONS (#49547)

3 years agoMove dotnet-sdk snaps into the installer repo (#49697)
Viktor Hofer [Tue, 16 Mar 2021 18:59:44 +0000 (19:59 +0100)]
Move dotnet-sdk snaps into the installer repo (#49697)

3 years agoPrevent unbounded lock holds in BufferManager of EventPipe (#48435)
John Salem [Tue, 16 Mar 2021 17:36:07 +0000 (10:36 -0700)]
Prevent unbounded lock holds in BufferManager of EventPipe (#48435)

3 years ago[mono][debugger] Disable by default the generation of mscordbi (#49596)
Thays Grazia [Tue, 16 Mar 2021 17:17:59 +0000 (14:17 -0300)]
[mono][debugger] Disable by default the generation of mscordbi (#49596)

* Disable by default compilation of mscordbi, it will be generated by default only on CI.
To generate it use /p:MonoMsCorDbi=true
Fixes #49590

* Changing what was suggested by @jkotas and @akoeplinger.
Thanks @directhex for your help.

* Update eng/Subsets.props

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
3 years ago[wasm] current dedup breaks blazor template apps (#49678)
Larry Ewing [Tue, 16 Mar 2021 17:05:00 +0000 (12:05 -0500)]
[wasm] current dedup breaks blazor template apps (#49678)

3 years agoPermit ST as a friendly name alias for stateOrProvinceName OID.
Kevin Jones [Tue, 16 Mar 2021 16:28:23 +0000 (12:28 -0400)]
Permit ST as a friendly name alias for stateOrProvinceName OID.

3 years agoDisable Interop test which is killing our pass rate on Mac ARM64 (#49703)
Jo Shields [Tue, 16 Mar 2021 15:42:02 +0000 (11:42 -0400)]
Disable Interop test which is killing our pass rate on Mac ARM64 (#49703)

3 years agoActiveIssue for failing Windows threading test (#49701)
Jo Shields [Tue, 16 Mar 2021 15:40:41 +0000 (11:40 -0400)]
ActiveIssue for failing Windows threading test (#49701)

3 years agoMove StartupHookerProvider from shared descriptor file (#49669)
Mateo Torres-Ruiz [Tue, 16 Mar 2021 15:28:19 +0000 (08:28 -0700)]
Move StartupHookerProvider from shared descriptor file (#49669)

* Move StartupHook substitution from shared descriptor

* Put things in proper descriptor

* Subs

* Add subs xml in SPCL

* Fix assembly name

3 years agoBig-endian test case fixes: PKCS crypto (#49695)
Ulrich Weigand [Tue, 16 Mar 2021 14:55:10 +0000 (15:55 +0100)]
Big-endian test case fixes: PKCS crypto (#49695)

* Fix endian assumption in Rfc3161 test case
  (serial number must always be in big-endian byte order)

3 years agoBig-endian test case fixes: BinaryWriter (#49688)
Ulrich Weigand [Tue, 16 Mar 2021 14:52:20 +0000 (15:52 +0100)]
Big-endian test case fixes: BinaryWriter (#49688)

* Fix endian assumption in BinaryWriter_WriteSpan
  (BinaryWriter always uses little-endian byte order)

3 years agoBig-endian test case fixes: unsafe compiler services (#49692)
Ulrich Weigand [Tue, 16 Mar 2021 14:51:57 +0000 (15:51 +0100)]
Big-endian test case fixes: unsafe compiler services (#49692)

* Update expected values for endian-dependent test cases

3 years agoBig-endian test case fixes: Visual Basic (#49696)
Ulrich Weigand [Tue, 16 Mar 2021 14:43:34 +0000 (15:43 +0100)]
Big-endian test case fixes: Visual Basic (#49696)

* Enable Randomize_SetsExpectedState test case on big-endian systems
  (VBMath.Randomize already handles big-endian systems)

3 years agoMove Windows Mono to Staging (Closes: #49569) (#49641)
Jo Shields [Tue, 16 Mar 2021 14:14:07 +0000 (10:14 -0400)]
Move Windows Mono to Staging (Closes: #49569) (#49641)

* Move Windows Mono to Staging (Closes: #49569)

3 years agoBig-endian test case fixes: XML (#49689)
Ulrich Weigand [Tue, 16 Mar 2021 13:45:48 +0000 (14:45 +0100)]
Big-endian test case fixes: XML (#49689)

* Update expected results for endian-dependent tests BinHex_9/BinHex_10

* Input strings for XML encode/decode tests are hard-coded little-endian

3 years agoBig-endian test case fixes: System.Memory tests (#49690)
Ulrich Weigand [Tue, 16 Mar 2021 13:45:24 +0000 (14:45 +0100)]
Big-endian test case fixes: System.Memory tests (#49690)

* Fix endian assumptions in preparing input byte patterns

* Enable tests that were disabled on big-endian systems

3 years agoBig-endian test case fixes: big-integer numerics (#49694)
Ulrich Weigand [Tue, 16 Mar 2021 13:44:24 +0000 (14:44 +0100)]
Big-endian test case fixes: big-integer numerics (#49694)

* Fix endian assumptions in CtorByteArray tests
  (the byte array must always be in little-endian byte order)

* Fix endian assumptions in left-/right-shift tests
  (byte array representing shift count must be in little-endian)

3 years agoReduce startup allocation from event pipe metadata (#49303)
Stephen Toub [Tue, 16 Mar 2021 13:36:14 +0000 (09:36 -0400)]
Reduce startup allocation from event pipe metadata (#49303)

* Reduce startup allocation from event pipe metadata

A "hello world" console app results in EventPipeMetadataGenerate.GenerateEventMetadata making almost 500 calls to factory methods on ScalarTypeInfo, each of which allocates a new ScalarTypeInfo object and a Func delegate, but they're all immutable objects that could be cached on first use and reused for all subsequent use.  Eliminating the need for the funcs entirely and caching the ScalarTypeInfo objects saves almost 1000 object allocations and 66K of allocation at startup.  It does mean we'll end up holding on to a few objects (9 objects == ~575 bytes) for the duration of the app that we would otherwise have dropped (plus the static fields).

* Update src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/SimpleTypeInfos.cs

3 years agoDev Innerloop pipeline timeout was passed in wrong (#49702)
Viktor Hofer [Tue, 16 Mar 2021 13:35:30 +0000 (14:35 +0100)]
Dev Innerloop pipeline timeout was passed in wrong (#49702)

3 years agoAvoid forcing parsing of DefaultRequestHeaders and from message.ToString() (#49673)
Stephen Toub [Tue, 16 Mar 2021 13:35:19 +0000 (09:35 -0400)]
Avoid forcing parsing of DefaultRequestHeaders and from message.ToString() (#49673)

* Avoid forcing parsing of DefaultRequestHeaders

In the past, this was done because every request would parse all headers as part of sending them, so it was better to parse once then on every request.  But we changed the behavior for sending in SocketsHttpHandler to actually respect TryAddWithoutValidation, such that we wouldn't forcefully validate unless the developer asked us to.  This makes DefaultRequestHeaders consistent with that.

* Avoid forcing parsing when ToString()'ing request and response messages

This not only can change behavior in the debugger just by hovering over a message, it can change behavior at runtime due to the request/response messages getting logged.

* Add another test

3 years agoWasm build improvements (#49658)
Zoltan Varga [Tue, 16 Mar 2021 04:17:30 +0000 (00:17 -0400)]
Wasm build improvements (#49658)

* Avoid passing mono libs twice when linking dotnet.wasm.

* Build aot-instances.dll in deterministic mode.

* Add a helper target for building the mono runtime + cross compiler without building dotnet.wasm.

Useful when working with AOT, since AOT will rebuild dotnet.wasm anyway.

* Avoid emitting a double -Oz into emcc-flags.txt

* Quiet emsdk_env.sh.

* Add a _WasmDevel internal property which can be used to pass -O0 to the wasm linker, speeding up builds.

* Disable native stripping for wasm tests.

* Revert unrelated changes.

* Don't overwrite EmccFlags.

3 years ago[wasm] Remove extraneous emission of MONO_PATH value (#49672)
Ankit Jain [Tue, 16 Mar 2021 03:25:58 +0000 (23:25 -0400)]
[wasm] Remove extraneous emission of MONO_PATH value (#49672)

3 years agoClear the buffers fields (#49575)
David Fowler [Mon, 15 Mar 2021 22:27:16 +0000 (15:27 -0700)]
Clear the buffers fields (#49575)

- This makes it easier to reason about gcroots in dumps

3 years agoAdd Andy's stress mode for byrefs. (#49636)
Sergey Andreenko [Mon, 15 Mar 2021 22:00:41 +0000 (15:00 -0700)]
Add Andy's stress mode for byrefs. (#49636)

3 years agoRemove reference to non-existing parameter (#49630)
Andrii Kurdiumov [Mon, 15 Mar 2021 21:11:16 +0000 (03:11 +0600)]
Remove reference to non-existing parameter (#49630)

3 years agoResolve ILLink warnings in System.ComponentModel.TypeConverter (Round 2) (#49467)
Eric Erhardt [Mon, 15 Mar 2021 20:45:26 +0000 (15:45 -0500)]
Resolve ILLink warnings in System.ComponentModel.TypeConverter (Round 2) (#49467)

* Resolve ILLink warnings in System.ComponentModel.TypeConverter (Round 2)

Contributes to #45623

* Change ComNativeDescriptorProxy so the linker can see the Type (when it is available) by using Type.GetType.

3 years agoUpdate buildtriage.md (#49651)
Viktor Hofer [Mon, 15 Mar 2021 18:12:06 +0000 (19:12 +0100)]
Update buildtriage.md (#49651)

* Update buildtriage.md

3 years agoSuppress the exception thrown when DiagnosticSourceEventSource access object properti...
Tarek Mahmoud Sayed [Mon, 15 Mar 2021 18:05:00 +0000 (11:05 -0700)]
Suppress the exception thrown when DiagnosticSourceEventSource access object properties (#49567)

3 years agoAdd non-RC2 content encryption test data for Pkcs test suite (#49564)
Elinor Fung [Mon, 15 Mar 2021 17:26:54 +0000 (10:26 -0700)]
Add non-RC2 content encryption test data for Pkcs test suite (#49564)

3 years ago[wasm] Add "Installation of JavaScript engines" to README (#49650)
Radek Doulik [Mon, 15 Mar 2021 16:49:26 +0000 (17:49 +0100)]
[wasm] Add "Installation of JavaScript engines" to README (#49650)

Add information about `jsvu` and how to install it on mac.

3 years agoPush Evidence down to System.Security.AccessControl (#49411)
Eric StJohn [Mon, 15 Mar 2021 16:41:38 +0000 (09:41 -0700)]
Push Evidence down to System.Security.AccessControl (#49411)

* Push Evidence down to System.Security.AccessControl

This can avoid the dependency
  System.Security.Cryptography.Xml > System.Security.Permissions

* Fix nullable annotations and ObsoleteAttributes

3 years agoImprove docs for StringValues.IsNullOrEmpty for empty strings (#49629)
scharnyw [Mon, 15 Mar 2021 14:53:02 +0000 (22:53 +0800)]
Improve docs for StringValues.IsNullOrEmpty for empty strings (#49629)

Fix #49626

Co-authored-by: Guanbo Wang <GWang26@slb.com>
3 years agoReplace LINQ's custom Set with HashSet (#49591)
Stephen Toub [Mon, 15 Mar 2021 13:02:57 +0000 (09:02 -0400)]
Replace LINQ's custom Set with HashSet (#49591)

3 years ago[RyuJIT] Fix rel32 for calls/data (#49549)
Egor Bogatov [Mon, 15 Mar 2021 12:24:57 +0000 (15:24 +0300)]
[RyuJIT] Fix rel32 for calls/data (#49549)

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
3 years agoDisable /OPT:ICF on windows, it merges identical functions breaking icall symbol...
Zoltan Varga [Mon, 15 Mar 2021 12:09:48 +0000 (08:09 -0400)]
Disable /OPT:ICF on windows, it merges identical functions breaking icall symbol lookup. (#49622)

3 years agoAdd null check for WaitInfo (#49628)
Ryan Lucia [Mon, 15 Mar 2021 11:49:50 +0000 (07:49 -0400)]
Add null check for WaitInfo (#49628)

* Add null check for WaitInfo

* Remove OnThreadExiting static from WaitSubsystem

3 years agoImplement struct enumerator for Tensor<T> (#46497)
Newell Clark [Mon, 15 Mar 2021 10:29:00 +0000 (06:29 -0400)]
Implement struct enumerator for Tensor<T> (#46497)

* Added struct enumerator to Tensor<T>

Fix issue #28391

* Added struct enumerator to Tensor<T>

Added unit test for element enumeration.

Fix issue #28391

* Added xml doc comments

* Apply suggested edit to System.Numerics.Tensor.Enumerator

Co-authored-by: Günther Foidl <gue@korporal.at>
* Fixed naming

* Forgot to change back Current to auto-prop

* Apply suggested changes

-Make Reset and Dispose public
-Fix null ref bug with Reset
-Added tests for Reset and Dispose

Co-authored-by: Günther Foidl <gue@korporal.at>
3 years agoNon-generic StringComparer conversion for dict and hashset (#49608)
Ben Adams [Mon, 15 Mar 2021 03:42:26 +0000 (03:42 +0000)]
Non-generic StringComparer conversion for dict and hashset (#49608)

3 years agoProfile guided compilation fixes (#49516)
David Wrighton [Sun, 14 Mar 2021 22:46:35 +0000 (15:46 -0700)]
Profile guided compilation fixes (#49516)

- Fix issue where if we can't load a token during profile data resolution, we crash with a NullReferenceException
- Fix issue where when profile specified methods are added to the compilation, they cause methods not specified to be compiled as well. This caused about a 3X bloat in method compilation when working off of profile specified data
  - Fixed by adding a dependency phase model to dependency analyzer
  - Then using that to tie into method compilation and dependencies so that some extra dependencies are trimmed by our dependency analysis flow

3 years agoConsolidate VS detection logic (#49593)
Anton Lapounov [Sun, 14 Mar 2021 21:48:27 +0000 (14:48 -0700)]
Consolidate VS detection logic (#49593)

3 years agoFix DateTime Tests (#49560)
Tarek Mahmoud Sayed [Sun, 14 Mar 2021 18:07:56 +0000 (11:07 -0700)]
Fix DateTime Tests (#49560)

* Fix DateTime Tests

3 years agoPass the cancellation token to FlushAsync (#49594)
David Fowler [Sun, 14 Mar 2021 14:45:34 +0000 (07:45 -0700)]
Pass the cancellation token to FlushAsync (#49594)

3 years agoHandle cleanup (#49578)
Zoltan Varga [Sun, 14 Mar 2021 05:36:41 +0000 (00:36 -0500)]
Handle cleanup (#49578)

* Remove unused named handle support.

* Remove more unused code.

3 years agoDelete a few more unused files (#49584)
Jan Kotas [Sun, 14 Mar 2021 02:57:18 +0000 (18:57 -0800)]
Delete a few more unused files (#49584)

3 years agoUse same brick size for both x64 and ARM64 (#49581)
Jan Kotas [Sun, 14 Mar 2021 01:08:06 +0000 (17:08 -0800)]
Use same brick size for both x64 and ARM64 (#49581)

3 years agoDelete Utf8Extensions.* (#49582)
Jan Kotas [Sat, 13 Mar 2021 21:22:05 +0000 (13:22 -0800)]
Delete Utf8Extensions.* (#49582)

Unused left over from the Utf8String prototype

3 years ago[mono][mbr] Implement DOTNET_MODIFIABLE_ASSEMBLIES support (#49507)
Aleksey Kliger (λgeek) [Sat, 13 Mar 2021 18:22:31 +0000 (13:22 -0500)]
[mono][mbr] Implement DOTNET_MODIFIABLE_ASSEMBLIES support (#49507)

Implements https://github.com/dotnet/runtime/issues/47274 for Mono.

1. `DOTNET_MODIFIABLE_ASSEMBLIES` environment variable must be set to `debug` for hot reload to be enabled (in addition to the interpreter being enabled)
2. Assemblies must be compiled in Debug mode - we check `DebuggableAttribute` for the `DisableOptimizations` bit.  If an assembly doesn't have the bit set, it can't be reloaded.
3. In the interpreter - don't try to inline when hot reload is enabled and the caller or callee has the DisableOptimizations bit set.

* [mbr] Check DOTNET_MODIFIABLE_ASSEMBLIES for hot reload support

   If it's set to "debug" (case insensitive) then hot reload is enabled for assemblies compiled in debug mode.  Otherwise hot reload is disabled

* [mbr] Disable inlining for DebuggerAttribue assemblies

   with the optimizer disabled flag

* [mbr] Update samples

* [mbr] Throw InvalidOperationException is hot reload is not supported

   On a per-assembly basis

* [mbr] Stub implementations if !ENABLE_METADATA_UPDATE

3 years agoSupport loading ICU data from managed Interop (#49406)
Steve Pfister [Sat, 13 Mar 2021 15:32:45 +0000 (10:32 -0500)]
Support loading ICU data from managed Interop (#49406)

In iOS we support loading a custom dat file when working with ICU.  The way this worked originally was the mono runtime exported a function that native code would call into (similar to wasm).  After thinking about it a bit, it makes more sense to load this the same way we do on desktop, but with the ability to provide the path to an ICU dat file via an AppContext key `ICU_DAT_FILE_PATH`.  This can be provided before Xamarin iOS calls `monovm_initialize` and they won't have to worry about calling some special function.

3 years agoPort some CoreRT Threading classes to Mono (#47333)
Ryan Lucia [Sat, 13 Mar 2021 07:33:05 +0000 (02:33 -0500)]
Port some CoreRT Threading classes to Mono (#47333)

3 years agoRemove Redundant "If" Check (#49324)
Alex-ABWorld [Sat, 13 Mar 2021 03:26:57 +0000 (03:26 +0000)]
Remove Redundant "If" Check (#49324)

Remove a redundant "NULL" check on a clearly NULL value, and corrected comments to correctly represent the current state of the function.

There are no longer any security checks, and as such the mentions of it are also redundant and have been removed.

3 years agoRemove SuperPMI upload of clrjit.dll (#49565)
Bruce Forstall [Sat, 13 Mar 2021 02:24:24 +0000 (18:24 -0800)]
Remove SuperPMI upload of clrjit.dll (#49565)

We never used the uploaded JITs, and we have a JIT rolling build
that gives us a better set of DLLs.

3 years agoEnable crossgen2 SuperPMI for Linux (#49531)
Bruce Forstall [Sat, 13 Mar 2021 00:41:02 +0000 (16:41 -0800)]
Enable crossgen2 SuperPMI for Linux (#49531)

* Fix SuperPMI on Linux for crossgen2

1. crossgen2 doesn't call DllMain (https://github.com/dotnet/runtime/issues/49525),
so add a call to initialize the PAL and other things in jitStartup() (the JIT does
it this way already). Note that crossgen2 doesn't call DllMain for shutdown, either,
so we won't properly shut down the logger. Normally, however, we don't use the logger
during collections.
1.1. I only changed the collector, not the other two shims (which aren't used).
2. We don't seem to be able to get the correct exception code for exceptions thrown
from crossgen2. So, as a workaround, instead of assuming we're going to succeed,
assume we're going to fail with a non-zero exception code, and then set it to zero
if no exception was thrown. This only applies to the `getCallInfo` API.

* Add crossgen2 collections for Linux platforms

* Clarify comment

3 years agoAdding an EventPipe README (#49542)
Noah Falk [Fri, 12 Mar 2021 22:46:46 +0000 (14:46 -0800)]
Adding an EventPipe README (#49542)

* Adding an EventPipe README

3 years agoMinor fix in dotnet-pgo.md (#49527)
Dong-Heon Jung [Fri, 12 Mar 2021 22:38:03 +0000 (07:38 +0900)]
Minor fix in dotnet-pgo.md (#49527)

3 years agoSkip compilation of simple methods that just throw in crossgen2 (#49514)
David Wrighton [Fri, 12 Mar 2021 22:27:39 +0000 (14:27 -0800)]
Skip compilation of simple methods that just throw in crossgen2 (#49514)

* Skip compilation of simple methods that just throw
- Significant savings when compiling System.Private.CoreLib. In particular, there are *many* intrinsic functions that we can now avoid compilation of
  - X64 build drops about 3,000 functions from compilation

* Update src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
3 years agoWasm dedup (#49538)
Zoltan Varga [Fri, 12 Mar 2021 19:16:45 +0000 (14:16 -0500)]
Wasm dedup (#49538)

* [wasm] Disable the linkonce linking of wrappers for now, the aot metadata about wrappers is not dedup-ed, so a separate dedup pass still saves more space.

* [wasm] Add dedup support to the build to avoid generating generic instances etc. multiple times.

This works as follows:
* Controlled by a new public 'WasmDedup' property, defaults to true.
* All assemblies are AOT compiled with the 'dedup-skip' option, which causes
the AOT compiler to avoid generating generic instances, certain wrappers etc.
* A new internal assembly called aot-instances.dll is added to the build.
* When aot-instances.dll is AOTed, all the other assemblies are AOTed together,
but only the generic instances/wrappers are emitted into its AOT image.

3 years ago[mono][jit] read DebuggableAttribute(DebuggingModes) ctor; move to metadata/ (#49505)
Aleksey Kliger (λgeek) [Fri, 12 Mar 2021 18:44:04 +0000 (13:44 -0500)]
[mono][jit] read DebuggableAttribute(DebuggingModes) ctor; move to metadata/ (#49505)

* [jit] read DebuggableAttribute(DebuggingModes) ctor; move to metadata/

   Pull is_jit_optimizer_disabled out of mini into metadata.

   Also support reading the DebuggingModes ctor

* fix whitespace

Co-authored-by: Thays Grazia <thaystg@gmail.com>
3 years agoBaggage and Tags for activity tracking options (#46571) (#48722)
Marc Sallin [Fri, 12 Mar 2021 17:36:53 +0000 (18:36 +0100)]
Baggage and Tags for activity tracking options (#46571) (#48722)

Co-authored-by: Sallin Marc, I212 <marc.sallin@post.ch>
3 years ago[wasm][debugger] Detect exception/error when calling runtime_invoke (#49498)
Thays Grazia [Fri, 12 Mar 2021 17:17:46 +0000 (14:17 -0300)]
[wasm][debugger] Detect exception/error when calling runtime_invoke (#49498)

* Related to #49206.
When we call runtime_invoke on wasm the exception always returns NULL and the error returns OK.
This was a problem because we were trying to get value of this new static property in DateTime type:
private static ReadOnlySpan<byte> DaysInMonth365 => new byte[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
As we don't know that we were getting an exception, the value that returns to the test was wrong.
The goal of this PR is detect that we got an exception when running runtime_invoke and return the expected value to debugger.
This is a temporary solution, I think the final solution is to fix runtime_invoke to return exception correctly on WASM.
We also need to support it: https://github.com/dotnet/runtime/blob/b3411852caa6a3de8ab9fa27f7860c76ef43e384/src/mono/mono/metadata/object.c#L6298

* Fix compilation error

* Update src/mono/mono/mini/mini-wasm-debugger.c

Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
* Adding comment as suggested by @lambdageek

Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
3 years ago[mono][debugger] Implementing mscordbi to support iCorDebug on mono runtime (#47639)
Thays Grazia [Fri, 12 Mar 2021 17:00:59 +0000 (14:00 -0300)]
[mono][debugger] Implementing mscordbi to support iCorDebug on mono runtime (#47639)

* Implementing mscordbi on mono to support icordebug

* Fix eval, fix step and cancel step, remove suspend status on mscordbi

* Using log from coreclr as mscordbi does

* Missing files

* Removing eglib from implementation

* Compiling on Mac

* Compiling and Working on windows.
Changing what @lambdageek suggested about mono_atomic_inc_i32

* Generating libmscordbi on mac

* Fix socket on mac

* Counting references, deleting objects, removing unecessary properties,
formating with cland-format, renaming properties to follow the used
pattern.

* Checking error when get reply from debugger

* Fix format, reuse regmeta from coreclr and try to fix compilation on
windows

* Dont build when target is android or ios or wasm

* Fix error unused variable

* Fixing error: 'CFUserNotificationDisplayAlert' is unavailable: not
available on macCatalyst

* Fix compilation error on Linux

* Fix function not found in maccatalyst
Fix warning as error of macro redefinition

* Dont compile mscordbi on maccatalyst

* Fix compilation on linux

* Fix compilation on android, ios and browser

* Fix compilation on linux

* Fix cross compiling

* Fix compilation x86 windows

* Fix x86 compilation

* Fix compilation on windows

* Fix cmake error

* Fix cmake

* Fix arm64 mac

* Fix windows compilation

* Fix memory leak

* Returning E_NOTIMPL where it was possible and it's not implemented as
suggested by @cshung

* Fix what @cshung

* Use only one ref count

* Adding ex_try everywhere that we could have an allocation failure.

* Implementing get class

* Apply suggestions from code review

Co-authored-by: Noah Falk <noahfalk@users.noreply.github.com>
* Fix what @noahfalk suggested in his review.

* Fixing what was suggested by @viniciusjarina

* Fix what was suggested by @viniciusjarina

* Changing what @noahfalk suggested

* Accept more than 1 stepper per thread

* Changing what was suggested by @noahfalk

* Using CORDB_ADDRESS to return addresses from debugged process

* Fix eval

* Update src/mono/mono/mini/debugger-agent.c

Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
* Using 1:1 with runtime for cordbtype and cordbclass

* Rnaming methods as suggested by @lambdageek

* Update src/mono/dbi/cordb-process.h

Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
* Update CMakeLists.txt

* Fix arm64 compilation

* Fix arm64 compilation

* Fix error cmake

* fix arm64 compilation

* Fix arm64 compilation

* Fix arm64 compilation

* Fix arm64 compilation

* Revert "Fix arm64 compilation"

This reverts commit 25f24bc7ac66966fe59805e54e4009c909608b2c.

* Revert "Fix arm64 compilation"

This reverts commit a8f0318881d7b3e6b5a69b1b56c17478a71fdb4f.

* Revert "fix arm64 compilation"

This reverts commit b5de06dcf00bf296f2c8f4b47aa2492afbd73acd.

* Revert "Fix error cmake"

This reverts commit 2aae4636499d073ca5aa6fb9319d84875be6e08e.

* Revert "Fix arm64 compilation"

This reverts commit ae5f701589c3bd8ca04b9d9369af2b285a5d9bd0.

* Revert "Fix arm64 compilation"

This reverts commit 94d957c7416a900c9e90dec53900a104572ea6a1.

* Removing arm64 compilation

* Remove arm64 compilation

Co-authored-by: Noah Falk <noahfalk@users.noreply.github.com>
Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
3 years ago[interp] Rework the allocation of offsets for variables (#49072)
Vlad Brezae [Fri, 12 Mar 2021 15:03:37 +0000 (17:03 +0200)]
[interp] Rework the allocation of offsets for variables (#49072)

* [interp] Cleanup get_interp_local_offset

Use it just for allocating an offset for a var, at the top of the locals space.

* [interp] Save the args inside call instructions

This will aid later optimizations, in order to easily detect the call args for an opcode. This is stored as a -1 terminated array of var indexes. Also change the structure of newobj_reg_map array, so it can reuse this format (newobj_reg_map should be killed at some point anyway).

* [interp] Pass target_ip in a normal var to MINT_CALLI_NAT_FAST

Making it consistent with other calli opcodes and simplifies a little bit the code generation path.

* [interp] Add explicit return for CallArgs opcodes

Before this change, calls used to receive a single special dreg argument. This was resolved to an offset. At this offset, the call could find all the parameters and the return value was also written at the same offset. With this change we move towards having an explicit dreg return. For calls, the last sreg must be of the special type MINT_CALL_ARGS_SREG. The var offset allocator should ensure all call args are allocated one after the other and that this special reg type is resolved to the offset where these args reside.

* [interp] Remove call args flag from code generation / optimization phases

This flag should only be relevant to the var offset allocator

* [interp] Add new local offset allocator

This change aims to simplify the handling of vars during optimizations. Before this change we had different types of vars : managed locals, var residing on the execution stack, vars that are the argument of a call. Multiple restrictions applied to vars residing on the execution stack and to call args. Following this change, all vars share the same semantics during optimizations passes. At the very end, we allocate offsets for them and we will end up with 3 types of vars : global vars (used from multiple bblocks), local vars (used in a single bblock) and call arg vars. Call arg vars are always local.

The first step of the allocator is to detect all global vars and allocate offsets for them by doing a full iteration over the code. They will reside in the first section of the stack frame and they are allocated one after the other in the order they are detected. The param area (containing call arg vars) will have to be allocated after the local var space, otherwise a call would overwrite vars in the calling method. These vars are allocated for one basic block at a time.

For simple local vars we do an initial iteration over the bblock instructions and we set the liveness information for each referenced var (live_start and live_end). We will maintain a list of active vars and the current top of stack. As a var becomes alive we allocate it at the current offset and add it to the active_vars array. As a var becomes dead, we remove entries from the active_vars array and update the current top of stack, if space has been freed at the end of the stack.

For call args, because we must control the offset at which these vars are allocated, in the initial pass we generate MOVs from the var to a new local var, if the call arg was initially global. Afterwards, call arg vars are allocated in a similar manner to normal local vars. The space for them is tied to the param area of the call, so the entire space is allocated at once. A call become active when any of its args is first written. The liveness of the call ends when the actual call is done, at which point we resolve the offset of every arg relative to the start of the param area of the method. Once all normal local vars are allocated, we will compute the final offset of the call arg vars.

* [interp] Improve dumping for call instructions

* [interp] Fix var type of valuetype this

* [interp] Re-enable copy propagation

* [interp] Rename MINT_NEWOBJ opcodes

* [interp] Disable tracking of offsets on the execution stack during codegen

They are no longer needed. We generate offsets for every var at the very end.

* [interp] Remove memmove of args during newobj

The offset allocator is allocating the vars at the right offset in the param area. We also used `push_types` to add the arguments back on the stack, which was allocating new vars for each argument. We no longer do this, so newobj_reg_map is not needed anymore.

* [interp] Re-enable inlining of constructors

For object ctors, MINT_NEWOBJ_INLINED allocates an object which will be used both as a `this` arg to the ctor as well as the return var from the newobj operation.

For valuetype ctors, we need to first inform the var offset allocator that the valuetype exists before the MINT_NEWOBJ_VT_INLINED invocation, which will take its address, which will be used as `this` arg to the inline method. We also need to dummy use the valuetype, so it never dies before the ctor is inlined, otherwise `this` points to garbage. We use this def/dummy_use mechanism in order to avoid promoting the valuetype to a global var, as it happens with normal vars that have their address taken (via ldloca).

* [interp] Avoid optimization if newobj is guarded

MINT_NEWOBJ* should not store into a local if the ctor might throw, because we set the return value before the ctor starts executing, and a guarding clause can see this variable as being set.

* [interp] Refactor the active vars code a bit

* [interp] Add missing implicit conversion

When passing an argument or returning a value from a method. The stack contents are not necessarily matching the signature type, in which case we add conversions.

* [interp] Disable test using excessive stack space

This test was exceeding the stack limit even before the new offset allocator, it was just not reported.

3 years agoAddress flakey behavior testing COM lifetime cleanup. (#49266)
Aaron Robinson [Fri, 12 Mar 2021 15:00:19 +0000 (07:00 -0800)]
Address flakey behavior testing COM lifetime cleanup. (#49266)

* Address flakey behavior testing COM lifetime cleanup.

* Add new lifetime test for COM.

3 years ago[mono] Implement AdvSimd (#49260)
imhameed [Fri, 12 Mar 2021 14:57:08 +0000 (06:57 -0800)]
[mono] Implement AdvSimd (#49260)

This change adds AdvSimd and AdvSimd.Arm64 support to LLVM-enabled Mono.

Most aarch64 LLVM intrinsic functions are overloaded and have names determined
by an invariant base string prepended to a string representation of one or two
type parameters. Intrinsic functions used by an LLVM module must have a
declaration somewhere in memory when JITting or somewhere in the output bitcode
file when AOTing. Currently Mono maintains a hash table that maps internal
intrinsic IDs to LLVM intrinsic declarations. These IDs have been extended: a
simplified type representation is added to the key's upper bits. This
representation is not especially compact, and currently uses 9 bits to label 18
states, but it's easy to look at in a debugger. (A simple base-18 encoding
could encode three parameters in 13 bits.)

These overload-tagged IDs can be passed to
`OP_XOP_OVR{_,_SCALAR,_BYSCALAR}X_{X,X_X,X_X_X}`. The return type of the
intrinsic that generates these mini ops is used to derive the overload tag to
find the corresponding LLVM intrinsic function declaration.

`MonoLLVMModule::intrins_by_id` is removed, because LLVM intrinsic lookup keys
are no longer small contiguous integers. It only seemed to serve as a lookup
table for data already contained in a hash table.

The corresponding instructions for some of these .NET-level intrinsics take
immediate parameters. For some of these instructions, the LLVM IR code that
selects these immediate-argument instructions can emit a fallback for
non-constant parameters, either by using an equivalent instruction with a
register operand or by using a longer and less-efficient instruction sequence.
For the rest, a branching code sequence is emitted. Helper functions
(`immediate_unroll_begin` etc.) are added to make this a little less
repetitious.

Some operations take an immediate operand denoting a lane to select in a vector
before proceeding with another generic vector or scalar operation. These are
decomposed into a sequence of `OP_ARM64_SELECT_SCALAR` followed by the
non-lane-specific operation. LLVM can still optimize this to the lane-selecting
instruction when possible, and can generate fallback code for non-immediate
lane selection.

The tables describing the intrinsics supported by the runtime are extended to
support intrinsics with different target instructions for signed, unsigned and
floating point parameters. Whenever possible, .NET-level intrinsics that
correspond to a single LLVM intrinsic function are stored as a single entry in
these tables. Unfortunately many intrinsics need to be translated into a
sequence of LLVM IR operations; for these, new mini IR opcodes are added to
select the LLVM IR builder code that should run.

3 years agoAdd Libs.Pretest to make runtime (#48799)
Ryan Lucia [Fri, 12 Mar 2021 14:37:38 +0000 (09:37 -0500)]
Add Libs.Pretest to make runtime (#48799)

3 years agoDon't include mono-dtrace.h when generating offsets (#49482)
monojenkins [Fri, 12 Mar 2021 12:10:16 +0000 (07:10 -0500)]
Don't include mono-dtrace.h when generating offsets (#49482)

offsets-tool can run before mono-dtrace.h is generated which leads to a compiler error about the file missing.
This happened with the mac arm64 sdks build where we didn't disable dtrace like we do for iOS.

It was racy since it depends on whether we already built the target mono before we're building the cross compiler mono.

Co-authored-by: akoeplinger <akoeplinger@users.noreply.github.com>
3 years agoRemove DynamicDependency workaround (#49523)
Sven Boemer [Fri, 12 Mar 2021 08:20:50 +0000 (00:20 -0800)]
Remove DynamicDependency workaround (#49523)

The linker no longer needs these DynamicDependency attributes because it
can resolve the assemblies when it sees the strings passed to GetType.

3 years agoSupport Time Zone IANA Ids and Windows Ids in all platforms (#49412)
Tarek Mahmoud Sayed [Fri, 12 Mar 2021 04:29:04 +0000 (20:29 -0800)]
Support Time Zone IANA Ids and Windows Ids in all platforms (#49412)

* Support Time Zone IANA Ids <-> Windows Ids conversions

3 years ago[wasm][debugger] Replace Mono.Cecil with MetadataReader. (#49440)
Thays Grazia [Fri, 12 Mar 2021 03:18:11 +0000 (00:18 -0300)]
[wasm][debugger] Replace Mono.Cecil with MetadataReader. (#49440)

* Removing the usage of Mono.Cecil and using MetadataReader to read Assembly information and Pdb information.

* Fixing tests...
Having problems with async methods.

* Update src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs

Co-authored-by: Larry Ewing <lewing@microsoft.com>
* Fix tests which calls async methods.

* Fix packaging of BrowserDebugHost.

Co-authored-by: Larry Ewing <lewing@microsoft.com>
3 years agoUpdate SDK's target version to 6.0 Preview 2 (#49509)
Viktor Hofer [Fri, 12 Mar 2021 02:57:41 +0000 (03:57 +0100)]
Update SDK's target version to 6.0 Preview 2 (#49509)

* Update target version of SDK to 6.0 preview 2

Not updating the minimum required version as that's considered a breaking change that needs to go through the monthly infra rollout.

* Remove msbuild hack in Tools.props

* Remove sendtohelixhelp hack with P1 SDK

3 years ago[wasm] Turn off canonization of NaNs. It doesn't seem to be needed, and it causes...
Zoltan Varga [Fri, 12 Mar 2021 02:05:38 +0000 (21:05 -0500)]
[wasm] Turn off canonization of NaNs. It doesn't seem to be needed, and it causes test failures. (#49475)

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

3 years agoExclude out of range fp test on arm32 (#49519)
David Wrighton [Fri, 12 Mar 2021 01:52:57 +0000 (17:52 -0800)]
Exclude out of range fp test on arm32 (#49519)

3 years agoRemove a few more unnecessary StringBuilders (#49488)
Stephen Toub [Fri, 12 Mar 2021 01:42:00 +0000 (20:42 -0500)]
Remove a few more unnecessary StringBuilders (#49488)

3 years agoTweak Process.GetEnvironmentVariablesBlock (#49484)
Stephen Toub [Fri, 12 Mar 2021 01:41:32 +0000 (20:41 -0500)]
Tweak Process.GetEnvironmentVariablesBlock (#49484)

* Tweak Process.GetEnvironmentVariablesBlock

Mostly a cleanup (e.g. the comment refers to Windows 2000), but removes some interface dispatch as part of simplifying the code.

* Update src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
3 years agoFix polling on https connections in HttpConnectionPool (#49474)
Stephen Toub [Fri, 12 Mar 2021 01:41:07 +0000 (20:41 -0500)]
Fix polling on https connections in HttpConnectionPool (#49474)

* Fix polling on https connections in HttpConnectionPool

Avoid performing read-aheads on such connections, which can result in long-pinned buffers and unnecessary faulted tasks when the connections are torn down.

* Update src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs

Co-authored-by: Cory Nelson <phrosty@gmail.com>
Co-authored-by: Cory Nelson <phrosty@gmail.com>
3 years agoTry to upload collections from successful partition (#49496)
Kunal Pathak [Fri, 12 Mar 2021 01:24:35 +0000 (17:24 -0800)]
Try to upload collections from successful partition (#49496)

If SPMI collection of few partitions fail, try best attempt to merge
the successful partition and upload them to azure. However, if none
of the partition succeeded, `merge-mch` would fail and we should skip
upload step.

3 years ago[marshal] Fix VARIANT marshaling in structs (#49451)
monojenkins [Fri, 12 Mar 2021 00:33:10 +0000 (19:33 -0500)]
[marshal] Fix VARIANT marshaling in structs (#49451)

Partial revert of mono/mono#8732

If a managed struct is declared as

        public struct StructWithVariant
        {
            [MarshalAs (UnmanagedType.Struct)]
            public object data;
        };

Then the `data` field should be marshalled as a VARIANT.

The fix checks that the field's type is `object` and uses VARIANT for marshaling, otherwise it continues as in mono/mono#8732 and uses MONO_MARSHAL_CONV_OBJECT_STRUCT.

---

Also added tests for BSTR marshaling inside structs.  This actually works on mono master thanks to https://github.com/mono/mono/pull/19701 but there was no test covering this case.

Co-authored-by: lambdageek <lambdageek@users.noreply.github.com>
3 years agoRemote unwinder's put_unwind_info function needs to cleanup for FEATURE_USE_SYSTEM_LI...
Mike McLaughlin [Fri, 12 Mar 2021 00:27:25 +0000 (16:27 -0800)]
Remote unwinder's put_unwind_info function needs to cleanup for FEATURE_USE_SYSTEM_LIBUNWIND (#49444)

Fixes issue: https://github.com/dotnet/runtime/issues/42561

3 years agoApple Silicon coreclr runtime tests (#49447)
Steve MacLean [Fri, 12 Mar 2021 00:14:56 +0000 (19:14 -0500)]
Apple Silicon coreclr runtime tests (#49447)

* Apple Silicon coreclr runtime tests

Create SetPathVars_coreclr_AppleSilicon for enabling limited PR runtime testing

Enable coreclr runtime tests on Apple Silicon for isFullMatrix & SetPathVars_coreclr_AppleSilicon.containsChange

* Fix did not find alphanumeric

* Enable OSX.1100.ARM64.Open for PR triggers

3 years agodisable buildwasmapps for resource reasons (#49517)
Larry Ewing [Fri, 12 Mar 2021 00:11:02 +0000 (18:11 -0600)]
disable buildwasmapps for resource reasons (#49517)

3 years agoAdd Fedora 35 RID (#48200)
Omair Majid [Fri, 12 Mar 2021 00:07:36 +0000 (19:07 -0500)]
Add Fedora 35 RID (#48200)

Fedora rawhide now uses the fedora.35-x64 RID:

    $ podman run -it registry.fedoraproject.org/fedora:rawhide /bin/bash -c 'cat /etc/os-release'
    NAME=Fedora
    VERSION="35 (Container Image Prerelease)"
    ID=fedora
    VERSION_ID=35
    VERSION_CODENAME=""
    PLATFORM_ID="platform:f35"
    PRETTY_NAME="Fedora 35 (Container Image Prerelease)"
    ANSI_COLOR="0;38;2;60;110;180"
    LOGO=fedora-logo-icon
    CPE_NAME="cpe:/o:fedoraproject:fedora:35"
    HOME_URL="https://fedoraproject.org/"
    DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/rawhide/system-administrators-guide/"
    SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
    BUG_REPORT_URL="https://bugzilla.redhat.com/"
    REDHAT_BUGZILLA_PRODUCT="Fedora"
    REDHAT_BUGZILLA_PRODUCT_VERSION=rawhide
    REDHAT_SUPPORT_PRODUCT="Fedora"
    REDHAT_SUPPORT_PRODUCT_VERSION=rawhide
    PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
    VARIANT="Container Image"
    VARIANT_ID=container

3 years agoRemove a few StringBuilder uses from TraceListener (#49485)
Stephen Toub [Thu, 11 Mar 2021 22:35:15 +0000 (17:35 -0500)]
Remove a few StringBuilder uses from TraceListener (#49485)

3 years ago[wasm] Allow assemblies to be skipped for AOTMode=AotInterp (#49446)
Ankit Jain [Thu, 11 Mar 2021 22:34:16 +0000 (17:34 -0500)]
[wasm] Allow assemblies to be skipped for AOTMode=AotInterp (#49446)

* [wasm] reduce visibility of `[AOT] /foo/bar.dll`  messages

* [wasm] Quote assembly path when invoking mono-aot-cross

* [wasm] WasmApp.*: Use the msbuild equivalent of `Path.Combine` in

.. the targets/props .

* [wasm] WasmApp.targets: Simplify emcc invocations a bit

* [wasm] WasmApp.targets: quote paths correctly

* [wasm] Add `%(WasmAssembliesToBundle._InternalForceInterpret)`

.. to allow skipping AOT, per assembly.

* [wasm] don't copy dotnet.* to appbundle unnecessarily

This was added earlier to support blazor workload which only uses AOT.
But that has since been fixed to correctly use
`WasmBuildApp`+`@(WasmNativeAsset)`, so this can be removed.

* [wasm] Add new `$(WasmNativeDebugSymbols)` that to get symbols with

.. dotnet.wasm . It defaults to `true`.

* [wasm] Check that EMSDK_PATH is set when building native files

* [wasm] Rename `@(_WasmAssemblies)` -> `@(_WasmAssembliesInternal)`

* [wasm] Fix sample build

* [wasm] Fix tests on helix - typo

* Address review feedback

* fix a missing quote

Co-authored-by: Larry Ewing <lewing@microsoft.com>
3 years agofix invariant linking error (#49492)
Larry Ewing [Thu, 11 Mar 2021 22:23:21 +0000 (16:23 -0600)]
fix invariant linking error (#49492)

Disable the conditional inclusion to fix #48847 until we have a solution.

3 years agoUse hosted pools to send libraries tests to helix to ease out our build pools (#49497)
Santiago Fernandez Madero [Thu, 11 Mar 2021 22:13:59 +0000 (14:13 -0800)]
Use hosted pools to send libraries tests to helix to ease out our build pools (#49497)

3 years agoUse the .noRC2 cert variants in the System.Net tests when on a platform that does...
Jeremy Koritzinsky [Thu, 11 Mar 2021 22:02:56 +0000 (14:02 -0800)]
Use the .noRC2 cert variants in the System.Net tests when on a platform that does not support RC2. (#49461)

3 years agoChange prejit instrumentation default back to block profiling (#49441)
Andy Ayers [Thu, 11 Mar 2021 19:48:42 +0000 (11:48 -0800)]
Change prejit instrumentation default back to block profiling (#49441)

Both crossgen1 and crossgen2 currently reject schemas that contain edge profile
counters. Change the jit defaults back to block profiling when prejitting.

See notes in #49267.

3 years agoSPMI: add pgo data fingerprint to method identity (#49416)
Andy Ayers [Thu, 11 Mar 2021 19:47:42 +0000 (11:47 -0800)]
SPMI: add pgo data fingerprint to method identity (#49416)

This ensures that pgo and non-pgo machine contexts for the same method with
otherwise identical jit flags won't get merged, and likewise for pgo contexts
with different counter values.

3 years agoRemoved .dylib from Libraries.AppleCryptoNative literal (#49401)
Vladimir Sadov [Thu, 11 Mar 2021 19:27:56 +0000 (11:27 -0800)]
Removed .dylib from Libraries.AppleCryptoNative literal (#49401)

3 years ago[AndroidCrypto] Enable using X.509 certs with DSA (#49394)
Jeremy Koritzinsky [Thu, 11 Mar 2021 18:58:45 +0000 (10:58 -0800)]
[AndroidCrypto] Enable using X.509 certs with DSA (#49394)

* [AndroidCrypto] Enable using X.509 certs with DSA

* Refactor key pair creation.

* Only PinAndClear X.

* Update src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Android/X509Pal.cs

Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
* Alphabetize the sources in the csproj.

* Add missing include.

* Add missing parameter

* Add missing DuplicateHandle call.

Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
3 years agoFix incomplete dumps generated by createdump (#49468)
Mike McLaughlin [Thu, 11 Mar 2021 18:48:02 +0000 (10:48 -0800)]
Fix incomplete dumps generated by createdump (#49468)

* Fix incomplete dumps generated by createdump

Issue: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1277488?src=WorkItemMention&src-action=artifact_link

* Code review feedback

3 years agoRemove serialization field from HashSet (#49483)
Stephen Toub [Thu, 11 Mar 2021 18:39:24 +0000 (13:39 -0500)]
Remove serialization field from HashSet (#49483)

Same as the approach taken in Dictionary.

3 years agoAdd Task.WaitAsync methods (#48842)
Stephen Toub [Thu, 11 Mar 2021 17:11:15 +0000 (12:11 -0500)]
Add Task.WaitAsync methods (#48842)

3 years agoFix silent bad codegen VSD possible tailcall converted to normal call (#49256)
Bruce Forstall [Thu, 11 Mar 2021 17:01:30 +0000 (09:01 -0800)]
Fix silent bad codegen VSD possible tailcall converted to normal call (#49256)

The problem was when a VSD interface call returning a multi-byte struct
in registers was initially considered to be a tailcall, but the tailcall
was abandoned in morph due to not enough stack space to store outgoing
arguments, in which case we create a new call return local to store the
return struct, and re-morph the call. In doing so, we forget that we had
already added VSD non-standard args, and re-add them, leaving the originally
added arg as a "normal" arg that shouldn't be there.

So, in summary, for a call A->B, to see this failure, we need:
1. The call is considered a potential tailcall (by the importer)
2. The call requires non-standard arguments that add call argument IR in
   fgInitArgInfo() (e.g., VSD call -- in this case, a generic interface call)
3. We reject the tailcall in fgMorphPotentialTailCall() (e.g., not enough
   incoming arg stack space in A to store B's outgoing args), in this case
   because the first arg is a large struct. We can't reject it earlier,
   due to things like address exposed locals -- we must get far enough
   through the checks to have called fgInitArgInfo() to add the extra
   non-standard arg.
4. B returns a struct in multiple registers (e.g., a 16-byte struct in
   Linux x64 ABI)

The fix is to remove the previously-added non-standard VSD argument IR when
we are preparing to re-morph a call.

There was one other location that was already doing this. I'm a little
worried that there are other places where the non-standard added IR is
not being considered when we clear out the arg info before remorphing.
It seems like there is some risk here. Probably, we should consider a
better way of handling the non-standard arg IR given the need in some
cases to re-morph calls.

I commented out a few cases of:
```
assert(!fgCanFastTailCall(call, nullptr));
```
because this function can call `fgInitArgInfo` which can alter the IR.
That seems dangerous in an assert, which should have any side-effects
like modifying the IR.

Fixes #49078

No SPMI asm diffs.

3 years agosuperpmi.py: Add support for Azure CLI authentication (#49272)
Bruce Forstall [Thu, 11 Mar 2021 17:00:05 +0000 (09:00 -0800)]
superpmi.py: Add support for Azure CLI authentication (#49272)

Azure CLI authentication is currently disabled (the current
unauthenticated mode will be used).

To use SuperPMI collections and JIT rolling builds after Azure
authentication is enabled, you will need to install the Azure CLI from:

https://docs.microsoft.com/en-us/cli/azure/install-azure-cli

and then log in using `az login` before running any superpmi.py
commands.

3 years agoAdd iOS functional test for invariant culture only mode. (#49057)
Maxim Lipnin [Thu, 11 Mar 2021 15:17:39 +0000 (18:17 +0300)]
Add iOS functional test for invariant culture only mode. (#49057)

Contributes to #43865

1. ./build.sh mono+libs -os iOS -arch x64 -c Release
2. ./dotnet.sh build /t:Test src/tests/FunctionalTests/iOS/Simulator/InvariantCultureOnlyMode /p:TargetOS=iOS /p:TargetArchitecture=x64 /p:Configuration=Release

3 years agoConvert the 'if (Const < (uint)span.Length)' patterns to equivalent natural versions...
SingleAccretion [Thu, 11 Mar 2021 14:52:23 +0000 (17:52 +0300)]
Convert the 'if (Const < (uint)span.Length)' patterns to equivalent natural versions (#49450)

3 years agoEnable new CA1839 and CA1840 Environment rules (#49393)
Stephen Toub [Thu, 11 Mar 2021 11:50:25 +0000 (06:50 -0500)]
Enable new CA1839 and CA1840 Environment rules (#49393)

3 years agoAdd Android functional test for invariant culture only mode (#49204)
Maxim Lipnin [Thu, 11 Mar 2021 08:23:10 +0000 (11:23 +0300)]
Add Android functional test for invariant culture only mode (#49204)

Contributes to #43865

./build.sh mono+libs -os Android -arch x64 -c Release
./dotnet.sh build /t:Test src/tests/FunctionalTests/Android/Device_Emulator/InvariantCultureOnlyMode /p:TargetOS=Android /p:TargetArchitecture=x64 /p:Configuration=Release

3 years agoFix APICompat errors for atttributes on parameters (#49408)
Santiago Fernandez Madero [Thu, 11 Mar 2021 08:03:10 +0000 (00:03 -0800)]
Fix APICompat errors for atttributes on parameters (#49408)

3 years agoAdd an option to do zero byte reads on StreamPipeReader (#49117)
David Fowler [Thu, 11 Mar 2021 07:49:43 +0000 (23:49 -0800)]
Add an option to do zero byte reads on StreamPipeReader (#49117)

- Added UseZeroByteReads to StreamPipeReaderOptions that allows not allocating a buffer by doing a zero byte read on the underlying Stream before the internal buffer is allocated.