platform/upstream/dotnet/runtime.git
4 years agoMove System.Net.Quic to internal shared source (#32549) (#32610)
Chris Ross [Thu, 20 Feb 2020 21:42:07 +0000 (13:42 -0800)]
Move System.Net.Quic to internal shared source (#32549) (#32610)

4 years ago[wasm] Improve locals visualization (#32503)
monojenkins [Thu, 20 Feb 2020 21:07:22 +0000 (16:07 -0500)]
[wasm] Improve locals visualization (#32503)

Co-authored-by: Ankit Jain <radical@gmail.com>
4 years agoPermit incorrectly DER sorted SET for decoding X500 names. (#32604)
Kevin Jones [Thu, 20 Feb 2020 21:06:41 +0000 (16:06 -0500)]
Permit incorrectly DER sorted SET for decoding X500 names. (#32604)

* Permit incorrectly DER sorted SET for decoding X500 names.

* Add comment to explain.

4 years agoIncrease timeout in ValueTaskTests (#32607)
Stephen Toub [Thu, 20 Feb 2020 21:06:28 +0000 (16:06 -0500)]
Increase timeout in ValueTaskTests (#32607)

4 years agoFix verify_heap to handle > 1 UOH generations (#32586)
Vladimir Sadov [Thu, 20 Feb 2020 20:39:20 +0000 (12:39 -0800)]
Fix verify_heap to handle > 1 UOH generations (#32586)

4 years agoTemporarily disable nullable enabled for Pkcs (#32617)
Stephen Toub [Thu, 20 Feb 2020 19:58:35 +0000 (14:58 -0500)]
Temporarily disable nullable enabled for Pkcs (#32617)

4 years agoRemove unused LogSendPacketsBuffers method (#32605)
Eric Erhardt [Thu, 20 Feb 2020 18:26:57 +0000 (12:26 -0600)]
Remove unused LogSendPacketsBuffers method (#32605)

4 years agoAnnotate System.Security.Cryptography.Pkcs for nullable (#32571)
buyaa-n [Thu, 20 Feb 2020 18:03:32 +0000 (10:03 -0800)]
Annotate System.Security.Cryptography.Pkcs for nullable (#32571)

* Annotate System.Security.Cryptography.Pkcs

4 years agoFix debugger crash during unload of assemblies in ALC (#32311)
Juan Hoyos [Thu, 20 Feb 2020 18:02:35 +0000 (10:02 -0800)]
Fix debugger crash during unload of assemblies in ALC (#32311)

* Add implementation for DebuggerModuleTable::RemoveModule

4 years agoRemove duplicate ToString() call (#32598)
Alaa Masoud [Thu, 20 Feb 2020 17:44:05 +0000 (20:44 +0300)]
Remove duplicate ToString() call (#32598)

4 years agoNullable annotate System.Security.Cryptography.X509Certificates (#32191)
Eirik Tsarpalis [Thu, 20 Feb 2020 17:42:26 +0000 (17:42 +0000)]
Nullable annotate System.Security.Cryptography.X509Certificates (#32191)

* Nullable annotate System.Security.Cryptography.X509Certificates

* address feedback

* address feedback

* address feedback

* address feedback

4 years agoAvoid Split(new char[]) inside loops (#32601)
Alaa Masoud [Thu, 20 Feb 2020 16:52:19 +0000 (19:52 +0300)]
Avoid Split(new char[]) inside loops (#32601)

4 years agoCleanup System.Text.Json tests names with issue number (#32562)
Santiago Fernandez Madero [Thu, 20 Feb 2020 16:51:04 +0000 (08:51 -0800)]
Cleanup System.Text.Json tests names with issue number (#32562)

* Cleanup System.Text.Json tests names with issue number

* Fix build

* Cleanup more test/classes names

* PR Feedback

4 years agoUpdate testing with configuration system changes
Viktor Hofer [Thu, 20 Feb 2020 16:39:21 +0000 (17:39 +0100)]
Update testing with configuration system changes

4 years agoReduce simple HTTP/2 post app allocation by ~40% (#32557)
Stephen Toub [Thu, 20 Feb 2020 14:28:01 +0000 (09:28 -0500)]
Reduce simple HTTP/2 post app allocation by ~40% (#32557)

* Remove cancellation-related allocations in Http2Stream

We don't need to allocate a linked token source in SendRequestBodyAsync if the caller's token is the default

* Reduce size of SendDataAsync state machine

We're carrying around an extra 24-bytes for a `ReadOnlyMemory<byte>`, when we could instead just use the argument.

* Tweak HeaderField's ctor to use ROS.ToArray

If `value` happens to be empty, this will avoid an allocation.  But what actually led me to do this was just tightening up the code.

* Make HPackDecoder.State enum 1 instead of 4 bytes

* Remove spilled CancellationTokenSource field from SendDataAsync

* Add known-header values for access-control-* headers

* Reduce allocation in SslStream.ReadAsync

The current structure is that ReadAsync makes two calls to FillBufferAsync, one to ensure the frame header is read and another to ensure any additional payload is read.  This has two issues:
1. It ensures that in addition to allocating a state machine for FillBufferAsync (or, rather, a helper it uses) when it needs to yield, it'll also end up allocating for ReadAsync.
2. It complicates error handling, which needs to differentiate whether the first read can't get any bytes or whether a subsequent read can't, which necessitates storing state like how many bytes we initially had buffered so we can compare to that to see if we need to throw.

We can instead:
- Make FillBufferAsync into a simple "read until we get the requested number of bytes" loop and throw if it fails to do so.
- Do the initial read in ReadAsync, thereby allowing us to special-case the first read for both error handling and to minimize the chances that the helper call needs to yield.

This eliminates a bunch of FillBufferAsync state machines and also decreases the size of the state machines when they are needed.

* Replace CreditManager's waiter queue with a circular singly-linked list

This has a variety of benefits:
- We no longer need to allocate a `Queue<Waiter>` and its underlying `Waiter[]`.
- We no longer need to allocate a `TaskCompletionSource<int>` and its `Task<int>`, instead creating a single `IValueTaskSource<T>` implementation.
- For non-cancelable waiters, we can specialize to not need to carry around a meaningless CancellationToken field.
- For cancelable waiters (the common case), we can avoid an entire async method and its state machine by just storing the relevant state onto the waiter itself.

* Fix comment from previous change

* Manually inline and specialize EnsureIncomingBytesAsync

It's not that much more code to just manually inline EnsureIncomingBytesAsync into the three places it's used, and doing so has multiple benefits, both for size and for error messages.

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

Co-Authored-By: Cory Nelson <phrosty@gmail.com>
* Fix typo in online feedback

Co-authored-by: Cory Nelson <phrosty@gmail.com>
4 years agoFix minor issue in debugging.md (#32597)
Egor Bogatov [Thu, 20 Feb 2020 14:16:59 +0000 (17:16 +0300)]
Fix minor issue in debugging.md (#32597)

4 years agoAdd struct offset definitions to s390x (#32591)
monojenkins [Thu, 20 Feb 2020 14:06:00 +0000 (09:06 -0500)]
Add struct offset definitions to s390x (#32591)

Fix build on s390x after commit 79135c6

Fixes: mono/mono#18930

Co-authored-by: sharkcz <dan@danny.cz>
4 years ago[debugger] Enable reading embedded ppdb (#32447)
monojenkins [Thu, 20 Feb 2020 12:59:52 +0000 (07:59 -0500)]
[debugger] Enable reading embedded ppdb (#32447)

To fix the issue of enable reading embedded pdb everywhere the problem was that when the roslyn tests are compiling sources it creates embedded pdb with source file "", and before enable reading the embedded pdb we don't read this information, and now we read and our StackTrace corlib doesn't expect a source file "", it's okay if it's NULL but not "".
I could fix in corlib or in mono, I prefer to fix on mono because I don't know if there is any other place in corlib that doesn't expect source file "".

Co-authored-by: Thays Grazia <thaystg@gmail.com>
4 years ago[mono] Remove CoreFX.issues_mac.rsp file (#32585)
Maxim Lipnin [Thu, 20 Feb 2020 10:01:25 +0000 (13:01 +0300)]
[mono] Remove CoreFX.issues_mac.rsp file (#32585)

* Remove CoreFX.issues_mac.rsp

* Replace ActiveIssue with ConditionalFact

4 years agoRemove LOCK_DECLARE and LOCK_INIT -- unused and incorrect comments (not idempotent...
monojenkins [Thu, 20 Feb 2020 09:51:40 +0000 (04:51 -0500)]
Remove LOCK_DECLARE and LOCK_INIT -- unused and incorrect comments (not idempotent). (#32572)

Co-authored-by: Jay Krell <jay.krell@cornell.edu>
4 years agoCheck return code of bootstrap script in format.py. (#32581)
Eugene Rozenfeld [Thu, 20 Feb 2020 08:40:24 +0000 (00:40 -0800)]
Check return code of bootstrap script in format.py. (#32581)

Formatting jobs run format.py script, which calls bootstrap.{cmd/sh}
from jitutils. This change adds a check for return code of the call and
returns an error code from format.py if bootstrap.{cmd/sh} failed.

4 years ago[metadata] use descriptive constants for method table columns (#32567)
Bernhard Urban-Forster [Thu, 20 Feb 2020 08:30:33 +0000 (09:30 +0100)]
[metadata] use descriptive constants for method table columns (#32567)

4 years agoFix OverflowException in JsonSerializer.Serialize (#1308)
Felipe Pessoto [Thu, 20 Feb 2020 08:15:58 +0000 (00:15 -0800)]
Fix OverflowException in JsonSerializer.Serialize (#1308)

* Add failing test

At first I tried to create five internal references to CustomClassToExceedMaxBufferSize and create 25 levels deep instances, but the tests ran forever. So I changed it to have several big string properties, which lead to the System.OverflowException using 3 level deep instance.

* Initial implementation. Still needs to throw the appropriated Exception

* Validate new buffer size against MaxByteArrayLength

* When newSize overflows because growBy == _renteBuffer.Length, it tries to use growBy = sizeHint
If it still overflow, we set the newSize to int.MaxValue, which will throw an OutOfMemoryException when calling ArrayPool.Rent.

* Change to make assembly smaller and reduce a extra check in the common case

* Name conventions
OuterLoop
Make the test simpler

* Improve assembly size
Run test on 64 bits only

* Added Platform Specific attribute.
Separate OuterLoop attribute, to be consistent with the other tests in this solution.

4 years agoUpdate documentation about HostModel (#32583)
Swaroop Sridhar [Thu, 20 Feb 2020 07:11:48 +0000 (23:11 -0800)]
Update documentation about HostModel (#32583)

Update the notes about HostModel library, to reflect the post-repo consolidation names.

4 years agoNullability of BaseDirectory fix (#32486)
Tomasz Kajetan Stańczak [Thu, 20 Feb 2020 05:57:46 +0000 (06:57 +0100)]
Nullability of BaseDirectory fix (#32486)

BaseDirectory is never null. Not sure if you want to keep it this way as a protection against the future API changes?

4 years agoFix managed hosting assembly PackageReference versions to libraries to 4.7.0 (#2115)
Jeremy Koritzinsky [Thu, 20 Feb 2020 05:50:58 +0000 (21:50 -0800)]
Fix managed hosting assembly PackageReference versions to libraries to 4.7.0 (#2115)

* Hardcode System.Text.Json and System.Text.Encodings.Web package version to 4.7.0.

* Use System.Reflection.Metadata@1.8.0 to match the combined dotnet/sdk+dotnet/toolset repo.

4 years agoRemove a smattering of string allocations with spans (#32463)
Stephen Toub [Thu, 20 Feb 2020 02:39:20 +0000 (21:39 -0500)]
Remove a smattering of string allocations with spans (#32463)

4 years agoRemove _activeReadWriteTask field from Stream (#32569)
Stephen Toub [Thu, 20 Feb 2020 02:38:42 +0000 (21:38 -0500)]
Remove _activeReadWriteTask field from Stream (#32569)

The field is only used for handling misuse (EndXx called for something other than the "current" operation / called multiple times), and only with the legacy Begin/EndXx methods, yet it's taking up 8 bytes (on 64-bit) on the very mainstream Stream type.

4 years ago[mono.proj] use all available cores for runtime build (#32566)
Bernhard Urban-Forster [Thu, 20 Feb 2020 01:35:46 +0000 (02:35 +0100)]
[mono.proj] use all available cores for runtime build (#32566)

* [mono.proj] use all available cores for runtime build

* Update src/mono/mono.proj

Co-Authored-By: Alexander Köplinger <alex.koeplinger@outlook.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
4 years agoUpdate areas and owners (#32570)
Eric StJohn [Thu, 20 Feb 2020 01:27:15 +0000 (17:27 -0800)]
Update areas and owners (#32570)

Make System.Net areas owned by dotnet/ncl

4 years agoJIT: invoke nullable box optimizations earlier (#32269)
Andy Ayers [Thu, 20 Feb 2020 00:17:40 +0000 (16:17 -0800)]
JIT: invoke nullable box optimizations earlier (#32269)

Move the logic in `fgMorphRecognizeBoxNullable` into `gtFoldExprSpecial`
so it can be invoked earlier. This may prevent the original struct
from becoming address exposed and allow subsequent optimizations when the
`hasValue` field has a known value.

Fixes #31661.

4 years agoSupport Write-Thru of EH variables in LSRA (#543)
Carol Eidt [Wed, 19 Feb 2020 23:52:22 +0000 (15:52 -0800)]
Support Write-Thru of EH variables in LSRA (#543)

* Support Write-Thru of EH variables in LSRA

Mark EH variables (those that are live in or out of exception regions) only as lvLiveInOutOfHndlr, not necessarily lvDoNotEnregister
During register allocation, mark these as write-thru, and mark all defs as write-thru, ensuring that the stack value is always valid.
Mark those defs with GTF_SPILLED (this the "reload" flag and is not currently used for pure defs) to indicate that it should be kept in the register.
Mark blocks that enter EH regions as having no predecessor, and set the location of all live-in vars to be on the stack.
Change genFnPrologCalleeRegArgs to store EH vars also to the stack if they have a register assignment.

Tuned throughput to compensate for extra processing by rearranging some fields and short-circuiting the physical register RefPositions during allocation.

It is disabled by default

4 years agoAppHost.Bundle.Tests: Fix a flaky test (#32563)
Swaroop Sridhar [Wed, 19 Feb 2020 23:49:18 +0000 (15:49 -0800)]
AppHost.Bundle.Tests: Fix a flaky test (#32563)

The BundleRename test is an inherently concurrent test which needs the app and the test infrastructure to synchronize.
Originally, the app and the test synchronized using a lock file: the app creates the lock file and waits until the lock is deleted.
However, this caused problems because the test may attempt to delete the lock file even before the app has closed it.

Therefore, this change fixes the issue by using different files to trigger the app's wait and resume steps.

4 years agoJIT: fix profiler leave hook trash register sets for x64 SysV (#32553)
Andy Ayers [Wed, 19 Feb 2020 22:49:45 +0000 (14:49 -0800)]
JIT: fix profiler leave hook trash register sets for x64 SysV (#32553)

The profiler leave hook must preserve `rdx` and `xmm1` as they
can be used to return values.

Fixes #31769.

4 years agoChange back-edge dependencies to toolset dependencies (#32554)
Matt Mitchell [Wed, 19 Feb 2020 22:43:36 +0000 (14:43 -0800)]
Change back-edge dependencies to toolset dependencies (#32554)

There were a bunch of backedge and build-only dependencies in here that should be moved to the toolset category.
Also fix a few darc verify errors

4 years agoChange COMPlus_DiagnosticsServerTransportPath (#32087)
John Salem [Wed, 19 Feb 2020 22:41:13 +0000 (14:41 -0800)]
Change COMPlus_DiagnosticsServerTransportPath (#32087)

* Change COMPlus_DiagnosticsServerTransportPath to DOTNET_DiagnosticsServerAddress

4 years ago[interp] Inline newobj. (#32480)
monojenkins [Wed, 19 Feb 2020 22:32:46 +0000 (17:32 -0500)]
[interp] Inline newobj. (#32480)

The real goal is to make it not recursive.
This is just a step along the way.
Note that the actual not-recursive change has *not* yet been developed,
so this *might* amount to nothing useful.

Co-authored-by: Jay Krell <jay.krell@cornell.edu>
4 years agoHostModel: Retry ResourceUpdate on Win32 error (#32347)
Swaroop Sridhar [Wed, 19 Feb 2020 22:27:09 +0000 (14:27 -0800)]
HostModel: Retry ResourceUpdate on Win32 error (#32347)

This change attempts to fix a non-deterministic customer reported failure.

Several customers have observed failure during resource update when the HostModel updates the AppHost (to transfer resources from the managed app).
The failure is not detereminisitc, not reproducible on our machines, and depends on specific computers/software running.
This indicates interference by other software while the HostWriter is updating the AppHost.

The current implementation retries the resource update if an update because the device or drive is locked (say by an antivurus) HRESULT 0x21 and 0x6C.
However, the failures reported have errors 0x5 (Access violation) and 0x6# (Open failed).
Windows/Defender team said that file-locking with these error-codes is not expected.
However, different AVs work differently about examining files.

We believe that the correct fix for this issue is to complete:

To implement #3828 and #3829
Ship AppHost with an extension/permissions not indicating an executable.
However the above is a fairly large change for servicing .net core 3.1.

So, this change implements a simpler fix intended for servicing 3.1 branch:
Always retry the resource-update on Win32 error, unless the failure is a knwon irrecoverable code (listed a few error codes relevent to File IO).

This change may cause unnecessary retries on legitimate failures (about 50 seconds).
But such cases are rare, because the SDK supplies the apphost, and the HostModel itself creates the file to update.

Fixes #3832

4 years ago[wasm] Avoid spilling refs to the stack in gsharedvt wrappers, those functions don...
monojenkins [Wed, 19 Feb 2020 22:16:15 +0000 (17:16 -0500)]
[wasm] Avoid spilling refs to the stack in gsharedvt wrappers, those functions don't need safepoints. (#32215)

Co-authored-by: Zoltan Varga <vargaz@gmail.com>
4 years ago[sgen] Disable managed allocator when using nursery-canaries (#32537)
monojenkins [Wed, 19 Feb 2020 22:10:57 +0000 (17:10 -0500)]
[sgen] Disable managed allocator when using nursery-canaries (#32537)

The managed allocator included in a full aot image does not support canaries, leading to inconsistent object layout.

Fixes https://github.com/mono/mono/issues/18925

Co-authored-by: Vlad Brezae <brezaevlad@gmail.com>
4 years ago[interp] Fix incorrect propagation of indirect local (#32511)
monojenkins [Wed, 19 Feb 2020 22:09:32 +0000 (17:09 -0500)]
[interp] Fix incorrect propagation of indirect local (#32511)

We never track the value of locals who have their address taken in a method, since their value can change without the pass detecting it, leading to propagation of incorrect values. We failed to check for this when doing a stloc.np optimization.

Fixes System.Reflection.Metadata.Tests.ImmutableByteArrayInteropTest.DangerousCreateFromUnderlyingArray

Enable more interp tests, which don't seem to fail on my machine.

Co-authored-by: Vlad Brezae <brezaevlad@gmail.com>
4 years ago[loader] Add check to mono_domain_ensure_entry_assembly for AOT (#32556)
Ryan Lucia [Wed, 19 Feb 2020 21:48:40 +0000 (16:48 -0500)]
[loader] Add check to mono_domain_ensure_entry_assembly for AOT (#32556)

Fixes a crash with AOT because domain->setup is NULL here

4 years agoUpdate branding to preview2 (#32542)
Matt Mitchell [Wed, 19 Feb 2020 21:20:55 +0000 (13:20 -0800)]
Update branding to preview2 (#32542)

4 years agoFix armel cross build of native part of libraries (#32127)
Gleb Balykov [Wed, 19 Feb 2020 21:19:50 +0000 (00:19 +0300)]
Fix armel cross build of native part of libraries (#32127)

4 years agoUpdate docs for steps to take if CI fails (#32548)
Dan Moseley [Wed, 19 Feb 2020 20:29:38 +0000 (12:29 -0800)]
Update docs for steps to take if CI fails (#32548)

* Update docs for steps to take if CI fails

* update

* more

* more

* more

* include dumps

* more

* more

* typo

4 years ago[loader] Parse in more netcore hosting properties (#32263)
Ryan Lucia [Wed, 19 Feb 2020 19:10:27 +0000 (14:10 -0500)]
[loader] Parse in more netcore hosting properties (#32263)

This includes some other minor cleanup to the netcore hosting functions.

Setting `assemblies_path` with `APP_PATHS` despite it also being set by `MONO_PATH` doesn't scare me too much because:
1) Anyone using `MONO_PATH` is probably not going through the hosting API and is using `mono-sgen` directly
2) The default host doesn't set `APP_PATHS` unless `Microsoft.NETCore.DotNetHostPolicy.SetAppPaths` is set to 1 in the `.runtimeconfig.json` (which is rare, and we've worked fine without `APP_PATHS` being set at all up until now)
3) This is a temporary measure; we will have to refactor our preload hook when we want to properly support the other loader properties anyway

4 years ago[llvm] Remove the disable-self-init debug option, it doesn't work any more. (#32532)
monojenkins [Wed, 19 Feb 2020 18:10:58 +0000 (13:10 -0500)]
[llvm] Remove the disable-self-init debug option, it doesn't work any more. (#32532)

Co-authored-by: Zoltan Varga <vargaz@gmail.com>
4 years agoEnsure ActiveIssue attribute is only used with issue links (#32535)
Alexander Köplinger [Wed, 19 Feb 2020 13:58:17 +0000 (14:58 +0100)]
Ensure ActiveIssue attribute is only used with issue links (#32535)

* Ensure ActiveIssue attribute is only used with issue links

The constructor that takes an `int` was removed in https://github.com/dotnet/arcade/pull/4831.

Update docs to recommend using issue links instead of numbers.

Fix two tests that were using ActiveIssue incorrectly.

* PR feedback

4 years agoHttpClient throws TimeoutException wrapped by TaskCancellationException when request...
Alexander Nikolaev [Wed, 19 Feb 2020 11:31:05 +0000 (12:31 +0100)]
HttpClient throws TimeoutException wrapped by TaskCancellationException when request times out (#2281)

Currently, HttpClient throws the same TaskCancellationException regardless of the request cancellation reason that can be caller's cancellation, all pending request cancellation or timeout. This makes it impossible to handle a request timeout in a way different from all other cases (e.g. special retry logic).

This PR adds a timeout detection logic into HttpClient. It watches for all TaskCancelledExceptions and catches the one caused by timeout. Then, it creates two new exceptions and build a hierarchy. The first is a TimeoutException having its InnerException set to the original TaskCancelledException. The second is a new TaskCancelledException having its InnerException set to that new TimeoutException, but preserving the original stack trace, message and cancellation token. Finally, this top-level TaskCancelledException gets thrown.

Fixes #21965

4 years ago[mono] Fix several nits (#32529)
Maxim Lipnin [Wed, 19 Feb 2020 10:53:43 +0000 (13:53 +0300)]
[mono] Fix several nits (#32529)

* Remove the commented code

* Remove unused nint/nuint aliases from PNSE version of Utf8String

4 years agoInitial Crossgen2 changes for composite R2R support (#31663)
Tomáš Rylek [Wed, 19 Feb 2020 10:21:09 +0000 (11:21 +0100)]
Initial Crossgen2 changes for composite R2R support (#31663)

This change adds the new command-line option "--composite",
a new type of input files "--unrooted-input-file" for files that should
be made part of the composite image but only rooted as hit by the
dependency analysis, not automatically as the normal input files
(to reduce the size of framework built along with the app) and new
Crossgen2 logic for producing the additional R2R metadata needed
by composite images including rewriting of input MSIL by injecting
a "component R2R header" on them that forwards the native code
to the composite image. With a set of runtime changes out for
a separate PR I'm able to make first steps in running composite R2R
in the CoreCLR runtime.

Thanks

Tomas

4 years agoUpdate SDK used in global.json. (#32189)
Jeremy Koritzinsky [Wed, 19 Feb 2020 08:23:50 +0000 (00:23 -0800)]
Update SDK used in global.json. (#32189)

4 years agoOptimize integral ToString (without generics) (#32528)
ts2do [Wed, 19 Feb 2020 07:18:47 +0000 (01:18 -0600)]
Optimize integral ToString (without generics) (#32528)

- Make the fast path for Number.FormatXX & Number.TryFormatXX inlineable
- Make parameterless ToString in SByte, Int16, Int32, and Int64 directly invoke the default formatting method

4 years agoChange StreamEvent.Abort to use byte instead of bool (#32517)
Justin Kotalik [Wed, 19 Feb 2020 05:43:13 +0000 (21:43 -0800)]
Change StreamEvent.Abort to use byte instead of bool (#32517)

4 years agoRemove some #if __cplusplus wrt inlining. (#32519)
monojenkins [Wed, 19 Feb 2020 02:50:24 +0000 (21:50 -0500)]
Remove some #if __cplusplus wrt inlining. (#32519)

The code is fine, and we should put it back at some point,
but I want things to be clearer regarding https://github.com/mono/mono/issues/18827.

i.e. That this does not cause it.
I don't know what does cause it, granted.
Maybe a preexisting race condition/deadlock, I don't know.

Repro is run a loop like:
```
type \s\1.cmd
for /l %%a in (1 1 999) do echo %%a && C:\s\mono2\msvc\build\sgen\x64\bin\Release\mono-sgen.exe \s\mono2\mono\tests\bug-10127.exe
```

Co-authored-by: Jay Krell <jay.krell@cornell.edu>
4 years agoMake MONO_API_DATA clearer. (#32459)
monojenkins [Wed, 19 Feb 2020 01:59:50 +0000 (20:59 -0500)]
Make MONO_API_DATA clearer. (#32459)

Make MONO_API_DATA clearer, its old form -- MONO_API extern.
extern "C" { } should be added around it not within it, for clarity.
I've always found extern "C" without braces unclear, esp. for data.

i.e.

```
 extern "C" {
1   extern void function(); // redundant but clear
                            // same as void function();
2   extern int data; // not redundant, and clear
}
```

vs.
```
3   extern "C" void function(); // I guess clear.
4   extern "C" int data; // unclear -- is it extern or extern "C" or both?
```

This PR in particular turns 4 into 2.
2 is clearly a declaration, not a definition.
4 is unclear as to if it is a declaration or definition.

I was looking into https://github.com/mono/mono/issues/18827.

This does not actually change anything but makes things clearer.

This is similar/related in spirit to https://github.com/mono/mono/pull/18891.
It should not make a difference.
In this case, `#if __cplusplus` remains, but the meaning of it is clearer.
It becomes *only* about the common `extern "C" { }` and not even the less clear `extern "C"`.

4 years agoConvert System.Globalization unix calls to QCalls into coreclr (#32132)
Santiago Fernandez Madero [Wed, 19 Feb 2020 01:06:11 +0000 (17:06 -0800)]
Convert System.Globalization unix calls to QCalls into coreclr (#32132)

* Convert System.Globalization unix calls to QCalls into coreclr

* Fix build errors, define UChar instead of using uint16_t

* Fix indentation in some header files

* Add libraries-native library to define qcalls entrypoints for libraries native shims

* Change DLLEXPORT to PALEXPORT and declare visibility hidden when in entrypoints.c

* Fix build and PALEXPORT definition

* Fix mono tests

* Fix System.Globalization tests by getting the icu version via NativeLibrary.Load

* Fix full framework build

* PR Feedback

* Revert changes in Interop.Libraries.cs

* Fix build and default version to 0.0.0.0 if pinvoke not found

* Remove __LIB_NATIVE_ENTRYPOINTS define and move icu headers to internal header file

* Add GetICUVersion to trimmer xml for mono and PR Feedback

* PR Feedback: move mono link entry to bottom

4 years agoFix nullable warnings on windows (#32515)
Santiago Fernandez Madero [Wed, 19 Feb 2020 00:34:53 +0000 (16:34 -0800)]
Fix nullable warnings on windows (#32515)

4 years ago[interp] Make newobj_vt[st]_fast non-recursive. (#32477)
monojenkins [Wed, 19 Feb 2020 00:17:00 +0000 (19:17 -0500)]
[interp] Make newobj_vt[st]_fast non-recursive. (#32477)

[interp] Make newobj_vtst_fast and newobj_vt_fast not recursive.

This is builds upon https://github.com/mono/mono/pull/18875 which was newobj_vt_fast-only.
That was preceded by https://github.com/mono/mono/pull/18870 which did not handle the stack/GC perhaps as well.

Some notes:
 - This is a little gnarly in its stack manipulation in transform.c and interp.c. Please review carefully.
 - This is *not* known to contribute to WebAssembly/Blazor failures (which are suspected fixed via earlier fixes already). Leaving it alone is an option. Not my favorate, but I understand.
  - There are expected to be improvements on the Apple side as well, further strengthening the previous point. Still not my preference, but again I understand.

Co-authored-by: Jay Krell <jay.krell@cornell.edu>
4 years agoGet more HTTP/3 tests running (#32495)
Cory Nelson [Wed, 19 Feb 2020 00:16:44 +0000 (16:16 -0800)]
Get more HTTP/3 tests running (#32495)

Fix: QuicStream now throws OperationCanceledException with a set CancellationToken.
Fix: QPackDecoder detects 0-length header name and throws.
Fix: Http3RequestStream.ReadResponseContent incorrectly slicing user buffer.
Fix: Http3RequestStream.ReadResponseContent not detecting early EOF.
Fix: Http3LoopbackServer adding :status header to end of headers rather than beginning.
Optimization: don't parse Alt-Svc header if HTTP/3 is disabled.

4 years agoMerging small assemblies (part 2/N) (#31991)
Jan Kotas [Tue, 18 Feb 2020 23:56:59 +0000 (15:56 -0800)]
Merging small assemblies (part 2/N) (#31991)

* Move System.Runtime\src to CoreLib

* Move System.Runtime.Extensions/src to CoreLib

* Refresh ref/System.Runtime.cs

* Merge System.Security.Principal/ref into System.Runtime

* Move System.Runtime.Extensions/ref to System.Runtime/ref

* Fix binary serialization of SwitchExpressionException

* Fix ALC tests

* Fix annotation

4 years agoUpdate all issues in source code to point to runtime (#32349)
Santiago Fernandez Madero [Tue, 18 Feb 2020 23:49:23 +0000 (15:49 -0800)]
Update all issues in source code to point to runtime (#32349)

4 years agoSet TargetsFreeBSD in installer's props (#31939)
Adeel Mujahid [Tue, 18 Feb 2020 23:03:34 +0000 (01:03 +0200)]
Set TargetsFreeBSD in installer's props (#31939)

4 years agoMove EventLog tests to not run on CI (#32501)
Viktor Hofer [Tue, 18 Feb 2020 23:01:57 +0000 (00:01 +0100)]
Move EventLog tests to not run on CI (#32501)

* Move EventLog tests to not run on CI

We are hitting Win32 API issues when calling specific EventLog features.
As the risk of changes in EventLog is low we decided to turn off some
tests in CI and run them manually before a release.

4 years ago[mono] Remove SIGTRAP handler, as it interferes with debugging (#32264)
monojenkins [Tue, 18 Feb 2020 21:33:53 +0000 (16:33 -0500)]
[mono] Remove SIGTRAP handler, as it interferes with debugging (#32264)

See https://github.com/mono/mono/pull/18243#issuecomment-586013427

<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->

Co-authored-by: Alexis Christoforides <alexis@thenull.net>
4 years ago[merp] Capture Environment.FailFast message in crash report (#32326)
monojenkins [Tue, 18 Feb 2020 20:59:42 +0000 (15:59 -0500)]
[merp] Capture Environment.FailFast message in crash report (#32326)

If the process calls `System.Environment.FailFast (message, exception)` we should capture the message in the crash report log.

Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
4 years ago[interp] Unwrap RuntimeWrappedException if needed (#32485)
monojenkins [Tue, 18 Feb 2020 18:59:27 +0000 (13:59 -0500)]
[interp] Unwrap RuntimeWrappedException if needed (#32485)

when throwing non exception objects.

Enable the entire System.Linq.Expressions suite with interpreter

Co-authored-by: Vlad Brezae <brezaevlad@gmail.com>
4 years ago[mono][xunit tests] Move skipped tests out of rsp file (#2087)
Maxim Lipnin [Tue, 18 Feb 2020 18:57:50 +0000 (21:57 +0300)]
[mono][xunit tests] Move skipped tests out of rsp file (#2087)

Addresses https://github.com/dotnet/runtime/issues/1980

* [xunit tests][mono] Remove disabled Microsoft.VisualBasic.Core.Tests tests from rsp file.

* [xunit tests][mono] Remove System.Collections.Specialized.Tests.Ctor_NegativeCapacity_ThrowsArgumentOutOfRangeException from rsp file

* Remove System.Collections.Concurrent.Tests.ConcurrentQueueTests.ReferenceTypes_NulledAfterDequeue from rsp file because it passes on release mono

* Remove BasicEventSourceTests.TestsManifestNegative.Test_GenerateManifest_InvalidEventSources from rsp file because it passes locally

* Remove ManagedTests.DynamicCSharp.Conformance.dynamic.overloadResolution.Methods.Oneclass2methods.twoprms004.twoprms004.Test.DynamicCSharpRunTest from rsp file

* Remove System.IO.Tests.*.CopyFileWithData_MemberData from rsp file

* Move a set of skipped System.Linq.Expressions.Tests out of rsp file.

* Annotate System.Collections.Concurrent.Tests.ConcurrentQueueTests.ReferenceTypes_NulledAfterDequeue with ActiveIssue attribute

* Move another set of skipped System.Linq.Expressions.Tests out of rsp file.

* Move skipped System.Linq.Parallel.Tests.PlinqModesTests.WithExecutionMode_Multiple test out of rsp file

* Move skipped System.Memory.Tests out of rsp file

* Move skipped System.Net.Http.Functional.Tests.PlatformHandler_HttpClientHandler.* tests out of rdp file

* Remove System.Net.Sockets.Tests.SocketOptionNameTest.MulticastInterface_Set_AnyInterface_Succeeds because it passes locally.

* Move System.Reflection tests with an active issue out of rsp file

* Move skipped System.Runtime.InteropServices.Tests out of rsp file

* Replace closed CoreFX GH issue with the active Runtime one

* Move skipped System.Runtime.Serialization.Formatters.Tests out of rsp file

* Move skipped System.Runtime.Tests with an active issue out of rsp file

* Move skipped System.Threading.Tests with an active issue out of rsp file

* Remove skipped System.Data.Common.Tests because the related issue was addressed

* Move skipped System.Data.Common.Tests.DbConnectionTests.ProviderFactoryTest with an active issue out of rsp file

* Move skipped System.Diagnostics.StackTrace.Tests with an active issue out of rsp file

* Move skipped System.Numerics.Vectors.Tests with an active issue out of rsp file

* Move skipped System.Reflection.Context.Tests with an active issue out of rsp file

* Move skipped System.Threading.ThreadPools.Tests.ThreadPoolTests.SetMinMaxThreadsTest with an active issue out of rsp

* Move skipped System.ComponentModel.Composition and Tests.Integration namespaces with an active issue out of rsp file

* Update a message in skipped System.Runtime.InteropServices.Tests

* Move skipped System.Reflection.Tests.MetadataTokenTests.SuccessImpliesNonNilWithCorrectTable with an active issue out of rsp file

* Move skipped/no repro System.Threading.Overlapped.Tests with an active issue out of rsp file

* Move skipped System.Runtime.Extensions with an active issue out of rsp file

* Re-enable skipped System.Runtime.Handles.Tests because the related issue was addressed

* Move skipped System.Reflection.TypeExtensions.Tests with an active issue out of rsp file

* Move skipped System.Reflection.Emit.Lightweight.Tests with an active issue out of rsp file

* Move skipped System.Reflection.MetadataLoadContext.Tests with an active issue out of rsp file

* Move skipped System.Xml.Xsl.XslTransformApi.Tests with an active issue out of rsp file

* Move skipped System.Security.Cryptography.Encoding.Tests with an active issue out of rsp file

* Move System.Drawing.Imaging.Tests.ImageAttributesTests.SetColorMatrix_InvalidFlags_ThrowsArgumentException out of rsp file

* Add an active issue attribute to System.Drawing.Imaging.Tests.ImageAttributesTests.SetColorMatrix_InvalidFlags_ThrowsArgumentException test; add a comment about libgdiplus dependency to PlatformDetection.IsDrawingSupported method.

* Move System.Net.Http.Functional.Tests.SocketsHttpHandler_HttpClientHandler_ClientCertificates_Test.AutomaticOrManual_DoesntFailRegardlessOfWhetherClientCertsAreAvailable out of rsp because it has an active corefx issue; see https://github.com/dotnet/corefx/issues/37336

* Remove System.Net.Http.Functional.Tests.SocketsHttpHandler_HttpClientHandler_DangerousAcceptAllCertificatesValidator_Test.SetDelegate_ConnectionSucceeds from rsp because it's already disabled as part of system.net.* tests; see https://github.com/dotnet/runtime/pull/2318

* Move skipped System.Reflection.Emit.ILGeneration.Tests with an active issue out of rsp file

* Move skipped System.Reflection.Emit.Tests with an active issue out of rsp file

* Remove skipped System.Reflection.Tests from rsp file because they pass locally

* Try to re-enabled skipped System.Reflection.Tests.AssemblyTests.LoadFromStream_Location_IsEmpty

* Remove broken namespace

* Add an active issue to System.Reflection.Tests.AssemblyTests.LoadFromStream_Location_IsEmpty

* Add an active issue to several System.Reflection tests

* Remove skipped System.Tests.ExitCodeTests.SigTermExitCode because it passes locally.

* Remove skipped System.Tests.Types.VoidTests.IsByRef_Get_ReturnsExpected from rsp file because it passes locally

* Remove skipped System.Tests.GCTests.LatencyRoundtrips from rsp file because it passes locally

* Remove skipped System.Tests.GCExtendedTests.GetGCMemoryInfo from rsp-file because the related functionality has been implemented (see https://github.com/mono/mono/issues/15236)

* Remove skipped System.Tests.GetEnvironmentVariable.EnvironmentVariablesAreHashtable from rsp file because it passes locally

* Turn System.Threading.Tasks.Tests.ExecutionContextFlowTest.TaskCompletionSourceDoesntCaptureExecutionContext into a conditional theory because it requires precise GC

* Try to re-enable System.Threading.Tasks.Tests.TaskContinueWithTests.LongContinuationChain_ContinueWith_DoesNotStackOverflow

* Remove skipped System.Threading.ThreadPools.Tests.ThreadPoolTests.SetMinThreadsTo0Test from rsp file because it passes locally

* Remove System.Threading.ThreadPools.Tests.ThreadPoolTests.SetMinMaxThreadsTest_ChangedInDotNetCore from rsp file because it's explicitly skipped on Mono using SkipOnTargetFramework attribute

* Add an active issue to System.Tests.ExitCodeTests.SigTermExitCode and System.Tests.GCTests.LatencyRoundtrips tests

* Remove skipped System.Data.Tests.SqlTypes.SqlCharsTest.ReadWriteXmlTest from rsp file because it passes locally

* Add an active issue to System.Tests.GCExtendedTests.GetGCMemoryInfo because it fails on helix

* Add an active issue

* Add an active issue

* Re-add an active issue to System.Tests.ExceptionTests.ThrowStatementDoesNotResetExceptionStackLineOtherMethod

* Move skipped System.ComponentModel.Composition.MetadataViewProviderTests.GetMetadataView_InterfaceWithIndexer_ShouldThrowNotSupportedException with an active issue out of rsp file (see https://github.com/mono/mono/issues/15169)

* Remove skipped Tests.Integration.ExportFactoryTests.ExportFactoryStandardImports_ShouldWorkProperly from rsp file because it's already disabled within the entire Tests.Integration.ExportFactoryTests class (see https://github.com/mono/mono/issues/16417)

* Remove several skipped System.ComponentModel.Composition.Tests from rsp file because they pass locally.

* Move skipped System.ComponentModel.Composition.ExportCollectionTests.ImportCollectionsFromContainerOnly with an active issue out of rsp file

* Move skipped System.Diagnostics.Tests.StackTraceTests.Ctor_Exception_SkipFrames and System.Diagnostics.Tests.StackTraceTests.Ctor_Exception_SkipFrames_FNeedFileInfo tests with an active issue out of rsp file.

* Move skipped System.Diagnostics.Tests.StackTraceTests.ToString_Invoke_ReturnsExpected with an active issue out of rsp file

* Remove skipped System.Reflection.Tests.MetadataLoadContextTests.RelocatableAssembly from rsp file because it passes locally.

* Move skipped System.Runtime.Loader.Tests.RefEmitLoadContextTests.LoadRefEmitAssembly with an active issue out of rsp file

* Moved skipped ThreadPoolBoundHandleTests.PreAllocatedOverlapped_NullAsCallback_ThrowsArgumentNullException with an active issue out of rsp file (see https://github.com/mono/mono/issues/15313)

* Move skipped System.Runtime.Tests.ProfileOptimizationTest.ProfileOptimization_CheckFileExists with an active issue out of rsp file

* Move skipped System.Reflection.Emit.Tests.DynamicILInfoTests with an active issue out of rsp file

* Move skipped System.Reflection.Emit.Tests.DynamicILInfoTests.SetX_NullInput_ThrowsArgumentNullException and System.Reflection.Emit.Tests.DynamicMethodctor1.InvalidOwner_ThrowsArgumentException with an active issue out of rsp file

* Add an active issue to System.Threading.Tasks.Tests.TaskContinueWithTests.LongContinuationChain_ContinueWith_DoesNotStackOverflow because it's flaky

* Add an active issue to Tests.Integration.DiscoveryTests.DiscoverAddinsWithCombinedCustomExportAndMetadataAttribute

* Add an active issue to System.Threading.ThreadPools.Tests.ThreadPoolTests.SetMinMaxThreadsTest_ChangedInDotNetCore

* Add an active issue to System.ComponentModel.Composition.MetadataAttributeTests.StronglyTypedStructureTestWithTransparentViews

* Replace TargetFrameworkMonikers.Mono with TestRuntimes.Mono

* Remove redundant space

* Remove all -notrait category

* Add an active issue to System.ComponentModel.Composition.MetadataAttributeTests.StronglyTypedStructureTest

* Add an active issue to System.ComponentModel.Composition.CompositionContainerTests.GetExportOfTTMetadataView1_TypeAsMetadataViewTypeArgument_IsUsedAsMetadataConstraint

* Disable the whole System.ComponentModel.Composition.Tests namespace

* Move some System.Runtime.Loader.Tests, which rely on collectible AssemblyLoadContext, out of rsp file

* Remove three System.Runtime.Loader.Tests.AssemblyLoadContextTest tests with no local failures from rsp file

* Remove System.Runtime.Loader.Tests.DefaultLoadContextTests.LoadNonExistentInDefaultContext and System.Runtime.Loader.Tests.DefaultLoadContextTests.LoadInDefaultContext from rsp file because the related issues should be addressed

* Add an active issue to System.Runtime.Loader.Tests.DefaultLoadContextTests.LoadNonExistentInDefaultContext and System.Runtime.Loader.Tests.DefaultLoadContextTests.LoadInDefaultContext because they fail on CI

* Move several System.Runtime.Loader.Tests.AssemblyLoadContextTest with an active issues out of rsp file

* Remove System.Utf8String.Experimental.Tests from rsp file to verify how they behave on CI

* Clean up rsp file to check all remaining failures

* Skip the entire System.ComponentModel.Composition.Registration.Tests namespace on Mono

* Disable a set of classes in System.Utf8String.Experimental.Tests workspace.

* Add stubs for Utf8String and Utf8Span.cs classes to fix the test build on Mono

* Remove nint/nunit aliases unused in PNSE version of Utf8Span

* Remove CoreFX.issues.rsp file because it has been cleaned up

4 years agoFix Platform setting in mono nuget Directory.Build.props (#32491)
Alexander Köplinger [Tue, 18 Feb 2020 18:56:44 +0000 (19:56 +0100)]
Fix Platform setting in mono nuget Directory.Build.props (#32491)

Otherwise doing `./mono.sh -pack` didn't work since it'd use amd64 instead of x64.
We copied much of this logic from coreclr so I assume this is specific to their build, but I still don't fully understand every bit.

4 years agoMerge pull request #2351 from manne/feature/nullable_microsoft_win32_registry
Eirik Tsarpalis [Tue, 18 Feb 2020 18:11:27 +0000 (18:11 +0000)]
Merge pull request #2351 from manne/feature/nullable_microsoft_win32_registry

Nullable annotate for Microsoft.Win32.Registry

4 years agoIf we have the capacity, try running Mono CI on ARM64 (#32303)
Jo Shields [Tue, 18 Feb 2020 17:44:34 +0000 (12:44 -0500)]
If we have the capacity, try running Mono CI on ARM64 (#32303)

* If we have the capacity, try running Mono CI on ARM64

* Add ARM64 Helix queue to general availability

4 years agoSimplify CheckIsReserved in IriHelper (#32340)
Miha Zupan [Tue, 18 Feb 2020 17:36:49 +0000 (18:36 +0100)]
Simplify CheckIsReserved in IriHelper (#32340)

* Simplify CheckIsReserved in IriHelper

* Simplify CheckIsReserved further

4 years agoOptimize CheckIriUnicodeRange (#31860)
Miha Zupan [Tue, 18 Feb 2020 17:36:29 +0000 (18:36 +0100)]
Optimize CheckIriUnicodeRange (#31860)

* Optimize CheckIriUnicodeRange

* Improve clarity of if check in CheckIriUnicodeRange

Co-Authored-By: Stephen Toub <stoub@microsoft.com>
* Improve clarity of if check in CheckIriUnicodeRange

* Optimize range checks that are equivalent mod 2^16

* Invert escape boolean condition

Co-authored-by: Stephen Toub <stoub@microsoft.com>
4 years agoMerge pull request #32185 from NikolaMilosavljevic/pkg.dev.1
Nikola Milosavljevic [Tue, 18 Feb 2020 16:53:23 +0000 (08:53 -0800)]
Merge pull request #32185 from NikolaMilosavljevic/pkg.dev.1

Enable rpm/deb build on dev machines

4 years agoRemove unused locals in System.ServiceModel.Syndication (#31841)
Next Turn [Tue, 18 Feb 2020 14:59:42 +0000 (22:59 +0800)]
Remove unused locals in System.ServiceModel.Syndication (#31841)

4 years agoMerge branch 'master' into feature/nullable_microsoft_win32_registry
Stephen Toub [Tue, 18 Feb 2020 14:58:37 +0000 (09:58 -0500)]
Merge branch 'master' into feature/nullable_microsoft_win32_registry

4 years agoChange several `static readonly byte[]` fields to be `ReadOnlySpan<byte>` properties...
Stephen Toub [Tue, 18 Feb 2020 14:25:32 +0000 (09:25 -0500)]
Change several `static readonly byte[]` fields to be `ReadOnlySpan<byte>` properties (#32464)

4 years agoReduce allocation in HTTP/2 requests by ~30% (#32406)
Stephen Toub [Tue, 18 Feb 2020 13:24:08 +0000 (08:24 -0500)]
Reduce allocation in HTTP/2 requests by ~30% (#32406)

* Avoid forcing ExpectContinue / TransferEncodingChunked headers into existence

* Reduce cookie-related allocations

- Make CookieParser/CookieTokenizer into structs. CookieParser is just created as a helper with some state to help a loop do parsing; it's not passed around in any way.  And CookieTokenizer is just the implementation of CookieParser separated out for some reason.  They can both be structs.
- Remove enumerator allocations related to cookies. Also reduces interface method invocations.

* Remove often-unnecessary allocation in Uri.IdnHost

This is happening for every request.  But if the host is already all ASCII, we don't need to create a new string, and if it's already all lowercase, we don't need to create yet another new string. (This logic could stand to be cleaned up further; I just removed the allocations and some unnecessarily complex unsafe code along the way.)

* Combine ReadAtLeastAsync into EnsureIncomingBytesAsync

There's no need for them to be separate, and separating them leads to an extra async stack frame / state machine.

* Reduce calls to ReadFrameAsync that need to yield

Many frames either won't have a payload, or the act of waiting for the header will also end up waiting for the payload (in the same packet).  By pulling out the wait in the hot path, we significantly reduce the number of times ReadFrameAsync will need to yield.

* Override Http2ReadStream.CopyToAsync

Reduces allocation / improves throughput when using responseStream.CopyToAsync.

* Shrink EnsureIncomingBytesAsync state machine by 8 bytes

Remove two lifted Int32s.

* Shrink size of Http2Connection.SendAsync state machine

The order of a comparison operation is, based on C# required order of operations, forcing a temporary to be spilled and lifted to the state machine.

* Add additional values to known headers

Avoids string allocations when these common response values are used.

* Remove dead Uri code

4 years agoPrefer StringBuilder.Append(char) over Append(string) (#32467)
Stephen Toub [Tue, 18 Feb 2020 13:23:25 +0000 (08:23 -0500)]
Prefer StringBuilder.Append(char) over Append(string) (#32467)

* Prefer StringBuilder.Append(char) over Append(string)

* Address PR feedback

4 years ago[master] Update dependencies from mono/linker dotnet/arcade (#32472)
dotnet-maestro[bot] [Tue, 18 Feb 2020 11:24:41 +0000 (12:24 +0100)]
[master] Update dependencies from mono/linker dotnet/arcade (#32472)

* Update dependencies from https://github.com/mono/linker build 20200217.1

- ILLink.Tasks - 0.1.6-prerelease.20117.1

* Update dependencies from https://github.com/dotnet/arcade build 20200217.3

- Microsoft.DotNet.XUnitExtensions - 5.0.0-beta.20117.3
- Microsoft.DotNet.VersionTools.Tasks - 5.0.0-beta.20117.3
- Microsoft.DotNet.ApiCompat - 5.0.0-beta.20117.3
- Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20117.3
- Microsoft.DotNet.Build.Tasks.Feed - 5.0.0-beta.20117.3
- Microsoft.DotNet.Build.Tasks.Packaging - 5.0.0-beta.20117.3
- Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk - 5.0.0-beta.20117.3
- Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk - 5.0.0-beta.20117.3
- Microsoft.DotNet.CodeAnalysis - 5.0.0-beta.20117.3
- Microsoft.DotNet.GenAPI - 5.0.0-beta.20117.3
- Microsoft.DotNet.GenFacades - 5.0.0-beta.20117.3
- Microsoft.DotNet.Helix.Sdk - 5.0.0-beta.20117.3
- Microsoft.DotNet.RemoteExecutor - 5.0.0-beta.20117.3
- Microsoft.DotNet.XUnitConsoleRunner - 2.5.1-beta.20117.3

4 years agoRemove #if __cplusplus from MagicTypeInfo. (#32461)
monojenkins [Tue, 18 Feb 2020 09:53:13 +0000 (04:53 -0500)]
Remove #if __cplusplus from MagicTypeInfo. (#32461)

This wastes about 24 static const bytes which I think is ok.
6 bytes per struct plus 2 padding, and there are 3 of them, total, ever, passed by pointer.

I was looking into https://github.com/mono/mono/issues/18827
and wanting to rule out #if __cplusplus.

Co-authored-by: Jay Krell <jay.krell@cornell.edu>
4 years agoUpdate ILLinkTasksVersion dependency (#32170)
Marek Safar [Tue, 18 Feb 2020 08:10:51 +0000 (09:10 +0100)]
Update ILLinkTasksVersion dependency (#32170)

* Revert "Revert "Update ILLinkTasksVersion dependency (#2334)" (#31807)"

This reverts commit 334391bdc9d4e9e20ea8b8a19ec5788da680b850.

* Update ILLink version

* Update ILLink task netcore execution version

* Another version update

4 years agoUse CancellationToken.ThrowIfCancellationRequested directly where applicable (#32468)
Stephen Toub [Tue, 18 Feb 2020 06:36:16 +0000 (01:36 -0500)]
Use CancellationToken.ThrowIfCancellationRequested directly where applicable (#32468)

4 years agoUnobservedTaskExceptionEventArgs.Exception should not be nullable (#32457)
Joseph Musser [Tue, 18 Feb 2020 03:38:22 +0000 (22:38 -0500)]
UnobservedTaskExceptionEventArgs.Exception should not be nullable (#32457)

4 years agoR2RDump fixes (#32460)
Andrew Au [Tue, 18 Feb 2020 02:33:13 +0000 (18:33 -0800)]
R2RDump fixes (#32460)

4 years ago[win32] Make non-recursive mutexes SRWLOCK instead of CRITICAL_SECTION. (#32258)
monojenkins [Mon, 17 Feb 2020 21:35:18 +0000 (16:35 -0500)]
[win32] Make non-recursive mutexes SRWLOCK instead of CRITICAL_SECTION. (#32258)

Co-authored-by: Jay Krell <jay.krell@cornell.edu>
4 years agoAnnotate System.IO.Pipes.AccessControl for nullable reference types (#32343)
Eric Erhardt [Mon, 17 Feb 2020 21:14:46 +0000 (15:14 -0600)]
Annotate System.IO.Pipes.AccessControl for nullable reference types (#32343)

* Annotate System.IO.Pipes.AccessControl for nullable reference types

Contributes to #2339

4 years agoCross compilation, check first if an env variable is defined (#32392)
s0dyy [Mon, 17 Feb 2020 19:19:49 +0000 (20:19 +0100)]
Cross compilation, check first if an env variable is defined (#32392)

4 years agoFix GeneratorCommand in Microsoft.XmlSerializer.Generator.Tests.csproj (#32446)
Alexander Köplinger [Mon, 17 Feb 2020 18:13:15 +0000 (19:13 +0100)]
Fix GeneratorCommand in Microsoft.XmlSerializer.Generator.Tests.csproj (#32446)

On non-Windows operating systems we need to use `&&` to chain the two commands instead of a single ampersand.

4 years agoFix IsArgPassedByRef in crossgen2 on ARM32 (#32425)
Dong-Heon Jung [Mon, 17 Feb 2020 17:12:19 +0000 (02:12 +0900)]
Fix IsArgPassedByRef in crossgen2 on ARM32 (#32425)

4 years agoUpdate dependencies from https://github.com/dotnet/arcade build 20200216.1 (#32438)
dotnet-maestro[bot] [Mon, 17 Feb 2020 16:38:46 +0000 (10:38 -0600)]
Update dependencies from https://github.com/dotnet/arcade build 20200216.1 (#32438)

- Microsoft.DotNet.XUnitExtensions - 5.0.0-beta.20116.1
- Microsoft.DotNet.VersionTools.Tasks - 5.0.0-beta.20116.1
- Microsoft.DotNet.ApiCompat - 5.0.0-beta.20116.1
- Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20116.1
- Microsoft.DotNet.Build.Tasks.Feed - 5.0.0-beta.20116.1
- Microsoft.DotNet.Build.Tasks.Packaging - 5.0.0-beta.20116.1
- Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk - 5.0.0-beta.20116.1
- Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk - 5.0.0-beta.20116.1
- Microsoft.DotNet.CodeAnalysis - 5.0.0-beta.20116.1
- Microsoft.DotNet.GenAPI - 5.0.0-beta.20116.1
- Microsoft.DotNet.GenFacades - 5.0.0-beta.20116.1
- Microsoft.DotNet.Helix.Sdk - 5.0.0-beta.20116.1
- Microsoft.DotNet.RemoteExecutor - 5.0.0-beta.20116.1
- Microsoft.DotNet.XUnitConsoleRunner - 2.5.1-beta.20116.1

4 years agoUpdate environ.cpp (#832)
Federico Zuccollo [Mon, 17 Feb 2020 16:06:19 +0000 (17:06 +0100)]
Update environ.cpp (#832)

The search for a prefix has been inlined to squeeze some extra performance by directly comparing bytes.

The prefix search functionality has been put in a separate static function to have all the state given as input and use multiple returns as control flow.

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

4 years ago[interp] Consolidate non-recursive call sites. (#32220)
monojenkins [Mon, 17 Feb 2020 16:03:17 +0000 (11:03 -0500)]
[interp] Consolidate non-recursive call sites. (#32220)

 Consolidate native_stack_addr as a result (resolving a FIXME).
 Builds on:
  https://github.com/mono/mono/pull/18857
  https://github.com/mono/mono/pull/18858
  https://github.com/mono/mono/pull/18869

Co-authored-by: Jay Krell <jay.krell@cornell.edu>
4 years agoAdd PreserveDependency to StackFrameHelper (#32023)
Vitek Karas [Mon, 17 Feb 2020 15:36:58 +0000 (07:36 -0800)]
Add PreserveDependency to StackFrameHelper (#32023)

While linker can recognize the hardcoded type name in the InitializeSoruceInfo it sometimes fails to resolve the type as the System.Diagnostics.StackTrace is not directly referenced by most assemblies. This is partially an internal linker limitation and the attribute is a workaround.

That said linker would not be able to recognize the GetMethod or CreateInstance calls which follow and in member-level trimming mode would not correctly keep the GetSourceLineInfo nor the .ctor of the type.

4 years agoIntroducing Pinned Object Heap (#32283)
Vladimir Sadov [Mon, 17 Feb 2020 15:26:21 +0000 (07:26 -0800)]
Introducing Pinned Object Heap (#32283)

* Introducing Pinned Object Heap

* PR feedback

* reverted a test-only change

4 years agoFix THREADS_SUSPEND_DEBUG to compile (id vs. mono_thread_info_get_tid). (#32393)
monojenkins [Mon, 17 Feb 2020 15:06:43 +0000 (10:06 -0500)]
Fix THREADS_SUSPEND_DEBUG to compile (id vs. mono_thread_info_get_tid). (#32393)

Co-authored-by: Jay Krell <jay.krell@cornell.edu>
4 years ago[llvm] Disable X86 call frame size optimization. (#11118)
monojenkins [Mon, 17 Feb 2020 14:41:54 +0000 (09:41 -0500)]
[llvm] Disable X86 call frame size optimization. (#11118)

Fixes https://github.com/mono/mono/issues/17285.

For calls that require parameters passed in stack memory,
X86CallFrameOptimization can sometimes replace a sequence of movs to
prologue-reserved stack memory with a sequence of pushes and a compensating sub
rsp after the call. LLVM accumulates an OpAdjustCfaOffset MCCFIInstruction for
each push and and records the ephemeral parameter space consumed by the call
using an OpGnuArgsSize MCCFIInstruction (i.e. DW_CFA_GNU_args_size).

MonoException doesn't support encoding OpGnuArgsSize MCCFIInstructions, and
attempting to encode this instruction can cause unpredictable behavior, due to
our use of llvm_unreachable with assertions disabled [1]. Moreover, even if
MonoException happens to emit valid call frame instructions despite the UB
induced by llvm_unreachable, Mono's exception handler will restore the stack
pointer to the value it contained at the time right before the protected call
instruction was made, without compensating for any ephemeral parameter space.

The stack pointer could be fixed before the jump to the EH handler by
supporting DW_CFA_GNU_args_size or by executing call frame instructions for the
EH handler's frame all the way to the end of the protected instruction address
range--which will include a sub rsp with an appropriate immediate--to determine
an appropriate delta. But it's easier to just disable this optimization. We
already disable it for AOT [2]. It's sometimes disabled by LLVM on Darwin [3].

Also, this commit adds a test (which is a nearly verbatim copy of laszk's
reproduction sample in mono/mono#17285) for EH failures caused by the interaction of our
EH code and X86CallFrameOptimization.

See also [4], [5], and [6].

[1] https://github.com/dotnet/llvm-project/blob/adeaa08e7bbc9aba5d67cb16c2b348be12deb000/llvm/lib/CodeGen/AsmPrinter/MonoException.cpp#L209-L210
[2] https://github.com/mono/mono/blob/1317cf06da06682419f8f4b0c9810ad5d5d3ac3a/mono/mini/aot-compiler.c#L9872-L9875
[3] https://github.com/dotnet/llvm-project/blob/adeaa08e7bbc9aba5d67cb16c2b348be12deb000/llvm/lib/Target/X86/X86CallFrameOptimization.cpp#L146-L152
[4] https://bugs.llvm.org/show_bug.cgi?id=24792
[5] https://reviews.llvm.org/D13132
[6] http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151005/304074.html

Co-authored-by: imhameed <imhameed@microsoft.com>
4 years ago[jit] Run static cctors for inlined methods, the cctor might not have ran in AOT...
monojenkins [Mon, 17 Feb 2020 14:15:23 +0000 (09:15 -0500)]
[jit] Run static cctors for inlined methods, the cctor might not have ran in AOT mode. (#31752)

Co-authored-by: Zoltan Varga <vargaz@gmail.com>
4 years agoAdd missing MONO_LLVM_INTERNAL to mono_marshal_get_native_wrapper (#32431)
Alexander Köplinger [Mon, 17 Feb 2020 13:39:44 +0000 (14:39 +0100)]
Add missing MONO_LLVM_INTERNAL to mono_marshal_get_native_wrapper (#32431)

It was missed due to a glitch in the GitHub API that caused the mirror to not get the latest version of the diff.

4 years ago[cross] check against correct alignment value (#31801)
monojenkins [Mon, 17 Feb 2020 13:22:12 +0000 (08:22 -0500)]
[cross] check against correct alignment value (#31801)

It's essentially dead code in any of our configurations.

`MONO_ALIGN_gint8` is define here:
https://github.com/mono/mono/blob/ab2321c1dc1bf0293dadd7e52436b2bd87f2b7c3/mono/metadata/abi-details.h#L26-L35

And the correct value is set here:
https://github.com/mono/mono/blob/ab2321c1dc1bf0293dadd7e52436b2bd87f2b7c3/mono/metadata/abi.c#L71-L75

Co-authored-by: Bernhard Urban-Forster <bernhard.urban@xamarin.com>