Jan Kotas [Thu, 25 Mar 2021 14:45:51 +0000 (07:45 -0700)]
Port misc changes from feature/NativeAOT (#50212)
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).
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)`
David Cantú [Thu, 25 Mar 2021 08:45:24 +0000 (01:45 -0700)]
Use Length property instead of GetFileInformationByHandleEx for Seek(SeekOrigin.End) (#50218)
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.
Zoltan Varga [Thu, 25 Mar 2021 04:29:33 +0000 (00:29 -0400)]
[mono] Fix an assert. (#50220)
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)
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.
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
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.
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)
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)
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)
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.
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
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
Jeff Handley [Wed, 24 Mar 2021 22:16:38 +0000 (15:16 -0700)]
Include the iOS, Android, and macCatalyst supported platforms (#50143)
Stephen Toub [Wed, 24 Mar 2021 21:24:43 +0000 (17:24 -0400)]
Avoid multiple exceptions at startup from MsQuic support tests (#49973)
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
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
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
Sergey Andreenko [Wed, 24 Mar 2021 18:20:11 +0000 (11:20 -0700)]
Disable a failing test. (#50160)
Eric Erhardt [Wed, 24 Mar 2021 17:57:08 +0000 (12:57 -0500)]
Fix string.Remove exception message (#50176)
Follow up from #50096
Jeremy Barton [Wed, 24 Mar 2021 17:52:14 +0000 (10:52 -0700)]
Fix cross compilation of XmlSerializer.Generator tests (#50180)
Jeremy Barton [Wed, 24 Mar 2021 17:27:42 +0000 (10:27 -0700)]
Use EVP_PKEY for RSA Decrypt
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.
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
```
Nikola Milosavljevic [Wed, 24 Mar 2021 15:31:18 +0000 (08:31 -0700)]
Pick new version of Microsoft.DotNet.Build.Tasks.Installers (#50153)
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
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
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>
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
Anton Firszov [Wed, 24 Mar 2021 11:46:32 +0000 (12:46 +0100)]
Improve NonDisposedSocket_SafeHandlesCollected test (#50104)
Apply timeouts in NonDisposedSocket_SafeHandlesCollected
wfurt [Wed, 24 Mar 2021 01:01:36 +0000 (18:01 -0700)]
fix BasicTest_AccessInstanceProperties_NoExceptions_Bsd
jaymin suthar [Mon, 22 Feb 2021 16:03:32 +0000 (21:33 +0530)]
fixes the https://github.com/dotnet/runtime/issues/48062
Egor Bogatov [Wed, 24 Mar 2021 09:55:13 +0000 (12:55 +0300)]
JIT: Add rootTreeOp to DumpFg (#50119)
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.
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.
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.
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
Anton Lapounov [Wed, 24 Mar 2021 07:23:29 +0000 (00:23 -0700)]
Put back DiaSymReader library for cross-arch crossgen to package (#50149)
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)
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)
Matt Johnson-Pint [Wed, 24 Mar 2021 01:34:09 +0000 (18:34 -0700)]
Improve time zone display names on Unix (#48931)
Larry Ewing [Wed, 24 Mar 2021 01:05:08 +0000 (20:05 -0500)]
Skip ninja and cmake errors in aotcrossonly mode (#50140)
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>
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>
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)
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.
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
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 ().
Stephen Toub [Tue, 23 Mar 2021 20:22:12 +0000 (16:22 -0400)]
Fix str.Remove(str.Length) to not throw (#50096)
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>
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.
Radek Doulik [Tue, 23 Mar 2021 17:29:36 +0000 (18:29 +0100)]
[wasm] Add more information about windows build (#50103)
C-xC-c [Tue, 23 Mar 2021 17:07:02 +0000 (17:07 +0000)]
Add Span overloads to System.Numerics.Vectors (#50062)
Anirudh Agnihotry [Tue, 23 Mar 2021 17:02:49 +0000 (10:02 -0700)]
update branding to preview4 (#50049)
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
Omair Majid [Tue, 23 Mar 2021 16:38:27 +0000 (12:38 -0400)]
Guard use of brew command by OSX (#50069)
Kevin Jones [Tue, 23 Mar 2021 16:02:21 +0000 (12:02 -0400)]
Use the one-shot hash functions for asymmetric operations (#50061)
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
```
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.
Jo Shields [Tue, 23 Mar 2021 14:22:03 +0000 (10:22 -0400)]
Mark ActiveIssue on Vector test which is still failing (#50091)
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.
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'
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).
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.
Elinor Fung [Tue, 23 Mar 2021 10:54:12 +0000 (03:54 -0700)]
Skip CreateTransform tests with RC2CryptoServiceProvider if RC2 is not supported (#50072)
Eirik Tsarpalis [Tue, 23 Mar 2021 10:32:07 +0000 (10:32 +0000)]
avoid unnecessary allocations in PriorityQueue.EnqueueRange (#50065)
Stephen Toub [Tue, 23 Mar 2021 10:14:55 +0000 (06:14 -0400)]
Seal private classes in libraries (#49969)
Stephen Toub [Tue, 23 Mar 2021 10:14:29 +0000 (06:14 -0400)]
Move ConcurrentQueueSegment<T>.RoundUpToPowerOf2 to BitOperations (#50070)
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>
Jo Shields [Tue, 23 Mar 2021 08:38:43 +0000 (04:38 -0400)]
Re-enable iOS/tvOS simulator builds (#50058)
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.
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)
Bruce Forstall [Tue, 23 Mar 2021 05:19:39 +0000 (22:19 -0700)]
Stop using EA_PTRSIZE outside of emitter (#50066)
Steve Pfister [Tue, 23 Mar 2021 04:17:12 +0000 (00:17 -0400)]
Remove openssl dependency from android (#49282)
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
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>
Elinor Fung [Tue, 23 Mar 2021 02:22:25 +0000 (19:22 -0700)]
[AndroidCrypto] Implement X509 chain building (#49532)
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.
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
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
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>
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.
Jo Shields [Mon, 22 Mar 2021 19:51:57 +0000 (15:51 -0400)]
Don't try bypassing `uname` for CPU detection on Mac (#49992)
On Apple Silicon, the command `arch -x86_64 XYZ` allows executing XYZ
as if on an AMD64 CPU, rather than an ARMv8 CPU, for cases where both
are possible (e.g. a shell script like build.sh).
The deleted lines of code bypass the lies `arch` writes into uname,
and instead forcibly detects the true nature of the host system's CPU
regardless of whether or not the developer has reasons to lie.
Whilst this trick was important in the early days of bringing up
Apple Silicon support, it should hopefully now be obsolete.
This fixes linking of LLVM in Mono runtime builds, where
`arch -x86_64 ./build.sh -arch x64` would still attempt to link
against ARM64 LLVM.
Radek Doulik [Mon, 22 Mar 2021 19:42:05 +0000 (20:42 +0100)]
[wasm] windows build improvements (#49771)
Fix build on windows in folders containing space(s) in the name and also
in case where `EMSDK_PATH` contains space(s).
* Add few quotes
To fix windows build in directory containing spaces.
* Add quotes around link attributes paths
* More quotes and trimming
* More improvements related to EMSDK_PATH
* Use immediate set for EMSCRIPTEN_VERSION
* Do not set ExeExt twice
* Force ninja on Browser/windows
And check for cmake and ninja in CheckEnv
* Apply Ankit's quotation changes
* Simplify forcing wasm, fix typos
* Use -File instead of & "<ps1 script>"
* Fix typo
* Only add the escaped quotes on windows
Co-authored-by: Ankit Jain <radical@gmail.com>
Anirudh Agnihotry [Mon, 22 Mar 2021 17:59:48 +0000 (10:59 -0700)]
use packages instead of package report for packageInstallation and closure verification (#49315)
* use packages instead of package report for packageInstallation and closure verification
* add the package dependency
* correct the names
* excluding freebsd from testing
* Update Versions.props
* update the package versions, add support for exclude pakcages and packages to test
* update the package validation version
* Make package testing work indepent of version
* testpackages -> testpackagesPath
* fix restore or when no packages are produced
* correct the no packages produced condition
* use regex instead of major version
Bruce Forstall [Mon, 22 Mar 2021 17:55:47 +0000 (10:55 -0700)]
Fix DEBUG/non-DEBUG asm diffs due to instruction group size estimation (#49947)
* Fix DEBUG/non-DEBUG asm diffs due to instruction group size estimation
This change fixes a long-existing difference between DEBUG and non-DEBUG codegen
that recently manifest as asm diffs in instruction encoding in a Checked/Release
SuperPMI run, mostly in the tests\JIT\Directed\arglist\vararg.cs test, specifically:
```
NativeVarargTest.VarArg:TestPassingManyFloats(System.Double[]):bool
NativeVarargTest.VarArg:TestPassingManyDoublesManaged(System.Double[]):bool
NativeVarargTest.VarArg:TestPassingManyDoubles(System.Double[]):bool
NativeVarargTest.VarArg:TestPassingManyFloatsManaged(System.Single[]):bool
double1:ProcessJagged3DArray(System.Double[][])
``
Example diff:
```
215c7758454: 76 6a jbe 106 // checked
215c77b8ab4: 0f 86 6a 00 00 00 jbe 106 // release
```
Note that the offset ends up exactly the same, but the encoding is different.
Some context on the emitter:
The emitter collects generated machine instructions as a set of variable-sized
`instrDesc` structures in instruction groups (IG, or `insGroup`). An IG is filled
with a variable number of instrDescs into a fixed-sized buffer, which, when full
or a new label (e.g., branch target) is encountered, is copied to dynamically
allocated precise-sized memory for the set of instructions collected. If a BasicBlock
required more instructions than fit in a single IG, multiple IG are generated, and
the ones besides the first are marked with the IGF_EXTEND flag, called "emitAdd"
or overflow IG. After codegen, all the IG are filled, and we have an estimated
size for each instruction, and each IG has an estimated code offset from the
beginning of the function. The estimated sizes could be wrong if we incorrectly
estimated the size of an instruction (which in most cases could be considered a
bug, but is particularly common with our Intel vector instructions currently) or
the offset required for a branch (especially a forward branch). The JIT only does
a single pass of branch tightening, so could have some cases of non-optimal estimates.
Note that estimates are required to be too large; it is fatal for an estimate to
be too small. During emission, we walk the IG list and instructions, encoding them
into the memory buffer provided by the VM. At this point, we might shrink an instruction
encoding, possibly because we can use a smaller branch encoding that expected.
Notably, the size of instrDescs and insGroups varies between DEBUG and non-DEBUG builds.
That means that the number of instrDescs that fit in an IG differs. This should have
no effect on generated code, as long as code properly handles overflow IG and doesn't
affect codegen based on IG size or number of contained instructions.
The problem:
During emission, we calculate an "offset adjustment" (in `emitOffsAdj`) that is used to
estimate the distance from a forward jump instruction to its target. This determines the
size of jump instruction encodings that we emit. For example, on x86/x64, a relative
conditional branch can have a 1 byte or a 4 byte target offset. A 1-byte offset can be
used if the target instruction is 127 bytes or fewer away. So, we estimate the distance
using the jump instruction's known offset and the estimated offset of the target, which
is the estimated offset of the instruction group (the label) calculated before emission
minus the "shrinkage" of instruction sizes that we've seen so far. This "shrinkage" is
due to over-estimation of instruction encoding sizes and branch estimated sizes.
The shrinkage in `emitOffsAdjs` is only computed at the beginning of an IG. As additional
instructions in an IG shrink, we don't take that into account when we reach a forward jump
instruction and try to determine if a "small" branch encoding can be used. Thus, it's
possible for a branch to be estimated to require a large 4-byte offset instead of a 1-byte
offset because the forward branch is barely over the limit, but wouldn't be if we considered
the already-shrunk instructions in the current IG. In fact, the more instructions that
shrink in an IG, the larger our target offset estimate becomes, because the source instruction
address is precise (since we know precisely how many bytes of instructions we've emitted),
but the target offset estimate is fixed.
Due to the different number of instructions in an IG between DEBUG and non-DEBUG builds,
the estimate we use for a target offset for any particular branch, given enough instruction
shrinkage and overflowing IG (such that there are a different number of IG between DEBUG and
non-DEBUG) is different. This leads to different instruction encoding between the flavors.
The solution:
The solution is simple: track instruction shrinkage as we emit instructions, and use the
latest, most accurate shrinkage adjustment when estimating branches. This gives no difference
between DEBUG and non-DEBUG because it removes the indirect dependence on IG instruction
count in recomputing `emitOffsAdj`.
There are asm diffs (with just a Checked x64 JIT compared to baseline Checked JIT) due to some
branches now being SHORT where previously they were LONG.
* Add assert
Bruce Forstall [Mon, 22 Mar 2021 17:47:07 +0000 (10:47 -0700)]
Remove duplicate method name string initialization (#49963)
Both `compInit` and `compCompile` were initializing the method/class/full
name strings. The call to `eeGetMethodFullName` is not cheap, and shows
up high on a SuperPMI replay trace.
Remove the duplicate initialization in `compCompile`.
Speeds up SuperPMI replay and asm diffs.
Bruce Forstall [Mon, 22 Mar 2021 17:45:51 +0000 (10:45 -0700)]
Add more loop alignment output (#49967)
Fix potential Checked/Release issue.
Remove default arg to emitLoopAlign to make calls more explicit.
Drew Scoggins [Mon, 22 Mar 2021 17:43:30 +0000 (10:43 -0700)]
Add arch parameter to artifact name property (#50004)
Bruce Forstall [Mon, 22 Mar 2021 17:42:55 +0000 (10:42 -0700)]
Fix COUNT_LOOPS build (#49965)
Jo Shields [Mon, 22 Mar 2021 16:54:05 +0000 (12:54 -0400)]
Disable arm64 tvOS/iOS simulator builds until ICU issue is addressed (#50003)
Jan Kotas [Mon, 22 Mar 2021 16:16:27 +0000 (09:16 -0700)]
Update minimum recommended cmake version for Windows (#49961)
Fan Yang [Mon, 22 Mar 2021 15:55:36 +0000 (11:55 -0400)]
Add new Mono embedding API to consume binary runtimeconfig format (#49740)
* Add new Mono embedding API to consume binary runtimeconfig format
* Merge properties
* Remove redundant macro
* Move string process to the install function
* Check if runtime_config_arg exist
* Move file processing to install function
* Update src/mono/mono/metadata/appdomain.c
Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
* Update src/mono/mono/metadata/appdomain.c
Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
* Update src/mono/mono/metadata/appdomain.c
Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
* Update src/mono/mono/metadata/appdomain.c
Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
* Update src/mono/mono/metadata/appdomain.c
Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
* Update src/mono/mono/metadata/appdomain.c
Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
* Update src/mono/mono/metadata/appdomain.c
Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
* Update src/mono/mono/metadata/appdomain.c
Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
* Update src/mono/mono/metadata/appdomain.c
Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
* Update src/mono/mono/metadata/appdomain.c
Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
* Remove redundant intermediate copy
* Remove extra memory allocation
* Update src/mono/mono/mini/mono-private-unstable.h
Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
dotnet-maestro[bot] [Mon, 22 Mar 2021 15:41:46 +0000 (15:41 +0000)]
Update dependencies from https://github.com/dotnet/runtime build
20210319.6 (#49991)
[main] Update dependencies from dotnet/runtime
Stephen Toub [Mon, 22 Mar 2021 13:33:04 +0000 (09:33 -0400)]
Lazily-allocate rarely needed ValueTask.s_canceledTask (#49968)
* Lazily-allocate rarely needed ValueTask.s_canceledTask
* Update ValueTask.cs
Steve MacLean [Mon, 22 Mar 2021 13:27:14 +0000 (09:27 -0400)]
Apple Silicon fix remote unwinding (#49974)
Stephen Toub [Mon, 22 Mar 2021 10:33:17 +0000 (06:33 -0400)]
Reduce cost of CreateSecKeyAndSecWebSocketAccept (#49831)
This isn't a big deal as it's once per websocket connection, but it annoys me every time I see the unnecessary waste in a trace. Previously this would allocate:
1. A byte[] for the bytes from the guid
2. A base64-encoded string for (1)
3. A string concatenating (2) and the known server guid
4. A byte[] containing the bytes from (3)
5. A byte[] containing the SHA1-hashed bytes of (4)
6. A base64-encoded string of (5)
Now, it only allocates (2) and (6).