platform/upstream/dotnet/runtime.git
3 years agoAdd System.Diagnostics.StackFrame.GetMethodFromNativeIP API for VS4Mac (#61289)
Mike McLaughlin [Tue, 9 Nov 2021 16:31:46 +0000 (08:31 -0800)]
Add System.Diagnostics.StackFrame.GetMethodFromNativeIP API for VS4Mac (#61289)

* Add System.Diagnostics.StackFrame.GetMethodInfoFromNativeIP API for VS4Mac

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

3 years agoEnsure MaxBy/MinBy return first element if all keys are null. (#61364)
Eirik Tsarpalis [Tue, 9 Nov 2021 16:30:26 +0000 (16:30 +0000)]
Ensure MaxBy/MinBy return first element if all keys are null. (#61364)

3 years agoAdd additional steps in gcc validation leg (#61241)
Adeel Mujahid [Tue, 9 Nov 2021 15:50:46 +0000 (17:50 +0200)]
Add additional steps in gcc validation leg (#61241)

3 years ago[wasm] Remove WasmBuildTemplate (#61315)
Radek Doulik [Tue, 9 Nov 2021 15:28:52 +0000 (16:28 +0100)]
[wasm] Remove WasmBuildTemplate (#61315)

It is not needed anymore, as the flags and stripping is handled
by msbuild and cmake. The configuration dependent template parameters
are not used anymore.

3 years agoConvert concatenation string to interpolation for System.Private.Xml (#60057)
kronic [Tue, 9 Nov 2021 10:39:57 +0000 (13:39 +0300)]
Convert concatenation string to interpolation for System.Private.Xml (#60057)

* use interpolation string

* fix XmlSerializationReader

* fix new line

* fix new line for XmlSerializationReaderILGen

* review feedback

* review feedback

* fix XmlTextWriter

* fix Compiler

* fix XmlSchemaExporter

* fix XmlSchemas

* fix XmlSerializationReader

* fix XmlSerializationWriter

* fix XmlSerializationWriter

* fix XmlSerializationWriterILGen

* fix QilValidationVisitor

* fix XmlSerializationReaderILGen

* fix XmlQueryOutput

Co-authored-by: kronic <kronic@softland.ru>
3 years ago[wasm][aot] Disable (again) `Microsoft.Extensions.Logging.Generators.Roslyn3.11.Tests...
Krzysztof Wicher [Tue, 9 Nov 2021 09:36:07 +0000 (10:36 +0100)]
[wasm][aot] Disable (again) `Microsoft.Extensions.Logging.Generators.Roslyn3.11.Tests` failing due to OOM (#61323)

* [wasm] Disable tests failing due to OOM

Microsoft.Extensions.Logging.Generators.Roslyn3.11.Tests
https://github.com/dotnet/runtime/issues/61339

* [wasm] Use special exitcodes when AOT test build fails, and when it gets oom-killed

Co-authored-by: Ankit Jain <radical@gmail.com>
3 years agoProvide PEM implementations for AsymmetricAlgorithm.
Kevin Jones [Tue, 9 Nov 2021 08:04:25 +0000 (03:04 -0500)]
Provide PEM implementations for AsymmetricAlgorithm.

Now that the Encoding and Primitive assemblies are unified, an implementation
for PKCS#8 and SPKI keys can be provided in the abstract AsymmetricAlgorithm.
Derived types will continue to override these members to provide support
for additional PEM labels.

3 years agoFix binplacing for (impl) System.Security.Cryptography.Encoding.dll
Jeremy Barton [Tue, 9 Nov 2021 08:02:24 +0000 (00:02 -0800)]
Fix binplacing for (impl) System.Security.Cryptography.Encoding.dll

3 years agoUse UTC throughout certificate request tests
Kevin Jones [Tue, 9 Nov 2021 07:03:46 +0000 (02:03 -0500)]
Use UTC throughout certificate request tests

3 years agoAdding Regex source generator to Microsoft.netcore.app.ref pack (#61329)
Jose Perez Rodriguez [Tue, 9 Nov 2021 04:26:40 +0000 (20:26 -0800)]
Adding Regex source generator to Microsoft.netcore.app.ref pack (#61329)

3 years agoAdd instructions for using Codespaces (#60996)
Eric Erhardt [Tue, 9 Nov 2021 02:18:05 +0000 (20:18 -0600)]
Add instructions for using Codespaces (#60996)

* Add instructions for using Codespaces

* Automate resetting the HEAD to the same commit ID used to build the pre-built container

* - Add notes about testing changes.

- Add 4-core machines

* Revert 4-core change since prebuild doesn't support multiple sku_names.

3 years agoJIT: extend redundant relop to handle side effects (#61275)
Andy Ayers [Tue, 9 Nov 2021 01:30:01 +0000 (17:30 -0800)]
JIT: extend redundant relop to handle side effects (#61275)

Handle the case where the side-effecting redundant relop appears
just before the jump tree relop.

Also revamp how we search for related VNs so it can be done as a
search loop.

3 years agoFix format.py to use jit-format.exe, not jit-format.bat (#61334)
Bruce Forstall [Tue, 9 Nov 2021 00:07:20 +0000 (16:07 -0800)]
Fix format.py to use jit-format.exe, not jit-format.bat (#61334)

Adjust for https://github.com/dotnet/jitutils/pull/343

3 years agoFix: add missed open curly (#61320)
Annchous [Mon, 8 Nov 2021 23:05:08 +0000 (02:05 +0300)]
Fix: add missed open curly (#61320)

3 years agoRemove sorting requirement for interface lists (#60541)
Michal Strehovský [Mon, 8 Nov 2021 21:55:37 +0000 (06:55 +0900)]
Remove sorting requirement for interface lists (#60541)

Fixes #60454.

3 years agoFix incorrect CCW decoding in GetObjectForCCW (#61193)
Tom McDonald [Mon, 8 Nov 2021 21:12:57 +0000 (13:12 -0800)]
Fix incorrect CCW decoding in GetObjectForCCW (#61193)

* Fix incorrect CCW decoding in GetObjectForCCW

* Fix linux/mac build

3 years agoType key hash tweaks. (#61234)
Vladimir Sadov [Mon, 8 Nov 2021 19:58:19 +0000 (11:58 -0800)]
Type key hash tweaks. (#61234)

* use HashTypeKey(), remove ComputeHash()

* nonrecursive HashTypeHandle

* remove instrumentation from pendingload.cpp

* two more uses of `ComputeHash()`

* Make GCC happy

* couple tweaks

* unnecessary full fences.

3 years agoRemoving `m_hostAssemblyMap` and ceremony around it (#61292)
Vladimir Sadov [Mon, 8 Nov 2021 19:34:34 +0000 (11:34 -0800)]
Removing `m_hostAssemblyMap` and ceremony around it (#61292)

* remove m_hostAssemblyMap and ceremony around it

* Removes SHash::AddPhases  - support for callouts in hosted scenarios.

* typos

3 years agoFix value numbering of field assignments (#61113)
SingleAccretion [Mon, 8 Nov 2021 16:08:09 +0000 (19:08 +0300)]
Fix value numbering of field assignments (#61113)

When value numbering an assignment to a field, VNApplySelectorsAssign
was called twice, first for the field sequence to find the exact
value, then for the heap VN update. This is not correct as the method
expects to be called only for sequences that will end up updating a
map with exact values, as it type checks the store with the helper
VNApplySelectorsAssignTypeCoerce. Usage of VNApplySelectorsAssign
to update the heap ended up meaning that any stores to struct fields
ended up with casts for maps, blocking traversal in VNForMapSelect.

A handful of positive diffs for this commit resulting from more CSEs
and redundant branch optimizations, due to more precise liberal VNs.

3 years ago[main] Update dependencies from dotnet/runtime dotnet/xharness (#61309)
dotnet-maestro[bot] [Mon, 8 Nov 2021 15:55:03 +0000 (16:55 +0100)]
[main] Update dependencies from dotnet/runtime dotnet/xharness (#61309)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
3 years ago[main] Update dependencies from 10 repositories (#61087)
dotnet-maestro[bot] [Mon, 8 Nov 2021 12:05:30 +0000 (13:05 +0100)]
[main] Update dependencies from 10 repositories (#61087)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Premek Vysoky <premek.vysoky@microsoft.com>
3 years agoEnable global constant propagation for GT_LCL_FLD (#61209)
SingleAccretion [Mon, 8 Nov 2021 11:30:55 +0000 (14:30 +0300)]
Enable global constant propagation for GT_LCL_FLD (#61209)

These are leaf nodes without side effects, and we can
sometimes evaluate them in VN, so it does not seem like
there is any reason not to enable propagation for them.

3 years agoClean up the documentation for the library testing (#59401)
Maxim Lipnin [Mon, 8 Nov 2021 09:11:54 +0000 (12:11 +0300)]
Clean up the documentation for the library testing (#59401)

3 years ago[wasm] Add console version of browser-bench sample (#60733)
Radek Doulik [Mon, 8 Nov 2021 08:58:06 +0000 (09:58 +0100)]
[wasm] Add console version of browser-bench sample (#60733)

* [wasm] Add console version of browser-bench sample

Example run:

    > v8 --expose_wasm runtime.js --  --run  Wasm.Console.Bench.Sample.dll -t Json:non,Exceptions:Inline
    console.info: Arguments: --run,Wasm.Console.Bench.Sample.dll,-t,Json:non,Exceptions:Inline
    console.debug: MONO_WASM: Initializing mono runtime
    console.debug: MONO_WASM: ICU data archive(s) loaded, disabling invariant mode
    console.debug: mono_wasm_runtime_ready fe00e07a-5519-4dfe-b35a-f867dbaf2e28
    console.info: Initializing.....
    Benchmark started
    Json, non-ASCII text serialize count: 23, per call: 7.565217391304348ms, total: 0.174s
    ...
    Exceptions, TryCatchFilterInline count: 1766666, per call: 4.301888415806949E-05ms, total: 0.076s

    Summary
    Json, non-ASCII text serialize: 7.478260869565218ms
    Json, non-ASCII text deserialize: 10.789473684210526ms
    Exceptions, TryCatchFilterInline: 4.301888415806949E-05ms

    .md
    | measurement | time |
    |-:|-:|
    |         Json, non-ASCII text serialize |     7.4783ms |
    |       Json, non-ASCII text deserialize |    10.7895ms |
    |       Exceptions, TryCatchFilterInline |     0.0430us |

* Don't generate v8 script for browser project

* Fix option set

* Changes for linux/mac

* Add link to bench sample README

* Pass ARGS to the console version

Add info about filtering and options to the README

* Show how the table will looks like

* Do not sign the assembly

To avoid

    CSC : error CS8002: Referenced assembly 'Mono.Options, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name.

* Add examples how to run it on windows

* Fix interpolated string

* Improve formatting

* Remove unwanted space

3 years ago[mono][interp] Implement tailcalls (#59799)
Vlad Brezae [Mon, 8 Nov 2021 08:57:28 +0000 (10:57 +0200)]
[mono][interp] Implement tailcalls (#59799)

* [interp] Fix opcode dump

* [interp] Implement tailcalls

Before this commit we supported tailcalls only for calls to the same method. Tailcalls are implemented by copying the call arguments to the start of the stack space, followed by replacing of the current executing method.

* Re-enable test

3 years agoFix build failure due to conflicting PR merge (#61286)
Jeremy Koritzinsky [Sun, 7 Nov 2021 01:11:31 +0000 (18:11 -0700)]
Fix build failure due to conflicting PR merge (#61286)

3 years agoUse the Xunit assert library instead of CoreCLRTestLibrary for most asserts (#61226)
Jeremy Koritzinsky [Sat, 6 Nov 2021 19:46:50 +0000 (12:46 -0700)]
Use the Xunit assert library instead of CoreCLRTestLibrary for most asserts (#61226)

Asserts not provided by Xunit are provided by an AssertExtensions class.

Tests that reference System.Private.Corelib directly will use a polyfill implementation based off the old CoreCLRTestLibrary asserts.

All assert methods provided by CoreCLRTestLibrary have been changed to follow Xunit conventions.

3 years agoDon't create a COM weak reference if the object is an aggregated COMWrappers RCW...
Jeremy Koritzinsky [Sat, 6 Nov 2021 19:02:48 +0000 (12:02 -0700)]
Don't create a COM weak reference if the object is an aggregated COMWrappers RCW. (#61267)

* Don't create a COM weak reference if the object is an aggregated COMWrappers RCW.

* Add test for weak reference + aggregation with native weak reference impl.

* Apply suggestions from code review

Co-authored-by: Aaron Robinson <arobins@microsoft.com>
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
3 years agoensure the AcceptSocket is cleared when AcceptAsync completes (#61258)
Geoff Kizer [Sat, 6 Nov 2021 17:15:14 +0000 (10:15 -0700)]
ensure the AcceptSocket is cleared when AcceptAsync completes (#61258)

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
3 years agoMake JitPrintInlinedMethods less verbose (#61208)
Egor Bogatov [Sat, 6 Nov 2021 14:10:38 +0000 (17:10 +0300)]
Make JitPrintInlinedMethods less verbose (#61208)

3 years agouse GenTreeFlags for better debugging (#61272)
Sergey Andreenko [Sat, 6 Nov 2021 09:28:18 +0000 (02:28 -0700)]
use GenTreeFlags for better debugging (#61272)

3 years agoRemove BestFitMapping, CallingConvention, and ThrowOnUnmappableChar from GeneratedDll...
Elinor Fung [Sat, 6 Nov 2021 04:24:50 +0000 (21:24 -0700)]
Remove BestFitMapping, CallingConvention, and ThrowOnUnmappableChar from GeneratedDllImportAttribute (#61182)

3 years agoImplement `GT_AND_NOT` for ARM/ARM64 (#59881)
SingleAccretion [Sat, 6 Nov 2021 03:10:03 +0000 (06:10 +0300)]
Implement `GT_AND_NOT` for ARM/ARM64 (#59881)

* Move late arithmetic to its own section in gtlist

* Implement AND_NOT for AAarch

* Delete the unnecessary platfrom-specific methods

They were a leftover from some previous work.

* Mention the SIMD origins of AND_NOT

3 years agoUpdate area-owners.md (#61269)
Andy Gocke [Sat, 6 Nov 2021 02:49:31 +0000 (19:49 -0700)]
Update area-owners.md (#61269)

3 years agoConvert to OleDb assembly and last Cryptography DllImport to GeneratedDllImport ...
Aaron Robinson [Sat, 6 Nov 2021 00:09:05 +0000 (17:09 -0700)]
Convert to OleDb assembly and last Cryptography DllImport to GeneratedDllImport (#61184)

* Enable DllImport generator for all source projects.

* Convert OleDb to only use GeneratedDllImport.

* Update source generator to distinguish between "no marshalling info"
  which can cause a failure vs "missing support" which enables us to
  fallback to the marshalling forwarder.

* Remove unused DllImports.

* Reuse existing P/Invoke definitions.

3 years agoSimplify minterm generation in Regex NonBacktracking engine (#61232)
Olli Saarikivi [Fri, 5 Nov 2021 23:05:03 +0000 (16:05 -0700)]
Simplify minterm generation in Regex NonBacktracking engine (#61232)

PartitionTree had a holdover from when it was tracking the predicates
that made up each minterm, which caused it to use order n too much
memory for some patterns.
Nodes with the same predicate as the parent are no longer created.
This also significantly simplified the algorithm.
Remove the deduplication, since its now optional and the only call
site already passes in a unique set of predicates.
Make MintermGenerator take an IEnumerable.

3 years ago[wasm] Add test for blazor/sdk fix for lazy loaded assemblies (#60673)
Ankit Jain [Fri, 5 Nov 2021 23:00:48 +0000 (23:00 +0000)]
[wasm] Add test for blazor/sdk fix for lazy loaded assemblies (#60673)

Co-authored-by: Larry Ewing <lewing@microsoft.com>
3 years agofix unexpected TimeSeriesLimitReached after HistogramLimitReached(#60752) (#61199)
Yusuke Ito [Fri, 5 Nov 2021 22:06:52 +0000 (07:06 +0900)]
fix unexpected TimeSeriesLimitReached after HistogramLimitReached(#60752) (#61199)

3 years ago1388 xml serializer assembly load context awareness (#58932)
Steve Molloy [Fri, 5 Nov 2021 21:27:50 +0000 (14:27 -0700)]
1388 xml serializer assembly load context awareness (#58932)

* Generate dynamic serialization assembly in the appropriate ALC, and don't keep any hard refs to types that could prevent unloading.

3 years agoFix build options for native test lib to not enable avx-512 (#61229)
Andy Ayers [Fri, 5 Nov 2021 18:54:16 +0000 (11:54 -0700)]
Fix build options for native test lib to not enable avx-512 (#61229)

Just enable AVX, so that we can run the lib on any of our test machines.

3 years agoJIT: don't bother with GDV for an abstract class (#61191)
Andy Ayers [Fri, 5 Nov 2021 15:58:17 +0000 (08:58 -0700)]
JIT: don't bother with GDV for an abstract class (#61191)

Fixes #61190.

3 years agoFix UnobservedTaskException from SemaphoreSlim.WaitAsync (#60890)
Stephen Toub [Fri, 5 Nov 2021 15:06:44 +0000 (11:06 -0400)]
Fix UnobservedTaskException from SemaphoreSlim.WaitAsync (#60890)

* Fix UnobservedTaskException from SemaphoreSlim.WaitAsync

If a SemaphoreSlim.WaitAsync times out, it correctly returns false, but it also results in TaskScheduler.UnobservedTaskException being raised unexpectedly, due to internal use of a faulted task whose exception isn't observed.  This fixes that by marking any such exceptions as having been observed.

* Fix wasm build

3 years ago[wasm] Revert back to eval in wasm InvokeJS with modularization support . (#61212)
Marek Fišera [Fri, 5 Nov 2021 14:02:45 +0000 (15:02 +0100)]
[wasm] Revert back  to eval in wasm InvokeJS with modularization support . (#61212)

Revert back  to eval in wasm InvokeJS with modularization support .

Wrap code to evaluate in a function with MONO, BINDING, INTERNAL
and module as local variables.

Added tests for running js expressions (successful, null, undefined, global scope separation)

Co-authored-by: Pavel Savara <pavelsavara@microsoft.com>
3 years agoFix comment typo (#61246)
James Newton-King [Fri, 5 Nov 2021 13:38:02 +0000 (02:38 +1300)]
Fix comment typo (#61246)

3 years agoJIT: Fold "shift-by-zero" in lower (#61222)
Egor Bogatov [Fri, 5 Nov 2021 13:11:23 +0000 (16:11 +0300)]
JIT: Fold "shift-by-zero" in lower (#61222)

3 years agoFix bug in iterator test, modify attempt count, make more robust (#61242)
Katelyn Gadd [Fri, 5 Nov 2021 10:55:12 +0000 (03:55 -0700)]
Fix bug in iterator test, modify attempt count, make more robust (#61242)

3 years agoFold S.S.C.Encoding into new System.Security.Cryptography library
Jeremy Barton [Thu, 4 Nov 2021 23:31:56 +0000 (16:31 -0700)]
Fold S.S.C.Encoding into new System.Security.Cryptography library

* Split the new library from just NetCoreAppCurrent to all of the varieties that S.S.C.Encoding had, plus browser.
* Move src/libraries/System.Security.Cryptography.Encoding/src/System/... to src/libraries/System.Security.Cryptography/src/System/...
* Move src/libraries/System.Security.Cryptography.Encoding/src/Internal/Cryptography/* to src/libraries/System.Security.Cryptography.Encoding/src/System/Security/Cryptography/*
* Merge in the Strings.resx content that was needed.
  *  Added two ObjectDisposedException.ThrowIf calls to eliminate a resource from the move.
* Move src/libraries/System.Security.Cryptography.Encoding/tests/... to src/libraries/System.Security.Cryptography.Encoding/tests/..., with a couple files gaining the "Tests" suffix that their class had.
* Fix the namespaces of the previously moved from-Primitives tests to match the new location.
* Fix the namespaces of the newly moved from-Encoding tests to match the new location.
* Make System.Security.Cryptography.Encoding ref & src just build as facades/forwarders.

3 years ago[DllImportGenerator] Use ElementMarshallingGeneratorFactory to create the marshalling...
Jeremy Koritzinsky [Thu, 4 Nov 2021 23:16:30 +0000 (16:16 -0700)]
[DllImportGenerator] Use ElementMarshallingGeneratorFactory to create the marshalling generator for collection elements (#61219)

3 years agoUse constant ids for RoArrayType GetMethodsCore (#61177)
Buyaa Namnan [Thu, 4 Nov 2021 23:10:05 +0000 (16:10 -0700)]
Use constant ids for RoArrayType GetMethodsCore (#61177)

3 years agoimproved BDD Unicode table representation in NonBacktracking engine (#61142)
Margus Veanes [Thu, 4 Nov 2021 23:02:32 +0000 (16:02 -0700)]
improved BDD Unicode table representation in NonBacktracking engine (#61142)

* improved BDD Unicode table representation in NonBacktracking engine

* remove line

Co-authored-by: Dan Moseley <danmose@microsoft.com>
* improved bounds-check elimination

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* clearer notation of numbers

Co-authored-by: Dan Moseley <danmose@microsoft.com>
* fixed typo

Co-authored-by: Dan Moseley <danmose@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years ago[mono][interp] Fix GetType called on ptr constrained to Nullable` (#61020)
Vlad Brezae [Thu, 4 Nov 2021 21:24:26 +0000 (23:24 +0200)]
[mono][interp] Fix GetType called on ptr constrained to Nullable` (#61020)

* [interp] Fix GetType called on ptr constrained to Nullable`

We were statically optimizing this call to return the actual constrained class type, which is incorrect for nullables, because boxing of a nullable (as part of the constrained call) actually creates an object with the type of the nullable's value (or null if there is no value).

* Add test for GetType call on ptr constrained to nullable

3 years agoApplied @marek-safar review to exit the loop once the condition is fulfilled. (#61165)
Ilona Tomkowicz [Thu, 4 Nov 2021 12:08:52 +0000 (13:08 +0100)]
Applied @marek-safar review to exit the loop once the condition is fulfilled. (#61165)

3 years agoFix Assertion failed 'ins == INS_add' for madd/msub (#61171)
Egor Bogatov [Thu, 4 Nov 2021 11:41:54 +0000 (14:41 +0300)]
Fix Assertion failed 'ins == INS_add' for madd/msub (#61171)

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
3 years agoSet IL offsets for calls created during devirtualization (#61189)
Jakob Botsch Nielsen [Thu, 4 Nov 2021 10:34:48 +0000 (11:34 +0100)]
Set IL offsets for calls created during devirtualization (#61189)

Since inlined statements use the IL location of the inliner's statement
all statements created while inlining devirtualized calls would get no
debug info before, while normally these will have IL location pointing
to the call statement in the root.

3 years ago[arm64] JIT: Recognize sbfiz/ubfiz idioms (#61045)
Egor Bogatov [Thu, 4 Nov 2021 08:51:29 +0000 (11:51 +0300)]
[arm64] JIT: Recognize sbfiz/ubfiz idioms (#61045)

3 years ago[DllImportGenerator] Fix stub generation for char array marshalling (#61188)
Elinor Fung [Thu, 4 Nov 2021 05:49:01 +0000 (22:49 -0700)]
[DllImportGenerator] Fix stub generation for char array marshalling (#61188)

3 years agolock protect nullability cache of symbolic regex node (#60942)
Margus Veanes [Wed, 3 Nov 2021 23:55:39 +0000 (16:55 -0700)]
lock protect nullability cache of symbolic regex node (#60942)

* fixed nullability checking to be threadsafe

* use volatile write for nullability cache

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* made read of nullability cache volatile and fixed other PR comments

* made non-lock-protected reads from SymbolicRegexBuilder._delta volatile

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agoMake System.Security.Cryptography.X509Certificates compliant with interop guidelines...
Badre BSAILA [Wed, 3 Nov 2021 19:18:46 +0000 (20:18 +0100)]
Make System.Security.Cryptography.X509Certificates compliant with interop guidelines - part 2

Convert more of S.S.C.X509Certificates to use correct interop style.

3 years agoJIT: limited version of forward substitution for some relops (#61023)
Andy Ayers [Wed, 3 Nov 2021 18:40:28 +0000 (11:40 -0700)]
JIT: limited version of forward substitution for some relops (#61023)

Add a new optimization to redundant branch opts that looks at prior statements
in the same block for redundant relop trees. If one is found, we check to see
if it can be forward-substituted down to the terminal jump tree. And if it can
we duplicate the computation down at the jump.

This removes many of the cases we see in our generated code where we materialize
a boolean value in a register and then immediately test that register to see if
it is true/false, and then use that second test to drive branching -- instead we
now use the initial test logic to drive the jump and so the boolean value only
exists in the flags.

3 years agoUpdate SDK to 6.0 RC2 (#60256)
Viktor Hofer [Wed, 3 Nov 2021 17:09:41 +0000 (18:09 +0100)]
Update SDK to 6.0 RC2 (#60256)

Co-authored-by: Rainer Sigwald <raines@microsoft.com>
Co-authored-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
3 years agoRemove _validator field from ObjectCollection (#59589)
Adeel Mujahid [Wed, 3 Nov 2021 16:37:16 +0000 (18:37 +0200)]
Remove _validator field from ObjectCollection (#59589)

* Remove _validator field from ObjectCollection

* Use more specific types for fields and args

3 years agoDeduplicate tests with class name 'BringUpTest' (#61128)
Tomáš Rylek [Wed, 3 Nov 2021 15:35:36 +0000 (16:35 +0100)]
Deduplicate tests with class name 'BringUpTest' (#61128)

3 years agoDeduplicate runtime tests using the class name 'Test' (#61125)
Tomáš Rylek [Wed, 3 Nov 2021 15:35:18 +0000 (16:35 +0100)]
Deduplicate runtime tests using the class name 'Test' (#61125)

3 years agoFix invalid optimization of (-1 * -A) + A (#61091)
Jakob Botsch Nielsen [Wed, 3 Nov 2021 15:15:57 +0000 (16:15 +0100)]
Fix invalid optimization of (-1 * -A) + A (#61091)

We were hitting both transforms in this block, but the first transform
changes the node from GT_ADD to GT_SUB, while the second transform is
valid only for GT_ADD. It is difficult to have natural code that hits
both of these transforms, so I have just made them mutually exclusive
instead of rechecking the oper in the second one.

No SPMI diffs.

Fix #61077

3 years agoCredential fixes (#61114)
Jan Jahoda [Wed, 3 Nov 2021 14:05:01 +0000 (15:05 +0100)]
Credential fixes (#61114)

* fix HttpClientHandlerTest.RemoteServer.cs

* fix HttpClientHandlerTest.Authentication.cs

* fix HttpClientHandlerTest.cs

3 years ago[wasm][debugger]Add hidden attribute support (#61143)
Ilona Tomkowicz [Wed, 3 Nov 2021 13:17:36 +0000 (14:17 +0100)]
[wasm][debugger]Add hidden attribute support (#61143)

* Draft of hidden attribute decorator use.

* Removed checking custom attributes in the runtime each time the breakpoint is set and moved it to the constructor which is more efficient.

* Added test for DebuggerHidden decorator.

* By adding a line: using System.Diagnostics; IntAdd method moved down one line what resulted in CreateGoodBreakpoint tests failures. All row numbers in these tests had to be incremented.

* Reverted edition of tests not connected with HiddenAttribute.

* Added visible method to the HiddenAttribute test.

* Applying thaystg review suggestion.

3 years agoAllow nfloat to be in the ObjCRuntime namespace, and make it work for Xamarin.MacCata...
Rolf Bjarne Kvinge [Wed, 3 Nov 2021 11:45:27 +0000 (12:45 +0100)]
Allow nfloat to be in the ObjCRuntime namespace, and make it work for Xamarin.MacCatalyst.dll as well. (#60854)

Ref: https://github.com/xamarin/xamarin-macios/pull/13092
Ref: https://github.com/mono/mono/pull/21261

3 years agoSkip sys/sysctl.h on linux in mono (#61110)
Adeel Mujahid [Wed, 3 Nov 2021 10:15:41 +0000 (12:15 +0200)]
Skip sys/sysctl.h on linux in mono (#61110)

Fixes three warnings:
```sh
  [ 56%] Building C object mono/mini/CMakeFiles/monosgen-objects.dir/__/utils/mono-mmap.c.o
  In file included from /runtime/src/mono/mono/utils/mono-mmap.c:23:
  /usr/include/x86_64-linux-gnu/sys/sysctl.h:21:2: warning: #warning "The <sys/sysctl.h> header is deprecated and will be removed." [-Wcpp]
     21 | #warning "The <sys/sysctl.h> header is deprecated and will be removed."
        |  ^~~~~~~
# snip
  [ 59%] Building C object mono/mini/CMakeFiles/monosgen-objects.dir/__/utils/mono-time.c.o
  In file included from /runtime/src/mono/mono/utils/mono-proclib.c:42:
  /usr/include/x86_64-linux-gnu/sys/sysctl.h:21:2: warning: #warning "The <sys/sysctl.h> header is deprecated and will be removed." [-Wcpp]
     21 | #warning "The <sys/sysctl.h> header is deprecated and will be removed."
        |  ^~~~~~~
  [ 59%] Building C object mono/mini/CMakeFiles/monosgen-objects.dir/__/utils/mono-uri.c.o
  [ 59%] Building C object mono/mini/CMakeFiles/monosgen-objects.dir/__/utils/mono-poll.c.o
  In file included from /runtime/src/mono/mono/utils/mono-time.c:107:
  /usr/include/x86_64-linux-gnu/sys/sysctl.h:21:2: warning: #warning "The <sys/sysctl.h> header is deprecated and will be removed." [-Wcpp]
     21 | #warning "The <sys/sysctl.h> header is deprecated and will be removed."
        |  ^~~~~~~
```

With this PR: 0 warnings - http://sprunge.us/96kyq9

Like in src/libraries/Native, skip linux from sys/sysctl.h check. For other systems, `check_include_files` (instead of `check_include_file` (singular)) when a header depends on another one.

Also, simplified few conditions: "is linux" check supersedes "is android".

3 years ago[wasm] simplify startup configuration (#61072)
Pavel Savara [Wed, 3 Nov 2021 08:46:57 +0000 (09:46 +0100)]
[wasm] simplify startup configuration (#61072)

* added configSrc - path to MonoConfig json file
* added Module.onConfigLoaded callback
* added Module.onDotNetReady replacing MonoConfig.loaded_cb
* removed loaded_cb, assembly_list, runtime_assets, runtime_asset_sources from MonoConfig
* simplified all sample and test projects
* renamed no_global_exports to disableDotNet6Compatibility
* implement default Module.preInit and Module.onRuntimeInitialized which could be overriden by user code (like Blazor)

* re-enable the interp lane

3 years agoAdd TFM and version support query to marshaller interface. (#61064)
Aaron Robinson [Wed, 3 Nov 2021 04:27:34 +0000 (21:27 -0700)]
Add TFM and version support query to marshaller interface. (#61064)

* Add TFM and version support query to marshaller interface.

* If any marshaller fails to support the current tfm version, fallback
to using the built-in DllImport attribute.

* Add tests for fallback generation on downlevel or generation if marshallers
  are supported on the target framework.

* Convert CreateCompilationWithReferenceAssemblies to CreateCompilation overload.

Co-authored-by: Elinor Fung <elfung@microsoft.com>
3 years agoRemove setting CallingConvention field on GeneratedDllImport (#61130)
Elinor Fung [Wed, 3 Nov 2021 04:07:16 +0000 (21:07 -0700)]
Remove setting CallingConvention field on GeneratedDllImport (#61130)

3 years agoRemove dead code in src/coreclr/jit (#61129)
Egor Chesakov [Wed, 3 Nov 2021 03:47:26 +0000 (20:47 -0700)]
Remove dead code in src/coreclr/jit (#61129)

3 years agoFix refcount when a composite r2r image is loaded from a bundle (#61066)
Vladimir Sadov [Wed, 3 Nov 2021 01:29:05 +0000 (18:29 -0700)]
Fix refcount when a composite r2r image is loaded from a bundle (#61066)

* Fix refcount when a composite r2r image is loaded from a bundle

* PR feedback - better comments.

3 years agoMake QCalls respect the EntryPoint property (#60992)
Jeremy Koritzinsky [Tue, 2 Nov 2021 23:37:18 +0000 (16:37 -0700)]
Make QCalls respect the EntryPoint property (#60992)

Co-authored-by: Elinor Fung <elfung@microsoft.com>
3 years agoAdd back SoD Blazor Pizza Aot test (#61118)
Drew Scoggins [Tue, 2 Nov 2021 22:51:49 +0000 (15:51 -0700)]
Add back SoD Blazor Pizza Aot test (#61118)

3 years agoSwitch to run only smoke tests per PR for apple mobile configurations (#61108)
Steve Pfister [Tue, 2 Nov 2021 21:48:17 +0000 (14:48 -0700)]
Switch to run only smoke tests per PR for apple mobile configurations (#61108)

Contributes to #61017

3 years agoFix: Incorrect order of checks for TypeBuilder `GetConstructor` and `GetField` method...
Bartosz Klonowski [Tue, 2 Nov 2021 21:38:36 +0000 (22:38 +0100)]
Fix: Incorrect order of checks for TypeBuilder `GetConstructor` and `GetField` method (#53645)

* Reorder checks for TypeBuilder.GetConstructor()

* Reorder checks for TypeBuilder.GetField()

* Adjust unit test to reordered TypeBuilder checks

* Use 'not' keyword for pattern matching

* Apply the same Type checks for Mono

GetConstructor and GetField had the same incorrect checks order
comparing to GetMethod as in the CoreCLR.
To keep the consistent solution, Mono has also been adjusted.

* Check whether a declaring type isn't type's generic definition

* Make generic type if contains generic parameters

* Suppres UnrecognizedReflectionPattern for GetField and GetConstructor

* Move GetMethodType validation method at original order

* Test GetConstructor against throwing an exception

* Fix: copy-paste error  'type' -> 'constructor'

* Align Mono and CoreCLR with nameof for GetConstructor

* Use type for argument exception and test against type parameter

* Get tests passing on both coreclr and mono.

Ensure checks are consistent across GetConstructor, GetField, and GetMethod for both coreclr and mono.

* Fix mono exception messages to use SR resources.

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
3 years ago[wasm] Disable failing System.Security.Cryptography tests due to http… (#61102)
Ankit Jain [Tue, 2 Nov 2021 21:02:08 +0000 (21:02 +0000)]
[wasm] Disable failing System.Security.Cryptography tests due to http… (#61102)

#61099

3 years agoDisable couple of randomly failing PerformanceCounter tests (#61101)
Krzysztof Wicher [Tue, 2 Nov 2021 20:30:22 +0000 (21:30 +0100)]
Disable couple of randomly failing PerformanceCounter tests (#61101)

* Disable couple of randomly failing PerformanceCounter tests

* fix: disabled the wrong test

3 years ago[wasm] Re-enable source generator tests failing due to OOM (#60701)
Ankit Jain [Tue, 2 Nov 2021 20:16:25 +0000 (20:16 +0000)]
[wasm] Re-enable source generator tests failing due to OOM (#60701)

This adds support for setting per-project optimization flags, and sets them for these projects so they don't OOM.

Microsoft.Extensions.Logging.Generators.Roslyn3.11.Tests
Microsoft.Extensions.Logging.Generators.Roslyn4.0.Tests
System.Text.Json.SourceGeneration.Roslyn3.11.Unit.Tests
System.Text.Json.SourceGeneration.Roslyn4.0.Unit.Tests
System.Text.RegularExpressions.Generators.Tests
Some individual ones are disabled due to
#58226, and #60899 .

Additionally, if a AOT build fails, then on linux it dumps the last few lines from dmesg, to help identify it was an oom-kill.

Fixes #51961 .

Co-authored-by: Larry Ewing <lewing@microsoft.com>
3 years ago[arm64] JIT: Fold "A * B + C" to MADD/MSUB (#61037)
Egor Bogatov [Tue, 2 Nov 2021 18:10:23 +0000 (21:10 +0300)]
[arm64] JIT: Fold "A * B + C" to MADD/MSUB (#61037)

3 years agoRemoved two unused packages from .vsconfig (#60798)
Steve Dunn [Tue, 2 Nov 2021 16:40:45 +0000 (16:40 +0000)]
Removed two unused packages from .vsconfig (#60798)

These packages are unused as described in #60794

Co-authored-by: Santiago Fernandez Madero <safern@microsoft.com>
3 years agoThrowing `FormatException` when a required property from `Microsoft.Extensions.Depend...
Filip [Tue, 2 Nov 2021 16:10:39 +0000 (17:10 +0100)]
Throwing `FormatException` when a required property from `Microsoft.Extensions.DependencyModel` is empy (#60842)

* Setting framework name as nullable.

* Setting path to nullable.

* Setting runtime to nullable.

* Setting path to nullable.

* Setting Target Name, RuntimeTargetEntrySub Path and TargetLibrary Name as nullable (string) properties.

* Adding missing line of code.

* Adding new string resource and throwing argument exception on null/empty values.
Adding unit tests to check for specific null/empty value cases

* Removing Argument from string resource.
Updating PR according to comments

* Updating unit tests to use FormatException

* Rollback of ArgumentExceptions in DependencyModels

* Added missing usings

* Updating all exceptions to FormatException

* Moving FormatException while reading target name

* Updating PR with new comments.

* Update src/libraries/Microsoft.Extensions.DependencyModel/src/DependencyContextJsonReader.cs

3 years agoHTTP2 loopback server WaitForCancellationAsync should validate error code sent (...
Badre BSAILA [Tue, 2 Nov 2021 15:55:17 +0000 (16:55 +0100)]
HTTP2 loopback server WaitForCancellationAsync should validate error code sent (#59313)

HTTP2 loopback server WaitForCancellationAsync should validate error code sent

3 years agoFix gcc warnings during mono linux-x64 build (#60675)
Adeel Mujahid [Tue, 2 Nov 2021 15:47:37 +0000 (17:47 +0200)]
Fix gcc warnings during mono linux-x64 build (#60675)

* Fix gcc warnings during mono linux-x64 build

main with Debug configuration: 822 warnings - http://sprunge.us/2GzrDE
PR with Debug configuration: 3 warnings related to deprecated sys/sysctl.h includes - http://sprunge.us/JuyA3K

after fixing Debug warnings, there were 13 additional warnings in Release configuration:
http://sprunge.us/PJCivP

PR with Release configuration: (same) 3 warnings - http://sprunge.us/NwKHNE

* Address CR feedback

3 years agoAvoid bogus cred scanning hits (#61070)
Dan Moseley [Tue, 2 Nov 2021 14:39:28 +0000 (08:39 -0600)]
Avoid bogus cred scanning hits (#61070)

* Remove quasi passwords

* oops

3 years agorevert 58594 CacheCredential change (#61069)
Tomas Weinfurt [Tue, 2 Nov 2021 14:36:53 +0000 (07:36 -0700)]
revert 58594 CacheCredential change (#61069)

3 years agoTemporarily disable scaled index on arm64 (#61090)
Egor Bogatov [Tue, 2 Nov 2021 12:17:47 +0000 (15:17 +0300)]
Temporarily disable scaled index on arm64 (#61090)

3 years agoBring up full library test CI runs on iOS / tvOS devices (#59503)
Steve Pfister [Tue, 2 Nov 2021 11:43:15 +0000 (04:43 -0700)]
Bring up full library test CI runs on iOS / tvOS devices (#59503)

This change enables device runs on CI by building each test app on the helix instance it was deployed to. In past attempts, we looked at enhancing what takes place on the build machine via build tricks, compressing / cleaning up files early, etc and we could not overcome the need for excessively long timeouts and far more disk space.

The change also adopts the patterns established in the wasm test build, giving us the opportunity to support different scenario runs as well as workloads testing in the future.

3 years agoSome VN refactoring (#61034)
SingleAccretion [Tue, 2 Nov 2021 11:16:58 +0000 (14:16 +0300)]
Some VN refactoring (#61034)

* Remove "block" from VNApplySelectorsAssign

It was unused and all the callers passed the current block anyway.

Also some renaming to make Assign and AssignTypeCoerce methods consistent.

* Improve the readability of VNForMapStore

By naming parameters properly.

* Improve the readability of VNForMapSelect

By naming parameters properly.

* Pull ASG numbering out of fgValueNumberTree

In my upcoming substantive changes to this code the unreasonable level
of nesting started to significantly degrade the readability of code.

So, move it out of the main numbering function. The result is still
pretty huge and could be split up further, but this will do for now.

* Refactor VNApplySelectors

Make it use a loop instead of recursion.

Rename parameters to match the "Assign" variants.

Add standard header comments.

3 years agoFix typo in profiler method (#60999)
David Mason [Tue, 2 Nov 2021 10:18:11 +0000 (03:18 -0700)]
Fix typo in profiler method (#60999)

3 years ago[arm64] JIT: Fix IsContainableImmed for arm64 v8.1 or higher (#61035)
Egor Bogatov [Tue, 2 Nov 2021 09:33:15 +0000 (12:33 +0300)]
[arm64] JIT: Fix IsContainableImmed for arm64 v8.1 or higher (#61035)

3 years ago[main] Update dependencies from 6 repositories (#61033)
dotnet-maestro[bot] [Tue, 2 Nov 2021 08:26:59 +0000 (09:26 +0100)]
[main] Update dependencies from 6 repositories (#61033)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
3 years agoSeed the unified System.Security.Cryptography.dll
Jeremy Barton [Tue, 2 Nov 2021 05:30:26 +0000 (22:30 -0700)]
Seed the unified System.Security.Cryptography.dll

* All of System.Security.Cryptography.Primitives has been moved
* AsymmericKeyExchangeFormatter moved from S.S.C.Algorithms
* This just starts the process to keep the infrastructure pieces separate from code layout pieces.

3 years agodisable sending NT Authority in TLS handshake if specific trust was specified (#60988)
Tomas Weinfurt [Tue, 2 Nov 2021 05:20:53 +0000 (22:20 -0700)]
disable sending NT Authority in TLS handshake if specific trust was specified (#60988)

* diable sending NT Authority if specific trust was specified

* feedback from review

* add missing file

* Apply suggestions from code review

Co-authored-by: Cory Nelson <phrosty@gmail.com>
* one more style update

Co-authored-by: Cory Nelson <phrosty@gmail.com>
3 years agoAdd Maui iOS and MacCatalyst build steps (#61068)
Parker Bibus [Tue, 2 Nov 2021 04:48:05 +0000 (23:48 -0500)]
Add Maui iOS and MacCatalyst build steps (#61068)

* Fix artifact match string.

* Completed first attempt for a complete Maui SOD run. Added ios_scenarios tests, setup file copies, uploads, and downloads; and setup perf branch to use as partner testing branch.

* Reset performance-setup.ps1 file to use main perf branch.

* Reenable yml jobs disabled for testing.

3 years agoAdd linux x86 build CI for pull request (#60817)
Dong-Heon Jung [Tue, 2 Nov 2021 04:25:56 +0000 (13:25 +0900)]
Add linux x86 build CI for pull request (#60817)

* Add linux x86 build CI for pull request

* Fix linux x86 build error

* Fix linux x86 linking error

3 years agoMake sure smoke tests aren't run on the rolling build (#61055)
Steve Pfister [Tue, 2 Nov 2021 01:57:37 +0000 (18:57 -0700)]
Make sure smoke tests aren't run on the rolling build (#61055)

The way we were trying to use isFullMatrix was not visible to the xplat-setup template. This PR makes sure we grab the value at run time as opposed to compile time.

3 years agoValidate CompressionLevel value is defined in BrotliStream ctor (#57561)
Bar Arnon [Mon, 1 Nov 2021 23:15:18 +0000 (01:15 +0200)]
Validate CompressionLevel value is defined in BrotliStream ctor (#57561)

Co-authored-by: carlossanlop <1175054+carlossanlop@users.noreply.github.com>
3 years agoFix 60597 by using genActualType (#61057)
Benjamin Hodgson [Mon, 1 Nov 2021 22:24:21 +0000 (18:24 -0400)]
Fix 60597 by using genActualType (#61057)