Jan Kotas [Fri, 15 Jan 2021 04:48:05 +0000 (20:48 -0800)]
Skip NativeLibrary abstraction for Windows-specific system libraries (#47013)
Stephen Toub [Fri, 15 Jan 2021 03:35:19 +0000 (22:35 -0500)]
Enable HttpHeaderValueCollection.GetEnumerator to return an empty singleton (#47010)
* Enable HttpHeaderValueCollection.GetEnumerator to return an empty singleton
An empty collection is common. We can avoid the enumerator allocation in such cases.
* Update src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpHeaderValueCollection.cs
Jeremy Koritzinsky [Fri, 15 Jan 2021 01:18:57 +0000 (17:18 -0800)]
Remove all dependencies on the old sharedfx tooling. (#47015)
Maoni Stephens [Fri, 15 Jan 2021 00:33:51 +0000 (16:33 -0800)]
regions BGC work (#46972)
Regions work (mostly for BGC) -
+ updated the regions list for newly allocated UOH segs, when we delete segs during sweep/compact UOH
and deleting segs that were marked eligible for deletion during BGC.
+ updated the region list for SOH segs deleted during BGC.
+ commit mark array for new segs if needed for BGC.
+ need to have BGC's ephemeral sweep look at background_allocated of gen0 regions because we could have
alloc contexts on some gen0 regions that haven't been fixed up yet so we can't go beyond
background_allocated. and it needs to set it to 0 when it's done with a region so BGC sweep doesn't
try to look at it.
+ fixed a bug in GCHeap::IsPromoted where we should return true if it's not in condemned.
+ added the necessarily handle table methods to make STRESS_REGIONS work with embedded GC
+ made some dprintfs that only printed region print heap_segment_mem (region) so it's easier to correlate
+ fixed a bug in process_last_np_surv_region that Peter hit when he wasn't using STRESS_REGIONS where we
ran out gen0 regions for the new consing_gen alloc context. I'm just getting a new region here and assuming
we can but we need to make sure we actually can (I've put TODOs for this in the code).
Other work -
+ define VERIFY_HEAP for standalone GC and sample.
+ fixed a bug that also exists for doubly linked FL where we didn't update current_sweep_pos when a GC is
triggered when we are waiting to acquire the UOH alloc lock which caused us to erroneously set BGC mark
bit during BGC planning.
=================================================================
I've been running this GCPerfSim cmdline for 15 hours with no problems in the following condition -
gcperfsim.dll -tc 2 -tagb 128 -tlgb 0.05 -lohar 100 -sohsi 10 -lohsi 100 -pohsi 0 -sohpi 0 -lohpi 0 -sohfi 0 -lohfi 0 -pohfi 0 -allocType reference -testKind time -printEveryNthIter 300000
with the following env vars -
complus_GCRegionsRange=
20000000
complus_GCName=clrgc.dll
(and env vars for logging)
So standalone GC with WKS GC + BGC + STRESS_REGIONS. I actually did do heap verification but a light weight version.
I also tried with embedded GC but just a little to verify the handle table changes.
Bruce Forstall [Fri, 15 Jan 2021 00:02:51 +0000 (14:02 -1000)]
Fix uses of uninitialized data (#46965)
* Fix uses of uninitialized data
Fixes #46961
* Fix typo
* Formatting
Günther Foidl [Thu, 14 Jan 2021 23:01:11 +0000 (00:01 +0100)]
NameResolutionPal.Unix enabled async name resolution (#34633)
* Native implementation
* Native tests
* Managed implementation
* Managed tests
* Revert Interop.GetHostName change -- it's needed at other places too
So this change was a bad idea ;-)
* Fixed builds failures due to "unused parameter"
* Native: move struct addrinfo hint from stack-alloc to heap-alloc
Before I didn't last the async operation as it was on the stack. Now it's part of the GetAddrInfoAsyncState which gets heap allocted, so it last.
I'm not sure if addrinfo needs to last the async operation, as the native tests pass either way. This change makes it more correct, nevertheless.
* PR feedback
* Fixed leak in tests.c according to valgrind's run
* Fixed bug due to marshalled string argument
* More managed PalTests
* Revert "Native tests"
This reverts commit
8c955bc4bd1d0dbe4b2823f4327ad52bf9856fd7 and
d7cb2be7eb3ec09f27a537c89341fb63e176e0bc.
* Handle the case of HostName="" and tests for this
* Use flexible array member to hold the address in struct state
Cf. https://github.com/dotnet/runtime/pull/34633#discussion_r406447963
* Nits in native layer
Cf. https://github.com/dotnet/runtime/pull/34633#discussion_r406494734
* Fixed native merge conflict + added AddressFamily-handling
* Fixed managed merge conflicts + added AddressFamily-handling
* Updated NameResolutionPalTests for AddressFamily
* Removed EnsureSocketsAreInitialized
On Unix this was a nop anyway, https://github.com/dotnet/runtime/pull/43284 removed it from Windows.
* Fixed bug at native side
Seems like "hint" must last the async operation, so stack-only won't do it.
Tests will crash with
```
The active test run was aborted. Reason: Test host process crashed : .../runtime/src/libraries/Native/Unix/System.Native/pal_networking.c (315): error -7: Unknown AddrInfo error flag. Unknown error -7 (0 failed)
```
If put into the heap, it succeeds.
* Refactor setting of the address family into TrySetAddressFamily
* Fixed unused parameter warning / failure
* Little cleanup
* Fixed (unrelated) test failures
Cf. https://github.com/dotnet/runtime/pull/34633#issuecomment-
746377633
* Made LoggingTest async instead of GetAwaiter().GetResult()
* Use function pointer
* Use OperatinngSystem instead of RuntimeInformation in tests
* PR Feedback for CMake
* Update src/libraries/Native/Unix/System.Native/extra_libs.cmake
Co-authored-by: Günther Foidl <gue@korporal.at>
* Revert "Update src/libraries/Native/Unix/System.Native/extra_libs.cmake"
This reverts commit
fa9c6f90b7ef5033e3c30a46dfe34dc47d5ef91e.
* Another to build single file host
Based on https://github.com/dotnet/runtime/pull/34633#issuecomment-
756045320
* Test for !Windows instead excluding several Unix-flavors
Cf. https://github.com/dotnet/runtime/pull/34633#issuecomment-
760205332
Co-authored-by: Vladimir Sadov <vsadov@microsoft.com>
Stephen Toub [Thu, 14 Jan 2021 22:59:02 +0000 (17:59 -0500)]
Clean up silly attempt at thread-safety in NetworkStream.Dispose (#46997)
Dan Moseley [Thu, 14 Jan 2021 22:17:17 +0000 (14:17 -0800)]
Fix failure to dispose stream when exception occurs in Package.Open (#46796)
* Fix packaging bug
* Update Tests.cs
* CR feedback
Santiago Fernandez Madero [Thu, 14 Jan 2021 21:33:54 +0000 (13:33 -0800)]
Include server core testing to PR outerloop coreclr builds (#47001)
Jo Shields [Thu, 14 Jan 2021 19:49:17 +0000 (14:49 -0500)]
Initial Android cross-compiler (#43535)
Produce cross compilers for Android targets, from Linux x64 and OSX x64 hosts. This should be reasonably solid groundwork for adding more targets and more hosts for cross-compile scenarios.
Santiago Fernandez Madero [Thu, 14 Jan 2021 19:28:34 +0000 (11:28 -0800)]
Quick doc formatting update to test checkout without bundle.
Tomas Weinfurt [Thu, 14 Jan 2021 19:19:25 +0000 (11:19 -0800)]
add Alpine 3.13 to RID graph (#46543)
dotnet-maestro[bot] [Thu, 14 Jan 2021 19:10:00 +0000 (19:10 +0000)]
[master] Update dependencies from dotnet/arcade dotnet/xharness (#46980)
[master] Update dependencies from dotnet/arcade dotnet/xharness
Stephen Toub [Thu, 14 Jan 2021 18:46:57 +0000 (13:46 -0500)]
Add Parallel.ForEachAsync (#46943)
* Add Parallel.ForEachAsync
* Address PR feedback and add a few more tests
Also clean up a few things in the src, adding a few more asserts and moving nullable suppressions closer to the point where they're relevant.
Stephen Toub [Thu, 14 Jan 2021 18:46:20 +0000 (13:46 -0500)]
Fix lots of uint[] allocation in BigInteger (#46895)
* Fix lots of uint[] allocation in BigInteger
- Lots of temporary uint[]s are being created and fed into BigInteger's ctor, which then creates a new one. This enables using the input in most cases.
- GetPartsForBitManipulation is creating uint[]s for small values, after which it generally gets thrown away. Stop doing that.
- Stack allocation can be used for smaller values in many cases.
* Address PR feedback
Tarek Mahmoud Sayed [Thu, 14 Jan 2021 17:51:18 +0000 (09:51 -0800)]
Add Activity.SetBaggage API (#46836)
Johan Lorensson [Thu, 14 Jan 2021 17:45:13 +0000 (18:45 +0100)]
Prealloc 16 ipc slots in poll handle array. (#46981)
Sung Yoon Whang [Thu, 14 Jan 2021 17:24:31 +0000 (09:24 -0800)]
Fix GC fragmentation counter to not return NaN (#46938)
* Fix fragmenetation counter to not return NaN
* add regression test
Johan Lorensson [Thu, 14 Jan 2021 15:43:42 +0000 (16:43 +0100)]
Add all public types into ep/ds rt API to be redefined by rt implementation. (#46976)
Adeel Mujahid [Thu, 14 Jan 2021 12:20:23 +0000 (14:20 +0200)]
Prefer ucontext.h over sys/ucontext.h (#46790)
* Prefer ucontext.h over sys/ucontext.h
* Cleanup redundant _XOPEN_SOURCE definitions
* Remove unused makefile from PAL tests
Johan Lorensson [Thu, 14 Jan 2021 08:24:51 +0000 (09:24 +0100)]
Add support for local array types in EventPipe C library. (#46924)
Sung Yoon Whang [Thu, 14 Jan 2021 08:20:31 +0000 (00:20 -0800)]
Fix TestsManifestGeneration test again (#46928)
* Add more sleeps after flush
* remove sleeps and add retry loop
* Fix build
Bruce Forstall [Thu, 14 Jan 2021 00:48:56 +0000 (14:48 -1000)]
Do a JIT rolling build if the JIT-EE GUID changes (#46963)
Normally, any JIT-EE GUID change would be accompanied by
a change in the JIT source code, so a JIT build would be
kicked off. But in some cases, such as a change in the
SuperPMI data format to cause an incompatible format, with
a manual change of the GUID to compensate, should also
kick off a JIT build so asmdiff baselines have a JIT
with an appropriate GUID.
dotnet-maestro[bot] [Thu, 14 Jan 2021 00:37:02 +0000 (00:37 +0000)]
Update dependencies from https://github.com/dotnet/xharness build
20210113.1 (#46929)
[master] Update dependencies from dotnet/xharness
Steve MacLean [Thu, 14 Jan 2021 00:28:40 +0000 (19:28 -0500)]
Fix data breakpoint issues (#46763)
* Ignore data breakpoint during GC
* Simplify disabling DebuggerDataBreakpoint during GC
* Fix destroy pinned handle
* Fix CordbModule::IsMappedLayout assert to allow using VS with debug/checked runtime builds
Co-authored-by: Chuck Ries <chuckr@microsoft.com>
dotnet-maestro[bot] [Thu, 14 Jan 2021 00:08:48 +0000 (00:08 +0000)]
Update dependencies from https://github.com/mono/linker build
20210113.3 (#46937)
[master] Update dependencies from mono/linker
Vladimir Sadov [Thu, 14 Jan 2021 00:02:49 +0000 (16:02 -0800)]
signable single file apps on mac (#46558)
* extend the __LINKEDIT. section to cover the single-exe metadata.
* codesign test
Steve MacLean [Wed, 13 Jan 2021 23:51:44 +0000 (18:51 -0500)]
MacOS-arm64 Fix libdebugshim search path (#46932)
David Wrighton [Wed, 13 Jan 2021 22:40:56 +0000 (14:40 -0800)]
Phase 1 of refactoring pgo data pipeline (#46638)
Phase 1 of replacing existing infrastructure around handling of pgo data with more flexible schema based approach.
The schema based approach allows the JIT to define the form of data needed for instrumentation.
- The schema associates 4 32bit integers with each data collection point (ILOffset, InstrumentationKind, Count, and Other)
- Rich meaning is attached to InstrumentationKind, and Count
- InstrumentationKind defines the size and layout of individual instrumentation data items
- Count allows a single schema item to be repeated
- ILOffset and Other are not processed in any specific way by the infrastructure
Changes part of this phase
- PgoManager holds arbitrary amount of pgo data instead of a slab
- Aware of collectible assemblies
- Match with pgo data utilizes hash of IL body in addition to IL size information for greater accuracy in match
- JIT no longer uses block count apis, and instead uses schema based apis
- JIT now explicitly defines the shape of data collected for both basic block and type probes
- The rest of the system handles that without deep knowledge of what those formats are
- Text file format for pgo data updated
- Existing IBC infrastructure adjusted to speak in terms of schema concept
- Uncompressed and binary encoded implementation of Pgo schema handling
- Update SuperPMI to handle new apis
Future Changes for static Pgo
- Move Pgo type handle histogram processing into JIT
- Extract Pgo data from process using Event infrastructure
- Triggers for controlling Pgo data extraction
- Instrumented Pgo processing as part of dotnet-pgo tool
- Pgo data flow in crossgen2
David Mason [Wed, 13 Jan 2021 21:37:18 +0000 (13:37 -0800)]
Fix sync issue in profiler tests (#46907)
Jeremy Koritzinsky [Wed, 13 Jan 2021 21:30:15 +0000 (13:30 -0800)]
Rewrite ARM64 IJW bootstrap thunk assembly. (#46933)
* Rewrite ARM64 IJW bootstrap thunk.
* Fix alignment.
Tammy Qiu [Wed, 13 Jan 2021 20:25:35 +0000 (15:25 -0500)]
[wasm] Add support for AOT profiling, and add a `browser-profile` sample (#45910)
* Enable AOT Profiler
* Add a `browser-profile` sample
* Clean up Makefile add AotInterp mode to MonoAotMode
* move the shared make logic to wasm.mk
Co-authored-by: Steve Pfister <steveisok@users.noreply.github.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
Ankit Jain [Wed, 13 Jan 2021 19:25:28 +0000 (14:25 -0500)]
[wasm][debugger][tests] Refactor test harness to support simpler test code (#44987)
* [wasm][debugger] Move DevToolsQueue to a separate file
* Move Inspector to separate file, mv Support.cs=>DebuggerTest.cs
* [wasm][debugger][tests] Some improvements to DevToolsQueue
- `Pump` -> `TryPump`
- use a ConcurrentQueue instead of a List, for tracking the pending
requests.
DevToolsClient:
- use DevToolsQueue, and remove the redundant code.
- Wake up the runloop when a new send task gets added
* [wasm][debugger] Check Proxy's client_initiated_close early
- this allows the proxy to shutdown quicker, and not have to wait for
the other tasks to get scheduled.
- Fixes the issue of chrome processes left around.
* [wasm][debugger][tests] Inspector - handle event being received before a waiter
.. gets added.
This handles the case where `NotifyOf` gets invoked before a
corresponding `WaitFor` gets called.
* [wasm][debugger][tests] Refactor test harness to support simpler test code
Problem:
- Currently, test methods must call `insp.Ready(..)` with a
callback. And `Ready` takes care of the init, and shutdown for
the proxy, and browser.
- But this means that we have to repeat that boiler plate code in all
the test methods. And the stack traces are deeply nested.
- Instead, we want to have the *test method* contain only the test
specific code.
Solution:
- we want to do that by using xunit's `IAsyncLifetime`, with
methods:
- `InitializeAsync` - setup proxy+browser here
- `DisposeAsync` - shutdown
- This would mean that when the *test method* runs, it already has
everything set up, so the code can be just specific to the actual test.
Implementation:
- Improve DevToolsClient's RunLoop, to support this
- Tries to handle shutdown/close requests explicitly, and not throw
errors in such cases
- Adds a `RunLoopStopped` event, which gets invoked with the reason due
to which it stopped. Eg - Exception getting thrown, cancellation,
shutdown request etc.
- With `insp.Ready(..)`, the whole setup (launch proxy, browser,
run test code) happens from the same *test method*. But here we
are doing it at separate times, from different methods, and it's
all async.
- IOW, there are multiple places where failure can
happen, and we need to explicitly propogate that, and
fail the appropriate listeners/tasks/etc
-> causing the test to correctly fail.
Note: This does not change *any* actual test code! The `Ready` method is
adjusted to use the new init/shutdown bits.
Subsequent commits will make the test changes.
* [wasm][debugger][tests] Port some tests to the simpler test harness bits
We add a `SingleSessionTestBase` class, which implements
`IAsyncLifetime` to init/shutdown the proxy+browser outside the test
methods.
And port `HarnessTests`, and `SteppingTests` to that.
Added a few more tests to `HarnessTests`, to check for common cases like
test methods throwing exceptions, or timing out, or commands failing
etc.
- This is needed because with the older `insp.Ready` API, the
whole thing was called from the test method, so failures would
correctly fail the test.
- But now we do these things in separate steps, so failing the
test requires a bit more work in the harness.
Note: I didn't port all the tests in one go, to make the review a bit
simpler. A subsequent PR can move rest of the tests over, and do some
cleanup that it would afford.
* [wasm][debugger][tests] Fix race in ExceptionThrownInJSOutOfBand test
Fix the race where the `Runtime.exceptionThrown` message can be received
before the test calls `WaitFor`, causing it to get missed.
* [wasm][debugger] Formatting fixes on the changes
* Remove unncessary AssertHelpers.ThrowsAsync
Suggested by @lewing !
* [wasm][debugger][tests] Fix a race when sending messages
DevToolsClient.Send adds to `pending_ops`, which can happen while the
list is being modified in `RunLoop`.
Fix: Since, we need to modify it outside `RunLoop` only when a new send
task is available, we can let `RunLoop` itself add it to the list. And use
a taskCompletionSource to wake up the loop.
Stephen Toub [Wed, 13 Jan 2021 18:49:39 +0000 (13:49 -0500)]
Add comments about _singleBufferHandleState to SocketsAsyncEventArgs.Windows.cs (#46923)
Steve MacLean [Wed, 13 Jan 2021 18:07:04 +0000 (13:07 -0500)]
Fix MS.NETCore.App.Bundle on osx-arm64 (#46878)
Vladimir Sadov [Wed, 13 Jan 2021 18:01:53 +0000 (10:01 -0800)]
Enable host tests on OSX (#46640)
* Enable host tests on OSX
* initialize Ssl shim on demand
* fix OpenSsl.Tests
* partial modifier
* fixed Cryptography.Algorithms
* first to dlopen libssl wins
Drew Scoggins [Wed, 13 Jan 2021 17:43:58 +0000 (09:43 -0800)]
Set official build value to false (#46834)
* Set official build value to false
* Add pr trigger
* Remove PR
Tanner Gooding [Wed, 13 Jan 2021 17:09:10 +0000 (09:09 -0800)]
Adding support for ReciprocalEstimate and ReciprocalSqrtEstimate (#46692)
* Adding support for ReciprocalEstimate and ReciprocalSqrtEstimate
* Adding basic documentation comments to the new Math.ReciprocalEstimate functions
* Increasing the epsilon for estimated functions to account for ARM64 only doing a single Newton-Raphson iteration
Marek Safar [Wed, 13 Jan 2021 16:27:13 +0000 (17:27 +0100)]
Don't assume presence of MonoResolveUnmanagedDllUsingEvent method (#46917)
Follow up change missing in #46323
Fixes #46908
dotnet-maestro[bot] [Wed, 13 Jan 2021 15:31:58 +0000 (16:31 +0100)]
[master] Update dependencies from dotnet/xharness dotnet/runtime-assets dotnet/llvm-project dotnet/icu (#46853)
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Stephen Toub [Wed, 13 Jan 2021 14:48:00 +0000 (09:48 -0500)]
Use stackalloc in RSAPkcs1X509SignatureGenerator.BuildPublicKey (#46893)
Just an unnecessary allocation. The AsnEncodedData ctor makes a copy regardless of whether the input is a span or an array, so may as well avoid allocating another array on top of that.
dotnet-maestro[bot] [Wed, 13 Jan 2021 13:38:23 +0000 (14:38 +0100)]
[master] Update dependencies from mono/linker (#46906)
Microsoft.NET.ILLink.Tasks
From Version 6.0.0-alpha.1.21061.5 -> To Version 6.0.0-alpha.1.21063.1
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
monojenkins [Wed, 13 Jan 2021 12:36:30 +0000 (07:36 -0500)]
Try to fix #19803 (#37156)
My previous unsuccessful pull request https://github.com/mono/mono/pull/19804
I have improved the logic so that the code is more systematic
Co-authored-by: alexger97 <alexger97@users.noreply.github.com>
Viktor Hofer [Wed, 13 Jan 2021 11:04:13 +0000 (12:04 +0100)]
Specify a GUID for the IL SDK and expose it to slngen (#46877)
* Specify a GUID for the IL SDK and expose it to slngen
Johan Lorensson [Wed, 13 Jan 2021 08:15:43 +0000 (09:15 +0100)]
Fix Mono Windows x64 SIMD support. (#46812)
Bruce Forstall [Wed, 13 Jan 2021 06:27:01 +0000 (20:27 -1000)]
Fix sig inst (#46886)
* Fix 32-bit platform handling of CORINFO_SIG_INST
Previous code was reading an array of pointers as an array of
8-byte elements, leading to some cases of reading beyond
allocated memory and causing access violations. Convert remaining
cases to properly serialized/deserialized pointers.
This is a follow-up to #46604.
Moves all Agnostic types to their own file, agnostic.h, so MethodContext
and CompileResult can share helpers with the same types (previously,
they each had a copy of AgnosticCORINFO_SIG_INFO).
* Remove duplicate types
* Convert CompileResult to use common CORINFO_SIG_INFO functions
Add CrSigInstHandleMap to store handle map for CompileResults.
* Change JIT/EE GUID
SuperPMI format has changed, so change the GUID.
Aleksey Kliger (λgeek) [Wed, 13 Jan 2021 06:16:53 +0000 (01:16 -0500)]
Mono: use shared StartHelper object (#46896)
* Revert "Partial rollback of #46244 to workaround #46389 (#46390)"
This reverts commit
43d07801e94c3c302ed61852fff11ddbdff515a4.
* [threads] Check for null longlived thread data
This might happen on netcore if the managed Thread constructor throws an
exception before calling InitInternal. In that case the finalizer may see a
partially initialized object.
Sung Yoon Whang [Wed, 13 Jan 2021 05:00:19 +0000 (21:00 -0800)]
Update TraceEvent version (#46655)
* update TraceEvent version
* remove MicrosoftDiagnosticsTracingTraceEventPackageVersion and consolidate using TraceEventVersion
* Fix profiler test
Anton Firszov [Wed, 13 Jan 2021 02:38:46 +0000 (03:38 +0100)]
Harmonize ReceiveMessageFrom tests and bring them back to Inner Loop (#46862)
* extend SocketTestHelper
* SocketHelperMemoryNativeTask: implement UDP methods
* unified test for ReceiveSentMessages_Success
* oops, these overloads are not here yet
* ReceiveSentMessages_ReuseEventArgs_Success
* altering bufferMode does not work on Linux
* remove ReceiveMessageFromAsync.cs
* use AssertExtensions.SequenceEqual
Andy Ayers [Wed, 13 Jan 2021 01:28:46 +0000 (17:28 -0800)]
JIT: jump threading (#46257)
Optimize branches where a branch outcome is fully determined by a dominating
branch, and both true and false values can reach the dominated branch.
Juan Hoyos [Wed, 13 Jan 2021 01:02:00 +0000 (17:02 -0800)]
Small PoliCheck fix (#46876)
Ankit Jain [Tue, 12 Jan 2021 23:57:43 +0000 (18:57 -0500)]
[wasm] Disable `System.Diagnostics.Tests.ActivityTests.IdGenerationInternalParent` (#46875)
throws `System.PlatformNotSupportedException : Cannot wait on monitors on this runtime.`
Partially fixes https://github.com/dotnet/runtime/issues/46768
Jeremy Koritzinsky [Tue, 12 Jan 2021 23:28:54 +0000 (15:28 -0800)]
Implement System.Runtime.InteropServices.CLong/CULong/NFloat (#46401)
* Implement managed side of CLong/CULong/NFloat.
* Make CLong, CULong, and NFloat intrinsically handled correctly by the JIT.
* Add framework tests for CLong, CULong, and NFloat.
* Add interop test of CLong to validate calling convention semantics.
* Update CULong.cs
* Fix implicit conversions.
* Fix overflow and equality test failures.
* Fix formatting.
* Fix formatting and add function header.
* Add doc comments.
* Don't throw on float out of range. Rename tests.
* Rewrite EqualsTest implementations more straightforward.
* Fix NFloat tests.
* Use .Equals instead of ==
* Use ToString directly instead of hard coding the expected value.
* Update the emitted assembly stub's thiscall retbuf support for x86 to account for the new native exchange types.
* Add sizeof tests.
* Add test with struct containing CLong.
* Disable ThisCallTest on Mono due to #46820
* validate type name.
Ankit Jain [Tue, 12 Jan 2021 23:24:59 +0000 (18:24 -0500)]
[wasm] Simplify, and refactor `WasmApp.targets`, and wasm projects (#46772)
Refactor `WasmApp.targets` to:
1. Move duplicated properties, targets from the various wasm projects to a common location
2. Split `WasmApp.targets` into:
a. `WasmApp.InTree.props`, and `WasmApp.props`
b. `WasmApp.InTree.targets`, and `WasmApp.Targets`
- The props/targets split makes this similar to a SDK
- `WasmApp.{props, targets}` - have the core bits to build a wasm app, but don't have anything specific to the `dotnet/runtime` tree
- `WasmApp.InTree.{props, targets}` - have bits to facilitate local builds in `dotnet/runtime`, eg. to use a local build of the runtime pack
This simplifies project files a lot. And sets things up for being able to have a wasm SDK, and be able to use them to build wasm apps outside the tree.
Note: In case of the *InTree* files, they depend on runtime specific properties being set, like `$(ArtifactsBinDir)` which are set in inherited `Directory.Build*` files, which tend to override properties even if they are already set. Due to this, in some cases we have to import `*InTree*` files after the inherited ones, and set some properties before, and some after importing `Directory.Build.*`.
* [wasm] WasmAppBuilder: add new input for extra files to deploy
.. to the bundle. This eliminates the need to hack it in with
aftertargets.
* [wasm] samples: Extract the common bits to Directory.Build.*
- Also, introduce WasmApp.props, to have some of the property defaults
that aren't specific to the samples
* [wasm] samples: no need to add cs files manually
* [wasm] Extract common bits from wasm FunctionalTests to Directory.Build*
* [wasm] Add WasmApp.InTree.{props,targets}
The *InTree* files have the properties/targets required to build within
the tree. The main `WasmApp.{props,targets}` should be on the way to
becoming useful outside the tree.
* [wasm] Update debugger-tests to use the InTree targets
* [wasm] Add to debugger tests, consistent with other make targets
* [wasm] use TrickRuntimePackLocation target only if applicable
* [wasm] add EMSDK_PATH default value for wasm projects
* [wasm] Move RebuildWasmAppBuilder to InTree.targets
* [wasm] Simplify functionalTests project files
* [wasm] Fix tests in src/tests run with WasmTestRunner
* little cleanup
* Address review feedback from @mdh1418
* add comment
* [wasm] update build/README.md
* Add comment for InTree* files
* [wasm] sample - move some non-debug properties to D.B.props
* [wasm] Move CopySampleAppToHelix* to InTree.targets
Mateo Torres-Ruiz [Tue, 12 Jan 2021 22:20:07 +0000 (14:20 -0800)]
Add RequiresAssemblyFilesAttribute (#46824)
* Add RequiresAssemblyFilesAttribute
* Apply suggestions from code review
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Sean Hall [Tue, 12 Jan 2021 21:34:24 +0000 (15:34 -0600)]
Publish hostfxr static library. (#46787)
Tanner Gooding [Tue, 12 Jan 2021 20:50:43 +0000 (12:50 -0800)]
Adding support for Math/MathF.SinCos (#46551)
* Adding support for Math/MathF.SinCos
* Fix the handling of sincos on __APPLE__
* Adjusting the SinCos internal call to work on all platforms
* Mark the public SinCos as intrinsic and ensure it is handled in gentree
* Dropping the NI_System_Math_SinCos intrinsic as it requires more extensive changes
* Removing unnecessary casts from the COMSingle and COMDouble SinCos calls
Brian Sullivan [Tue, 12 Jan 2021 20:33:42 +0000 (12:33 -0800)]
Fix Ilasm Round Trip script by adding retry logic (#46765)
* Fix Ilasm Round Trip script by adding retry logic
Fix bash syntax
Update bash syntax to use while true
* Fix bash syntax error missing then
* bash - increment ilasm_count
Viktor Hofer [Tue, 12 Jan 2021 19:55:41 +0000 (20:55 +0100)]
Update packageindex for 5.0 servicing release (#46866)
Dan Moseley [Tue, 12 Jan 2021 19:38:07 +0000 (11:38 -0800)]
Fix SAPI error code mappings (#46841)
* Fix PKT
* Fix SAPI errors
* Disable test as appropriate
* enable more tests to fail to get messages
* reenable tests
* Update src/libraries/System.Speech/tests/SpeechRecognizerTests.cs
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Bruce Forstall [Tue, 12 Jan 2021 18:07:56 +0000 (08:07 -1000)]
Fix link (#46864)
Mitchell Hwang [Tue, 12 Jan 2021 18:06:14 +0000 (13:06 -0500)]
Remove Microsoft.DotNet.RemoteExecutor from library test linker inclusions (#46814)
Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
Eric Erhardt [Tue, 12 Jan 2021 16:25:37 +0000 (10:25 -0600)]
Resolve ILLink warnings in System.Reflection.TypeExtensions (#46786)
* Resolve ILLink warnings in System.Reflection.TypeExtensions
Contributes to #45623
* Update API Compat baseline for Type.GetMembers() attribute change.
Eirik Tsarpalis [Tue, 12 Jan 2021 14:36:46 +0000 (14:36 +0000)]
Ensure console is initialized before writing to stdout (#46852)
dotnet-maestro[bot] [Tue, 12 Jan 2021 12:19:27 +0000 (13:19 +0100)]
[master] Update dependencies from dotnet/runtime dotnet/xharness (#46804)
* Update dependencies from https://github.com/dotnet/xharness build
20210111.2
Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Xunit
From Version 1.0.0-prerelease.20630.1 -> To Version 1.0.0-prerelease.21061.2
* Update dependencies from https://github.com/dotnet/runtime build
20210110.3
Microsoft.NETCore.ILAsm , runtime.native.System.IO.Ports , Microsoft.NETCore.DotNetHost , Microsoft.NET.Sdk.IL , Microsoft.NETCore.DotNetHostPolicy , System.Runtime.CompilerServices.Unsafe , System.Text.Json
From Version 6.0.0-alpha.1.21053.3 -> To Version 6.0.0-alpha.1.21060.3
* Update dependencies from https://github.com/dotnet/xharness build
20210111.3
Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Xunit
From Version 1.0.0-prerelease.20630.1 -> To Version 1.0.0-prerelease.21061.3
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
dotnet-maestro[bot] [Tue, 12 Jan 2021 12:12:05 +0000 (13:12 +0100)]
[master] Update dependencies from mono/linker (#46805)
* Update dependencies from https://github.com/mono/linker build
20210111.1
Microsoft.NET.ILLink.Tasks
From Version 6.0.0-alpha.1.21057.1 -> To Version 6.0.0-alpha.1.21061.1
* Update dependencies from https://github.com/mono/linker build
20210111.2
Microsoft.NET.ILLink.Tasks
From Version 6.0.0-alpha.1.21057.1 -> To Version 6.0.0-alpha.1.21061.2
* Update dependencies from https://github.com/mono/linker build
20210111.3
Microsoft.NET.ILLink.Tasks
From Version 6.0.0-alpha.1.21057.1 -> To Version 6.0.0-alpha.1.21061.3
* Update dependencies from https://github.com/mono/linker build
20210111.4
Microsoft.NET.ILLink.Tasks
From Version 6.0.0-alpha.1.21057.1 -> To Version 6.0.0-alpha.1.21061.4
* Update dependencies from https://github.com/mono/linker build
20210111.5
Microsoft.NET.ILLink.Tasks
From Version 6.0.0-alpha.1.21057.1 -> To Version 6.0.0-alpha.1.21061.5
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Johan Lorensson [Tue, 12 Jan 2021 10:37:07 +0000 (11:37 +0100)]
Fix couple of races in EventPipe C library. (#46193)
Fix primarily two main issues triggering races related to ref counting on
EventPipeThread.
First was an incorrect mapping of hash map add method in CoreClr shim.
Intent of this method was a add_replace, but CoreClr shim ended up with
Add implementation. That could result in unreferenced threads being added
into thread_sequence_number_map, that on free would release the ref count
creating unbalance, triggering EventPipeThreads to be terminated to soon.
There is also a theoretical race (don't know if it has been hit) that
manifests when we end up adding threads into thread_sequence_number_map
instead of replacing an existing already ref counted item. If we add,
then we will hit the same race, so added a fix making sure we detect
this case and correctly makes an addref to the thread. This potential
issue exists in C++ version of EventPipe library as well.
The other issue triggering another race related to ref counted threads.
The streaming thread in C library used ep_thread_get_or_create to get a
reference to itself. This will create an EventPipeThread
instance in TLS, but it will also add thread into global thread list.
Since the streaming thread doesn’t do additional writes of events it
will not get a thread session state, meaning that it will keep its original
ref count. This opens up a race when the TLS destructor decrements
the reference count, and another thread disabling a session. The
thread that disables the session will get a copy of all running threads,
but if the thread running TLS destructor managed to be the first
hitting ref count down to 0, but other thread will beat it taking
locks protecting list, the thread with refcount == 0 will still
be in the list copy, meaning the other thread will end up with a
potentially freed object on its thread list copy.
I made two fixes for this issue, first, don’t use ep_thread_get_or_create
from streaming thread, since there is an ability to get hold of
runtime specific thread object, that will eliminate the race between
a thread added into EventPipe, but not writing events, so it won’t have
an thread session state holding an additional ref count. Second, since
the race is still there due to the spit between ref count and lock
protecting the list, I also made a change in the C library, moving the
register/unregister on the list into the ep_thread_get_or_create (register)
and TLS destructor (unregister), meaning that the list will track live
threads currently using EventPipe library, and the EventPipeThread
object is still ref counted, meaning that it still can outlive the
lifetime of the physical thread.
Doing this split close the potential race condition (and even fix the
scenario if we kept the streaming thread added into the global thread list).
This hypothetical race condition exists in C++ library as well but might
have been mitigated by ref counting thread session state and making sure
the TLS destructor won’t race with a thread doing disable since thread
session state ref count will be held past par of disable that could race.
Dong-Heon Jung [Tue, 12 Jan 2021 06:29:51 +0000 (15:29 +0900)]
Fix threading issue in MulticoreJit (#46783)
Fix https://github.com/dotnet/runtime/issues/46778 issue
Tomas Weinfurt [Tue, 12 Jan 2021 06:15:51 +0000 (22:15 -0800)]
fallback to GetAddrInfoW if GetAddrInfoExW fails (#45816)
* fallback to GetAddrInfoW if GetAddrInfoExW fails
* Update src/libraries/System.Net.NameResolution/src/System/Net/Dns.cs
Co-authored-by: Cory Nelson <phrosty@gmail.com>
* Update src/libraries/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.cs
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* feedback from review
* update fakes
* attempt to fix telemetry
* remofe forced telemetry
* fix spelling
* improve duration precision
* task refactor
* update fakes again
* rename function
Co-authored-by: Cory Nelson <phrosty@gmail.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Kunal Pathak [Tue, 12 Jan 2021 04:54:18 +0000 (20:54 -0800)]
Align inner loops (#44370)
* Detect inner loop and add 10 bytes of padding at the beginning
* generate nop in previous blocks
* TODO: figure out if anything needs to be done in optCanonicalizeLoop
* Add COMPlus_JitAlignLoopMinBlockWeight and COMPlus_JitAlignLoopMaxCodeSize
- Add 2 variables to control which loops get aligned
- Moved padding after the conditional/unconditional jump of previous block
* Reuse AlignLoops flag for dynamic loop alignment
* Detect back edge and count no. of instructions before doing loop alignment
* fix bugs
* propagate the basic block flag
* Switch from instrCount to codeSize
* JitAlignLoopWith32BPadding
* Add emitLoopAlign32Bytes()
* wip
* Add logic to avoid emitting nop if not needed
* fix a condition
* Several things:
- Replaced JitAlignLoopWith32BPadding with JitAlignLoopBoundary
- Added JitAlignLoopForJcc
- Added logging of boundary and point where instruction splitting happpens
- Add logic to take into consideration JCC.
* Added JitAlignLoopAdaptive algorithm
* wip
* revert emitarm64.cpp changes
* fix errors during merge
* fix build errors
* refactoring and cleanup
* refactoring and build errors fix
* jit format
* one more build error
* Add emitLoopAlignAdjustments()
* Update emitLoopAlignAdjustments to just include loopSize calc
* Remove #ifdef ADAPTIVE_LOOP_ALIGNMENT
* Code cleanup
* minor fixes
* Fix issues:
- Make sure all `align` instructions for non-adaptive fall under same IG
- Convert some variables to `unsigned short`
- Fixed the maxPadding amount for adaptive alignment calculation
* Other fixes
* Remove align_loops flag from coreclr
* Review feedback
- Do not align loop if it has call
- Created `emitSetLoopBackEdge()` to isolate `emitCurIG` inside emitter class
- Created `emitOutputAlign()` to move the align instruction output logic
- Renamed emitVariableeLoopAlign() to emitLongLoopAlign()
- Created `optIdentifyLoopsForAlignment()` to identify loops that need alignment
- Added comments at various places
* jit format
* Add FEATURE_LOOP_ALIGN
* remove special case for align
* Do not propagate BBF_LOOP_ALIGN in certain cases
* Introduce instrDescAlign and emitLastAlignedIgNum
* Several changes:
- Perform accurate padding size before outputting align instruction
- During outputting, just double check if the padding needed matches to what was calculated.
- If at any time, instruction sizes are over-estimated before the last align instruction,
then compensate them by adding NOP.
- As part of above step, do not perform encoding "VEX prefix shortening" if there is align
instruction in future.
- Fix edge cases where because of loop cloning or resolution phase of register allocator, the
loops are marked such that they cover the loops that are already mark for alignment. Fix by
resetting their IGF_LOOP_ALIGN flag.
- During loop size calculation, if the last IG also has `align` flag, then do not take into account
the align instruction's size because they are reserved for the next loop.
* jit format
* fix issue related to needLabel
* align memory correctly in superpmi
* Few more fixes:
- emitOffsAdj takes into account for any mis-prediction of jump. If we compensate that mis-prediction, that off that adjustment.
- Record the lastAlignIG only for valid non-zero align instructions
* minor JITDUMP messages
* Review comments
* missing check
* Mark the last align IG the one that has non-zero padding
* More review comments
* Propagate BBF_LOOP_ALIGN for compacting blocks
* Handle ALIGN_LOOP flag for loops that are unrolled
* jit format
* Loop size upto last back-edge instead of first back-edge
* Take loop weight in consideration
* remove align flag if loop is no longer valid
* Adjust loop block weight to 4 instead of 8
* missing space after rebase
* fix the enum values after rebase
* review feedback
* Add missing #ifdef DEBUG
Alex Covington [Tue, 12 Jan 2021 02:30:28 +0000 (18:30 -0800)]
Gtneg mul divoptimizations (#45604)
* GT_NEG optimization for multiplication and division
* Distribute negation over parenthetical multiplication or division.
* Removing duplicate logic that I had put in accidently.
* Check overflow and other conditions before performing morph
* Resolved merge conflict and cleanup morph.cpp
* Formatting morph.cpp
* Returning tree after performing smpop again to fix flags
* Formatting
* Added check for optimizations, formatting.
* Using gtIsActiveCSE_Candidate instead of fgGlobalMorph
* Update src/coreclr/jit/morph.cpp
Co-authored-by: Sergey Andreenko <seandree@microsoft.com>
* Formatting
* delete formatting changes.
* Add a test.
* Change the conditions a bit.
* Better names for the tests.
Co-authored-by: Sergey Andreenko <seandree@microsoft.com>
Simon Nattress [Tue, 12 Jan 2021 02:20:04 +0000 (18:20 -0800)]
R2RDump improvements (#46833)
* Fix handling of module override token in signature parser. When the override is present, a new SignatureDecoder is created and used as the decoder for the final signature with the fixup kind (and module override flag which is stored in the upper bit of the fixup kind byte) already parsed. This causes the remainder of the signature to be parsed as a full R2R signature which is now missing the fixup type.
* Instead of creating a new decoder when a module override is present, set up the initial decoder's metadata reader in the constructor by detecting the module override up front.
* Fix `TryLocateNativeReadyToRunHeader` to swallow `BadImageFormatException` and return true / false whether the image has a native R2R header (for composite images).
* Running R2RDump on IL assemblies with no R2R now emits an error message that the assembly is not R2R instead of an unhelpful error about some RVA offset conversion failing.
Eric Erhardt [Tue, 12 Jan 2021 02:17:20 +0000 (20:17 -0600)]
Remove unnecessary .sln file in System.Runtime.Serialization.Formatters (#46839)
Eric Erhardt [Tue, 12 Jan 2021 00:35:47 +0000 (18:35 -0600)]
Resolve ILLink warnings in System.Reflection.DispatchProxy (#46715)
* Resolve ILLink warnings in System.Reflection.DispatchProxy
I also took this chance to remove unnecessary GetTypeInfo() calls, since some of them needed to be removed.
Contributes to #45623
* Update annotations for PR feedback.
Remove DynamicallyAccessedMemberTypes.All from the interface and base class types. If unused members are trimmed, this won't cause problems with DispatchProxy.
* Add a trimming test for DispatchProxy since we are suppressing ILLinker warnings.
Zoltan Varga [Tue, 12 Jan 2021 00:33:07 +0000 (19:33 -0500)]
Quiet the output from emsdk_env.sh to make the build less verbose. (#46780)
* Quiet the output from emsdk_env.sh to make the build less verbose.
* Quiet mono-cil-strip as well.
Johan Lorensson [Mon, 11 Jan 2021 22:27:13 +0000 (23:27 +0100)]
Disable Speech Tests on Mono. (#46828)
Mono on netcore doesn't support COM wrappers that System.Speech depends
on. Disable System.Speech.Tests on Mono.
Vladimir Sadov [Mon, 11 Jan 2021 21:44:55 +0000 (13:44 -0800)]
No need to handle COR_E_STACKOVERFLOW when waiting for GC. (#46733)
* remove TSNC_WaitUntilGCFinished, noone checks for it
* remove TS_BlockGCForSO, the secenario no longer can happen.
* unused flag related to user-requested thread suspension
Stephen Toub [Mon, 11 Jan 2021 21:00:26 +0000 (16:00 -0500)]
Improve OidLookup.ToLookup perf, in particular for X509Certificate2.Extensions (#46819)
* Avoid OidLookup.ToOid call per extension in X509Certificate2.Extensions
`X509Certificate2.Extensions` invokes `CertificatePal.Extensions`, which in turn creates the extensions collection, invoking `new Oid(string)` for each. This in turn calls `OidLookup.ToOid` in order to gather the friendly name, even though in many situations, no one actually cares about the friendly name. We can instead call `new Oid(string, null)`, which makes the friendly name lazily initialized on first use, saving the `OidLookup.ToOid` call when it's not needed, and significantly reducing the time to call Extensions (in particular when the predefined OID lookup tables don't contain the OID for an extension and when it can't be found on lookup).
* Allow OidLookup.ToOid to cache failure
ToOid has a cache, but it only caches successful results. If ToOid fails to find the relevant OID, nothing is cached, which makes the failure path very expensive, as every ToOid call for that OID takes the slow path. This lets it be cached.
Adam Sitnik [Mon, 11 Jan 2021 20:06:05 +0000 (21:06 +0100)]
Fix PostEvictionCallbacks bug (#46807)
* add a failing test
* fix the actual bug (this was not a CacheEntry but a CacheEntryTokens instance here)
Tomas Weinfurt [Mon, 11 Jan 2021 19:32:11 +0000 (11:32 -0800)]
fix SslStreamCertificateContext.Create with partial chain (#46664)
* fix SslStreamCertificateContext.Create with partial chain
* add test with long partial chain
Aleksey Kliger (λgeek) [Mon, 11 Jan 2021 18:13:10 +0000 (13:13 -0500)]
[Mono] Initial metadata update support (#45612)
* Initial metadata-update prototype
Co-Authored-By: Bernhard Urban-Forster <lewurm@gmail.com>
* Add metadata-update.{c,h} to CMakeLists.txt
* Add icall to corelib
* Add console and browser metadata update samples
Both samples depend on the roslynildiff tool which should be specified with a RoslynILDiffFullPath property in the .csproj files for the projects.
* Add README for mbr samples
* [build] Add initial runtime support for MonoMetadataUpdate property
In the runtime defines cmake ENABLE_METADATA_UPDATE option and sets a preprocessor flag.
In System.Private.CoreLib, defines FEATURE_METADATA_UPDATE and uses it to throw a NotSupportedException from LoadMetadataUpdate
* [runtime] ifdef out metadata updates if not enabled
Also move execution engine initialization into the main update function and use a MonoError to signal failures (such as if interp inlining is not turned off) instead of asserting at startup.
* [wasm] set log mask to metadata-update
* [mbr] Add InjectUpdate fn to sample
* [metadata-update] don't merge heaps
* Don't make entrypoint public yet
* Add LoadMetadataUpdate to linker descriptor
* [wasm] add default Makefile variable value
* fix mono/mono CI
don't try to run enc tests yet since they depend on roslynildiff
* remove mono/mono/tests/enc
Will add as runtime tests in a future PR
* [metadata-update] Add per-thread exposed generation
A thread has to voluntarily roll up to the latest published generation in order to see updates.
- Roll up to the latest published generation when attaching a thread
- The updater thread sees the allocated unpublished generation
* [mbr] Fixup console sample
Use a single changing testfile
* [metadata-update] delete unused method
* [mbr] Use 2 threads in console sample
* [metadata-update] Respect exposed generation in MethdDef RVA lookups
* [interp] Expose latest metadata update before transforming methods
* [mbr] Update samples after rebase
Use the WasmApp.targets
* [metadata-update] Don't fail after the first unsupported edit
Log all the unsupported edits, then cancel the update
* [metadata_update] Keep track of logical table sizes for deltas
Keep track of inserted/modified rows for each table in each delta. This will help to use a simpler algorithm to locate effective table rows by keeping track of the logical number of rows in the appended tables
* [metadata-update] Use a GList for MonoImage:delta_image
We're going to need to walk backwards from the latest published delta
* [metadata-update] add effective table lookup debug output
* Address review feedback
* [interp] Save top interp frame at MINT_SAFEPOINT to ThreadContext
Give metadata updates a peek at the interp frames since the LMF so that it can copy the InterpMethods that are currently executing
This only works with hybrid and full coop suspend. Preemptive suspend will need another mechanism.
* [mbr] Extend console sample
Add a busy thread to demonstrate that interp frames since the last managed frame are visible to the metadata update mechanism and the active method bodies are copied before being invalidated.
* [interp] Check mono_polling_required at safepoint
Co-authored-by: Bernhard Urban-Forster <lewurm@gmail.com>
LateApexEarlySpeed [Mon, 11 Jan 2021 17:36:26 +0000 (01:36 +0800)]
issue-46477 Fix issue about checking last char in datetime string. (#46614)
* issue-46477 Fix issue about checking last char in datetime string.
* issue-46477 Fix comment: Add more tests with timezone part.
Andy Ayers [Mon, 11 Jan 2021 16:27:00 +0000 (08:27 -0800)]
JIT: suppress edge weight second computation pass (#46779)
Follow up to #45615.
We compute edge weights twice. Make sure we either enable or suppress
both the computations.
Ankit Jain [Mon, 11 Jan 2021 16:24:39 +0000 (11:24 -0500)]
[wasm] Fix running on browsers missing SharedArrayBuffer (#46784)
Recently we added:
`BINDING.mono_sab_supported: typeof SharedArrayBuffer !== "undefined"`
.. which is meant to guard use of `SharedArrayBuffer` on browsers that
don't support it. But the final dotnet.js seems to check this at build
time itself, and converts the above to:
`BINDING.mono_sab_supported: true`
.. which causes errors on Safari (for example):
```
[Error] Unhandled Promise Rejection: ReferenceError: Can't find variable: SharedArrayBuffer
onPendingRequestComplete (dotnet.js:1:149348)
processFetchResponseBuffer (dotnet.js:1:149582)
processFetchResponseBuffer
promiseReactionJob
```
Instead, we can use the type check directly.
Ivan Kochurkin [Mon, 11 Jan 2021 15:41:37 +0000 (18:41 +0300)]
Use Math.DivRem instead of / % in BigInteger if dividend and divisor are trivial (#45230) (#46711)
Miha Zupan [Mon, 11 Jan 2021 15:17:15 +0000 (16:17 +0100)]
Simplify Uri UnicodeEquivalent helper (#46747)
hopeko [Mon, 11 Jan 2021 14:29:31 +0000 (22:29 +0800)]
Fix the position of the comment (#46806)
Shreyas Jejurkar [Mon, 11 Jan 2021 13:10:38 +0000 (18:40 +0530)]
Minor refactoring to collections (#46506)
* Minor refactoring to collections
1. Removed unwanted casting.
2. Added condition for Clear() method for SortedDictionary.
* Addressed PR feedback.
Removed unwated Clear condition.
* Addressed PR feedback.
1. Fixed spacing.
Ryan Lucia [Mon, 11 Jan 2021 13:05:54 +0000 (08:05 -0500)]
[mono] Add DISABLE_NONBLITTABLE for non-blittable marshaling (#46444)
This flag is not set by default on any platforms, but long-term it should be useful on wasm with the pinvoke generator work being done by the interop team.
This flag reduces around 13k in dotnet.wasm as of today (12/29/2020). However, that is a fairly low-end measurement because this PR only focused on the pinvoke marshaling rather than the full functionality. The structure of our marshaling callbacks means that even with icall linking, a lot of marshaling code will be kept around and unused, including all the string marshaling.
To solve this, we can either give up on the ilgen functionality being in a separate library so it gets linked our normally or we can just have this flag cover marshaling functionality as a whole. I've split that part off into a followup PR since it's more likely to be contested, but I implemented the latter option (and also disable things like certain JIT icalls for the same reason). We also will want analyzers set up before this is useful, so hopefully this solution is fine in combination with an extra analyzer for the marshaling methods in question?
Johan Lorensson [Mon, 11 Jan 2021 07:42:51 +0000 (08:42 +0100)]
Fix Mono Windows x64 crash blocking CI Windows x64 Release job. (#46573)
After upgrade to later msvc version on CI boots, see
https://github.com/dotnet/runtime/issues/45524 for details,
Window x64 Release builds started to crash on libraries tests.
After investigation it turns out that new msvc compiler handles an
expression different compared to how it was handled in previous version.
After upgrade of msvc, the expression:
int _amd64_width_temp = ((guint64)(imm) == (guint64)(int)(guint64)(imm));
implemented in amd64_mov_reg_imm and then called from tramp-amd64.c@500
was transformed into an always true expression by compiler:
amd64_mov_reg_imm (code, AMD64_R11, (guint8*)mono_get_rethrow_preserve_exception_addr ());
lea rcx,[rethrow_preserve_exception_func (07FFB9E33A590h)]
mov word ptr [rbx+0Dh],0BB41h
mov byte ptr [rbx+0Fh],cl
mov rax,rcx
shr eax,8
mov byte ptr [rbx+10h],al
mov rax,rcx
shr eax,10h
shr ecx,18h
mov byte ptr [rbx+11h],al
lea rax,[rbx+13h]
mov byte ptr [rbx+12h],cl
as seen above, the condition and handling of a 64-bit imm has been
dropped by compiler.
This cause issues when the imm is a 64-bit value since it will always gets
truncated into 32-bit imm and in this case it was a pointer to a function
within coreclr.dll (mono_get_rethrow_preserve_exception_addr)
loaded located at higher address (using more than 32-bit).
This is most likely a regression issue in compiler for this specific
construction. I tried simpler construction (using same type conversion) on
both old and new compiler version and then it makes the right optimization.
Fix is to switch to a macro already available in amd64-codegen (amd64_is_imm32)
detecting if an imm needs a 32-bit or 64-bit sized value. This will be
correctly optimized by new msvc compiler and even if this is a work around
for a what seems to be a optimization bug in the compiler, it is still
cleaner and better describes the intent than current code.
Fix also re-enable Windows x64 Release CI test lane.
Jan Jahoda [Mon, 11 Jan 2021 01:09:52 +0000 (02:09 +0100)]
Disable the test (#46752)
Co-authored-by: Jan Jahoda <jajahoda@.microsoft.com>
Tomáš Rylek [Sun, 10 Jan 2021 21:06:44 +0000 (22:06 +0100)]
Add recursion / thread interaction guard in LogInfoForFatalError (#46561)
Based on local instrumentation I introduced while investigating
issues related to the switch-over to compile System.Private.CoreLib
using Crossgen2 I'm proposing to harden fatal exception handling
against nested and concurrent fatal error occurrences.
Thanks
Tomas
Zoltan Varga [Sat, 9 Jan 2021 21:44:16 +0000 (16:44 -0500)]
Fix the allocation of the acfg->cfgs array, it would have an incorrect size when using profiled AOT. (#46781)
Fixes https://github.com/dotnet/runtime/issues/46746.
dotnet-maestro[bot] [Sat, 9 Jan 2021 15:57:05 +0000 (15:57 +0000)]
[master] Update dependencies from dotnet/runtime-assets dotnet/arcade (#46744)
[master] Update dependencies from dotnet/runtime-assets dotnet/arcade
Bruce Forstall [Sat, 9 Jan 2021 00:03:11 +0000 (14:03 -1000)]
Fix parsing of JIT-EE version GUID (#46773)
With https://github.com/dotnet/runtime/pull/46116, a copy of the
actual first line of the GUID definition was added as a comment.
Unfortunately, the superpmi.py GUID parser was finding that one
instead of the actual GUID. Fix the parser to match from the
beginning of the line.
James Newton-King [Fri, 8 Jan 2021 21:46:50 +0000 (10:46 +1300)]
HTTP/3: Fix decoding trailing headers (#46734)
Dan Moseley [Fri, 8 Jan 2021 20:58:27 +0000 (12:58 -0800)]
Disable some Speech tests on Server Core (#46756)
David Mason [Fri, 8 Jan 2021 20:05:41 +0000 (12:05 -0800)]
add shutdown guard to profiler tests (#46739)
Zoltan Varga [Fri, 8 Jan 2021 19:03:42 +0000 (14:03 -0500)]
Fix void returns in llvmonly runtime invokes. (#46735)
Tanner Gooding [Fri, 8 Jan 2021 18:27:22 +0000 (10:27 -0800)]
Adding System.Math overloads for nint/nuint (#46647)
* Adding System.Math overloads for nint/nuint
* Adding a missing cast
* Fixing the Clamp_NInt and Clamp_NUInt tests to work with the provided MemberData