platform/upstream/dotnet/runtime.git
3 years ago Block debugger attach after any ApplyUpdate changes (#50200)
Mike McLaughlin [Fri, 26 Mar 2021 01:39:14 +0000 (18:39 -0700)]
 Block debugger attach after any ApplyUpdate changes (#50200)

* Block debugger attach after any ApplyUpdate changes

* Add better error message for ApplyUpdate while debugging

* Code review feedback

* Fix arm32/arm64 builds

* Code review feedback

* Code review feedback

3 years agoAdd PropertyItem tests (#46794)
Hugh Bellamy [Fri, 26 Mar 2021 01:05:47 +0000 (01:05 +0000)]
Add PropertyItem tests (#46794)

* Refactor PropertyItem image code

* Refactor PropertyItemInternal

* Use Windows implementation of PropertyItem in Unix

* PR feedback

* Use ArrayPool

3 years agoremove repetitions ';' (#50236)
kronic [Fri, 26 Mar 2021 00:59:08 +0000 (03:59 +0300)]
remove repetitions ';' (#50236)

Co-authored-by: kronic <kronic@softland.ru>
3 years agoSeal internal types in libraries (#50225)
Stephen Toub [Fri, 26 Mar 2021 00:50:33 +0000 (20:50 -0400)]
Seal internal types in libraries (#50225)

3 years agoMake tests target overwrite any existing xunit-excludes.txt file when building test...
Elinor Fung [Fri, 26 Mar 2021 00:22:53 +0000 (17:22 -0700)]
Make tests target overwrite any existing xunit-excludes.txt file when building test app (#50183)

3 years ago[mbr] Fix encmap boundary and method RVA lookup. (#50248)
Aleksey Kliger (λgeek) [Fri, 26 Mar 2021 00:21:14 +0000 (20:21 -0400)]
[mbr] Fix encmap boundary and method RVA lookup. (#50248)

Two separate issues:

1. When we process the EnC map, any tables after the last one that has an
update gets an "enc_recs" pointer that's one past the last row of the
table.  (the enc_recs pointer is used to speed up relative address lookup).  So
at lookup time if enc_recs says to look past the end of the EnC map table, we
know there won't be any updates - return -1.

2. When looking for the updated RVA of a method, we need to go through every
delta and find the latest one that has an update for the given method.  The
problem is that if a later generation doesn't have an update, we would take the
NULL return value at face value and it would look like the method had no
updates to its body - we would go back to using the original version from
before any updates were applied.  Instead now ignore lookup table misses and
remember the last successful lookup.  Fixes
https://github.com/dotnet/runtime/issues/50190

3 years agoRemoving suspension prioritization scheme for GC threads vs. non-GC (#49378)
Vladimir Sadov [Thu, 25 Mar 2021 23:45:58 +0000 (16:45 -0700)]
Removing suspension prioritization scheme for GC threads vs. non-GC (#49378)

* remove nonfunctional suspension prioritization scheme for GC threads

* remove cntCollideRetry statistics counter

3 years agoDo not set predecessor for throw block (#50115)
Kunal Pathak [Thu, 25 Mar 2021 23:38:43 +0000 (16:38 -0700)]
Do not set predecessor for throw block (#50115)

* Do not set predecessor for throw block

* jit format

* added comments

* delete BBF_SHARED_THROW

3 years agoRemove unused JNI objects (#50224)
Elinor Fung [Thu, 25 Mar 2021 22:43:44 +0000 (15:43 -0700)]
Remove unused JNI objects (#50224)

3 years ago[main] Update dependencies from dotnet/arcade dotnet/xharness dotnet/runtime-assets...
dotnet-maestro[bot] [Thu, 25 Mar 2021 22:41:48 +0000 (22:41 +0000)]
[main] Update dependencies from dotnet/arcade dotnet/xharness dotnet/runtime-assets (#50231)

[main] Update dependencies from dotnet/arcade dotnet/xharness dotnet/runtime-assets

 - Re-introduce publishing workaround

Required while https://github.com/dotnet/arcade/issues/6987 is resolved

3 years agoAdd arch specifier for AOT unpack path (#50194)
Drew Scoggins [Thu, 25 Mar 2021 21:37:18 +0000 (14:37 -0700)]
Add arch specifier for AOT unpack path (#50194)

3 years agoRemove GETTHREAD_ALLOWED tracking (#50080)
Vladimir Sadov [Thu, 25 Mar 2021 21:26:44 +0000 (14:26 -0700)]
Remove GETTHREAD_ALLOWED tracking (#50080)

* Remove GETTHREAD_ALLOWED tracking

* removed EE_THREAD_NOT_REQUIRED

* removed EE_THREAD_REQUIRED

* step1

* more changes

* fix Unix build

* more changes

* GetThread in pinvokestubs.S

* build fix for dac

* PInvokeGetThreadHelper

* more changes (dac)

* more (cordbe)

* more (nearly all?)

* Couple places that were mistakengly set to use `GetThreaNotOk` (should use `GetThreadNULLOk`)

* Renamed GetThread() -> GetThreadDoNotUse()

* Missed a few uses of GetThread()

* One more case of GetThread

* Bring GetThread() back - now with an assert in it.

* Renamed PInvokeGetThreadHelper -> JitGetThreadHelper

* One place that should use GetThreadNULLOk (otherwise there are asserts)

* Apply suggestions from code review

Jan's 74 suggestions.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* remove SetFiberMode - it is dead code

* Make `EE_THREAD_NOT_REQUIRED` a noop and revert its removal.

* `GetThreadNULLOk()` should be used here.

* PR review suggestion

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* renamed JitGetThreadHelper -> GetThreadHelper

* One more place that should use `GetThreadNULLOk()`.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
3 years ago[debugger] Removing call to jit_done to help debug multithread (#50240)
Thays Grazia [Thu, 25 Mar 2021 19:40:00 +0000 (16:40 -0300)]
[debugger] Removing call to jit_done to help debug multithread (#50240)

It was causing a side effect on Unity, I will study it again while implement multithread on icordebug.

Reverting part of this PR #19103
Mirror of this PR https://github.com/mono/mono/pull/20970

3 years agoDispose the ContentFileProvider when the host is disposed (#50181)
David Fowler [Thu, 25 Mar 2021 19:09:20 +0000 (12:09 -0700)]
Dispose the ContentFileProvider when the host is disposed (#50181)

* Dispose the ContentFileProvider when the host is disposed
- Today we don't and it results in a leak when hosts are created and destroyed.

* Added test

3 years agoImprove Linux root certificate store change detection involving symlinks
Tomas Weinfurt [Thu, 25 Mar 2021 16:08:57 +0000 (09:08 -0700)]
Improve Linux root certificate store change detection involving symlinks

3 years agoPort misc changes from feature/NativeAOT (#50212)
Jan Kotas [Thu, 25 Mar 2021 14:45:51 +0000 (07:45 -0700)]
Port misc changes from feature/NativeAOT (#50212)

3 years agoFix incorrect optimization of Activator.CreateInstance (#50228)
Michal Strehovský [Thu, 25 Mar 2021 14:39:41 +0000 (15:39 +0100)]
Fix incorrect optimization of Activator.CreateInstance (#50228)

We should not return "default" if there's a private parameterless constructor. GetDefaultConstructor only calls the default constructor in the C# sense (public parameterless ctor on a non-abstract class).

3 years ago[wasm] Build AOT cross-compiler on windows (#50113)
Radek Doulik [Thu, 25 Mar 2021 14:13:57 +0000 (15:13 +0100)]
[wasm] Build AOT cross-compiler on windows (#50113)

Enable `BuildMonoAOTCrossCompiler ` on windows/wasm.

Update `offsets-tool` to add few emscripten include locations.

Use emscripten's `python` to run the `offsets-tool`.

* Add few debug prints

* Show libclang file on windows

* Use c:/dev/LLVM/bin/libclang.dll in CI builds

* Use emsdk's python

* Revert "Add few debug prints"

This reverts commit b3133cfa04a45d64cb07defb8841e8643bf5f0cc.

* Build wasm/windows as Release configuration

The debug has problems of mixing debug/release like:

    LLVMDemangle.lib(ItaniumDemangle.cpp.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in monosgen-2.0.lib(mini-llvm-cpp.cpp.obj)
    LLVMDemangle.lib(ItaniumDemangle.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MTd_StaticDebug' in monosgen-2.0.lib(mini-llvm-cpp.cpp.obj)

Need to further look into this

* Add `-c $(_BuildConfig)`

3 years agoUse Length property instead of GetFileInformationByHandleEx for Seek(SeekOrigin.End...
David Cantú [Thu, 25 Mar 2021 08:45:24 +0000 (01:45 -0700)]
Use Length property instead of GetFileInformationByHandleEx for Seek(SeekOrigin.End) (#50218)

3 years agoMove PGO support to Common (#50083)
Michal Strehovský [Thu, 25 Mar 2021 08:41:38 +0000 (09:41 +0100)]
Move PGO support to Common (#50083)

This part is shareable with other CorInfo implementers.

3 years ago[mono] Fix an assert. (#50220)
Zoltan Varga [Thu, 25 Mar 2021 04:29:33 +0000 (00:29 -0400)]
[mono] Fix an assert. (#50220)

3 years ago[wasm] Copy native ICU libraries to native bin dir (#50184)
Radek Doulik [Thu, 25 Mar 2021 04:09:05 +0000 (05:09 +0100)]
[wasm] Copy native ICU libraries to native bin dir (#50184)

We were missing these in built artifacts on windows, resulting in this
error, when building wasm projects:

    Compiling native assets with emcc. This may take a while ...
    emcc: error: C:\...\artifacts\bin\microsoft.netcore.app.runtime.browser-wasm\Release\runtimes\browser-wasm\native\libicuuc.a: No such file or directory ("C:\Users\rodo\git\winwasm2\artifacts\bin\microsoft.netcore.app.runtime.browser-wasm\Release\runtimes\browser-wasm\native\libicuuc.a" was expected to be an input file, based on the commandline arguments provided)

3 years agoFix more copy-paste errors in host_context_test.cpp (#50147)
Omair Majid [Thu, 25 Mar 2021 02:14:29 +0000 (22:14 -0400)]
Fix more copy-paste errors in host_context_test.cpp (#50147)

I missed a whole bunch of duplicate code when fixing
https://github.com/dotnet/runtime/pull/47430, this fixes that.

3 years agoEnsure Vector<T>.op_Multiply is handled as an intrinsic in appropriate cases (#49503)
Tanner Gooding [Thu, 25 Mar 2021 02:12:07 +0000 (19:12 -0700)]
Ensure Vector<T>.op_Multiply is handled as an intrinsic in appropriate cases (#49503)

* Ensure Vector<T>.op_Multiply is handled as an intrinsic in appropriate cases

* Applying formatting patch

* Ensure TYP_BYTE and TYP_UBYTE are handled for Vector<T>.op_Multiply on ARM64

* Ensure broadcast nodes are inserted for all `operator *(Vector<T>, T)`

* Ensure ARM64 uses MultiplyByScalar when its available

* Applying formatting patch

* Ensure the scalar for op_Multiply is op2 on ARM64

* Ensure we do a full multiply for `Vector<T> * Vector<T>` on ARM64

* Applying formatting patch

3 years agoFix leak of app variable on assert in hostpolicy (#50199)
Omair Majid [Thu, 25 Mar 2021 02:04:22 +0000 (22:04 -0400)]
Fix leak of app variable on assert in hostpolicy (#50199)

This was caught by a static anlyzer that pointed out that if the assert
is hit and the method returns, app is never deallocated.

3 years agoPropagate extra string data passed to Android instrumentation app as managed args...
Elinor Fung [Thu, 25 Mar 2021 01:58:53 +0000 (18:58 -0700)]
Propagate extra string data passed to Android instrumentation app as managed args (#50203)

3 years agoWhen marshalling a layout class, fall-back to dynamically marshalling the type if...
Jeremy Koritzinsky [Wed, 24 Mar 2021 23:42:59 +0000 (16:42 -0700)]
When marshalling a layout class, fall-back to dynamically marshalling the type if it doesn't match the static type in the signature. (#50137)

3 years agoMake DSACryptoServiceProvider set legal key sizes to most restrictive for platform...
Elinor Fung [Wed, 24 Mar 2021 23:25:26 +0000 (16:25 -0700)]
Make DSACryptoServiceProvider set legal key sizes to most restrictive for platform (#50192)

3 years agoLoop inversion throughput improvements (#50154)
Bruce Forstall [Wed, 24 Mar 2021 23:23:42 +0000 (16:23 -0700)]
Loop inversion throughput improvements (#50154)

A few minor changes that should improve throughput:
1. Move the `fgForwardBranch` check lower, after all the
cheaper checks, since it does a linear walk of the basic
block list.
2. Don't do a tree walk to count shared static helpers if we
already know it's cheap enough to do the optimization.

Also, removed the not-too-useful `optFindLoopTermTest`,
and added more use of FMT_WT.

3 years agoAlign dictionary key converter/metadata retrieval with pattern for collection element...
Layomi Akinrinade [Wed, 24 Mar 2021 22:54:44 +0000 (15:54 -0700)]
Align dictionary key converter/metadata retrieval with pattern for collection elements (#50074)

* Align dictionary key converter/metadata retrieval with pattern for collection elements

* Address review feedback

3 years agoFix CoreCLR runtime in the presence of 1-file composite images (#50188)
Tomáš Rylek [Wed, 24 Mar 2021 22:50:08 +0000 (15:50 -0700)]
Fix CoreCLR runtime in the presence of 1-file composite images (#50188)

I hit this while creating a regression test for the issue #49982.
In the initial composite R2R design I proposed slightly different
organization of the header tables when the composite image
only comprises a single file; later on I removed this special
casing as it was confusing and making the format more complicated
but apparently I forgot to fix this runtime bit. When there's a
composite image with only one component in it, we weren't properly
initializing the component header table and so we were unable to
resolve any R2R methods for the composite image.

Thanks

Tomas

3 years agoInclude the iOS, Android, and macCatalyst supported platforms (#50143)
Jeff Handley [Wed, 24 Mar 2021 22:16:38 +0000 (15:16 -0700)]
Include the iOS, Android, and macCatalyst supported platforms (#50143)

3 years agoAvoid multiple exceptions at startup from MsQuic support tests (#49973)
Stephen Toub [Wed, 24 Mar 2021 21:24:43 +0000 (17:24 -0400)]
Avoid multiple exceptions at startup from MsQuic support tests (#49973)

3 years ago[mbr] Fix null ptr use (#50173)
Aleksey Kliger (λgeek) [Wed, 24 Mar 2021 21:23:24 +0000 (17:23 -0400)]
[mbr] Fix null ptr use (#50173)

g_getenv can return NULL if the env var is unset

3 years ago[wasm] Add support for using emscripten from packages (#50077)
Ankit Jain [Wed, 24 Mar 2021 21:15:34 +0000 (17:15 -0400)]
[wasm] Add support for using emscripten from packages (#50077)

* [wasm] Add support for using emscripten from packages

When using a workload that has the emscripten packages, certain
properties get set. If that isn't set then we fallback to using
`$(EMSDK_PATH)`.

This should allow being able to use emscripten from workloads, but for
other cases where we depend on an installed emscripten, that should work
too.

* Fix setting PATH on windows

* Using msbuild NormalizeDirectory to construct dir path

* fix setting PATH on windows, when paths have trailing slash

* [wasm] Improve checking emscripten from workload, and EMSDK_PATH

- If a workload pack is being used, then ignore `EMSDK_PATH`
- And error in that order too
- Emit better error messages

Example messages:
- Missing python dir when relinking:

`warning : Specified Emscripten sdk at $(EMSDK_PATH)=. is missing some paths: $(EmscriptenPythonToolsPath)=/Users/radical/dev/r3/artifacts/bin/Wasm.Build.Tests/net6.0-Release/browser-wasm/e10djxv0.wdr/python/3.7.4-2_64bit/ . Emscripten SDK is required for building native files.`

- Missing node directory, or the wrong version dir:

`warning : Specified Emscripten sdk at $(EMSDK_PATH)=/Users/radical/dev/r3/src/mono/wasm/emsdk is missing some paths: $(EmscriptenNodeToolsPath)=/Users/radical/dev/r3/src/mono/wasm/emsdk/node/12.18.1_64bit/ . Emscripten SDK is required for building native files.`

- Empty `EMSDK_PATH`

`Error : Could not find Emscripten sdk at $(EMSDK_PATH)=/Users/radical/dev/r3/src/mono/wasm/emsdk/. Emscripten SDK is required for AOT'ing assemblies.`

- Bad `EMSDK_PATH`

`error : Specified Emscripten sdk at $(EMSDK_PATH)=. is missing some paths: $(EmscriptenPythonToolsPath)=/Users/radical/dev/r3/artifacts/bin/Wasm.Build.Tests/net6.0-Release/browser-wasm/l2mcsipf.isn/python/3.7.4-2_64bit/ . Emscripten SDK is required for AOT'ing assemblies.`

* [wasm] Don't hardcode versions for python/node bundled in emsdk

.. and listen to @lewing's suggestions!

* [wasm] GetDirectories doesn't like non-existant paths

* Fix the earlier fix

* improve errors when some paths are missing

* cleanup

* debugging on ci

* [wasm] emscripten uses system python on linux, so don't try to find it in emscripten sdk

3 years agoFix PriorityQueue not deleting references to dequeued elements (#50182)
Eirik Tsarpalis [Wed, 24 Mar 2021 21:13:15 +0000 (21:13 +0000)]
Fix PriorityQueue not deleting references to dequeued elements (#50182)

* Fix #50114

* add debug assertions to MoveUp/Down methods

3 years agoDisable a failing test. (#50160)
Sergey Andreenko [Wed, 24 Mar 2021 18:20:11 +0000 (11:20 -0700)]
Disable a failing test. (#50160)

3 years agoFix string.Remove exception message (#50176)
Eric Erhardt [Wed, 24 Mar 2021 17:57:08 +0000 (12:57 -0500)]
Fix string.Remove exception message (#50176)

Follow up from #50096

3 years agoFix cross compilation of XmlSerializer.Generator tests (#50180)
Jeremy Barton [Wed, 24 Mar 2021 17:52:14 +0000 (10:52 -0700)]
Fix cross compilation of XmlSerializer.Generator tests (#50180)

3 years agoUse EVP_PKEY for RSA Decrypt
Jeremy Barton [Wed, 24 Mar 2021 17:27:42 +0000 (10:27 -0700)]
Use EVP_PKEY for RSA Decrypt

3 years ago[llvm] Mark stores for reference variables volatile on wasm to avoid llvm moving...
Zoltan Varga [Wed, 24 Mar 2021 15:49:01 +0000 (11:49 -0400)]
[llvm] Mark stores for reference variables volatile on wasm to avoid llvm moving them. (#50159)

Fixes some GC crashes on WASM+aot.

3 years agoimprove 'optRemoveRedundantZeroInits' (#50155)
Sergey Andreenko [Wed, 24 Mar 2021 15:48:08 +0000 (08:48 -0700)]
improve 'optRemoveRedundantZeroInits' (#50155)

It covers cases like:
```
N006 ( 13, 12) [000019] -A-XG---R---              *  ASG       struct (copy)
N005 (  9,  9) [000018] n-----------              +--*  OBJ       struct<System.Threading.Tasks.ValueTask, 16>
N004 (  3,  5) [000017] ------------              |  \--*  ADDR      byref
N003 (  3,  4) [000014] D------N----              |     \--*  LCL_FLD   struct V03 tmp1         [+0] Fseq[_value]
N002 (  3,  2) [000015] ---XG-------              \--*  IND       struct
N001 (  1,  1) [000000] ------------                 \--*  LCL_VAR   byref  V00 this
```

3 years agoPick new version of Microsoft.DotNet.Build.Tasks.Installers (#50153)
Nikola Milosavljevic [Wed, 24 Mar 2021 15:31:18 +0000 (08:31 -0700)]
Pick new version of Microsoft.DotNet.Build.Tasks.Installers (#50153)

3 years agoFix Alpine 3.13 ARM build (#50105)
Jan Vorlicek [Wed, 24 Mar 2021 14:31:24 +0000 (15:31 +0100)]
Fix Alpine 3.13 ARM build (#50105)

* Fix Alpine 3.13 ARM build

Alpine 3.13 is the first version of Alpine Linux that uses 64 bit time_t
on both 64 and 32 bit platforms. That breaks the build as we assumed
that 32 bit platforms use always 32 bit time_t.

This change fixes it by making the PAL time_t type always 64 bit.
Everything still works fine on non-Alpine ARM / x86 Linuxes, since
it only changes the time_t type size outside of PAL.

* Fix case when time function gets NULL argument

3 years agoResolve ILLink warnings in System.ComponentModel.Annotations (#49901)
Eric Erhardt [Wed, 24 Mar 2021 13:33:38 +0000 (08:33 -0500)]
Resolve ILLink warnings in System.ComponentModel.Annotations (#49901)

* Resolve ILLink warnings in System.ComponentModel.Annotations

Contributes to #45623

* PR feedback

3 years agoSystem.Xml.NameTable optimizations (#49988)
kronic [Wed, 24 Mar 2021 13:32:28 +0000 (16:32 +0300)]
System.Xml.NameTable optimizations  (#49988)

* Slight simplification and acceleration

* use SequenceEqual

* fix nullability

* innline TextEquals

* Inline ComputeHash32

* remove using

* fix nullability

Co-authored-by: kronic <kronic@softland.ru>
3 years agoMake it possible to condition tests on line number support (#50165)
Michal Strehovský [Wed, 24 Mar 2021 13:20:04 +0000 (14:20 +0100)]
Make it possible to condition tests on line number support (#50165)

* Update PlatformDetection.cs

* Update ExceptionTests.cs

* Update PlatformDetection.cs

3 years agoImprove NonDisposedSocket_SafeHandlesCollected test (#50104)
Anton Firszov [Wed, 24 Mar 2021 11:46:32 +0000 (12:46 +0100)]
Improve NonDisposedSocket_SafeHandlesCollected test (#50104)

Apply timeouts in NonDisposedSocket_SafeHandlesCollected

3 years agofix BasicTest_AccessInstanceProperties_NoExceptions_Bsd
wfurt [Wed, 24 Mar 2021 01:01:36 +0000 (18:01 -0700)]
fix BasicTest_AccessInstanceProperties_NoExceptions_Bsd

3 years agofixes the https://github.com/dotnet/runtime/issues/48062
jaymin suthar [Mon, 22 Feb 2021 16:03:32 +0000 (21:33 +0530)]
fixes the https://github.com/dotnet/runtime/issues/48062

3 years agoJIT: Add rootTreeOp to DumpFg (#50119)
Egor Bogatov [Wed, 24 Mar 2021 09:55:13 +0000 (12:55 +0300)]
JIT: Add rootTreeOp to DumpFg (#50119)

3 years agoBig-endian fixes: networking stack (#48398)
Ulrich Weigand [Wed, 24 Mar 2021 09:29:35 +0000 (10:29 +0100)]
Big-endian fixes: networking stack (#48398)

* Fix various places that assumed host byte order was little-endian,
  use appropriate host <-> network byte order conversion instead.

* This in particular affects handling of IPv4 addresses, which
  are stored internally in network order.

* Fix endian assumptions in socket option code (GetSockOpt).

* Update test cases and provide /proc test files from a
  big-endian system.

3 years agoFix mono_simd_decompose_intrinsic to only decompose SIMD instructions. (#50109)
Johan Lorensson [Wed, 24 Mar 2021 08:34:12 +0000 (09:34 +0100)]
Fix mono_simd_decompose_intrinsic to only decompose SIMD instructions. (#50109)

Current implemention of mono_simd_decompose_intrinsic was a little too
imprecise when decomposing SIMD instructions. If we add one SIMD
instruction in emit_simd_intrinsics, we flagged complete cfg to be
investigate for SIMD instructions that needs decomposition on Windows.

In mono/mono that worked well enough, but in dotnet/runtime there are
more scenarios where this can cause issues and very hard to debug
issue together with additional set of SIMD intrinsics.

If we for example emit SN_get_Count and SN_get_IsHardwareAccelerated
that won't add any specific SIMD instructions, we still flag cfg that
it includes SIMD instructions that needs to be evaluated for decomposition.
If we then for example had a call using SIMD type directly reusing argument
from method, it would be incorrectly decomposed causing codegen error.

An example where this was observed was in SpanHelpers.Char LocateFirstFoundChar
that triggered an error returning incorrect value from method, causing
IndexOf to report incorrect index in some specific cases. Since it uses
count on Vector type, the cfg will be flagged to use SIMD instructions
that may need decomposition and when function is not inlined (debug build)
call to AsVectorUInt64 will directly take match from argument list, so
code thinks it needs to decompose that value type before passing it to
AsVectorUInt64, that is just a regular method taking value type as argument
so it already handles the case (unlike the SIMD intrinsics).

Fix makes the check if we should decompose source/dest regs more precise
and will only apply to registers that are xregs, meaning that they are
part of a SIMD instruction.

3 years agoSet default features flags to match to iOS SDK defaults (#49635)
Maxim Lipnin [Wed, 24 Mar 2021 08:06:24 +0000 (11:06 +0300)]
Set default features flags to match to iOS SDK defaults (#49635)

Contributes to #43865.

Based on https://github.com/xamarin/xamarin-macios/blob/834b0888853210ca01d5e8f5ce2c65fe9c55fc10/dotnet/targets/Xamarin.Shared.Sdk.targets#L138-L146

The changes:
- added a property group with iOS/iOSSimulator default feature flags;
- aligned the conditions to check the properties activating the defaults for true in order to follow better msbuild practice.

3 years agoAdd test coverage for Module.GetMethod/s (#50076)
Eric Rafalovsky [Wed, 24 Mar 2021 07:58:52 +0000 (03:58 -0400)]
Add test coverage for Module.GetMethod/s (#50076)

Fix dotnet/runtime#49926

3 years agoPut back DiaSymReader library for cross-arch crossgen to package (#50149)
Anton Lapounov [Wed, 24 Mar 2021 07:23:29 +0000 (00:23 -0700)]
Put back DiaSymReader library for cross-arch crossgen to package (#50149)

3 years agomove gen[]s to compiler.cpp as they are declared in compiler.h/hpp (#50141)
yowl [Wed, 24 Mar 2021 07:13:53 +0000 (02:13 -0500)]
move gen[]s to compiler.cpp as they are declared in compiler.h/hpp (#50141)

3 years agoDon't bundle the LLVM optimizer on wasm we use the emscripten version (#50132)
Larry Ewing [Wed, 24 Mar 2021 02:56:04 +0000 (21:56 -0500)]
Don't bundle the LLVM optimizer on wasm we use the emscripten version (#50132)

3 years agoImprove time zone display names on Unix (#48931)
Matt Johnson-Pint [Wed, 24 Mar 2021 01:34:09 +0000 (18:34 -0700)]
Improve time zone display names on Unix (#48931)

3 years agoSkip ninja and cmake errors in aotcrossonly mode (#50140)
Larry Ewing [Wed, 24 Mar 2021 01:05:08 +0000 (20:05 -0500)]
Skip ninja and cmake errors in aotcrossonly mode (#50140)

3 years agoUpdate dependencies from https://github.com/mono/linker build 20210322.2 (#50090)
dotnet-maestro[bot] [Tue, 23 Mar 2021 22:11:00 +0000 (23:11 +0100)]
Update dependencies from https://github.com/mono/linker build 20210322.2 (#50090)

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

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
3 years agoJIT: Fold null checks against initialized static readonly fields (#50000)
Egor Bogatov [Tue, 23 Mar 2021 22:01:51 +0000 (01:01 +0300)]
JIT: Fold null checks against initialized static readonly fields (#50000)

Co-authored-by: Andy Ayers <andya@microsoft.com>
Co-authored-by: Sergey Andreenko <seandree@microsoft.com>
3 years agoWe shouldn't provision emsdk on cross-compiler builds, which don't need it (#50098)
Jo Shields [Tue, 23 Mar 2021 21:38:46 +0000 (17:38 -0400)]
We shouldn't provision emsdk on cross-compiler builds, which don't need it (#50098)

3 years agoComments and cleanup for loop cloning (#49768)
Bruce Forstall [Tue, 23 Mar 2021 21:01:40 +0000 (14:01 -0700)]
Comments and cleanup for loop cloning (#49768)

* Comments and cleanup for loop cloning

This is a no-diff change

Added various comments to document loop cloning.

Standardized and improved some logging.

Consolidated more loop cloning condition checking into
`optIsLoopClonable` that was previously in `optIdentifyLoopOptInfo`.

Replaced some `0` weights with `BB_ZERO_WEIGHT`.

Made FMT_BB use pervasive.

* Review feedback

Added FMT_LP formatting string.

Cached often-used `optLoopTable[loopInd]` expression.

Added `const` to many loop query member functions.

Added static `GenTree::OperIs(compareOper, oper, oper, oper...)`
functions for simplifying oper check expressions where the
compareOper isn't from a GenTree node `OperGet()`. (This doesn't
need to be part of GenTree, but it doesn't hurt, either.)

Added a few more comments.

* Fix static OperIs

Rename to StaticOperIs. It appears the compiler uses the wrong
template in some cases, but doesn't complain about duplicate
options, leading to run-time failures.

3 years agoRemove ProjectGuids from libs projects and update slngen (#48551)
Viktor Hofer [Tue, 23 Mar 2021 20:36:19 +0000 (21:36 +0100)]
Remove ProjectGuids from libs projects and update slngen (#48551)

* Remove ProjectGuids from libs projects

Based on this comment: https://github.com/dotnet/project-system/issues/6830#issuecomment-782591566

* Update slngen

* Add required NuGet.config

3 years ago[mono] Pass 'vtable' to imt_thunk_builder. (#50108)
Zoltan Varga [Tue, 23 Mar 2021 20:33:03 +0000 (16:33 -0400)]
[mono] Pass 'vtable' to imt_thunk_builder. (#50108)

This worked on most platforms which ignored that argument, but crashes
on wasm which calls mini_llvmonly_get_imt_trampoline ().

3 years agoFix str.Remove(str.Length) to not throw (#50096)
Stephen Toub [Tue, 23 Mar 2021 20:22:12 +0000 (16:22 -0400)]
Fix str.Remove(str.Length) to not throw (#50096)

3 years agoFix casing of compile items in System.Speech and add CI protection (#50102)
Viktor Hofer [Tue, 23 Mar 2021 20:12:11 +0000 (21:12 +0100)]
Fix casing of compile items in System.Speech and add CI protection (#50102)

* Fix casing of compile items in System.Speech and add CI protection

* Add CI protection for allconfigurations build Unix

Co-authored-by: Dan Moseley <danmose@microsoft.com>
3 years ago[metadata] Don't access MonoTableInfo:rows, use table_info_get_rows() (#49738)
Aleksey Kliger (λgeek) [Tue, 23 Mar 2021 18:39:04 +0000 (14:39 -0400)]
[metadata] Don't access MonoTableInfo:rows, use table_info_get_rows() (#49738)

Rename the field to `rows_`.

Also updated some bounds checks to use `mono_metadata_table_bounds_check` (which is metadata-update aware) where the subsequent lookups go through the metadata decode functions and should just work with metadata-update.

Added `FIXME: metadata-update` in cases where the table row size is assumed to be
fixed or is used as a sentinel value, or where the decoding may depend on
sorting properties that metadata updates probably won't uphold.

3 years ago[wasm] Add more information about windows build (#50103)
Radek Doulik [Tue, 23 Mar 2021 17:29:36 +0000 (18:29 +0100)]
[wasm] Add more information about windows build (#50103)

3 years agoAdd Span overloads to System.Numerics.Vectors (#50062)
C-xC-c [Tue, 23 Mar 2021 17:07:02 +0000 (17:07 +0000)]
Add Span overloads to System.Numerics.Vectors (#50062)

3 years agoupdate branding to preview4 (#50049)
Anirudh Agnihotry [Tue, 23 Mar 2021 17:02:49 +0000 (10:02 -0700)]
update branding to preview4 (#50049)

3 years ago[main] Update dependencies from dotnet/xharness dotnet/llvm-project (#50086)
dotnet-maestro[bot] [Tue, 23 Mar 2021 17:00:05 +0000 (17:00 +0000)]
[main] Update dependencies from dotnet/xharness dotnet/llvm-project (#50086)

[main] Update dependencies from dotnet/xharness dotnet/llvm-project

3 years agoGuard use of brew command by OSX (#50069)
Omair Majid [Tue, 23 Mar 2021 16:38:27 +0000 (12:38 -0400)]
Guard use of brew command by OSX (#50069)

3 years agoUse the one-shot hash functions for asymmetric operations (#50061)
Kevin Jones [Tue, 23 Mar 2021 16:02:21 +0000 (12:02 -0400)]
Use the one-shot hash functions for asymmetric operations (#50061)

3 years agoGate enum tests that depend on Ref.Emit (#50093)
Michal Strehovský [Tue, 23 Mar 2021 15:35:09 +0000 (16:35 +0100)]
Gate enum tests that depend on Ref.Emit (#50093)

In #49925 I blindly followed the existing pattern but the existing pattern was wrong because with that we get failing tests:

```
System.InvalidOperationException : No data found for System.Tests.EnumTests.IsDefined_UnsupportedEnumType_ThrowsInvalidOperationException
```

3 years agoDon't remove trailing `\0` in custom attributes (#50088)
Michal Strehovský [Tue, 23 Mar 2021 15:19:58 +0000 (16:19 +0100)]
Don't remove trailing `\0` in custom attributes (#50088)

As the comment says - this behavior goes against the spec. Fixes #49756.

3 years agoMark ActiveIssue on Vector test which is still failing (#50091)
Jo Shields [Tue, 23 Mar 2021 14:22:03 +0000 (10:22 -0400)]
Mark ActiveIssue on Vector test which is still failing (#50091)

3 years agoMove GetExceptionForHRInternal into common (#50085)
Michal Strehovský [Tue, 23 Mar 2021 14:19:19 +0000 (15:19 +0100)]
Move GetExceptionForHRInternal into common (#50085)

Deleted the HResults.S_OK and HResults.S_FALSE cases because those are handled by the caller. Didn't touch anything otherwise.

3 years agoEnable CA1052 (static holder types should be static) (#50047)
Stephen Toub [Tue, 23 Mar 2021 14:04:52 +0000 (10:04 -0400)]
Enable CA1052 (static holder types should be static) (#50047)

* Enable CA1052 (static holder types should be static)

* Fix a few additional warnings in 'all configurations'

3 years agoAdd DiagnosticServer runtime TCP support. (#48154)
Johan Lorensson [Tue, 23 Mar 2021 12:35:05 +0000 (13:35 +0100)]
Add DiagnosticServer runtime TCP support. (#48154)

Restructuring of existing DiagnosticServer PAL code into following:

Win32 named pipe support for local IPC is renamed to ds-ipc-pal-namedpipe.h|c
Unix domain socket support for local IPC is part of more generic socket support ds-ipc-pal-socket.h|c

By default all builds and run as before, win32 uses named pipe for local IPC and none Windows uses Unix domain sockets.

This PR extends support in ds-ipc-pal-socket.* to also support TCP (IPv4/IPv6) transports cross platform, meaning that its possible to configure and compile DiagnosticServer using TCP instead of NamedPipe/Unix Domain Sockets for both listener and connect scenarios. TCP support will be needed in order to support EventPipe on remote targets like mobile, but then most likely only supporting the connect scenario (no listener support) and only for builds used during development/testing and profiling work, but all is completely configurable.

PR adds a couple of build config flags that could be used:

FEATURE_PERFTRACING_PAL_TCP

Enables TCP/IP support in diagnostics server on all platforms, instead of default named pipe/unix domain socket support.

FEATURE_PERFTRACING_DISABLE_CONNECT_PORTS

Disables ability for diagnostic server to connect against remote ports.

FEATURE_PERFTRACING_DISABLE_LISTEN_PORTS

Disables ability for diagnostic server to listen on local ports.

By default none of the above config flags are used by this PR, but for some Mono runtime workloads we will need TCP/IP and connect ports (listen ports can be disabled).

3 years agoPut test name in generated certificate chains. (#50048)
Kevin Jones [Tue, 23 Mar 2021 11:06:45 +0000 (07:06 -0400)]
Put test name in generated certificate chains. (#50048)

This helps the chain builder to not confuse which certificates should
be used in the chain by using unique names for each test.

3 years agoSkip CreateTransform tests with RC2CryptoServiceProvider if RC2 is not supported...
Elinor Fung [Tue, 23 Mar 2021 10:54:12 +0000 (03:54 -0700)]
Skip CreateTransform tests with RC2CryptoServiceProvider if RC2 is not supported (#50072)

3 years agoavoid unnecessary allocations in PriorityQueue.EnqueueRange (#50065)
Eirik Tsarpalis [Tue, 23 Mar 2021 10:32:07 +0000 (10:32 +0000)]
avoid unnecessary allocations in PriorityQueue.EnqueueRange (#50065)

3 years agoSeal private classes in libraries (#49969)
Stephen Toub [Tue, 23 Mar 2021 10:14:55 +0000 (06:14 -0400)]
Seal private classes in libraries (#49969)

3 years agoMove ConcurrentQueueSegment<T>.RoundUpToPowerOf2 to BitOperations (#50070)
Stephen Toub [Tue, 23 Mar 2021 10:14:29 +0000 (06:14 -0400)]
Move ConcurrentQueueSegment<T>.RoundUpToPowerOf2 to BitOperations (#50070)

3 years agoFileStream optimizations (#49975)
David Cantú [Tue, 23 Mar 2021 09:00:46 +0000 (02:00 -0700)]
FileStream optimizations (#49975)

* don't verify OS handle position

* track the file offset in memory, don't use expensive syscalls to synchronize it

* there is no need to set the Length since we are now tracking the offset in memory

* Cache GetFileInformationByHandleEx (Length) when FileShare does not allow other processes to modify it

Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
3 years agoRe-enable iOS/tvOS simulator builds (#50058)
Jo Shields [Tue, 23 Mar 2021 08:38:43 +0000 (04:38 -0400)]
Re-enable iOS/tvOS simulator builds (#50058)

3 years ago[mono] Stop first pass exception handling when exiting the interpreter in llvmonly...
Zoltan Varga [Tue, 23 Mar 2021 06:27:57 +0000 (02:27 -0400)]
[mono] Stop first pass exception handling when exiting the interpreter in llvmonly mode. (#50007)

* [mono] Add a FRAME_TYPE_INTERP_ENTRY frame type to the unwinder, it marks the location where execution transfers
to the interpreter.

* [mono] Stop first pass exception handling when exiting the interpreter in llvmonly mode.

Otherwise, you could end up with the following situation:
- [1] interpreted frame
- [2] AOTed frame catching the exception
- [3] interpreted frame catching the same exception

The EH code would think frame [3] caught the exception, setting up interpreter state for
resuming there, but frame [2] would catch the exception, so the exception state in
the interpreter would not be cleared, leading to an assert in interp_entry ().

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

3 years agoModify EventPipe runtime event generator to emit NULL string correctly (#48879)
Sung Yoon Whang [Tue, 23 Mar 2021 05:56:36 +0000 (22:56 -0700)]
Modify EventPipe runtime event generator to emit NULL string correctly (#48879)

3 years agoStop using EA_PTRSIZE outside of emitter (#50066)
Bruce Forstall [Tue, 23 Mar 2021 05:19:39 +0000 (22:19 -0700)]
Stop using EA_PTRSIZE outside of emitter (#50066)

3 years agoRemove openssl dependency from android (#49282)
Steve Pfister [Tue, 23 Mar 2021 04:17:12 +0000 (00:17 -0400)]
Remove openssl dependency from android  (#49282)

3 years agoMove System.Net.Http ILLink suppressions to LibraryBuild. (#50053)
Eric Erhardt [Tue, 23 Mar 2021 02:34:06 +0000 (21:34 -0500)]
Move System.Net.Http ILLink suppressions to LibraryBuild. (#50053)

This suppression is necessary because we don't have access to the Xamarin and Mono libraries that are used by System.Net.Http.

Contributes to #45623

3 years agoRemove some allocations related to logging configuration (#50055)
David Fowler [Tue, 23 Mar 2021 02:29:17 +0000 (19:29 -0700)]
Remove some allocations related to logging configuration (#50055)

* Remove some allocations related to logging configuration
- Today we allocate enumerators when enumerating custom attributes, this changes a for loop into a foreach and removes the inner foreach loop.

* Remove enumerator allocation from rules selector

* Make condition clearer

* Update src/libraries/Microsoft.Extensions.Logging/src/LoggerFilterOptions.cs

Co-authored-by: Jonas Nyrup <78789299+jn-foreflight@users.noreply.github.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Jonas Nyrup <78789299+jn-foreflight@users.noreply.github.com>
3 years ago[AndroidCrypto] Implement X509 chain building (#49532)
Elinor Fung [Tue, 23 Mar 2021 02:22:25 +0000 (19:22 -0700)]
[AndroidCrypto] Implement X509 chain building (#49532)

3 years agoResolve ILLink warnings in System.ComponentModel.TypeConverter (Round 3) (#49786)
Eric Erhardt [Tue, 23 Mar 2021 01:13:08 +0000 (20:13 -0500)]
Resolve ILLink warnings in System.ComponentModel.TypeConverter (Round 3) (#49786)

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

Contributes to #45623

* Mark GetProperties as RequiresUnreferencedCode.

PropertyDescriptors are not trim compatible because we can't guarantee the PropertyType is annotated as DynamicallyAccessedMembers.All.

* Mark GetConverter as RequiresUnreferencedCode.

NullableConverter requires the underlying type to be annotated with DynamicallyAccessedMembers.All, but it cannot be statically annotated.

* Mark GetDefaultEvent and GetDefaultProperty as RequiresUnreferencedCode.

GetDefaultProperty is not trim compatible because it calls GetProperties, which isn't trim compatible since the PropertyType can't be annotated.

GetDefaultEvent can technically be considered trim compatible when not passing in an object "instance" and only a Type. But this would require trim warning suppressions which aren't worth the risk since most of ICustomTypeDescriptor is already RequiresUnreferencedCode.

3 years agoUpdate coreclr test doc to call out LibrariesConfiguration (#50002)
Elinor Fung [Tue, 23 Mar 2021 01:02:26 +0000 (18:02 -0700)]
Update coreclr test doc to call out LibrariesConfiguration (#50002)

Include build configuration in error message about missing artifacts

3 years agoDisable JIT/Methodical/fp/exgen/10w5d_cs_ro for Linux/arm32 (#50056)
Bruce Forstall [Tue, 23 Mar 2021 00:13:09 +0000 (17:13 -0700)]
Disable JIT/Methodical/fp/exgen/10w5d_cs_ro for Linux/arm32 (#50056)

Currently failing in jitstress2_jitstressregs3 configuration.

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

3 years agoWasm windows aot (#49996)
Larry Ewing [Mon, 22 Mar 2021 22:20:41 +0000 (17:20 -0500)]
Wasm windows aot (#49996)

* Reenable windows mono-aot-cross and disable the optimizer for Browser builds

* remove the llvmoptimizer change

* Don't disable `MonoBundleLLVMOptimizer` when

building on Windows and building crosscompiler only.

* Fix the right condition

Co-authored-by: Radek Doulik <radekdoulik@gmail.com>
3 years agoSkip explanatory text at the start of cert byte blobs if we find a PEM header. (...
Jeremy Koritzinsky [Mon, 22 Mar 2021 20:16:47 +0000 (13:16 -0700)]
Skip explanatory text at the start of cert byte blobs if we find a PEM header. (#49920)

* Skip whitespace bytes at the start of cert byte blobs.

This enables support for PEM-formatted certs prepended with whitespace.

* Handle non-whitespace explanatory text.

* PR feedback.

* Bail early if we don't have enough space to find a header.

Run formatting.