Kevin Jones [Thu, 28 May 2020 16:14:37 +0000 (12:14 -0400)]
Use friendly name in exception if OID value is null. (#37110)
dotnet-maestro[bot] [Thu, 28 May 2020 16:13:49 +0000 (12:13 -0400)]
Update dependencies from https://github.com/mono/linker build
20200528.2 (#37126)
Microsoft.NET.ILLink.Tasks
From Version 5.0.0-preview.3.20276.2 -> To Version 5.0.0-preview.3.20278.2
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Andy Ayers [Thu, 28 May 2020 16:13:39 +0000 (09:13 -0700)]
JIT: some small improvements to tail duplication (#37038)
1. Allow duplicating when predecessor is BBJ_NONE
2. Require that predecessor and successor reference the same local
3. Make sure that local is not address exposed
4. Check up to two statements in predecessor for local reference
5. Require successor to compare local to constant, or local to local
Changes inspired by #36649 but don't actually improve CQ for that case (yet).
Also, add morph to post-phase whitelist because it seems odd not
to dump the IR after morph.
Zoltan Varga [Thu, 28 May 2020 16:07:01 +0000 (12:07 -0400)]
[runtime] Implement the many argument version of the Vector128.Create () intrinsic. (#37036)
Steve Harter [Thu, 28 May 2020 15:12:32 +0000 (10:12 -0500)]
Fix namespace for Nullable converters (#37019)
monojenkins [Thu, 28 May 2020 14:43:51 +0000 (10:43 -0400)]
[wasm] Fix the handling of i8/u8 in get_wrapper_shared_type_full (). (#37056)
Fixes https://github.com/mono/mono/issues/19837.
<!--
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>
Koundinya Veluri [Thu, 28 May 2020 13:32:31 +0000 (09:32 -0400)]
Move thread pool initialization to native side (#36789)
Move thread pool initialization to native side
- Following up from https://github.com/dotnet/runtime/pull/36697. Currently the initialization occurs when a static variable is accessed before calling into the VM, and after thinking about it some more the intent and need to initialize the thread pool can be a bit unclear
- The initialization is specific to this implementation and the managed side doesn't necessarily need to know about it
- Moved the initialization to the native side similarly to other thread pool APIs
- Added some more assertions to relevant managed-to-native entry point paths to ensure that they are not called before the thread pool is initialized
- This adds a non-volatile check when requesting a worker thread, which is already a very slow path. I ran into some issues with testing on the arm64 machine with updated locally built libcoreclr.so, so wasn't able to test that. I looked at the baseline profile and looking at time spent exclusively in ThreadPoolNative::RequestWorkerThread() and what it already does, I don't think the change would result in any significant perf difference.
Zoltan Varga [Thu, 28 May 2020 09:35:18 +0000 (05:35 -0400)]
[wasm] Test runner improvements. (#37097)
* Fix the test runner script.
* Add a ExtraFiles property to the wasm app builder.
* Add helper make targets.
* Bump sdk version to pick up wasm support.
* Fix make targets.
* Compile wasm runtime with --enable-minimal=threads.
Jeremy Koritzinsky [Thu, 28 May 2020 05:36:55 +0000 (22:36 -0700)]
Update Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk. (#36889)
* Update Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk.
Unblocks #36715
* Enable creating the LightCommand package drop to fix MSI creation.
* Update shared framework sdk to 20277.7
Santiago Fernandez Madero [Thu, 28 May 2020 01:45:56 +0000 (18:45 -0700)]
Add linux arm/arm64 libraries checked coreclr test runs (#36910)
* Add linux arm/arm64 libraries checked coreclr test runs
* Add linux_musl_arm64
* Disable BitmapTests on linux checked coreclr
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
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
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
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
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>
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>
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
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
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)
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.
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
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)
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.
Kenneth Pouncey [Wed, 27 May 2020 09:12:39 +0000 (11:12 +0200)]
[browser][wasm] InteropServices.JavaScript backing code. (#37044)
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.
Stephen Toub [Wed, 27 May 2020 08:29:11 +0000 (04:29 -0400)]
Avoid HttpClientHandler.ServerCertificateCustomValidationCallback keeping first request message alive (#37021)
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
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
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>
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.
Santiago Fernandez Madero [Wed, 27 May 2020 03:02:09 +0000 (20:02 -0700)]
Disable AddThresholdTest in all archs (#37032)
Eric Erhardt [Wed, 27 May 2020 02:55:46 +0000 (21:55 -0500)]
Use nint instead of IntPtr in _RegisterFrozenSegment. (#37029)
Anirudh Agnihotry [Wed, 27 May 2020 00:43:37 +0000 (17:43 -0700)]
rearrange tfms for intellisense (#37027)
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.
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
Santiago Fernandez Madero [Tue, 26 May 2020 23:13:15 +0000 (16:13 -0700)]
Add dotnet.js to sign exclusion list (#37033)
Jeremy Koritzinsky [Tue, 26 May 2020 22:03:11 +0000 (15:03 -0700)]
Fix bad refcount management in ComWrappers WeakReference test. (#37022)
Sung Yoon Whang [Tue, 26 May 2020 21:55:51 +0000 (14:55 -0700)]
merge with master
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>
Sung Yoon Whang [Tue, 26 May 2020 21:32:15 +0000 (14:32 -0700)]
fix GCC build
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.
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
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.
Sung Yoon Whang [Tue, 26 May 2020 21:03:22 +0000 (14:03 -0700)]
Fix incorrect filtering operation in EventPipeHelper::IsEnabled (#36933)
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
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
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.
Andrew Au [Tue, 26 May 2020 18:09:17 +0000 (11:09 -0700)]
Tracking how much memory is committed per object heap (#36731)
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>
Eirik Tsarpalis [Tue, 26 May 2020 16:50:18 +0000 (17:50 +0100)]
Document disabling ApiCompat checks (#37011)
* Document disabling ApiCompat checks
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
Egor Bogatov [Tue, 26 May 2020 15:43:13 +0000 (18:43 +0300)]
Switch to getCacheDir if getExternalFilesDir is not available (#37009)
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.
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.
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.
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>
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.
Ben Adams [Tue, 26 May 2020 09:12:12 +0000 (10:12 +0100)]
Avoid additional casts in SocketAsyncContext (#36997)
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)
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.
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
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>
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>
Stephen Toub [Mon, 25 May 2020 11:18:01 +0000 (07:18 -0400)]
Remove volatile on field in ConcurrentDictionary.Tables (#36976)
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>
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.
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
Sung Yoon Whang [Sun, 24 May 2020 09:33:12 +0000 (02:33 -0700)]
Add comments per code review feedback
Jan Kotas [Sun, 24 May 2020 07:01:32 +0000 (00:01 -0700)]
Disable GC/API/GC/AddThresholdTest on ARM64 (#36940)
Issue #36850
Kevin Jones [Sun, 24 May 2020 04:28:15 +0000 (00:28 -0400)]
Fix exception message to indicate Cofactor is required. (#36821)
Kevin Jones [Sun, 24 May 2020 04:26:47 +0000 (00:26 -0400)]
Use BinaryPrimitives where possible. (#36881)
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
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)
Youssef Victor [Sat, 23 May 2020 09:31:08 +0000 (11:31 +0200)]
Remove PreserveDependency from SR class (#36358)
Santiago Fernandez Madero [Sat, 23 May 2020 06:33:25 +0000 (23:33 -0700)]
Revert "Libunwind1.5rc2 (#36027)" (#36909)
This reverts commit
8c6c7655bb7abc5c4ce769923aa5bea1daee6bd3.
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>
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
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>
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
Kunal Pathak [Sat, 23 May 2020 00:50:33 +0000 (17:50 -0700)]
Make Vector256 dependent on AVX instruction set (#36895)
Miha Zupan [Sat, 23 May 2020 00:15:28 +0000 (02:15 +0200)]
Remove dead Exception handling code in Uri (#36865)
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
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
Santiago Fernandez Madero [Fri, 22 May 2020 23:00:45 +0000 (16:00 -0700)]
Disable System.Numerics.Tests.Vector3Tests.Vector3InequalityTest on arm64 (#36906)
Layomi Akinrinade [Fri, 22 May 2020 21:49:34 +0000 (17:49 -0400)]
Improve obsoletion message for IgnoreNullValues (#36886)
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>
Ryan Lucia [Fri, 22 May 2020 21:21:02 +0000 (17:21 -0400)]
Add MONO_LOADER_LIBRARY_NAME define (#36835)
Ivan [Fri, 22 May 2020 20:57:25 +0000 (15:57 -0500)]
Renamed pInitRegZeroed to pInitRegModified, initRegZeroed to initRegM… (#36321)
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
buyaa-n [Fri, 22 May 2020 19:49:42 +0000 (12:49 -0700)]
Add NotNullIfNotNull, MemberNotNull attributes to doc (#36856)
Egor Chesakov [Fri, 22 May 2020 17:46:19 +0000 (10:46 -0700)]
[Arm64] Polynomial Multiply Long Intrinsics (#36853)
Implements PolynomialMultiplyWideningLower and PolynomialMultiplyWideningUpper
Adeel Mujahid [Fri, 22 May 2020 17:37:33 +0000 (20:37 +0300)]
Fix CoreCLR initialization on Illumos-based distros (#36808)
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
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`.
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
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.
Honza Rameš [Fri, 22 May 2020 13:24:56 +0000 (15:24 +0200)]
Fix a summary typo in ConsoleLoggerOptions.cs (#36870)
Gleb Balykov [Fri, 22 May 2020 13:24:00 +0000 (16:24 +0300)]
Consider armel arch (#36872)
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
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.