Zoltan Varga [Tue, 27 Oct 2020 04:55:55 +0000 (00:55 -0400)]
Set TARGET_SIZEOF_VOID_P and SIZEOF_REGISTER correctly when cross compiling. (#43851)
Stephen Toub [Tue, 27 Oct 2020 02:24:54 +0000 (22:24 -0400)]
Add IDictionary_Generic_Tests test for multiple values with hash collisions (#43836)
* Add IDictionary_Generic_Tests test for multiple values with hash collisions
* Update src/libraries/System.Collections.Concurrent/tests/ConcurrentDictionary/ConcurrentDictionary.Generic.Tests.cs
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
* Update src/libraries/System.Collections.Concurrent/tests/ConcurrentDictionary/ConcurrentDictionary.Generic.Tests.cs
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
Koundinya Veluri [Tue, 27 Oct 2020 01:52:45 +0000 (21:52 -0400)]
[Portable thread pool] Don't spin-wait on semaphore when hill climbing stops a thread from processing work (#43840)
Egor Bogatov [Tue, 27 Oct 2020 01:14:15 +0000 (04:14 +0300)]
[RyuJIT] Propagate gtFlags in Vector.Create (#43578)
Propagate GTF_CALL if needed in GT_LIST. Use gtNewListNode. Ignore test for Mono
Krzysztof Wicher [Tue, 27 Oct 2020 00:48:14 +0000 (01:48 +0100)]
Improve annotations for XLinq methods taking params object[] (#43717)
* Improve annotations for XLinq classes taking params object[]
* annotate ref
* address Jozkee's feedback
* Fix XStreamingElement ctor to take nullable content
Tomas Weinfurt [Tue, 27 Oct 2020 00:45:18 +0000 (17:45 -0700)]
simplify SslStream_StreamToStream_Alpn_NonMatchingProtocols_Fail test (#43625)
* simplify SslStream_StreamToStream_Alpn_NonMatchingProtocols_Fail test
* feedback from review
Vladimir Sadov [Mon, 26 Oct 2020 22:52:10 +0000 (15:52 -0700)]
Statically linking coreclr and clrjit in single file host (#43556)
* Statically linking coreclr and clrjit in single file host.
* setting g_hmodCoreCLR on Unix
* System.Globalization.Native.lib must build with coreclr to be linkable with it
* Always use system unwind libs on FREEBSD
* no DllMain when coreclr is statically linked
* Handle cases when coreclr configuration is different from libraries
* Adding and using PAL_GetPalHostModule
Jeremy Koritzinsky [Mon, 26 Oct 2020 22:49:49 +0000 (15:49 -0700)]
Revert "Try re-enabling IBC on macOS. (#39801)" (#43839)
This reverts commit
3a4298cf15379678c4d437a6554a1453706cc3b3.
monojenkins [Mon, 26 Oct 2020 19:55:59 +0000 (15:55 -0400)]
[WIP][interp] Unify execution and valuetype stacks (#43681)
Before this change, an InterpFrame contained 3 regions of data : args + locals, valuetype stack, execution stack. Each entry on the execution stack was a stackval structure. The space for valuetypes, was allocated separately, since they have various sizes. When pushing a valuetype on the stack, we allocated first the space for it on the vtstack and then pushed the address of the region on the execution stack. This change merges the execution stack with the valuetype stack, meaning we push now variable sized data on the execution stack. In order to keep track of the current stack location, whenever we push a type on stack, during transform phase, we also keep track of the offset where this value will reside on stack, as well as the size it occupies. All callsites need to be informed how much they need to pop the stack for the arguments. While called code can access this space normally (the args are special locals belonging to the frame and are accessed directly as such), external code needs a new mechanism to detect each argument for a given frame. This is achieved with the lazily initialized arg_offsets array on an InterpMethod. The method doesn't need to be compiled for this array to be correctly initialized.
Why :
- this simplifies handling of valuetypes, their storage follows the same rules as a normal objref/primitive type
- removes the common use of the vt_sp variable. The compiler no longer needs to reserve it in a register during the switch loop, we no longer need to save it with each call. The sp and ip become now the only variables describing the execution state in a method.
- the flow of the data on the execution stack is well behaved now (with the exception of a few opcodes that update directly based on the stack offset). We were using the vtstack for some magic storage (MINT_VTRESULT for example)
- this makes it such that the stack offset of every value is easily known at compile time, making it possible to completely drop the execution stack approach, and have every opcode have a unique dreg and a list of sregs (which are mapped to a certain stack offset). This will enable more advanced optimizations during compile stage.
Co-authored-by: BrzVlad <BrzVlad@users.noreply.github.com>
Adeel Mujahid [Mon, 26 Oct 2020 19:31:35 +0000 (21:31 +0200)]
Merge PAL's _wcslwr into _wcslwr_s (#43265)
In (non-palsuite) product code, `_wcslwr` is only used within PAL
inside `_wcslwr_unsafe()` method, which is exposed as `_wcslwr_s` for
PAL consumers. PR inlines the usage of `_wcslwr` in `_wcslwr_unsafe`
and fixes up PAL tests.
David Wrighton [Mon, 26 Oct 2020 18:41:25 +0000 (11:41 -0700)]
Setting value of enums didn't properly widen the value when setting (#43779)
Use VerifierCorElementType instead of SignatureCorElementType to specify the element type of the target field
- This will send the runtime down the path which can perform primitive widening
Cory Nelson [Mon, 26 Oct 2020 18:06:10 +0000 (11:06 -0700)]
Add cancellable and AddressFamily-specific name resolution. (#33420)
Add AddressFamily-specific name resolution and cancellation support for Windows. Resolves #939
Steven [Mon, 26 Oct 2020 17:53:39 +0000 (18:53 +0100)]
Fixed bug in ReadOnlyDictionary's IDictionary.this[object] implementation. This method didn't adhere to IDictionary's contract to return null on a missing key. (#36926)
Zoltan Varga [Mon, 26 Oct 2020 17:23:37 +0000 (13:23 -0400)]
Bump emscripten to 2.0.6. (#43800)
* Bump emscripten to 2.0.6.
* Define HAVE_SYS_RANDOM_H on wasm, its not detected correctly.
Eugene Shcherbo [Mon, 26 Oct 2020 16:48:26 +0000 (19:48 +0300)]
Enhance #43238 so that it covers DefineScope method group with the tests to reflect the behavior added in the PR. (#43790)
Shreyas Jejurkar [Mon, 26 Oct 2020 16:41:47 +0000 (22:11 +0530)]
ServiceProcess Controller Refactor (#43797)
1. Simplified if checks.
2. Use expression property syntax.
3. Used using declaration.
4. Inlined out declaration.
5. Removed unwated unsafe modifier.
6. Removed redundant casting.
imhameed [Mon, 26 Oct 2020 16:38:25 +0000 (09:38 -0700)]
CoreCLR runtime tests + Mono LLVM AOT on arm64 Linux (#41751)
This change:
- Adds new options to mono.proj:
- MonoAOTEnableLLVM, which enables (or disables) building a Mono AOT
cross compiler with LLVM;
- MonoAOTLLVMDir, which specifies the path to a copy of LLVM suitable for
building a Mono AOT cross compiler, and is optional; and
- BuildMonoAOTCrossCompilerOnly, which allows building a Mono AOT
cross compiler without building an associated full Mono runtime.
- Changes offsets-tool.py's user interface slightly; '--include-prefix' is
renamed to '--prefix' and may be specified multiple times. While this latter
feature isn't necessary to build a Mono cross compiler today, because we don't
use distribution-supplied cross-compilation headers on CI, it does make it
easier to experiment with the offsets tool using arbitrary header layouts. For
example, Debian's arm64 cross-compilation packages scatter useful header files
across `/usr/lib/gcc-cross/aarch64-linux-gnu` and `/usr/aarch64-linux-gnu`.
- Updates the docker image used for arm64 cross-compilation to a newer revision
that includes libclang (see also
https://github.com/dotnet/dotnet-buildtools-prereqs-docker/pull/375).
- Adds some tests that currently fail to compile with Mono LLVM AOT to
issues.targets.
- Adds a Linux_arm64 LLVM AOT job to CI. Nothing particularly fancy is done to
build the Mono LLVM AOT cross compiler; it is built as a step in the same job
that also sends Linux_arm64 tests to Helix.
Aleksey Kliger (λgeek) [Mon, 26 Oct 2020 15:42:36 +0000 (11:42 -0400)]
[docs] Add area-System.Reflection-mono area owners (#43825)
Eric StJohn [Mon, 26 Oct 2020 15:02:17 +0000 (08:02 -0700)]
Ensure IBC data is copied to the expected location (#43644)
monojenkins [Mon, 26 Oct 2020 14:54:58 +0000 (10:54 -0400)]
[w32process-win32] Implement System.Diagnostics.Process::MainWindowHandle. (#43724)
L.A.Noire splash screen calls it to check if the game has opened its window, and stays forever visible if this is not implemented.
Co-authored-by: rbernon <rbernon@users.noreply.github.com>
Lakshan Fernando [Mon, 26 Oct 2020 12:49:59 +0000 (05:49 -0700)]
Fix to set the inner exception for ALC event (#43667)
* Fix to set the inner exception for ALC event
Removes the exception handling at
CLRPrivBinderCoreCLR::BindAssemblyByName so that
the inner exceptioncan be set when the default
AssemblyLoadContext.Resolving handler throws
* Fixing the test for alc.default
* Enhanced the tests by customizing the exception type that
will be thrown by the handlers
Anton Firszov [Mon, 26 Oct 2020 12:18:31 +0000 (13:18 +0100)]
Fix RHEL7 socket dispose hang, and extend coverage (#43409)
Fix #42686 by doing a graceful close in case if the abortive connect(AF_UNSPEC) call fails on Linux, and improve couple of related tests:
- Extend RetryHelper with an exception filter
- Connect, Accept, Send, Receive, SendFile cancellation tests: make sure cancellation failures are not masked by RetryHelper (use exception filter)
- Connect, Accept, Send, Receive cancellation tests: also test IPV6 and DualMode sockets
Zoltan Varga [Mon, 26 Oct 2020 00:46:52 +0000 (20:46 -0400)]
Disable JIT counters if the JIT is disabled. (#43808)
dotnet-maestro[bot] [Sun, 25 Oct 2020 22:44:01 +0000 (22:44 +0000)]
[master] Update dependencies from dotnet/arcade Microsoft/vstest dotnet/llvm-project dotnet/runtime-assets mono/linker (#43768)
[master] Update dependencies from dotnet/arcade Microsoft/vstest dotnet/llvm-project dotnet/runtime-assets mono/linker
Jan Kotas [Sun, 25 Oct 2020 18:56:53 +0000 (11:56 -0700)]
Use function pointers for interop (Unix) (#43793)
Alexander Köplinger [Fri, 23 Oct 2020 23:30:16 +0000 (01:30 +0200)]
Update Android instrumentation runner to be closer to upstream (#43775)
The upstream instrumentation runners don't use runOnMainSync() in the onStart() method, update our runner to do the same and add a bit more logging.
Also fixed a small typo in configure.cmake that I happened to notice.
Egor Chesakov [Fri, 23 Oct 2020 22:40:28 +0000 (15:40 -0700)]
Pass -target arm or -target arm64 to superpmi.exe when replaying in superpmi.py (#43784)
* Pass -target (arm|arm64) argument to superpmi.exe when replaying for arm/arm64 in superpmi.py
* Add the -target argument only in altjit in superpmi.py
Ankit Jain [Fri, 23 Oct 2020 19:21:16 +0000 (15:21 -0400)]
[wasm][debugger] Fix check for already loaded assemblies (#43747)
We send assembly loaded events to the proxy based off events from the
debugger engine. And we check that it isn't an assembly that was already
loaded. This check has a bug in computing the assembly name, from the
filename, which caused these events to be sent even for already loaded
assemblies.
Aleksey Kliger (λgeek) [Fri, 23 Oct 2020 18:53:35 +0000 (14:53 -0400)]
[mono] Use lax Roslyn and analyzers settings for samples (#43769)
* [mono] Use lax Roslyn and analyzers settings for samples
The samples are often used for debugging runtime problems by modifying the code
to reproduce issues. The code analyzers and warnings-as-errors add a papercut before a modified
sample can run.
* [mono] Make HelloWorld sample Makefile settings overridable
allow MONO_CONFIG and MONO_ENV_OPTIONS to be set from the outside
Stephen Toub [Fri, 23 Oct 2020 18:50:07 +0000 (14:50 -0400)]
Fix inconsistency of the 'CanRead' property after disposing an HTTP content stream (#43766)
* Fix inconsistency of the 'CanRead' property after disposing an HTTP content stream
* Update src/libraries/System.Net.Http/tests/FunctionalTests/RawConnectionStreamTest.cs
Co-authored-by: Marie Píchová <11718369+ManickaP@users.noreply.github.com>
Co-authored-by: Angelo Breuer <46497296+angelobreuer@users.noreply.github.com>
Co-authored-by: Marie Píchová <11718369+ManickaP@users.noreply.github.com>
Tomas Weinfurt [Fri, 23 Oct 2020 17:01:25 +0000 (10:01 -0700)]
improve link detection for WIFI on macOS (#43737)
* improve link detection for WIFI on macOS
* enable test back
* correct condition
* improve type detection for WIFI
* Update src/libraries/Native/Unix/System.Native/pal_interfaceaddresses.c
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
monojenkins [Fri, 23 Oct 2020 16:59:36 +0000 (12:59 -0400)]
[w32socket] Turn WireGuard ENOKEY errno to WASANETUNREACH (#43734)
When the destination IP on the packet doesn't match any WireGuard peer (such as
if the peer is disconnected while the app is running), the sender may get an ENOKEY errno.
This is mentioned in Section 3 "Send/Receive" of
https://www.wireguard.com/papers/wireguard.pdf
Fixes https://github.com/mono/mono/issues/20503
Co-authored-by: lambdageek <lambdageek@users.noreply.github.com>
RaymondHuy [Fri, 23 Oct 2020 16:31:56 +0000 (23:31 +0700)]
Fix issue: ConventionsBuilder and open generic export with constructor dependencies (#43003)
* Add new function to scan the open generic's constructors when the type is generic
Co-authored-by: HuyLuong <huy.luong@orientsoftware.com>
Larry Ewing [Fri, 23 Oct 2020 16:02:53 +0000 (11:02 -0500)]
Block the runtime on ready to early bind breakpoints (#43260)
* Block in ready
* Remove hideWebDriver option and always do it
* Rename attach method
monojenkins [Fri, 23 Oct 2020 15:39:20 +0000 (11:39 -0400)]
Mono: Clang bin path not added to PATH for VS2019 builds. (#43505)
Building full AOT using CI scripts won't work when VS2019 IDE is present (not falling back to VS2019 build tools).
This happens due to a typo in setup-vs-msvcbuild-env.bat. Since CI doesn't install VS IDE, but using buildtools (where clan bin
path is added to PATH) problem only shows up on local development environment using VS2019 IDE.
Co-authored-by: lateralusX <lateralusX@users.noreply.github.com>
Bekir Ozturk [Fri, 23 Oct 2020 15:38:01 +0000 (17:38 +0200)]
Setting `WebProxy.BypassList` to null throws (#40656)
* Argument validation in WebProxy BypassList setter
* Updated a failing test
* Added tests for new BypassList behavior
* Updated the tests for new BypassList behavior
* Added AllowNull attribute on BypassList property
* Update src/libraries/System.Net.WebProxy/src/System/Net/WebProxy.cs
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Wei Zheng [Fri, 23 Oct 2020 15:13:15 +0000 (23:13 +0800)]
Fix null reload token for ConfigurationProvider (#43306)
* Fix null reload token for ConfigurationProvider
* Add not null assert
Kevin Wittmer [Fri, 23 Oct 2020 15:10:53 +0000 (11:10 -0400)]
Improve error message thrown by Microsoft.Extensions.Configuration.Json.JsonConfigurationFileParser when the root element of a JSON config file is not an object. (#42780)
JSON configuration files must have an object as the root element. Previously, the exception message produced by Microsoft.Extensions.Configuration.Json.JsonConfigurationFileParser when a non-object root element was parsed was Error: Unsupported JSON token 'TOKEN_TYPE' was found. This error message was vague and caused confusion. This commit updates the error message to specifically mention that the root element must be an object.
Fix dotnet/extensions#3543.
Nikolay-parhimovich [Fri, 23 Oct 2020 15:01:26 +0000 (18:01 +0300)]
Fix issue #36999 (#43723)
* Created two resources string for exceptions.
Replaced static strings with resource.
* Fixed formatting.
Co-authored-by: Nikolay-parhimovich <>
Vitek Karas [Fri, 23 Oct 2020 14:52:38 +0000 (07:52 -0700)]
Suppress trim analysis warnings inside reflection implementation (#43594)
See the Justification for each of the added suppressions.
Also annotate GetMethodBody as potentially dangerous with trimming.
Trimming can change IL of a method (can remove branches, remove local variables, change some isntructions, ...) - as such accessing the actual body of a method is potentially dangerous.
Marek Safar [Fri, 23 Oct 2020 14:49:27 +0000 (16:49 +0200)]
Add link to Discord server (#43765)
* Add link to Discord server
* Update README.md
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Eric Erhardt [Fri, 23 Oct 2020 14:34:24 +0000 (09:34 -0500)]
Remove Common Extensions HashCodeCombiner (#43454)
* Remove Common Extensions HashCodeCombiner
Fix #33259
* Add unit tests for FilePatternMatch.GetHashCode.
Daniel Marbach [Fri, 23 Oct 2020 13:41:47 +0000 (15:41 +0200)]
Use non-generic TaskCompletionSource where possible in System.Threading.Channels (#40953)
* Use non-generic TaskCompletionSource where possible
* Apply suggestions from code review
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
dotnet-maestro[bot] [Fri, 23 Oct 2020 13:41:13 +0000 (13:41 +0000)]
[master] Update dependencies from mono/linker (#43698)
[master] Update dependencies from mono/linker
Adeel Mujahid [Fri, 23 Oct 2020 13:34:50 +0000 (16:34 +0300)]
Free allocated buffer after UTF8 encode on FreeBSD (#43431)
* Free allocated buffer after UTF8 encode on FreeBSD
* Address PR feedback
Stephen Toub [Fri, 23 Oct 2020 13:10:15 +0000 (09:10 -0400)]
Fix NegotiateStream handling of EOF (#43739)
In my refactoring of NegotiateStream to use async/await, I broke its handling of EOF, with it throwing an exception instead of returning 0. This fixes it to correctly handle EOF.
Zoltan Varga [Fri, 23 Oct 2020 11:53:57 +0000 (07:53 -0400)]
Allow WasmAppBuilder to run after the publish step. Change the (#43742)
wasm sample to use publish.
imhameed [Fri, 23 Oct 2020 10:42:48 +0000 (03:42 -0700)]
[mono] Use CMAKE_CURRENT_SOURCE_DIR instead of CMAKE_SOURCE_DIR (#43715)
CLion creates a directory named ".idea" as a sibling to the top-level
CMakeLists.txt that describes the project; with src/mono, git clean -dXf
will delete src/mono/.idea because ".idea/" is an ignored pattern in
.gitignore.
One workaround is to create an out-of-tree CMakeLists.txt that contains
nothing but add_directory(relative/path/to/src/mono), but this changes
the value of CMAKE_SOURCE_DIR to something other than what our CMake
build files expect.
Kevin Gosse [Fri, 23 Oct 2020 09:42:37 +0000 (11:42 +0200)]
Add missing opcodes to k_rgnStackPushes (#42246)
The rewriter defined two extra opcodes, CEE_COUNT and CEE_SWITCH_ARG, but does not define them in the k_rgnStackPushes array. This can cause out-of-bounds reads when computing the value of maxstack.
Zoltan Varga [Fri, 23 Oct 2020 08:37:12 +0000 (04:37 -0400)]
Fix the signature of Interop.Sys.Log () to match the native signature. (#43744)
Signature mismatches cause errors on some platforms like wasm.
Jan Kotas [Fri, 23 Oct 2020 08:33:28 +0000 (01:33 -0700)]
Disable test against https://github.com/dotnet/runtime/issues/43754 (#43755)
Marek Safar [Fri, 23 Oct 2020 07:45:44 +0000 (09:45 +0200)]
Move Thread PNSE check to managed to cut more dependencies (#43730)
Jan Kotas [Fri, 23 Oct 2020 06:42:27 +0000 (23:42 -0700)]
Fixes to allow using OS-provided threadpool (#43726)
Backport from dotnet/runtimelab:NativeAOT
Anton Lapounov [Fri, 23 Oct 2020 06:26:31 +0000 (23:26 -0700)]
Trim quoted file names passed to Crossgen2 (#43746)
hrrrrustic [Fri, 23 Oct 2020 04:27:00 +0000 (00:27 -0400)]
Make DebugDirectoryBuilder.AddCodeViewEntry public (#43267)
Eric Erhardt [Fri, 23 Oct 2020 03:06:04 +0000 (22:06 -0500)]
Increase Hosting tests timeout (#43695)
* Increase Hosting tests timeout
There are some environments (checked CoreCLR, no tiered compilation) where the current timeout is insufficient. Increasing the timeout so the tests don't fail in these environments.
Fix #43389
SUN Guoyun [Fri, 23 Oct 2020 01:15:44 +0000 (09:15 +0800)]
Change list-processed to ps (#42293) (#42297)
Co-authored-by: Sunguoyun <sunguoyun@loongson.cn>
Zoltan Varga [Thu, 22 Oct 2020 23:11:19 +0000 (19:11 -0400)]
[jit] Fix gsharedvt constrained calls to Object.GetType () under netcore. (#43729)
* [jit] Fix gsharedvt constrained calls to Object.GetType () under netcore.
Fixes https://github.com/dotnet/runtime/issues/35674.
* Update src/mono/mono/mini/jit-icalls.c
Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
Steve Harter [Thu, 22 Oct 2020 21:41:14 +0000 (16:41 -0500)]
Allow dynamic code sample to compile on v3.0-5.0 (#43703)
Tom Deseyn [Thu, 22 Oct 2020 20:09:11 +0000 (22:09 +0200)]
gc: shorten background thread name to fit Linux name limit (#43679)
* gc: shorten background thread name to fit Linux name limit
Egor Chesakov [Thu, 22 Oct 2020 17:04:15 +0000 (10:04 -0700)]
Update "Input Image Architectures" table in r2rdump README.md (#43727)
Mikel Blanchard [Thu, 22 Oct 2020 16:43:25 +0000 (09:43 -0700)]
Fix perf issue in System.Diagnostics.Activity (#43710)
Bruce Forstall [Thu, 22 Oct 2020 16:40:50 +0000 (09:40 -0700)]
Fix ildasm of certain floating-point numbers (#43673)
Change #42848 altered comments to print numbers in comments in
little-endian format, but went too far and changed two places
that print out numbers outside of comments that are later parsed
by ilasm in round-trip testing.
Fixes #43672
Bruce Forstall [Thu, 22 Oct 2020 16:05:33 +0000 (09:05 -0700)]
Bring back missing Exit_Failure case (#43665)
This script label and code was removed in a previous change
even though it is still required. Bring it back.
Bar Arnon [Thu, 22 Oct 2020 14:07:09 +0000 (17:07 +0300)]
Align MailAddress.GetHashCode with Equals (#43573)
Roman Bukin [Thu, 22 Oct 2020 13:44:47 +0000 (16:44 +0300)]
Fix issue #43714. Guid fallback for BigEndian had icorrect offsets. (#43718)
Marek Safar [Thu, 22 Oct 2020 10:54:18 +0000 (12:54 +0200)]
Slim down Path::Combine by removing dependency on ValueTuple`8 (#43582)
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Stephen Toub [Thu, 22 Oct 2020 02:13:12 +0000 (22:13 -0400)]
Extend allowed Task.Delay/CTS TimeSpan values to match Timer (#43708)
For some reason, Task.Delay(TimeSpan, ...) and CancellationTokenSource.CancelAfter(TimeSpan) cut off the max allowed timeout at int.MaxValue milliseconds, whereas Timer's TimeSpan support (which is used under the covers) goes all the way to UInt32.MaxValue - 2. This changes Task/CancellationTokenSource to match, effectively doubling the allowed length of the timeouts.
Anton Lapounov [Thu, 22 Oct 2020 01:35:14 +0000 (18:35 -0700)]
Replace command-line parser for Crossgen2 (#43655)
Switch back to the old command-line parser for Crossgen2 to improve performance of parsing arguments.
Zoltan Varga [Thu, 22 Oct 2020 00:39:09 +0000 (20:39 -0400)]
[llvm] Fix some simd issues. (#43647)
* [llvm] Add support for MONO_TYPE_FTNPTR.
* [llvm] Fix support for some SIMD intrinsics.
* Always use OP_SSE41_ROUNDS with 2 arguments, JIT opcodes can't
have optional arguments.
* Convert arguments to intrinsic calls, sometimes they have
slighly different pointer or vector types.
* [jit] Refactor the SIMD intrinsics handling code to share more code.
Avoid emitting LLVM intrinsics which are not not enabled since it
would cause llc to fail.
David Wrighton [Wed, 21 Oct 2020 21:45:10 +0000 (14:45 -0700)]
Fix and test crossgen2 on arm and x86 (#42998)
Fix last issues preventing the Pri0 tests from passing under crossgen2 for arm and x86
- Add support for stackprobe helper on arm32
- Fix field layout for x86 structures that contain long enums
- Add test suite for these enum scenarios
- Report the same alignment info to the jit for crossgen2 based compilation as was done in the core runtime
Also enable testing targetting x86 and arm
Koundinya Veluri [Wed, 21 Oct 2020 20:16:37 +0000 (16:16 -0400)]
Fix fallthrough cases in portable thread pool change (#43701)
t-mustafin [Wed, 21 Oct 2020 18:17:17 +0000 (21:17 +0300)]
Fix crossgen2 armel build (#42811)
Build fails with libjitinterface_armel.so and libclrjit_unix_armel_x64.so was not found after #41126.
Signed-off-by: Timur <t.mustafin@partner.samsung.com>
Steve Harter [Wed, 21 Oct 2020 17:53:45 +0000 (12:53 -0500)]
Code sample for supporting dynamic objects (#42097)
Stephen Toub [Wed, 21 Oct 2020 17:33:59 +0000 (13:33 -0400)]
Delete NetEventSource.Fail (#43579)
At some point some Debug.Asserts/Fails were replaced by this NetEventSource.Fail helper, which both Debug.Fails and fires an EventSource event. But asserts in our code base are intended for things that should never happen, and we needn't be emitting events for them (if we did want to emit events for them, we'd need to tackle the other ~20,000 Debug.Assert/Fails in the codebase.
I've deleted NetEventSource.Fail, and fixed up the call sites. Some were simply replaced by Debug.Assert/Fail. Some were deleted entirely, when from code inspection it looked like they could actually be hit, but were guarded by a check for the event source being enabled and thus were unlikely to have been triggered in our previous testing. Etc.
Koundinya Veluri [Wed, 21 Oct 2020 17:18:24 +0000 (13:18 -0400)]
Migrate coreclr's worker thread pool to be able to use the portable thread pool in opt-in fashion (#38225)
- Enables using the portable thread pool with coreclr as opt-in. Change is off by default for now, and can be enabled with COMPlus_ThreadPool_UsePortableThreadPool=1. Once it's had bake time and seen to be stable, at a reasonable time in the future the config flag would ideally be removed and the relevant parts of native implementation deleted.
- The IO thread pool is not being migrated in this change, and remains on the native side
- My goal was to get compatible behavior, compatible with diagnostics tools, and similar perf to the native implementation in coreclr. Tried to avoid changing scheduling behavior, behavior of heuristics, etc., compared with that implementation.
- The eventual goal is to have one mostly managed thread pool implementation that can be shared between runtimes, to ease maintenance going forward
Commit descriptions:
- "Add dependencies"
- Ported LowLevelLock from CoreRT, and moved LowLevelSpinWaiter to shared. Since we support Thread.Interrupt(), they were necessary in the wait subsystem in CoreRT partly to support that, and were also used in the portable thread pool implementation where a pending thread interrupt on a thread pool thread would otherwise crash the process. Interruptible waits are already used in the managed side of the thread pool in the queue implementations. It may be reasonable to ignore the thread interrupt problem and suggest that it not be used on thread pool threads, but for now I just brought in the dependencies to keep behavior consistent with the native implementation.
- "Add config var"
- Added config var COMPlus_ThreadPool_UsePortableThreadPool (disabled by default for now)
- Flowed the new config var to the managed side and set up a mechanism to flow all of the thread pool config vars
- Removed debug-only config var COMPlus_ThreadpoolTickCountAdjustment, which didn't seem to be too useful
- Specialized native and managed thread pool paths based on the config var. Added assertions to paths that should not be reached depending on the config var.
- "Move portable RegisteredWaitHandle implementation to shared ThreadPool.cs"
- Just moved the portable implementation, no functional changes. In preparation for merging the two implementations.
- "Merge RegisteredWaitHandle implementations"
- Merged implementations of RegisteredWaitHandle using the portable version as the primary and specializing small parts of it for coreclr
- Fixed PortableThreadPool's registered waits to track SafeWaitHandles instead of WaitHandles similarly to the native implementation. The SafeWaitHandle in a WaitHandle can be modified, so it is retrieved once and reused thereafter. Also added/removed refs for the SafeWaitHandles that are registered.
- "Separate portable-only portion of RegisteredWaitHandle"
- Separated RegisteredWaitHandle.UnregisterPortable into a different file, no functional changes. Those paths reference PortableThreadPool, which is conditionally included unlike ThreadPool.cs. Just for consistency such that the new file can be conditionally included similarly to PortableThreadPool.
- "Fix timers, tiered compilation, introduced time-sensitive work item queue to simulate coreclr behavior"
- Wired work items queued from the native side (appdomain timer callback, tiered compilation background work callback) to queue them into the managed side
- The timer thread calls into managed code to queue the callback
- Some tiered compilation work item queuing paths cannot call managed code, so used a timer with zero due time instead
- Added a queue of "time-sensitive" work items to the managed side to mimic how work items queued from the native side ran previously. In particular, if the global queue is backed up, when using the native thread pool the native work items still run ahead of them periodically (based on the Dispatch quantum). Potentially they could be queued into the global queue but if it's backed up it can potentially significantly and perhaps artificially delay the appdomain timer callback and the tiering background jitting. I didn't want to change the behavior in an observable (and potentially bad) way here for now, a good time to revisit this would be when IO completion handling is added to the portable thread pool, then the native work items could be handled somewhat similarly.
- "Implement ResetThreadPoolThread, set thread names for diagnostics"
- Aside from that, setting the thread names (at OS level) allows debuggers to identify the threads better as before. For threads that may run user code, the thread Name property is kept as null as before, such that it may be set without exception.
- "Cache-line-separate PortableThreadPool._numRequestedWorkers similarly to coreclr"
- Was missed before, separated it for consistency
- "Post wait completions to the IO completion port on Windows for coreclr, similarly to before"
- On Windows, wait completions are queued to the IO thread pool, which is still implemented on the native side. On Unixes, they are queued to the global queue.
- "Reroute managed gate thread into unmanaged side to perform gate activites, don't use unmanaged gate thread"
- When the config var is enabled, removed the gate thread from the native side. Instead, the gate thread on the managed side calls into the native side to perform gate activities for the IO completion thread pool, and returns a value to indicate whether the gate thread is still necessary.
- Also added a native-to-managed entry point to request the gate thread to run for the IO completion thread pool
- "Flow config values from CoreCLR to the portable thread pool for compat"
- Flowed the rest of the thread pool config vars to the managed side, such that COMPlus variables continue to work with the portable thread pool
- Config var values are stored in AppContext, made the names consistent for supported and unsupported values
- "Port - ..." * 3
- Ported a few fixes that did not make it into the portable thread pool implementation
- "Fix ETW events"
- Fixed the EventSource used by the portable thread pool, added missing events
- For now, the event source uses the same name and GUID as the native side. It seems to work for now for ETW, we may switch to a separate provider (along with updating tools) before enabling the portable thread pool by default.
- For enqueue/dequeue events, changed to use the object's hash code as the work item identifier instead of the pointer since the pointer may change between enqueue and dequeue
- "Fix perf of counts structs"
- Structs used for multiple counts with interlocked operations were implemented with explicit struct layout and field offsets. The JIT seems to generate stack-based code for such structs and it was showing up as higher overhead in perf profiles compared to the equivalent native implementation. Slower code in compare-exchange loops can cause a larger gap of time between the read and the compare-exchange, which can also cause higher contention.
- Changed the structs to use manual bit manipulation instead, and microoptimized some paths. The code is still not as good as that generated by C++, but it seems to perform similarly based on perf profiles.
- Code size also improved in many cases, for example one of the larger differences was in MaybeAddWorkingWorker(), which decreased from 585 bytes to 382 bytes and with far fewer stack memory operations
- "Fix perf of dispatch loop"
- Just some minor tweaks as I was looking at perf profiles and code of Dispatch()
- "Fix perf of ThreadInt64PersistentCounter"
- The implementation used to count completed work items was using `ThreadLocal<T>`, which turned out to be too slow for that purpose according to perf profiles
- Changed it to rely on the user of the component to provide an object that tracks the count, which the user of the component would obtain from a ThreadStatic field
- Also removed the thread-local lookup per iteration in one of the hot paths in Dispatch() and improved inlining
- "Miscellaneous perf fixes"
- A few more small tweaks as I was looking at perf profiles and code
- In ConcurrentQueue, added check for empty into the fast path
- For the portable thread pool, updated to trigger the worker thread Wait event after the short spin-wait completes and before actually waiting, the event is otherwise too verbose when profiling and changes performance characteristics
- Cache-line-separated the gate thread running state as is done in the native implementation
- Accessing PortableThreadPool.ThreadPoolInstance multiple times was generating less than ideal code that was noticeable in perf profiles. Tried to avoid it especially in hot paths, and in some cases where unnecessary for consistency if nothing else.
- Removed an extra call to Environment.TickCount in Dispatch() per iteration
- Noticed that a field that was intended to be cache-line-separated was not actually being separated, see https://github.com/dotnet/runtime/issues/38215, fixed
- "Fix starvation heuristic"
- Described in comment
- "Implement worker tracking"
- Implemented the equivalent in the portable thread pool along with raising the relevant event
- "Use smaller stack size for threads that don't run user code"
- Using the same stack size as in the native side for those threads
- "Note some SOS dependencies, small fixes in hill climbing to make equivalent to coreclr"
- Corresponds with PR that updates SOS: https://github.com/dotnet/diagnostics/pull/1274
- Also fixed a couple of things to work similarly to the native implementation
- "Port some tests from CoreRT"
- Also improved some of the tests
- "Fail-fast in thread pool native entry points specific to thread pool implementations based on config"
- Scanned all of the managed-to-native entry points from the thread pool and thread-entry functions, and promoted some assertions to be verified in all builds with fail-fast. May help to know in release builds when a path that should not be taken is taken and to avoid running further along that path.
- "Fix SetMinThreads() and SetMaxThreads() to return true only when both changes are successful with synchronization"
- These are a bit awkward when the portable thread pool is enabled, because they should return true only when both changes are valid and return false without making any changes otherwise, and since the worker thread pool is on the managed side and IO thread pool is on the native side
- Added some managed-to-native entry points to allow checking validity before making the changes, all under a lock taken by the managed side
- "Fix registered wait removals for fairness since there can be duplicate system wait objects in the wait array"
- Described in comment
- "Allow multiple DotNETRuntime event providers/sources in EventPipe"
- Temporary change to EventPipe to be able to get events from dotnet-trace
- For now, the event source uses the same name and GUID as the native side. It seems to work for now for ETW, and with this change it seems to work with EventPipe for getting events. Subscribing to the NativeRuntimeEventSource does not get thread pool events yet, that is left for later. We may switch to a separate provider (along with updating tools) before enabling the portable thread pool by default, as a long-term solution.
- "Fix registered wait handle timeout logic in the wait thread"
- The timeout logic was comparing against how long the last wait took and was not timing out waits sometimes, fixed to consider the total time since the last reset of timeout instead
- "Fix Browser build"
- Updated the Browser-specific thread pool variant based on the other changes
Corresponding PR to update SOS: https://github.com/dotnet/diagnostics/pull/1274
Fixes https://github.com/dotnet/runtime/issues/32020
Jo Shields [Wed, 21 Oct 2020 16:47:27 +0000 (12:47 -0400)]
Add test leg to the PR build to run libraries tests on Android devices (#42209)
The on-device version of https://github.com/dotnet/runtime/pull/37585
Co-authored-by: Premek Vysoky <premek.vysoky@microsoft.com>
Co-authored-by: Santiago Fernandez Madero <safern@microsoft.com>
Mitchell Hwang [Wed, 21 Oct 2020 16:45:57 +0000 (12:45 -0400)]
[Android] Add AndroidAppBuilder pkgproj for Android sample (#43216)
In preparation to bring mono samples to `dotnet/samples`, files that are most likely to change will be packaged into a nuget package to be downloaded and consumed on the `dotnet/samples` end rather than mirroring changes.
This PR expands the process that created the NuGet package for `Microsoft.NETCore.BrowserDebugHost.Transport` to build a NuGet package for the Android sample.
Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
Zoltan Varga [Wed, 21 Oct 2020 16:37:00 +0000 (12:37 -0400)]
Remove non-cmake build support from mono.proj. (#43678)
Huo Yaoyuan [Wed, 21 Oct 2020 16:08:53 +0000 (00:08 +0800)]
Update steps in debugging instruction of CLR (#43557)
* Update CLR debugging instruction steps.
* Use suggested BCL path
Co-authored-by: Jan Vorlicek <janvorli@microsoft.com>
* Mention the usage cases of CORE_LIBRARIES.
Co-authored-by: Jan Vorlicek <janvorli@microsoft.com>
Egor Bogatov [Wed, 21 Oct 2020 15:51:54 +0000 (18:51 +0300)]
RyuJIT: Don't emit null checks for constant strings (#37245)
* Fold "ldstr ==/!== null" (mikedn's PR)
* Formatting
* check IsUnsigned for GT_GT
* Address feedback
dotnet-maestro[bot] [Wed, 21 Oct 2020 15:43:28 +0000 (17:43 +0200)]
[master] Update dependencies from mono/linker dotnet/arcade dotnet/xharness dotnet/llvm-project (#43583)
* Update dependencies from https://github.com/dotnet/arcade build
20201015.7
Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk , Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.ApiCompat
From Version 6.0.0-beta.20514.1 -> To Version 6.0.0-beta.20515.7
* Update dependencies from https://github.com/dotnet/xharness build
20201019.2
Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Xunit
From Version 1.0.0-prerelease.20516.1 -> To Version 1.0.0-prerelease.20519.2
* Update dependencies from https://github.com/mono/linker build
20201020.1
Microsoft.NET.ILLink.Tasks
From Version 6.0.0-alpha.1.20516.1 -> To Version 6.0.0-alpha.1.20520.1
* Update dependencies from https://github.com/mono/linker build
20201020.2
Microsoft.NET.ILLink.Tasks
From Version 6.0.0-alpha.1.20516.1 -> To Version 6.0.0-alpha.1.20520.2
* Update dependencies from https://github.com/dotnet/arcade build
20201016.5
Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk , Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.ApiCompat
From Version 6.0.0-beta.20514.1 -> To Version 6.0.0-beta.20516.5
* Update dependencies from https://github.com/dotnet/llvm-project build
20201019.1
runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.linux-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk
From Version 9.0.1-alpha.1.20512.1 -> To Version 9.0.1-alpha.1.20519.1
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Alexander Köplinger [Wed, 21 Oct 2020 15:40:26 +0000 (17:40 +0200)]
Fix incremental build of tasks.proj for mobile (#43674)
* Fix incremental build of tasks.proj for mobile
The semaphore file that is used as the input for deciding whether to rebuild tasks.proj wasn't properly taking the mobile task projects into account.
This resulted in e.g. WasmAppBuilder not being built if you built for desktop before, resulting in a build error.
We now use the conditioned project references as an input instead of globbing through all nested projects.
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
Ryan Lucia [Wed, 21 Oct 2020 15:32:53 +0000 (11:32 -0400)]
[mono] Copy image data with AssemblyLoadContext.LoadFromStream (#43592)
We don't actually pin the byte array, so it must be copied or it can be overwritten once we run a GC on the LOH.
Fixes https://github.com/dotnet/runtime/issues/43402
Tested manually that it fixes the issue using the associated repro. This isn't really something that lends itself to a test, so that's the best I can do.
Steve Harter [Wed, 21 Oct 2020 14:50:02 +0000 (09:50 -0500)]
Add public JsonElement.ParseValue() and TryParseValue() (#43601)
Přemek Vysoký [Wed, 21 Oct 2020 14:29:45 +0000 (16:29 +0200)]
Add test leg to the PR build to run libraries tests on Android emulators (#37585)
Jan Vorlicek [Wed, 21 Oct 2020 13:53:43 +0000 (15:53 +0200)]
Disable / fix failing test in runincontext testing (#43663)
* Disable all profiler tests since they launch a secondary process
and process launch creates an infinite event loop in the
SocketAsyncEngine on Linux. Since runincontext loads even
framework assemblies into the unloadable context, locals in this
loop prevent unloading.
The tests were working before Process.Start moved to using sockets.
* Fix the multifoldertest to work under runincontext - the shell
script generated from the .csproj was passing an absolute path
for the multifolder.dll to the runincontext.sh/cmd instead of
a relative path that is used in all other tests and that the
runincontext expects.
Jan Vorlicek [Wed, 21 Oct 2020 10:48:21 +0000 (12:48 +0200)]
Enable implicit fallthrough warning (#43397)
* Enable implicit fallthrough warning
This change enables warnings for implicit fallthrough in
switch cases and fixes all the cases where the warning
was reported.
It also fixes some places where the fall through was incorrect.
Fortunately, these places were not causing functional issues.
Egor Bogatov [Wed, 21 Oct 2020 09:26:42 +0000 (12:26 +0300)]
[Browser] don't pass redundant args to wasm (#41608)
Zoltan Varga [Wed, 21 Oct 2020 08:58:48 +0000 (04:58 -0400)]
Mono: Fix the windows cmake build. (#43658)
This will not use cmake on windows, it just fixes the conditionals so the windows build doesn't fail if cmake is enabled by default.
Bruce Forstall [Wed, 21 Oct 2020 00:51:09 +0000 (17:51 -0700)]
Automatically trigger the ilasm round-trip test on PRs (#43666)
For changes to the ilasm or ildasm source code, trigger
the ilasm round-trip pipeline.
There could, of course, be other changes that could affect
ilasm/ildasm, but this at least catches the primary ones.
Juan Hoyos [Tue, 20 Oct 2020 23:34:38 +0000 (16:34 -0700)]
Fix missing signatures for Cross bitness DAC symbols (#43500)
* Unify paths used for cross-bit components
* Pass down buildArchitecture for signing
* Pass target properties to signing
Dong-Heon Jung [Tue, 20 Oct 2020 23:17:09 +0000 (08:17 +0900)]
Update MulticoreJit (#39996)
- Enable Generic Methods in MulticoreJit
- Enable NDirect Stub in MulticoreJit
Koundinya Veluri [Tue, 20 Oct 2020 22:29:02 +0000 (18:29 -0400)]
Clarify pre-merge commit squash guidance (#43664)
Kunal Pathak [Tue, 20 Oct 2020 22:27:41 +0000 (15:27 -0700)]
Display the real offset after branch tightening (#43469)
* display the real offset after branch tightening
* emit offset for cold codeblock
* move isColdBlock inside #DEBUG
* fix formatting
* Revert "fix formatting"
This reverts commit
0744e1e432e12c5bddd4ce8c208660e31d96f12a.
* Revert "move isColdBlock inside #DEBUG"
This reverts commit
60e511b0bfb1836476a5fcf05ff3450d32c3d907.
* Revert "emit offset for cold codeblock"
This reverts commit
e760beb2fcd1a5fcfd22ddf47eb6939a7094562d.
* Use emitCurCodeOffs() to display correct offset
Marek Safar [Tue, 20 Oct 2020 21:13:47 +0000 (23:13 +0200)]
Use ThrowHelper inside ValueType types (#43634)
Chris Ross [Tue, 20 Oct 2020 20:54:53 +0000 (13:54 -0700)]
Sync shared code from aspnetcore (#43624)
Zoltan Varga [Tue, 20 Oct 2020 19:49:01 +0000 (15:49 -0400)]
Mono: Turn on cmake build by default (#42119)
Turns it on everywhere except Windows.
Tomas Weinfurt [Tue, 20 Oct 2020 18:50:36 +0000 (11:50 -0700)]
improve reliability of SslStream tests with failing certificate validation (#43570)
* improve reliability of SslStream tests with failing certificate validation
* Update src/libraries/System.Net.Security/src/System/Net/Security/SslStream.Implementation.cs
Co-authored-by: Stephen Toub <stoub@microsoft.com>
* fix failing ALPN test on old OpenSSL
Co-authored-by: Stephen Toub <stoub@microsoft.com>
afroze9 [Tue, 20 Oct 2020 18:45:40 +0000 (23:45 +0500)]
Fixing stale version badges in docs (#43558)
Fixing stale version badges in docs
From the issue description:
Improper cache-control in generated badges caused browsers caching svg
badges for a year. It is, therefore, recommend to modify related
README.md content by simple find & replace from: _version_badge.svg
to _version_badge.svg?no-cache
This will trigger github to compute and use different/new Camo proxy URL.
Fix #3822