platform/upstream/dotnet/runtime.git
4 years agoMerge commit '6ccc72a9df472b2e1efd10d0c3493d580a9992ca' into di-external
Maryam Ariyan [Wed, 3 Jun 2020 15:57:44 +0000 (08:57 -0700)]
Merge commit '6ccc72a9df472b2e1efd10d0c3493d580a9992ca' into di-external

4 years agoARM/ARM64: Optimize virtual call stub for R2R and JIT (#36817)
Kunal Pathak [Thu, 28 May 2020 01:04:17 +0000 (18:04 -0700)]
ARM/ARM64: Optimize virtual call stub for R2R and JIT (#36817)

Optimize virtual call stub for R2R ARM/ARM64 scenarios

4 years agoLoosen property name collision detection involving hidden properties (#36936)
Layomi Akinrinade [Wed, 27 May 2020 23:59:48 +0000 (19:59 -0400)]
Loosen property name collision detection involving hidden properties (#36936)

* Loosen property name collision detection involving hidden properties

* Delay ignored prop cache creation; add more tests

* Clarify comments

4 years agoAdd ICU App-Local support on Mono (#37037)
Santiago Fernandez Madero [Wed, 27 May 2020 23:37:44 +0000 (16:37 -0700)]
Add ICU App-Local support on Mono (#37037)

* Add ICU App-Local support on Mono

* PR Feedback

4 years agoMerge commit 'a6e9098ffc9adf987be1' into di-external
Maryam Ariyan [Wed, 27 May 2020 23:07:52 +0000 (16:07 -0700)]
Merge commit 'a6e9098ffc9adf987be1' into di-external

4 years agoFix multi-reg copy (#37062)
Carol Eidt [Wed, 27 May 2020 22:02:47 +0000 (15:02 -0700)]
Fix multi-reg copy (#37062)

Also, fix dump for multi-reg copy.

Fix #37059

4 years ago[master] Update dependencies from mono/linker dotnet/xharness (#37051)
dotnet-maestro[bot] [Wed, 27 May 2020 17:11:49 +0000 (17:11 +0000)]
[master] Update dependencies from mono/linker dotnet/xharness (#37051)

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

Microsoft.NET.ILLink.Tasks
 From Version 5.0.0-preview.3.20271.1 -> To Version 5.0.0-preview.3.20276.2

* Update dependencies from https://github.com/dotnet/xharness build 20200527.1

Microsoft.DotNet.XHarness.Tests.Runners
 From Version 1.0.0-prerelease.20275.1 -> To Version 1.0.0-prerelease.20277.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
4 years agouddate Ubuntu and Alpine RID (#37031)
Tomas Weinfurt [Wed, 27 May 2020 16:46:41 +0000 (09:46 -0700)]
uddate Ubuntu and Alpine RID (#37031)

Co-authored-by: Tomas Weinfurt <furt@DESKTOP-0J9757E.corp.microsoft.com>
4 years agoImprove test ALPN detection (#36928)
Tomas Weinfurt [Wed, 27 May 2020 16:35:05 +0000 (09:35 -0700)]
Improve test ALPN detection (#36928)

* Improve test ALPN detection

* feedback from review

* add tvos

* update casing

4 years agoFix build with FEATURE_GDBJIT enabled (#37054)
Kirill Frolov [Wed, 27 May 2020 15:30:20 +0000 (18:30 +0300)]
Fix build with FEATURE_GDBJIT enabled (#37054)

This commit fixes broken build in case when following arguments added to
build.sh script: --cmakeargs -DFEATURE_GDBJIT=true

4 years agoEnable jumps4 tests, since the issue has been fixed via mono/mono PR #19809 (#37015)
Fan Yang [Wed, 27 May 2020 15:21:49 +0000 (11:21 -0400)]
Enable jumps4 tests, since the issue has been fixed via mono/mono PR #19809 (#37015)

4 years agoAdd a BundleTestWasmApp target to build wasm test apps for libraries. (#36739)
Zoltan Varga [Wed, 27 May 2020 14:37:31 +0000 (10:37 -0400)]
Add a BundleTestWasmApp target to build wasm test apps for libraries. (#36739)

Beginning of a BundleTestWasmApp target to build wasm test apps for libraries.

4 years agoUpdate the -vs switch and add docs for it (#37026)
Viktor Hofer [Wed, 27 May 2020 13:59:38 +0000 (15:59 +0200)]
Update the -vs switch and add docs for it (#37026)

* Remove testhost DOTNET_ROOT from vs switch

We don't need to point to the testhost folder anymore for libraries for
supporting VS Test Explorer.

* Update docs

* Fix verbosity alias

4 years agoReduce app size for iOS (#36902)
Egor Bogatov [Wed, 27 May 2020 13:57:20 +0000 (16:57 +0300)]
Reduce app size for iOS (#36902)

We did the same mistake for Android - `libmonosgen-2.0.dylib` shouldn't be copied to bundle (we already have a mono runtime there)

4 years agoMake ApkBuilder less verbose (#37050)
Egor Bogatov [Wed, 27 May 2020 13:56:10 +0000 (16:56 +0300)]
Make ApkBuilder less verbose (#37050)

The output is still pretty useful and x4 times less verbose.

4 years ago[browser][wasm] InteropServices.JavaScript backing code. (#37044)
Kenneth Pouncey [Wed, 27 May 2020 09:12:39 +0000 (11:12 +0200)]
[browser][wasm] InteropServices.JavaScript backing code. (#37044)

4 years ago[interp] Remove return value indirection (#37004)
Vlad Brezae [Wed, 27 May 2020 08:57:58 +0000 (11:57 +0300)]
[interp] Remove return value indirection (#37004)

* [interp] Remove return value indirection

When returning from a method we used to save the return value into frame->retval. We would then have separate opcodes for normal and void call and, depending on the type of call, we would access the retval and push it on the stack. In case of valuetype returns, the value is not returned in the proper space so we have an additional MINT_VTRESULT that copies the return around in the caller frame. In addition to this we had retval, is_void locals, saved as part of the current frame state which just make things confusing and are not needed.

This commit simplifies the call procedure by completely moving the responsability of the return to the called method. Simply put, once a method is ready for the call, it will leave its stack and vtstack to the state after pop-ing the arguments. The called method will then directly push the result to the parent frame's stack/vtstack. This means the calling code doesn't care about the type of the return anymore, the IL instructions after the call will just expect the return on the stack, if any, and use it naturally.

We still make use of frame->retval for interp entry frames (since we don't have a parent frame to push to), for pinvoke and jit_call frames out of convenience, but we should consider removing this variable to further trim down InterpFrame.

* [interp] Remove call opcodes that are no longer necessary

* [interp] Split up CALL and CALLVIRT opcodes

MINT_CALLVIRT is soon to be removed while MINT_CALL is the most common call opcode.

* [interp] Fix jit calls done through MINT_CALLVIRT

The callee should push the vt stack if there is a vt return, except when we are calling out of the interpreter, in which case the calling opcodes handle the push explicitly. We weren't handling the case of exiting the interpreter when doing a jit call through MINT_CALLVIRT. In order to keep the same structure for MINT_CALLVIRT, which doesn't need to know about the vt_res_size, we handle the vtstack change when doing a jit call by caching the return size in the InterpMethod, together with other jit_call information. Maybe we can refactor this later.

* [interp] Cleanup call opcode emitting

Add the opcode and set its data in the same place, making the code
easier to follow.

* [interp] Split up MINT_CALL_NAT in 2 opcodes

This opcode had two different cases embedded in it. Clean up the code,
split the opcode in two, removing also a dirty recursive call.

* [tests] Disable a few tests that fail with this PR due to false pinning

There are over a hundred tests calling GC.WaitForPendingFinalizers and potentially flaky with mono. We might have to disable all of them or tweak them to be mono friendly.

4 years agoAvoid HttpClientHandler.ServerCertificateCustomValidationCallback keeping first reque...
Stephen Toub [Wed, 27 May 2020 08:29:11 +0000 (04:29 -0400)]
Avoid HttpClientHandler.ServerCertificateCustomValidationCallback keeping first request message alive (#37021)

4 years agoRuyJIT: `Array.Length / cns` can be converted to unsigned div (mod) (#32368)
Egor Bogatov [Wed, 27 May 2020 05:52:18 +0000 (08:52 +0300)]
RuyJIT: `Array.Length / cns` can be converted to unsigned div (mod) (#32368)

* Optimize `array.Length / cns` and `array.Length % cns` if cns is positive

* Address feedback

4 years agoFix a couple of bugs in multi-reg stores (#36994)
Carol Eidt [Wed, 27 May 2020 04:56:16 +0000 (21:56 -0700)]
Fix a couple of bugs in multi-reg stores (#36994)

* Fix a couple of bugs in multi-reg stores

Fix #36912

4 years agoEnsure Vector3 inequality doesn't use the hidden 4th element (#36953)
Tanner Gooding [Wed, 27 May 2020 03:48:14 +0000 (20:48 -0700)]
Ensure Vector3 inequality doesn't use the hidden 4th element (#36953)

* Renable Vector3InequalityTest

* Fixing ARM64 LowerHWIntrinsicCmpOp to always treat the extra element of a TYP_SIMD12 as equivalent

* Adding a regression test for Vector3InequalityTest

* Update src/coreclr/src/jit/lowerarmarch.cpp

Co-authored-by: Carol Eidt <carol.eidt@microsoft.com>
* Applying formatting patch

Co-authored-by: Carol Eidt <carol.eidt@microsoft.com>
4 years agoAlign assembler mnemonics and operands in R2RDump (#37034)
Anton Lapounov [Wed, 27 May 2020 03:44:23 +0000 (20:44 -0700)]
Align assembler mnemonics and operands in R2RDump (#37034)

* Align assembler mnemonics and operands in R2RDump.
* For ARM64 images dump instruction bytes as 4-byte hexadecimal integers.
* Fix incorrect usage of _methods.Count.
* Fix the corrupted R2RFormat.png file.

4 years agoDisable AddThresholdTest in all archs (#37032)
Santiago Fernandez Madero [Wed, 27 May 2020 03:02:09 +0000 (20:02 -0700)]
Disable AddThresholdTest in all archs (#37032)

4 years agoUse nint instead of IntPtr in _RegisterFrozenSegment. (#37029)
Eric Erhardt [Wed, 27 May 2020 02:55:46 +0000 (21:55 -0500)]
Use nint instead of IntPtr in _RegisterFrozenSegment. (#37029)

4 years agorearrange tfms for intellisense (#37027)
Anirudh Agnihotry [Wed, 27 May 2020 00:43:37 +0000 (17:43 -0700)]
rearrange tfms for intellisense (#37027)

4 years agoSimple sideloaded profile guided optimization support (#36887)
Andy Ayers [Tue, 26 May 2020 23:26:53 +0000 (16:26 -0700)]
Simple sideloaded profile guided optimization support (#36887)

1. Add code so the runtime can read profile data from a text file and then
make this data available to the jit, so it will be easier to test the jit's
behavior when profile data is available.
2. Add code so the runtime can create profile text files by telling the jit
to insert probes into jitted code that write into a persistent buffer, which
is saved to text at shutdown. This is mainly intended to make creation of the
sideloaded profile data files easier, since their internal structure must
exactly match artifacts from jitted methods.
3. Add a mode where jit-instrumented Tier0 code can feed counts into Tier1
jitting. This is an experiment to see what benefit, if any, might accrue from
having  profile data available for Tier1 jitting.

External format is text so it can be edited by hand or checked into the repo
alongside tests. Binary format would be more compact but opaque.

In all cases the jit internally sees a profile buffer identical to the one it
sees with IBC; the only minor changes in the jit are to initialize the count
field of each probe entry to zero and to only emit the entry helper call for
prejitted IBC.

Only root methods are instrumented, and only root method blocks are given
profile weights. Broadening to handle inlinees is future work, facilitated by
the new capabilites added here.

4 years agoUpdate runtime providers' context object on EventPipe rundown (#36733)
Sung Yoon Whang [Tue, 26 May 2020 23:13:47 +0000 (16:13 -0700)]
Update runtime providers' context object on EventPipe rundown (#36733)

* Disable EventPipeProvider Context for runtime providers on EventPipe rundown

* Add comments per code review feedback

* fix GCC build

4 years agoAdd dotnet.js to sign exclusion list (#37033)
Santiago Fernandez Madero [Tue, 26 May 2020 23:13:15 +0000 (16:13 -0700)]
Add dotnet.js to sign exclusion list (#37033)

4 years agoFix bad refcount management in ComWrappers WeakReference test. (#37022)
Jeremy Koritzinsky [Tue, 26 May 2020 22:03:11 +0000 (15:03 -0700)]
Fix bad refcount management in ComWrappers WeakReference test. (#37022)

4 years agomerge with master
Sung Yoon Whang [Tue, 26 May 2020 21:55:51 +0000 (14:55 -0700)]
merge with master

4 years agoPorting some patches from sourcebuild to runtime (#36861)
Anirudh Agnihotry [Tue, 26 May 2020 21:46:02 +0000 (14:46 -0700)]
Porting some patches from sourcebuild to runtime (#36861)

* porting some patches from sourcebuild to runtime

* Update src/installer/Directory.Build.props

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
* lowercase or

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
4 years agofix GCC build
Sung Yoon Whang [Tue, 26 May 2020 21:32:15 +0000 (14:32 -0700)]
fix GCC build

4 years agoOptimization to remove redundant zero initializations. (#36918)
Eugene Rozenfeld [Tue, 26 May 2020 21:18:21 +0000 (14:18 -0700)]
Optimization to remove redundant zero initializations. (#36918)

* Optimization to remove redundant zero initializations.

This change adds a phase iterates over basic blocks starting with
the first basic block until there is no unique basic block successor
or until it detects a loop. It keeps track of local nodes it encounters.
When it gets to an assignment to a local variable or a local field,
it checks whether the assignment is the first reference to the local
(or to the parent of the local field), and, if so, it may do one of two
optimizations:
1. If the following conditions are true:
        the local is untracked,
        the rhs of the assignment is 0,
        the local is guaranteed to be fully initialized in the prolog,
   then the explicit zero initialization is removed.
2. If the following conditions are true:
        the assignment is to a local (and not a field),
        the local is not lvLiveInOutOfHndlr or no exceptions can be thrown
             between the prolog and the assignment,
        either the local has no gc pointers or there are no gc-safe points
             between the prolog and the assignment,
    then the local is marked with lvHasExplicitInit, which tells the codegen
    not to insert zero initialization for this local in the prolog.

This addresses one of the examples in #2325 and 5 examples in #1007.

4 years agoBump crossgen2 dependencies (#37017)
Jan Kotas [Tue, 26 May 2020 21:12:51 +0000 (14:12 -0700)]
Bump crossgen2 dependencies (#37017)

Unify on the latest version of System.CommandLine

4 years agoSingle-File: Run from Bundle (#36052)
Swaroop Sridhar [Tue, 26 May 2020 21:08:48 +0000 (14:08 -0700)]
Single-File: Run from Bundle (#36052)

* Single-File: Run from Bundle

This change implements:

* Runtime changes necessary to load assemblies directly from the bundle:
    * Design notes about [Load from Bundle](https://github.com/dotnet/designs/blob/master/accepted/2020/single-file/design.md#peimage-loader)
    * Most of these changes are directly from https://github.com/dotnet/coreclr/pull/26504 and https://github.com/dotnet/coreclr/pull/26904

* Hostpolicy change to not add bundled assemblies to TPA list:
    * Design notes about [Dependency Resolution](https://github.com/dotnet/designs/blob/master/accepted/2020/single-file/design.md#dependency-resolution)
    * TBD (separately) items: Fix for hammer servicing #36031

Fixes #32822

* Address some code review feedback

* Address futher review feedback

* Fix Assembly.ni.dll and Assembly.dll path usage.
* Remove unused full-path computation for corelib when loading from bundle.
* Add tracing when loading from bundle.
* Add bundle-probing for satellite assemblies.
* Adapt the BundleRename test to the .net5 scenario where assemblies are loaded from bundle.

4 years agoFix incorrect filtering operation in EventPipeHelper::IsEnabled (#36933)
Sung Yoon Whang [Tue, 26 May 2020 21:03:22 +0000 (14:03 -0700)]
Fix incorrect filtering operation in EventPipeHelper::IsEnabled (#36933)

4 years ago[mono] Remove unaligned apk after Sign step (#37018)
Egor Bogatov [Tue, 26 May 2020 19:52:33 +0000 (22:52 +0300)]
[mono] Remove unaligned apk after Sign step (#37018)

We don't need two *.apk files in the output dir

4 years agoBuilding coreclr and installer with true sourceBuildFlag (#36854)
Anirudh Agnihotry [Tue, 26 May 2020 18:44:48 +0000 (11:44 -0700)]
Building coreclr and installer with true sourceBuildFlag (#36854)

* Building coreclr and installer with true sourceBuildFlag

* removing the old ci leg

4 years agoFix binplacing WASM files for in-tree runtime pack (#36985)
Alexander Köplinger [Tue, 26 May 2020 18:19:02 +0000 (20:19 +0200)]
Fix binplacing WASM files for in-tree runtime pack (#36985)

It got broken by https://github.com/dotnet/runtime/pull/36781.

4 years agoTracking how much memory is committed per object heap (#36731)
Andrew Au [Tue, 26 May 2020 18:09:17 +0000 (11:09 -0700)]
Tracking how much memory is committed per object heap (#36731)

4 years agoImprove System.Text.Json coverage (#32341) (#36919)
Josh Schreuder [Tue, 26 May 2020 17:15:51 +0000 (03:15 +1000)]
Improve System.Text.Json coverage (#32341) (#36919)

* Remove unused method on JsonClassInfo (#32341)

* Add test coverage for a couple of validation branches in JsonWriterHelper (#32341)

Co-authored-by: Josh Schreuder <josh.schreuder@gmail.com>
4 years agoDocument disabling ApiCompat checks (#37011)
Eirik Tsarpalis [Tue, 26 May 2020 16:50:18 +0000 (17:50 +0100)]
Document disabling ApiCompat checks (#37011)

* Document disabling ApiCompat checks

4 years agoUpdate hosted pools for publish to BAR (#36832)
Matt Mitchell [Tue, 26 May 2020 16:06:45 +0000 (09:06 -0700)]
Update hosted pools for publish to BAR (#36832)

Reduce contention on the internal build pools

4 years agoSwitch to getCacheDir if getExternalFilesDir is not available (#37009)
Egor Bogatov [Tue, 26 May 2020 15:43:13 +0000 (18:43 +0300)]
Switch to getCacheDir if getExternalFilesDir is not available (#37009)

4 years agoAddress futher review feedback
Swaroop Sridhar [Sun, 24 May 2020 09:40:17 +0000 (02:40 -0700)]
Address futher review feedback

* Fix Assembly.ni.dll and Assembly.dll path usage.
* Remove unused full-path computation for corelib when loading from bundle.
* Add tracing when loading from bundle.
* Add bundle-probing for satellite assemblies.
* Adapt the BundleRename test to the .net5 scenario where assemblies are loaded from bundle.

4 years agoAdd SIMD acceleration for Matrix4x4.Invert #34394 (#36323)
Erhan Atesoglu [Tue, 26 May 2020 14:51:23 +0000 (07:51 -0700)]
Add SIMD acceleration for Matrix4x4.Invert #34394 (#36323)

* Add SIMD acceleration for Matrix4x4.Invert #34394

Fix for #34394.

Added SIMD hardware acceleration support to the Matrix4x4.Invert function.

* Add link to source and update THIRD-PARTY-NOTICES.TXT

Added the link to Microsoft/DirectXMath source code and appended license to THIRD-PARTY-NOTICES.TXT

* Add test for non-invertable matrix.

Given a Matrix4x4 of only rank 3 test to see the matrix is non-invertable.

* Typo fixed in new test case

* Fixed formating for test matrix.

* Fix for missing return statement.

* Add suggested fixes to Matrix4x4.Invert

Update containing all suggested fixes.

* Added missing using statement

Added missing using statement for Internal.Runtime.CompilerServices.Unknown static object.

* Use abbreviated constructor for Vector128

* Moved implementations into local functions

Moved the SSE implementation and SoftwareFallback to local functions of Invert.

4 years agoInitial work of porting native diagnostic eventpipe library to C. (#34600)
Johan Lorensson [Tue, 26 May 2020 13:28:53 +0000 (15:28 +0200)]
Initial work of porting native diagnostic eventpipe library to C. (#34600)

First bulk of changes related to porting EventPipe C++ library from
CoreCLR into a C library that can be shared between Mono as well as
CoreCLR runtime.

Due to dependencies and current time line it has been decided to
initially target Mono runtime (since it doesn't have event pipe
functionality at the moment), but library is still designed to
integrate into other runtimes, replacing current C++ library
implementation, when time permits.

Until that happens, we will need to make sure changes done in C++
code base gets ported over to C library. The amount of changes going
into the native library should however be small and if major changes
needs to be done, we should first make sure to move over to use the
shared version of event pipe C-library in CoreCLR and then only do
changes into shared version of the library.

Port is currently mapping existing C++ code base, no focus on rewrite
or change current implementation (unless needed to port code over to C).

Library source files are currently placed into mono/eventpipe folder
and build as a separate library, linked into runtime, but will be
moved when ready to be shared between runtimes. We might also move
all code into a loadable library and p/invokes, depending on size,
at least for Mono runtime targeting mobile devices.

There is also a unit test runner under mono/eventpipe/tests using
eglib test runner, running through a set of unit tests covering
the eventpipe library implementation.

Library is split up over a couple of source files closely mapping
corresponding coreclr source files. Most code could be shared between
runtimes and artifacts that are runtime specific, like
locks/lists/maps/strings/pal layer etc, a shim API is defined in ep-rt.h
and ep-rt-types.h that gets implemented by the targeted runtime consuming
the event pipe C library, like ep-rt-mono.h and ep-rt-types-mono.h.
All function in the shim API is small and should be inlinable. For example,
locking the configuration lock is declared like this in ep-rt.h:

bool
ep_rt_config_aquire (void);
and in ep-rt-mono.h it is implemented like this:

static
inline
bool
ep_rt_config_aquire (void)
{
ep_rt_spin_lock_aquire (ep_rt_mono_config_lock_get ());
return true;
}

and CoreCLR should implement the function using its corresponding
locking primitives. NOTE, since we primarily target Mono in initial
port there might smaller adjustments needed to the shim API once
bringing it over to CoreCLR, but those changes/adjustments can be
done when needed.

Since library could be shared, it tries to standardize on common C99
data types when available. If there are runtime specific types needed,
they are declared in ep-rt-types.h and implemented by each runtime in
corresponding file. Most of library is currently following Mono coding
guidelines.

For shared types naming is done like this, EventPipe[Type], like
EventPipeProvider. This naming follow naming of other types in Mono
as well as CoreCLR. There is one exception to this rule, types that
are runtime specific implementation, naming is following function
naming with a _t prefix, like ep_rt_session_provider_list_t,
that is a list specific type, implemented by each runtime. This is
done to make it easier to see difference of types implemented in
the runtime specific shim and types implemented in the shared
library API surface.

Since library shim implemented by targeted runtime will be called
by C code, it can't throw exceptions, the C library should however
compile under C++, meaning that CoreCLR's shim should be able to
use C++ constructions as long as it don't throw any exceptions.

Library function naming follows the following pattern, for "public"
functions included in ep-*.h , ep_ + object + action, so for example,
ep_config_create_provider, corresponds to EventPipe::Configuration::CreateProvider
in C++ library. For "private/internal" functions not, ep_ prefix is
dropped, but object + action is still preserved, for example
config_create_provider and function is marked as being static
when possible. If a function assumes a lock is held when getting
called, it is using _lock_held (similar to SAL annotations) postfix
to indicate that function doesn't claim lock and if function needs
lock to be held by caller, it will assert that condition on enter
(similar to PRECONDITION(EventPipe::IsLockOwnedByCurrentThread())).

Library uses asserts internally to validate state and conditions.
This is a debug/checked build assert that should be excluded in
release builds. It is defined in EP_ASSERT and should be redefined
by targeted runtime. Private/internal functions asserts incorrect
input parameters and state, while "public" functions return back
error to caller when detecting incorrect input parameters.
Incorrect state can still be assert in all kinds of functions.

Getters/Setters are setup for accessing type members. All functions
except a type's own alloc/init/fini/free implemented in ep-*.c are
not allowed to use direct type member access and should go through
available inlinable getter/setter functions. There is also a way
to build the library that catches incorrect use of members at
compile time (not in ep-*-internals.c since it include
alloc/init/fini/free implementations, but in other source files).

Types that can be stack allocated offers a init/fini function pairs.
Types that should only be heap allocated, alloc/free, and types
supporting both stack/heap, implements alloc/init/fini/free. Since C
can't prevent incorrect usage patterns, the implementation needs to
follow correct life time management patterns. Types allocated using
alloc should be freed with corresponding free function. For example,
ep_event_alloc should be freed by ep_event_free, the init/fini methods
are then called by the alloc/free implementations. For types supporting
stack allocation and allocated on stack or aggregated within other types,
init must be called before first use and fini before going out of scope.

Ownership of allocated objects is only considered complete on successful
function calls. If a function fails, caller still owns resource and need
to take actions.

Library uses UTF8 strings internally, mainly since Mono runtime already
uses that and it is more portable. Number of strings in the library is
limited, and in cases where stream protocol uses UTF16 strings,
a prealloc string is stored on the type, reducing need to do multiple
UTF8 -> UTF16 conversions over the lifetime of the type.

NOTE, this is first commit setting up most of the direction of the library
and (as part of doing that) ported a great deal of eventpipe code and
added ~40 native unittests. It is however not complete, or fully working,
so there will be several follow up commit building on top of this work
in order to get complete library.

4 years ago[reflection] Check whether a pointer is valid before dereferencing (#36981)
monojenkins [Tue, 26 May 2020 13:25:36 +0000 (09:25 -0400)]
[reflection] Check whether a pointer is valid before dereferencing (#36981)

`Xamarin.Android` native runtime calls `mono_reflection_type_from_name`
and passes `NULL` as the `image` parameter.  The parameter is then
propagated all the way to `_mono_reflection_get_type_from_info` where,
in case the assembly isn't loaded yet, it is used to obtain base
directory of the assembly.  However, since the `image` parameter is
`NULL` in our case, attempt to dereference it causes a segfault:

    libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4c0 in tid 11029 (ompanyname.app3), pid 11029 (ompanyname.app3)
    crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone
    /system/bin/tombstoned: received crash request for pid 11029
    crash_dump64: performing dump of process 11029 (target tid = 11029)
    DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    DEBUG   : Build fingerprint: 'google/sdk_gphone_x86_64/generic_x86_64:10/QSR1.190920.001/5891938:user/release-keys'
    DEBUG   : Revision: '0'
    DEBUG   : ABI: 'x86_64'
    DEBUG   : Timestamp: 2020-05-25 14:45:29+0200
    DEBUG   : pid: 11029, tid: 11029, name: ompanyname.app3  >>> com.companyname.app3 <<<
    DEBUG   : uid: 10134
    DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4c0
    DEBUG   : Cause: null pointer dereference
    DEBUG   :     rax 000000000000002f  rbx 0000000000000001  rcx 0000000000000000  rdx 0000000000000030
    DEBUG   :     r8  0000000000000003  r9  000000000013e2e2  r10 0173eed800000000  r11 0000000000000206
    DEBUG   :     r12 0000000000000000  r13 00007478530343c0  r14 00007478075eda33  r15 000074780763efb0
    DEBUG   :     rdi 0000000000000000  rsi 00007478e2cb14d0
    DEBUG   :     rbp 00007ffef3a35680  rsp 00007ffef3a355d0  rip 0000747807a4066a
    DEBUG   :
    DEBUG   : backtrace:
    DEBUG   :       mono/mono#00 pc 00000000003ba66a  /data/app/com.companyname.app3-aQUF6Ge6_v-WaLb5i8Q7vw==/lib/x86_64/libmonosgen-2.0.so (_mono_reflection_get_type_from_info+474)
    DEBUG   :       mono/mono#01 pc 00000000003ba3d1  /data/app/com.companyname.app3-aQUF6Ge6_v-WaLb5i8Q7vw==/lib/x86_64/libmonosgen-2.0.so (mono_reflection_type_from_name_checked+321)
    DEBUG   :       mono/mono#02 pc 00000000003ba26d  /data/app/com.companyname.app3-aQUF6Ge6_v-WaLb5i8Q7vw==/lib/x86_64/libmonosgen-2.0.so (mono_reflection_type_from_name+125)
    DEBUG   :       mono/mono#03 pc 000000000000ddb5  /data/app/com.companyname.app3-aQUF6Ge6_v-WaLb5i8Q7vw==/lib/x86_64/libmonodroid.so (xamarin::android::internal::EmbeddedAssemblies::typemap_java_to_managed(char const*)+389) (BuildId: 9952f1cfe0d910ae631abc73479f88eef34fd71d)
    DEBUG   :       mono/mono#04 pc 000000000000def3  /data/app/com.companyname.app3-aQUF6Ge6_v-WaLb5i8Q7vw==/lib/x86_64/libmonodroid.so (xamarin::android::internal::EmbeddedAssemblies::typemap_java_to_managed(_MonoString*)+99) (BuildId: 9952f1cfe0d910ae631abc73479f88eef34fd71d)
    DEBUG   :       mono/mono#05 pc 0000000000069532  <anonymous:5ad25000>

Even though this happens in `Xamarin.Android`, the error may occur for
any embedding application which passes `NULL` for the `image` parameter
in situation when the assembly isn't in memory yet.

<!--
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: grendello <grendello@users.noreply.github.com>
4 years agoOptimize decommit (#35896)
Peter Sollich [Tue, 26 May 2020 12:21:47 +0000 (05:21 -0700)]
Optimize decommit (#35896)

Optimize the way we decommit memory on both SVR and WKS GC.

Key ideas for SVR GC:
 - in decommit_ephemeral_segment_pages, instead of decommitting right there, just remember what we intended to decommit.

- in gc_thread function, have the thread with heap_number 0 periodically wake up and do gradual decommits for all heaps by calling the new method decommit_ephemeral_pages_step on them. This way, the decommit is not part of the GC pause and does not contribute to it.

- decommit_ephemeral_pages_step will decommit a "reasonable" amount of space per heap and time interval, and return how much it decomitted. A return value of 0 indicates no further progress.

- take into account Gen 1 budget size and Gen 1 free list when computing how much memory we are likely to need soon.

For WKS GC:

- As for SVR GC, take Gen 1 budget size and Gen 1 free list into account.

- Decommit gradually, taking into account the elapsed time since the last GC to make sure decommit does not become a major part of the GC pause.

As the validation scenario, I used an enhanced version of GCPerfSim that can be made to go through "phases", where the phases are programmed by an input text file. To cause decommits, I varied the amount of survivorship between phases - in one phase, one object out of 30 survived, in the next phase 1 out of 300 survived. 10 GB were allocated on each thread in each phase, and the phases with high and low survivorship were repeated 10 times. Test machine was an i9-7900X, 1 allocating thread was used for WKS GC, and 10 allocating threads for SVR GC.

Metrics directly influenced by decommitting memory were selected:
- Wall clock time (influenced both by GC pause time and page faults during allocation)
- GC pause time (especially in SVR GC, impacted by decommitting during GC pause)
- CPU samples spent decommitting
- CPU samples spend in KiPagefault triggered by allocator

Comparison with the master branch gave these results (numbers are medians of 3 runs):

SVR                                       Baseline    Optimized
================================
Wallclock time (secs):         127.456        106.581
GC pause time (secs):          50.120           41.293
Samples in decommit:           5,467            1,918
Samples in KiPagefault        77,872          21,449
 from allocator

WKS                                      Baseline    Optimized
================================
Wallclock time (secs):          57.213            54.321
GC pause time (secs):          21.422            22.060
Samples in decommit:             465                   48
Samples in KiPagefault         5,505               3,509
 from allocator

So all metrics are noticeably improved, with the exception of GC pause time for WKS. Given the scatter in the pause time numbers, it seems likely that this slight apparent regression is spurious.

4 years agoAvoid additional casts in SocketAsyncContext (#36997)
Ben Adams [Tue, 26 May 2020 09:12:12 +0000 (10:12 +0100)]
Avoid additional casts in SocketAsyncContext (#36997)

4 years agoUpdate mobile testing runner publishing target to insert before linker runs (#36687)
Marek Safar [Tue, 26 May 2020 08:33:44 +0000 (10:33 +0200)]
Update mobile testing runner publishing target to insert before linker runs (#36687)

4 years agoFix accumulating the offset in PemReader
Kevin Jones [Mon, 25 May 2020 19:52:11 +0000 (15:52 -0400)]
Fix accumulating the offset in PemReader

The preebEndIndex offset was a total value in to the PEM's contents,
not a moving offset. This would cause it to advance past the contents
of the PEM and potentially miss valid PEM contents.

4 years agoTimeout support for unprivileged Ping on Linux/BSD (#35461)
SRV [Mon, 25 May 2020 17:59:59 +0000 (20:59 +0300)]
Timeout support for unprivileged Ping on Linux/BSD  (#35461)

* Added support of timeout when unprivileged ping is used

* Fixed test according with new timeout parameter

* Fixes code style issues

* Fixed command-line flag for ping6 on BSD

* Separated timeout test

* Removed trailing whitespace

* Workaround for OSX ping6

* Removed static local method

* Suppress Ping stdout

* Fixed variable name

* Added test for zero timeout

* Handle zero timeout correctly

4 years agoUpdate dependencies from https://github.com/dotnet/xharness build 20200525.1 (#36982)
dotnet-maestro[bot] [Mon, 25 May 2020 17:30:29 +0000 (17:30 +0000)]
Update dependencies from https://github.com/dotnet/xharness build 20200525.1 (#36982)

Microsoft.DotNet.XHarness.Tests.Runners
 From Version 1.0.0-prerelease.20271.3 -> To Version 1.0.0-prerelease.20275.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
4 years agoconfigure.ac: check for sockaddr_in6 on Win32 (#36742)
monojenkins [Mon, 25 May 2020 15:08:54 +0000 (11:08 -0400)]
configure.ac: check for sockaddr_in6 on Win32 (#36742)

HAVE_STRUCT_SOCKADDR_IN6 needs to be defined to enable IPv6 features in
mono/metadata/w32socket.c.

Fixes TcpListener issues in wine-mono.

Co-authored-by: w-flo <w-flo@users.noreply.github.com>
4 years agoRemove volatile on field in ConcurrentDictionary.Tables (#36976)
Stephen Toub [Mon, 25 May 2020 11:18:01 +0000 (07:18 -0400)]
Remove volatile on field in ConcurrentDictionary.Tables (#36976)

4 years ago[master] Update dependencies from mono/linker Microsoft/vstest dotnet/xharness (...
dotnet-maestro[bot] [Mon, 25 May 2020 08:07:50 +0000 (08:07 +0000)]
[master] Update dependencies from mono/linker Microsoft/vstest dotnet/xharness (#36811)

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

Microsoft.NET.ILLink.Tasks
 From Version 5.0.0-preview.3.20269.1 -> To Version 5.0.0-preview.3.20270.1

* Update dependencies from https://github.com/microsoft/vstest build 20200521-01

Microsoft.NET.Test.Sdk
 From Version 16.7.0-preview-20200518-01 -> To Version 16.7.0-preview-20200521-01

* Update dependencies from https://github.com/dotnet/xharness build 20200520.2

Microsoft.DotNet.XHarness.Tests.Runners
 From Version 1.0.0-prerelease.20270.1 -> To Version 1.0.0-prerelease.20270.2

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

Microsoft.NET.ILLink.Tasks
 From Version 5.0.0-preview.3.20269.1 -> To Version 5.0.0-preview.3.20271.1

* Update dependencies from https://github.com/dotnet/xharness build 20200521.3

Microsoft.DotNet.XHarness.Tests.Runners
 From Version 1.0.0-prerelease.20270.1 -> To Version 1.0.0-prerelease.20271.3

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
4 years agoFix output for user strings in R2RDump (#36935)
Anton Lapounov [Mon, 25 May 2020 03:03:40 +0000 (20:03 -0700)]
Fix output for user strings in R2RDump (#36935)

Quote user strings and escape control characters, unpaired surrogates, and other unsafe characters.

4 years agoFixing emitAnyConst and related functions to better handle alignment (#36432)
Tanner Gooding [Sun, 24 May 2020 14:41:28 +0000 (07:41 -0700)]
Fixing emitAnyConst and related functions to better handle alignment (#36432)

* Fixing emitAnyConst and related functions to better handle alignment

* Don't use small alignment where it might not be supported

* Applying formatting patch

* Adding some comments explaining how emitAnyConst works

4 years agoAdd comments per code review feedback
Sung Yoon Whang [Sun, 24 May 2020 09:33:12 +0000 (02:33 -0700)]
Add comments per code review feedback

4 years agoDisable GC/API/GC/AddThresholdTest on ARM64 (#36940)
Jan Kotas [Sun, 24 May 2020 07:01:32 +0000 (00:01 -0700)]
Disable GC/API/GC/AddThresholdTest on ARM64 (#36940)

Issue #36850

4 years agoFix exception message to indicate Cofactor is required. (#36821)
Kevin Jones [Sun, 24 May 2020 04:28:15 +0000 (00:28 -0400)]
Fix exception message to indicate Cofactor is required. (#36821)

4 years agoUse BinaryPrimitives where possible. (#36881)
Kevin Jones [Sun, 24 May 2020 04:26:47 +0000 (00:26 -0400)]
Use BinaryPrimitives where possible. (#36881)

4 years agoFollow ups for Math.BigMul (#36920)
Jan Kotas [Sun, 24 May 2020 03:23:20 +0000 (20:23 -0700)]
Follow ups for Math.BigMul (#36920)

- Use more efficient and compact uint cast instead of bit masks where possible
- Improved test coverage
- Update comment in FastMod
- Optimize BigMul for 32-bit platforms

4 years agoUse TARGET_64BIT instead of set of TARGET_<arch> definitions for CLRConfig::EXTERNAL_...
Mikhail Pilin [Sun, 24 May 2020 03:18:14 +0000 (05:18 +0200)]
Use TARGET_64BIT instead of set of TARGET_<arch> definitions for CLRConfig::EXTERNAL_CORECLR_PROFILER_PATH_64 and CLRConfig::EXTERNAL_CORECLR_PROFILER_PATH_32 checking. (#36924)

4 years ago Remove PreserveDependency from SR class (#36358)
Youssef Victor [Sat, 23 May 2020 09:31:08 +0000 (11:31 +0200)]
 Remove PreserveDependency from SR class (#36358)

4 years agoRevert "Libunwind1.5rc2 (#36027)" (#36909)
Santiago Fernandez Madero [Sat, 23 May 2020 06:33:25 +0000 (23:33 -0700)]
Revert "Libunwind1.5rc2 (#36027)" (#36909)

This reverts commit 8c6c7655bb7abc5c4ce769923aa5bea1daee6bd3.

4 years ago[jit] Return the compiled method and an unbox trampoline from ldvirtftn when calling...
monojenkins [Sat, 23 May 2020 04:17:37 +0000 (00:17 -0400)]
[jit] Return the compiled method and an unbox trampoline from ldvirtftn when calling ldvirtftn on a valuetype method. (#36736)

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

<!--
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: vargaz <vargaz@users.noreply.github.com>
4 years agoOptimize BitOperations uses in CoreLib (#35650)
Clinton Ingram [Sat, 23 May 2020 03:50:01 +0000 (20:50 -0700)]
Optimize BitOperations uses in CoreLib (#35650)

* make Log2 branch-free

* convert LeadingZeroCount uses to Log2

* switch Bmi1.TrailingZeroCount calls to BitOperations

4 years agoBigMul with 64-bit operands (#35975)
SRV [Sat, 23 May 2020 03:48:53 +0000 (06:48 +0300)]
BigMul with 64-bit operands (#35975)

* Unsigned 128-bit BigMul

* Signed 128-bit BigMul

* Added explanation of alg and reference to it

* Removed else branch

Co-authored-by: Adeel Mujahid <adeelbm@outlook.com>
4 years ago[Arm64] ASIMD Shift Intrinsics (#36830)
Egor Chesakov [Sat, 23 May 2020 02:44:35 +0000 (19:44 -0700)]
[Arm64] ASIMD Shift Intrinsics (#36830)

* ShiftArithmetic

* ShiftArithmeticRounded

* ShiftArithmeticRoundedSaturate

* ShiftArithmeticRoundedSaturateScalar

* ShiftArithmeticRoundedScalar

* ShiftArithmeticSaturate

* ShiftArithmeticSaturateScalar

* ShiftArithmeticScalar

* ShiftLeftLogical

* ShiftLeftLogicalSaturate

* ShiftLeftLogicalSaturateScalar

* ShiftLeftLogicalSaturateUnsigned

* ShiftLeftLogicalSaturateUnsignedScalar

* ShiftLeftLogicalScalar

* ShiftLeftLogicalWideningLower

* ShiftLeftLogicalWideningUpper

* ShiftLogical

* ShiftLogicalRounded

* ShiftLogicalRoundedSaturate

* ShiftLogicalRoundedSaturateScalar

* ShiftLogicalRoundedScalar

* ShiftLogicalSaturate

* ShiftLogicalSaturateScalar

* ShiftLogicalScalar

* ShiftRightArithmetic

* ShiftRightArithmeticAdd

* ShiftRightArithmeticAddScalar

* ShiftRightArithmeticNarrowingSaturateLower

* ShiftRightArithmeticNarrowingSaturateUnsignedLower

* ShiftRightArithmeticNarrowingSaturateUnsignedUpper

* ShiftRightArithmeticNarrowingSaturateUpper

* ShiftRightArithmeticRounded

* ShiftRightArithmeticRoundedAdd

* ShiftRightArithmeticRoundedAddScalar

* ShiftRightArithmeticRoundedNarrowingSaturateLower

* ShiftRightArithmeticRoundedNarrowingSaturateUnsignedLower

* ShiftRightArithmeticRoundedNarrowingSaturateUnsignedUpper

* ShiftRightArithmeticRoundedNarrowingSaturateUpper

* ShiftRightArithmeticRoundedScalar

* ShiftRightArithmeticScalar

* ShiftRightLogical

* ShiftRightLogicalAdd

* ShiftRightLogicalAddScalar

* ShiftRightLogicalNarrowingLower

* ShiftRightLogicalNarrowingSaturateLower

* ShiftRightLogicalNarrowingSaturateUpper

* ShiftRightLogicalNarrowingUpper

* ShiftRightLogicalRounded

* ShiftRightLogicalRoundedAdd

* ShiftRightLogicalRoundedAddScalar

* ShiftRightLogicalRoundedNarrowingLower

* ShiftRightLogicalRoundedNarrowingSaturateLower

* ShiftRightLogicalRoundedNarrowingSaturateUpper

* ShiftRightLogicalRoundedNarrowingUpper

* ShiftRightLogicalRoundedScalar

* ShiftRightLogicalScalar

* SignExtendWideningLower

* SignExtendWideningUpper

* ZeroExtendWideningLower

* ZeroExtendWideningUpper

* ShiftArithmeticRoundedSaturateScalar

* ShiftArithmeticSaturateScalar

* ShiftLeftLogicalSaturateScalar

* ShiftLeftLogicalSaturateUnsignedScalar

* ShiftLogicalRoundedSaturateScalar

* ShiftLogicalSaturateScalar

* ShiftRightArithmeticNarrowingSaturateScalar

* ShiftRightArithmeticNarrowingSaturateUnsignedScalar

* ShiftRightArithmeticRoundedNarrowingSaturateScalar

* ShiftRightArithmeticRoundedNarrowingSaturateUnsignedScalar

* ShiftRightLogicalNarrowingSaturateScalar

* ShiftRightLogicalRoundedNarrowingSaturateScalar

4 years agoMake Vector256 dependent on AVX instruction set (#36895)
Kunal Pathak [Sat, 23 May 2020 00:50:33 +0000 (17:50 -0700)]
Make Vector256 dependent on AVX instruction set (#36895)

4 years agoRemove dead Exception handling code in Uri (#36865)
Miha Zupan [Sat, 23 May 2020 00:15:28 +0000 (02:15 +0200)]
Remove dead Exception handling code in Uri (#36865)

4 years agoRemove System.Globalization.Native shim from shared framework (#36904)
Santiago Fernandez Madero [Sat, 23 May 2020 00:13:41 +0000 (17:13 -0700)]
Remove System.Globalization.Native shim from shared framework (#36904)

* Remove System.Globalization.Native shim from shared framework

* Add System.Globalization.Native sources to mono paths in pipeline

4 years agoPipelines performance tweaks (#36815)
Ben Adams [Fri, 22 May 2020 23:58:02 +0000 (00:58 +0100)]
Pipelines performance tweaks (#36815)

* Pipelines performance tweaks

* Packaging

* Don't use Unsafe for array cast

* Remove Unsafe use

4 years agoDisable System.Numerics.Tests.Vector3Tests.Vector3InequalityTest on arm64 (#36906)
Santiago Fernandez Madero [Fri, 22 May 2020 23:00:45 +0000 (16:00 -0700)]
Disable System.Numerics.Tests.Vector3Tests.Vector3InequalityTest on arm64 (#36906)

4 years agoImprove obsoletion message for IgnoreNullValues (#36886)
Layomi Akinrinade [Fri, 22 May 2020 21:49:34 +0000 (17:49 -0400)]
Improve obsoletion message for IgnoreNullValues (#36886)

4 years agoFixing make dist after implementation of static ICU Shim. (#36795)
monojenkins [Fri, 22 May 2020 21:23:26 +0000 (17:23 -0400)]
Fixing make dist after implementation of static ICU Shim. (#36795)

Fixing make dist after implementation of static ICU Shim.

Co-authored-by: thaystg <thaystg@users.noreply.github.com>
4 years agoAdd MONO_LOADER_LIBRARY_NAME define (#36835)
Ryan Lucia [Fri, 22 May 2020 21:21:02 +0000 (17:21 -0400)]
Add MONO_LOADER_LIBRARY_NAME define (#36835)

4 years agoRenamed pInitRegZeroed to pInitRegModified, initRegZeroed to initRegM… (#36321)
Ivan [Fri, 22 May 2020 20:57:25 +0000 (15:57 -0500)]
Renamed pInitRegZeroed to pInitRegModified, initRegZeroed to initRegM… (#36321)

4 years ago[Arm64] Follow-up on renaming intrinsics to Narrowing for consistency with Widening...
Egor Chesakov [Fri, 22 May 2020 20:33:59 +0000 (13:33 -0700)]
[Arm64] Follow-up on renaming intrinsics to Narrowing for consistency with Widening (#36857)

* Rename AddHighNarrow to AddHighNarrowing

* Rename AddRoundedHighNarrow to AddRoundedHighNarrowing

* Rename ExtractAndNarrowHigh to ExtractNarrowingUpper

* Rename ExtractAndNarrowLow to ExtractNarrowingLower

* Rename SubtractHighNarrow to SubtractHighNarrowing

* Rename SubtractRoundedHighNarrow to SubtractRoundedHighNarrowing

4 years agoAdd NotNullIfNotNull, MemberNotNull attributes to doc (#36856)
buyaa-n [Fri, 22 May 2020 19:49:42 +0000 (12:49 -0700)]
Add NotNullIfNotNull, MemberNotNull attributes to doc (#36856)

4 years ago[Arm64] Polynomial Multiply Long Intrinsics (#36853)
Egor Chesakov [Fri, 22 May 2020 17:46:19 +0000 (10:46 -0700)]
[Arm64] Polynomial Multiply Long Intrinsics (#36853)

Implements PolynomialMultiplyWideningLower and PolynomialMultiplyWideningUpper

4 years agoFix CoreCLR initialization on Illumos-based distros (#36808)
Adeel Mujahid [Fri, 22 May 2020 17:37:33 +0000 (20:37 +0300)]
Fix CoreCLR initialization on Illumos-based distros (#36808)

4 years agoFix wasm build when runtime configuration and configuration are different (#36855)
Santiago Fernandez Madero [Fri, 22 May 2020 17:07:21 +0000 (10:07 -0700)]
Fix wasm build when runtime configuration and configuration are different (#36855)

* Fix wasm build when runtime configuration and configuration are different

* PR Feedback

4 years agoUse linux-musl runtime on Alpine Helix workers (#36827)
Simon Nattress [Fri, 22 May 2020 16:43:28 +0000 (09:43 -0700)]
Use linux-musl runtime on Alpine Helix workers (#36827)

* Use linux-musl runtime on Alpine Helix workers

* Add OS Subgroup to send-to-helix-step

* Pass in osSubgroup

Also, capitalize it in line with the rest of the repo

* Use __TargetOS which understands linux_musl for rid generation

I don't fully understand why we use `TargetOS` in `helixpublishwitharcade.proj` but set `__TargetOS` in the calling `send-to-helix-step.yml`.

4 years agoEnsure Image.Save can handle non readable / seekable Streams (#36805)
Eric StJohn [Fri, 22 May 2020 13:48:15 +0000 (06:48 -0700)]
Ensure Image.Save can handle non readable / seekable Streams (#36805)

* Ensure Image.Save can handle non readable / seekable Streams

* Address feedback

* Fix Image.Save on Unix for write only non-seekable stream

* Remove test which uses bogus handle value

4 years agoRemove x86 OSX code (#36874)
Jan Vorlicek [Fri, 22 May 2020 13:25:16 +0000 (15:25 +0200)]
Remove x86 OSX code (#36874)

This removes x86 OSX code that was never used for .NET Core.

4 years agoFix a summary typo in ConsoleLoggerOptions.cs (#36870)
Honza Rameš [Fri, 22 May 2020 13:24:56 +0000 (15:24 +0200)]
Fix a summary typo in ConsoleLoggerOptions.cs (#36870)

4 years agoConsider armel arch (#36872)
Gleb Balykov [Fri, 22 May 2020 13:24:00 +0000 (16:24 +0300)]
Consider armel arch (#36872)

4 years agoStrip the ILLinkTrim.xml file from System.Security assemblies (#36864)
Eric Erhardt [Fri, 22 May 2020 13:23:35 +0000 (08:23 -0500)]
Strip the ILLinkTrim.xml file from System.Security assemblies (#36864)

Contributes to #35199

4 years agoMove where wasm binaries are generated (#36781)
Steve Pfister [Fri, 22 May 2020 13:16:40 +0000 (09:16 -0400)]
Move where wasm binaries are generated (#36781)

This change shifts producing wasm binaries to the native dir so that they'll come over to the installer on CI.

4 years ago[mono] Fix MonoRunner.java - assets were not copied correctly (#36824)
Egor Bogatov [Fri, 22 May 2020 08:21:28 +0000 (11:21 +0300)]
[mono] Fix MonoRunner.java - assets were not copied correctly (#36824)

4 years agoAdded CreateDelegate<T> overloads to MethodInfo (#36680)
Ivan Diaz Sanchez [Fri, 22 May 2020 05:43:08 +0000 (22:43 -0700)]
Added CreateDelegate<T> overloads to MethodInfo (#36680)

* Added generic overloads for MethodInfo.CreateDelegate<>()

* Added full support of CreateDelegate<T> and the necessary tests.

* Refactored to apply the new CreateDelegate overloads as necessary throughout runtime.

* Reverted Linq.Expressions changes and fully qualified Delegate to System.Delegate

4 years agoExtract shared functionality to a TryRemoveCastIfPresent method (#36837)
Tanner Gooding [Fri, 22 May 2020 04:37:07 +0000 (21:37 -0700)]
Extract shared functionality to a TryRemoveCastIfPresent method (#36837)

4 years agoUse socketpair to implement Process.Start redirection (#34861)
Stephen Toub [Fri, 22 May 2020 04:19:46 +0000 (00:19 -0400)]
Use socketpair to implement Process.Start redirection (#34861)

* Use socketpair to implement Process.Start redirection

Today on Unix, we create an anonymous pipe via pipe/pipe2 to be used for stdin/stdout/stderr on processes created by Process.Start.  We then wrap the resulting file descriptors with FileStreams to hand out via Process.StandardInput/Output/Error.  This has a few issues, however. Any async operations on the resulting stream (or wrapping stream reader) will actually be async-over-sync, and that in turn means that a) any async read will end up blocking a thread pool thread until it's satisified, and b) the operation isn't cancelable.  The implications of (b) are obvious, and the problem with (a) is that code which launches a bunch of processes and uses BeginOutput/ErrorReadLine or the like will end up blocking a bunch of thread pool threads.

This change replaces the pipe/pipe2 calls with socketpair calls, and instead of wrapping the resulting file descriptors with FileStream, wraps them in Sockets and NetworkStreams.  This gives us the full capabilities of the networking stack, which fully supports asynchronous and cancelable reads and writes.

* Try to fix macOS failures with socketpair

4 years agoPorting more of the SIMD intrinsics to be implemented as HWIntrinsics (#36579)
Tanner Gooding [Fri, 22 May 2020 03:50:35 +0000 (20:50 -0700)]
Porting more of the SIMD intrinsics to be implemented as HWIntrinsics (#36579)

* Porting Ceiling and Floor to use SimdAsHWIntrinsic

* Porting SquareRoot to use SimdAsHWIntrinsic

* Porting ConditionalSelect to use SimdAsHWIntrinsic

* Porting get_AllBitsSet, get_Count, and get_Zero to use SimdAsHWIntrinsic

* Porting op_Explicit to use SimdAsHWIntrinsic

* Changing Vector2/3/4 and Vector<T>.Equals to forward to operator ==

* Removing SIMDIntrinsicAbs

* Removing SIMDIntrinsicMax and SIMDIntrinsicMin

* Removing SIMDIntrinsicCeil and SIMDIntrinsicFloor

* Porting op_Equality and op_Inequality to use SimdAsHWIntrinsic

* Removing SIMDIntrinsicSqrt

* Removing SIMDIntrinsicSelect

* Removing SIMDIntrinsicBitwiseAndNot and SIMDIntrinsicBitwiseXor

* Removing SIMDIntrinsicGreaterThanOrEqual and SIMDIntrinsicLessThanOrEqual

* Removing SIMDIntrinsicGreaterThan and SIMDIntrinsicLessThan

* Removing SIMDIntrinsicInstEquals

* Removing SIMDIntrinsicOpEquality and SIMDIntrinsicOpInEquality

* Porting this.Equals to use SimdAsHWIntrinsic

* Don't handle IEquatable`1.Equals via SimdAsHWIntrinsic

* Applying formatting patch

* Account for op2 being able to precede op1 in the LIR order

* Ensure SimdAsHWIntrinsic with 0 args are properly handled

* Fixup the arm64 LowerHWIntrinsicCmpOp implementation to use LowerNodeCC

* Fixing an assert in the NotSupported HWIntrinsic tests

4 years agoRemove Microsoft.DotNet.PlatformAbstractions (#36707)
Eric Erhardt [Fri, 22 May 2020 02:40:51 +0000 (21:40 -0500)]
Remove Microsoft.DotNet.PlatformAbstractions (#36707)

* Remove Microsoft.DotNet.PlatformAbstractions

This library overlapped with other System APIs and is now obsolete. For API replacement:

ApplicationEnvironment.ApplicationBasePath => AppContext.BaseDirectory
HashCodeCombiner => System.HashCode
RuntimeEnvironment.GetRuntimeIdentifier() => RuntimeInformation.RuntimeIdentifier
RuntimeEnvironment.OperatingSystemPlatform => RuntimeInformation.IsOSPlatform(OSPlatform)
RuntimeEnvironment.RuntimeArchitecture => RuntimeInformation.ProcessArchitecture
RuntimeEnvironment.OperatingSystem => RuntimeInformation.OSDescription
RuntimeEnvironment.OperatingSystemVersion => RuntimeInformation.OSDescription / Environment.OSVersion.Version

Fix #3470

4 years ago[wasm][debugger] Allow invoking property getters for objects (#35934)
monojenkins [Fri, 22 May 2020 02:38:34 +0000 (22:38 -0400)]
[wasm][debugger] Allow invoking property getters for objects (#35934)

Co-authored-by: radical <radical@users.noreply.github.com>
4 years agoJIT: don't call back into morph from fgRemoveConditionalJump (#36792)
Andy Ayers [Fri, 22 May 2020 01:41:29 +0000 (18:41 -0700)]
JIT: don't call back into morph from fgRemoveConditionalJump (#36792)

This can get called before morph and run into issues where morph
specific data is not yet initialized. The remorphing wasn't going to
do much other than extract side effects and rethread the statement
ordering. So just do these latter bits.

Closes #36468.