Sven Boemer [Fri, 19 Feb 2021 17:27:41 +0000 (09:27 -0800)]
Annotate framework assemblies as trimmable (#48428)
* Annotate framework assemblies as trimmable
This will opt them into trimming with the behavior described at https://github.com/mono/linker/blob/main/docs/design/trimmed-assemblies.md#assemblymetadataistrimmable-true.
* Add a condition to let projects opt out
A project just needs to set <SetIsTrimmable>false</SetIsTrimmable>, and
it won't get the trimmable metadata.
I also got rid of the SkipFrameworkAssemblyMetadata check since I don't
think the IsTrimmable metadata should be tied to whether we are building
a framework assembly, and this property was unused as far as I could tell.
Anton Firszov [Fri, 19 Feb 2021 16:37:05 +0000 (17:37 +0100)]
Fix Socket.SendFile test: SliceBuffers_Success (#48457)
* do not expect a single receive
* use expected.Length
* enable test
Eric Erhardt [Fri, 19 Feb 2021 15:10:48 +0000 (09:10 -0600)]
Remove trimming attributes from any assembly. (#48424)
* Remove trimming attributes from any assembly.
These attributes are allowed to be in any assembly, for assemblies that are built using older TFMs where the attributes didn't exist.
Fix #48399
* Remove nullable attributes as well.
Nathan Ricci [Fri, 19 Feb 2021 14:41:27 +0000 (09:41 -0500)]
Normalized names SIMD_OP_LLVM_* -> SIMD_OP_ARM64_* (#48489)
Co-authored-by: Nathan Ricci <naricc@xam-emag-01.redmond.corp.microsoft.com>
dotnet-maestro[bot] [Fri, 19 Feb 2021 10:51:53 +0000 (10:51 +0000)]
[master] Update dependencies from dotnet/xharness (#48452)
[master] Update dependencies from dotnet/xharness
Eirik Tsarpalis [Fri, 19 Feb 2021 10:02:52 +0000 (10:02 +0000)]
Expand PriorityQueue test coverage (#48420)
* make comparer field readonly
* abstract IComparer in PriorityQueue generic tests
does minor refactorings and adds new tests
* add PriorityQueue property tests
* address feedback
* add seed for deterministic runs
* apply var fixes in property tests
* replace FsCheck properties with theories
David Karlaš [Fri, 19 Feb 2021 09:24:33 +0000 (10:24 +0100)]
Removing myself from codeowners file (#48502)
In past I was involved in mono/debugger-agent.c, but not anymore, hence removing myself from CODEOWNERS file
Vlad Brezae [Fri, 19 Feb 2021 09:07:44 +0000 (11:07 +0200)]
[interp] Small interp tweaks (#48412)
* [interp] Fix overflow in PROFILE_INTERP log
* [interp] Replace LDFLDA of offset 0 field with MOV
Commonly used when accessing first field of valuetypes, eg span operations. Will help with cprop and remove redundant instruction.
* [interp] Remove redundant opcode
Marek Safar [Fri, 19 Feb 2021 08:51:54 +0000 (09:51 +0100)]
Remove redundant static ctor from LoggerFactory (#48478)
dotnet-maestro[bot] [Fri, 19 Feb 2021 05:04:51 +0000 (05:04 +0000)]
Update dependencies from https://github.com/mono/linker build
20210218.4 (#48493)
[master] Update dependencies from mono/linker
Elinor Fung [Fri, 19 Feb 2021 04:57:25 +0000 (20:57 -0800)]
Make ApkBuilder optionally generate debuggable apk (#48486)
Zoltan Varga [Fri, 19 Feb 2021 04:13:58 +0000 (23:13 -0500)]
[mono] More domain cleanups. (#48291)
* Remove the MonoClassRuntimeInfo structure, store the runtime vtable directly in MonoClass.
* Remove the 'domain' argument from mono_class_vtable_checked ().
* Remove the 'domain' argument from the object allocation functions.
* Remove the 'domain' argument from the m_.._alloc methods.
* Revert accidental changes.
* Remove more unused 'domain' parameters.
* Remove more remoting code.
* Remove shared code support.
* Remove the 'domain' argument from the IMT builder functions.
* Remove the 'domain' argument from the m_method_ functions.
* Remove more domain usage from the JIT backends.
* Remove the MONO_ARCH_HAVE_PATCH_CODE_NEW ifdef, all architectures support it now.
* Remove 'domain' argument from mini_jit_info_table_find ().
* Remove 'domain' argument from mono_arch_unwind_frame ().
* Remove unused/unfinished AOT cache code.
* Remove the 'domain' argument from mono_resolve_patch_target ().
* Remove domains from the stack walk/exception handling code.
* Remove domains from mono-debug.c.
The memory in mono-debug.c is now owned by a MonoMemoryManager instead of by a domain.
* Remove unused mono-mlist.{h,c}.
* Fix the coverage profiler build.
* Fix the build.
daveMueller [Fri, 19 Feb 2021 03:35:00 +0000 (04:35 +0100)]
JSON Console Logger not requiring scopes to implement IReadOnlyCollection (#48453)
Ankit Jain [Fri, 19 Feb 2021 02:40:41 +0000 (21:40 -0500)]
[wasm] Improve AOT builds (#48184)
* [wasm] pack: Let the workload configure the runtime pack path
* [wasm] update webassembly pack description
* [wasm] Makefile: fix being able to `make build`
* [wasm] Fix AOT compilation to work before publish
Instead of using runtime pack, and other assemblies from the
publish folder, we are now using them directly from the source
location. This means that `System.Private.CoreLib` can be in a different
directory, than the assembly being precompiled.
So, we need to set `MONO_PATH` to the relevant paths that will have the assemblies.
This manifests during blazor workload based builds.
* [wasm][aot] Don't strip the source assemblies in place
Currently we run `mono-cil-strip` on assemblies, in the AOT case, but we
do that in-place.
This is problematic because the assemblies from the runtime pack will
get modified in their original location (nuget/etc), since we don't use
them from the publish folder anymore.
- This would mean that a subsequent attempt to build with AOT would fail
because now the original assemblies are already stripped!
- this also becomes apparent if you have the runtime pack installed in a
system dotnet folder, eg. as a pack - `/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.browser-wasm/`,
because a regular user wouldn't have permissions to modify that.
Solution: Write the stripped assemblies into the obj dir
* [wasm] Make the final list of wasm assemblies as an item
- Blazor skips the generation of the app bundle when running
`WasmBuildApp` target.
- Because of the previous commit, the locations for the final assemblies
could be different (when aot+stripping), which needs to be surfaced
for blazor. So, generate a `@(WasmAssembliesFinal)` item for that.
* [wasm] Allow enabling assert messages with $(MonoEnableAssertMessages)
* [wasm][aot] WasmApp.targets: check that we have .bc file for each assembly
Just a sanity check to ensure that due to some build authoring error, we
are not building dotnet.js/wasm with no .bc files! That just shows up as
an assert:
`* Assertion at /Users/radical/dev/r3/src/mono/mono/mini/aot-runtime.c:2651, condition `<disabled>' not met`
.. which is:
`g_assert (info->version == MONO_AOT_FILE_VERSION);`
.. `0 != MONO_AOT_FILE_VERSION`
* [wasm] remove UsingTask for non-exitant WasmAOT
* MonoCrossAot pkg: use mono-aot-cross.exe on windows
* [wasm] Fix up emscripten command invocations for windows
* [wasm] WasmApp.targets: move some property inits closer to their use
* [wasm] fix build for browser-profile sample
* [wasm] fix emcc invocation for getting the version
* [wasm] Add new RunWithEmSdkEnv task
* [wasm] Use `RunWithEmSdkEnv` to run `emcc` commands
* [wasm] AotCompiler: use platform specific path separator
* [wasm] RunWithEmSdkEnv: quote path on windows
* [wasm] Use new ReadEmccVersion to get the versions
This simplifies the target too, and works on windows.
* Update src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.MonoCrossAOT.Sdk.props
Co-authored-by: Pranav K <prkrishn@hotmail.com>
* fix messageimportance for debug msg
* Fix emcc invocation on windows, thanks to @pranavkm
* Don't strip assemblies with mono-cil-strip for aotinterp mode
* [wasm] Remove ReadEmccVersion task, and use msbuild to get the version
.. string instead. We do this by looking for the line with `'emcc'` in
it, since the other lines are the license text. Hopefully, this isn't
too brittle, since we are invoking `emcc --version`.
* Fix emcc version extraction to not depend on a specific string
Co-authored-by: Pranav K <prkrishn@hotmail.com>
Egor Chesakov [Fri, 19 Feb 2021 02:27:07 +0000 (18:27 -0800)]
Do not emit Avx2 instruction `vpcmpeqd ymmReg, ymmReg, ymmReg` for `Vector256<T>.AllBitsSet` intrinsic when Avx2 is not supported (#48383)
Emit `vcmptrueps ymmReg, ymmReg, ymmReg` instead
Adeel Mujahid [Fri, 19 Feb 2021 01:41:07 +0000 (03:41 +0200)]
Probe libnuma.so.1.0.0 before its symlinks (#48133)
On Linux, libnuma.so{.1} are symlinks to libnuma.so.1.0.0.
When installed from default package manager; Ubuntu (libnuma-dev) and
Alpine (numactl-dev), found these two symlinks:
`{libnuma.so,libnuma.so.1} -> libnuma.so.1.0.0`
On Fedora (numactl-libs):
`libnuma.so.1 -> libnuma.so.1.0.0`
(there is no version-less variant)
PR adjusts probing fallback flow based on this info.
Kevin Jones [Fri, 19 Feb 2021 01:28:30 +0000 (20:28 -0500)]
Use newer microsoft.com certificate chain in X.509 tests
The old certificate chain used a root certificate that is deprecated
and is starting to disappear from some trust stores. The removal of
the root certificate led to a few failing tests, and other tests not
running since they were conditional on the trust of that certificate.
Drew Scoggins [Fri, 19 Feb 2021 00:47:58 +0000 (16:47 -0800)]
Add runs for Alpine performance measurement (#47304)
* WIP
* Add Alpine specific steps
* Fix musl string
* Fix musl string
* Add comment block
* Update Helix precommand for Alpine
* Add container support for Perf leg
* Remove dupe container
* Add apk installs
* Add libgdiplus
* Fix typo and remove --force-install from pip command
* Remove --force-reinstall from Alpine job
* Add pip upgrade step
* Add cargo install
* Add back full runs
* Remove PR line
* Remove temp files
* Fix spacing issue
Eric Erhardt [Thu, 18 Feb 2021 23:52:11 +0000 (17:52 -0600)]
Resolve ILLink warnings in System.Linq.Queryable (#48305)
* Resolve ILLink warnings in System.Linq.Queryable
Contributes to #45623
* Respond to PR feedback.
Annotate public AsQueryable() method as RequiresUnreferencedCode.
Mike McLaughlin [Thu, 18 Feb 2021 23:02:17 +0000 (15:02 -0800)]
Add hot reload apply changes API: AssemblyExtensions.ApplyUpdate (#48366)
Add hot reload apply changes API: AssemblyExtensions.ApplyUpdate
Issue: https://github.com/dotnet/runtime/issues/45689
Currently Windows only. Fail hot reload API if debugging.
Added some simple invalid parameter testing to the new ApplyUpdate API.
Sung Yoon Whang [Thu, 18 Feb 2021 22:38:43 +0000 (14:38 -0800)]
Fix AV in NativeRuntimeEventSource QCalls (#48414)
* Fix AV in NativeRuntimeEventSource QCalls
* Add test
* Use WriteEventCore APIs to emit events on Mono
* Separate out Mono/CoreCLR implementations to different files
* Fix wasm build
Stephen Toub [Thu, 18 Feb 2021 22:00:38 +0000 (17:00 -0500)]
Remove partitioning from CancellationTokenSource (#48251)
When CancellationTokenSource was original created, the expectation was that a majority use case would be lots of threads in parallel registering and unregistering handlers. This led to a design where CTS internally partitions its registrations to minimize contention between threads contending on its internal data structures. While that certainly comes up in practice, a much more common case is just one thread registering and unregistering at a time as a CancellationToken unique to a particular operation (e.g. a linked token source) is passed down through it, with various levels of the chain registering and unregistering from that non-concurrently-used token source. And having such partitioning results in non-trivial allocation overheads, in particular for a short-lived CTS with which only one or a few registrations are employed in its lifetime. This change removes that partitioning scheme; all scenarios end up with less memory allocation, and non-concurrent scenarios end up measurably faster... scenarios where there is contention do take a measurable hit, but given that's the rare case, it's believed to be the right trade-off (when in doubt, it's also the simpler implementation).
As long as I was refactoring a bunch of code, I fixed up a few other things along the way:
- Avoided allocating while holding the instance's spin lock
- Made WaitForCallbackAsync into a polling async method rather than an async-over-sync method
- Changed the state values to be 0-based to avoid needing to initialize _state to something other than 0 in the common case
- Used existing throw helpers in a few more cases
- Renamed a few methods, and made a few others to be local functions
Bruce Forstall [Thu, 18 Feb 2021 21:56:57 +0000 (11:56 -1000)]
Remove !CPU_HAS_FP_SUPPORT code (#48436)
* Remove !CPU_HAS_FP_SUPPORT code
CPU_HAS_FP_SUPPORT is always defined and we don't anticipate needing
the emulation support.
Fixes #47708
* Remove fgMorphToEmulatedFP declaration
Anirudh Agnihotry [Thu, 18 Feb 2021 21:54:06 +0000 (13:54 -0800)]
Disable slicebuffers_success and RunContinueWithStressTestsNoState test (#48442)
* disable long failing tests
* keeping the skipOncoreclr attribute
Anirudh Agnihotry [Thu, 18 Feb 2021 21:53:36 +0000 (13:53 -0800)]
make symbolsPath to default pack path (#48384)
Maxim Lipnin [Thu, 18 Feb 2021 20:53:18 +0000 (23:53 +0300)]
Fix test failures (#48302)
* Fix test failures
* Remove iOS/tvOS-specific platform detection
Andy Ayers [Thu, 18 Feb 2021 20:34:35 +0000 (12:34 -0800)]
JIT: change loop inversion edge weight updates and add phase (#48364)
Rename `fgOptWhileLoop` to `optInvertWhileLoop` (using terminology from
Muchnick). Split off this transformation into a new phase so it is easier
to see its impact. Make the block updates / reorderings that follow into
a proper phase as well.
Use the test block exit likelihoods to update the profile weights for the
edges involved in loop inversion. Because edge weight updates are now
consistent we no longer need to recompute edge weights afterwards.
Rename `optOptimizeLoops` to `optFindLoops` since it no longer optimizes.
Adeel Mujahid [Thu, 18 Feb 2021 20:34:00 +0000 (22:34 +0200)]
Use llvm-objcopy on Linux x64 (#48444)
Fan Yang [Thu, 18 Feb 2021 20:33:37 +0000 (15:33 -0500)]
Support remaining Sha1 intrinsics on Arm (#48413)
* Add support for Sha1 API with vector64 arguments
* Promote return to vector64
* Return a 2 x i32 instead of i64
* Update src/mono/mono/mini/mini-llvm.c
* Fix format
Co-authored-by: imhameed <imhameed@microsoft.com>
Jeremy Koritzinsky [Thu, 18 Feb 2021 20:15:23 +0000 (12:15 -0800)]
Fix all remaining System.Security.Cryptography.Algorithms test suite crashes. (#48432)
* Fix all remaining System.Security.Cryptography.Algorithms test suite crashes.
With this + PR #48348, the test suite runs to completion and reports the following results:
> Tests run: 2527 Passed: 1285 Inconclusive: 0 Failed: 1227 Ignored: 7
So we've got a ways to go to get things passing, but now we can easily track it at least for this assembly.
* PR Feedback.
Aleksey Kliger (λgeek) [Thu, 18 Feb 2021 20:12:25 +0000 (15:12 -0500)]
[coop] Enter GC Unsafe mode in mono_gc_init_finalizer_thread (#48465)
when lazy thread creation is used, this external API function is called
from a thread in GC Safe mode, so enter GC Unsafe before calling runtime
functions.
Fixes a double transition to GC Safe in mono_gc_pthread_create.
Fixes https://github.com/dotnet/runtime/issues/47121
Bruce Forstall [Thu, 18 Feb 2021 19:14:55 +0000 (09:14 -1000)]
Improve SuperPMI asserts (#48449)
Include `GetIndex` method calls in the assert message, to distinguish
the different assert cases in error output. E.g., the asserts
change from:
```
'index != -1' failed ...
```
(which was identical for several cases), to:
```
'GetClassAttribs->GetIndex(CastHandle(classHandle)) != -1' failed ...
```
This makes it easier to know where the problem is without debugging the failure.
Bruce Forstall [Thu, 18 Feb 2021 19:13:37 +0000 (09:13 -1000)]
Display more SuperPMI details in log file (#48448)
In particular, display missing info asserts, which give some hint
about what change might have caused the missing info to be requested.
Bruce Forstall [Thu, 18 Feb 2021 19:13:18 +0000 (09:13 -1000)]
Fix SuperPMI SEH exception handling (#48447)
Capture data in the filter; don't save a PEXCEPTION_POINTERS
that points to data that is is transient to the filter.
Bruce Forstall [Thu, 18 Feb 2021 19:10:27 +0000 (09:10 -1000)]
Run dotnet.sh/cmd script before running dotnet restore (#48375)
* Fix SuperPMI Linux collections
1. Run dotnet for jitutils with jitutils dir as the current working dir.
2. Run dotnet.sh/cmd script before running bootstrap (and `dotnet restore`)
to ensure `.dotnet` directory exists.
Tomáš Rylek [Thu, 18 Feb 2021 19:03:58 +0000 (20:03 +0100)]
Fix PerfMap file naming in Crossgen2 to match Crossgen1 (#48426)
For single-file builds, PerfMap file name is expected to have
the file name <output file>.ni.{managed assembly MVID}.map.
This change fixes Crossgen2 to conform to that naming style.
Thanks
Tomas
Mikhail Pilin [Thu, 18 Feb 2021 18:47:24 +0000 (19:47 +0100)]
Support profiler activation for same bitness architectures (x64+arm64 and x86+arm) on Windows ARM64 and macOS Apple Silicon. #39699 (#46868)
Mateo Torres-Ruiz [Thu, 18 Feb 2021 18:10:47 +0000 (10:10 -0800)]
Fix usage of relative path on bundle extraction (#47200)
* Don't append boolean
* Set working dir for the command only
Test different bunddle options when extracting to relative path
* Add error message
Use bundleOption parameter
* Normalize extraction dir path
Look for expected extracted files
* Only test for bundle options that extract files to disk
Update GetExtractedFiles
* Don't change value of env var
* On windows, forward slashes should be converted to standard dir sep
* Set COREHOST_TRACE in test
* Fixup path after appending rel path
Remove COREHOST_TRACE
* Add extension
* Remove netcoreappcompatmode test with backslash
* Don't modify dir sep
* Update GetFilesNeverExtracted
Skip 'foo/bar' in Windows
Katelyn Gadd [Thu, 18 Feb 2021 17:17:27 +0000 (09:17 -0800)]
Fix issue #48345 (#48391)
Fix issue #48345: Return value marshaling was incorrect for bound methods
Nathan Ricci [Thu, 18 Feb 2021 16:34:26 +0000 (11:34 -0500)]
Implemented abs saturate, absolute compare intrinsics. (#48361)
Co-authored-by: Nathan Ricci <naricc@xam-emag-01.redmond.corp.microsoft.com>
Maxim Lipnin [Thu, 18 Feb 2021 15:27:52 +0000 (18:27 +0300)]
Add tvOS functional tests (#48331)
Viktor Hofer [Thu, 18 Feb 2021 14:38:27 +0000 (15:38 +0100)]
Fix OOB src project configurations (#48318)
* Fix OOB src project configurations
* Optimize netstandard2.1 DI assembly
* Move netcoreapp3.0 tfm to netstandard2.1
* Remove NetCoreAppCurrent config from M.E.DI
Stephen Toub [Thu, 18 Feb 2021 14:01:06 +0000 (09:01 -0500)]
Delete a few lines of dead code in ListDictionaryInternal (#48404)
Vitek Karas [Thu, 18 Feb 2021 13:47:09 +0000 (05:47 -0800)]
Improve error message when bundler fails due to duplicate entries (#48336)
There are multiple possible cases which will make the bundler fail with duplicate entries. Currently there's no indication of which entries caused the problem, making it really hard to diagnose these failures.
This change prints out the source file paths and the colliding relative bundle path in the error message. This should help with diagnosing the failures.
Mateo Torres-Ruiz [Thu, 18 Feb 2021 08:59:47 +0000 (00:59 -0800)]
Fix ILLink descriptors filename (#48430)
Vladimir Sadov [Thu, 18 Feb 2021 07:25:31 +0000 (23:25 -0800)]
Check that rsp is within stack limits when redirecting a thread. (#48433)
* Check that rsp is within stack limits when redirecting a thread.
* move the check after/if SetThreadContext has failed
* just return FALSE after failed SetThreadContext
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Jeff Handley [Thu, 18 Feb 2021 07:19:21 +0000 (23:19 -0800)]
Clarify the behavior of FilePatternMatch Path and Stem (#48093)
* Add theories that illustrate globbing Path/Stem behavior
* Update Path/Stem docs for FilePatternMatch
* Apply suggestions from code review
Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com>
Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com>
David Cantú [Thu, 18 Feb 2021 04:04:19 +0000 (20:04 -0800)]
Add option to ignore reference cycles on serialization (#46101)
* Add option to ignore reference cycles on serialization
* Fix whitespace
* Combine IsValueType check on WriteCoreAsObject
* Add missing null-forgiving operator
* Fix perf regression by using ReferenceHandlerStrategy field in JsonSerializerOptions
* Address suggestions
* Rename API to IgnoreCycles
* Add missing letter to test class name
* Fix CI issue with nullable annotation
Eric Soros [Thu, 18 Feb 2021 03:24:18 +0000 (22:24 -0500)]
Setting Thread.Name sets the native thread name on MacOS. (#47465)
* Setting Thread.Name sets the native thread name on MacOS.
Setting Thread.Name will now set the name of the native thread
on MacOS - due to API constraints this will not work cross thread.
Fix #47087
* adding tests and formatting fixes
David Wrighton [Thu, 18 Feb 2021 03:03:19 +0000 (19:03 -0800)]
Adjust logic in cor.h, corhdr.h, corinfo.h, corjit.h and such so that they may be included without the PAL (#46055)
This was done via simple substitution of the standard sized integer types, and dealing with the fallout. It is tested by using the ICorJitInfo interface directly within the crossgen2 jitinterface thunk library.
Effort was made to use a minimum number of casts, as casts in such a large change are likely to be wrong somewhere.
- Exceptions are the use of casting to handle some calls to the existing internal metadata api and around use of char16_t.
In addition, a small amount of logic from the PAL headers were pulled into the proper header to allow compilation in the presence of some SAL annotation, and other small details.
SingleAccretion [Thu, 18 Feb 2021 02:45:35 +0000 (05:45 +0300)]
Add debug checking of the loop table (#48060)
* Add fgDebugCheckLoopTable()
* Minify some logging
* Add checking of the loop table to some phases
* Ignore removed loops in fgDebugCheckLoopTable
Elinor Fung [Thu, 18 Feb 2021 00:39:43 +0000 (16:39 -0800)]
Remove libraries test build from AndroidCrypto staging job (#48422)
Bruce Forstall [Thu, 18 Feb 2021 00:38:26 +0000 (14:38 -1000)]
Update SuperPMI license headers (#48417)
Prashanth Govindarajan [Thu, 18 Feb 2021 00:36:25 +0000 (16:36 -0800)]
Fix parsing of trailing zeros: TryParseNumber (#47666)
* Fix parsing of numbers to detect trailing zeros
* sq
* Typo
* Fix a bug
Calculate number of trailing zeros only when number.Digits is updated
* Test case should be culture agnostic
* Address feedback
* More unit tests
* Bug fix and unit tests
* sq
* Address feedback.
* Get more debug info to track down build break
* Turn off consistency check at 1 spot
* Skip consistency check for decimal
* Turn off trailing zero check
Jeremy Koritzinsky [Wed, 17 Feb 2021 22:58:12 +0000 (14:58 -0800)]
Fix various test crashes and asserts when running the Algorithms test suite with the Android Crypto PAL (#48370)
* Fix various test crashes and asserts when running the Algorithms test suite.
* Replace the key/iv if it is initialized multiple times.
Egor Bogatov [Wed, 17 Feb 2021 21:17:20 +0000 (00:17 +0300)]
[RyuJIT] Track exact class for special intrinsics (EqulityComparer, Comparer) (#48279)
Maryam Ariyan [Wed, 17 Feb 2021 20:46:42 +0000 (12:46 -0800)]
Add Eager Options Validation: ValidateOnStart API (#47821)
Steve MacLean [Wed, 17 Feb 2021 19:09:22 +0000 (14:09 -0500)]
Fix PInvoke GenericTest (#48382)
imhameed [Wed, 17 Feb 2021 18:08:36 +0000 (10:08 -0800)]
[mono] Developer convenience MSBuild property (#48381)
Adds a property, named `MonoCMakeExtraArgs`, which is passed through to the CMake configure command invocation.
Example usage:
```
MonoCMakeExtraArgs="-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=$HOME/clang-9.x/out/bin/ld.lld -DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=$HOME/clang-9.x/out/bin/ld.lld -DCMAKE_LINKER=$HOME/clang-9.x/out/bin/ld.lld -DCMAKE_AR=$HOME/clang-9.x/out/bin/llvm-ar -DCMAKE_RANLIB=$HOME/clang-9.x/out/bin/llvm-ranlib" \
./build.sh
-configuration Release \
--subset mono \
/p:MonoLLVMUseCxx11Abi=true /p:MonoEnableLLVM=true \
/p:MonoLLVMDir="$LLVM_PREFIX"
```
`touch src/mono/mono/mini/mini-llvm.c && time ninja -C artifacts/obj/mono/Linux.x64.Release` reports 5.3 seconds when using lld, llvm-ar, and llvm-ranlib; this takes 18 seconds when using GNU tools.
Note that GCC doesn't support full paths for fuse-ld, [unlike Clang](https://reviews.llvm.org/D17952).
Andy Ayers [Wed, 17 Feb 2021 16:43:47 +0000 (08:43 -0800)]
Add MCS verb to dump jit flags histogram (#48281)
Useful for determining what sorts of jit compilations are found in an SPMI
collection.
Neale Ferguson [Wed, 17 Feb 2021 13:43:38 +0000 (23:43 +1000)]
Further fixes for s390x that correct some test suite failures (#48196)
## Further s390x Fixes
This set up patches enables s390x to pass more of the test suite.
### 1. Mono array layout
The array "raw data" layout is defined in two places, one for the Mono C++ code, and one for C# code (which should match!):
```
struct _MonoArray {
MonoObject obj;
/* bounds is NULL for szarrays */
MonoArrayBounds *bounds;
/* total number of elements of the array */
mono_array_size_t max_length;
/* we use mono_64bitaligned_t to ensure proper alignment on platforms that need it */
mono_64bitaligned_t vector [MONO_ZERO_LEN_ARRAY];
};
```
vs.
```
private class RawData
{
public IntPtr Bounds;
public IntPtr Count;
public byte Data;
}
```
However, this only actually matches perfectly on 32-bit platforms if `MONO_BIG_ARRAYS` is false and 64-bit platforms if `MONO_BIG_ARRAYS` is true. In the dotnet build, `MONO_BIG_ARRAYS` is false, so we have a problem on 64-bit platforms. On little-endian 64-bit platforms the mismatch is mostly harmless, but on big-endian 64-bit platforms this causes test case failures in `System.Tests.ArrayTests.Clear_Invalid`.
The patch fixes this for s390x, but it should be possible to implement this in a cleaner way ...
### 2. Tail call implementation
There were actually two bugs here. First of all, the `tailcall_reg` instruction was not marked in `cpu-s390x.md` to have an sreg1 input, which meant that the target address was never actually loaded up.
More problematically, the way the tailcall implementation handles call-saved argument registers was fundamentally broken. This is a problem on s390x with the r6 register, which is call-saved even though it is also used as argument register. This is a problem for tail calls, because you have to restore the old value before performing the tail call, which conflicts with loading the required argument value. The same problem also applies for the RGCTX/IMT register, which is likewise both call-saved and used to hold an _implicit_ argument.
The current Mono code simply does not restore the old value and only loads the argument value. But that is an ABI break and may cause failures in a caller higher up on the stack once the tail-called routine finally returns. Consider three functions A, B, C where
#### A:
```
[...]
define R6
call B (does not use R6 as argument)
use R6
[...]
```
##### B:
```
save R6
[...]
load R6 with argument value
tail call C (uses R6 as argument)
```
#### C:
```
save R6
[...]
use R6 argument value
[...]
restore R6
return
```
Once C finally returns to A, the value in R6 will be the value it had on entry to C, not that on entry to B, which is what the code in A relies on.
The following patch fixes this by disabling tail calls in those cases where R6 is used as argument register, as well as in all cases where the RGCTX/IMT register is used.
Note that it might be possible to re-enable the latter cases by using a call-clobbered register as RGCTX/IMT register. One option might be `%r1`, which is also used by GCC as the static chain pointer for nested functions (which is a somewhat similar purpose). This would also match what x86_64 is doing: they likewise use the static chain register for RGCTX/IMT.
I haven't implemented this since there might be a problem with other intervening trampolines clobbering %r1 -- this would need careful review and possibly some reshuffling. I guess this can be done later as an optimization.
### 3. Crashes due to corrupted sigaltstack
When sigaltstack is enabled, the kernel provides the address of the alternate stack to signal handlers in the `uc_stack.ss_sp` field. More importantly, the kernel also *reads* out that field once the signal handler returns and updates its notion of what alternate stack is to be used for future signals! This is a problem with current Mono code, which writes the user-code stack pointer into `ss_sp` -- causing the kernel to attempt to use that part of the user stack as alternate stack for the next signal. If that then overlaps then regular stack (which is likely), the kernel will consider this value corrupted and deliver a SIGSEGV instead.
Looking into this, I'm not really sure why Mono (the s390x code only) even writes to `ss_sp` in the first place. This is apparently read out in just one place, where we actually want to know the user stack, so I guess we can just use r15 directly instead.
#### 4. Codegen problem with floating-point to integer conversions
The Mono back-end uses `cegbr`/`cdgbr` (64-bit int to float conversion instructions) even in the case where the source is actually a 32-bit integer. It really should be using `cefbr`/`cdfbr` in those cases, which is what the following patch implements.
Note that I'm a bit unclear about the intention of the original code here: there appears to be some effort made to hold 32-bit integers in 64-bit sign-extended form in registers, in which case the `cegbr`/`cdgbr` would probably be also correct (but still not really preferable). However, this doesn't seem to be done consistently.
#### 5. Codegen problems with integer overflow detection
There were two separate bugs with properly detecting integer overflows. First of all, the `OP_IADD_OVF_UN` implementation used the 64-bit `algr` instead of the 32-bit `alr` instruction. While the (32-bit) numerical result is of course the same, the detected overflow is incorrect.
More problematic is the overflow detection for signed multiplication. The code seems to only verify whether the sign of the result matches the product of the signs of the inputs -- but this doesn't reliably detect overflow! While of course there must have been an overflow if the sign doesn't match, there can still be an overflow if the sign *does* match, for example in the case from the test suite: 1.000.000.000 * 10
Now, on recent machines we have hardware support to detect overflow: `msgrkc` and `msrkc`. While Mono was already using `msgrkc` (so the problem doesn't occur for 64-bit multiplication) it didn't use `msrkc`. The following patch just adds that case. Note that this still only fixes the problem on z14 on higher; the code for older machines really also ought to be fixed at some point.
#### 6. Codegen problems with interlocked add
Finally, there is a subtle problem with the code currently generated for the interlocked add primitives, if the machine supports the laa(g) instruction. Those handle the whole interlocked-add operation in hardware, so the only thing Mono codegen needs to handle in addition is the proper return value. The laa(g) instructions return the value the memory location had *before* the addition, while the Mono interlocked-add primitive is specified to return the value the memory location has *after* the addition.
To fix this discrepancy, the code generated by Mono will perform another load from the memory location immediately after the laa(g). This usually returns the correct value, but it creates a race condition: in between the laa(g) and the load, another thread might have changed the value! This violates the atomicity guarantee of the interlocked-add primitive.
To fix this, the following patch instead uses the (atomically loaded) result of the laa(g) instruction and then simply performs the original addition a second time in registers.
dotnet-maestro[bot] [Wed, 17 Feb 2021 13:36:59 +0000 (13:36 +0000)]
[master] Update dependencies from dotnet/xharness dotnet/llvm-project dotnet/icu (#48333)
[master] Update dependencies from dotnet/xharness dotnet/llvm-project dotnet/icu
Marek Safar [Wed, 17 Feb 2021 11:35:24 +0000 (12:35 +0100)]
Clean up libraries trimming illink configuration (#48153)
Peter Sollich [Wed, 17 Feb 2021 10:27:11 +0000 (11:27 +0100)]
Fix issue 41928 (#48295)
Details:
The issue was that verify_heap called copy_brick_card_table while another thread was growing these tables, so we ended up with a mark_array where the sections for a new segment were not committed, leading to an AV in bgc_verify_mark_array_cleared.
The fix is to take the gc_lock *before* calling veriy_heap. To avoid a deadlock, the lock has to be taken before we suspend the EE. This only affects the end of a background GC, the verify_heap at the start of a background GC already happens under the gc_lock.
I factored out common code into new methods enter_gc_lock_for_verify_heap and leave_gc_lock_for_verify_heap.
Marek Safar [Wed, 17 Feb 2021 09:36:43 +0000 (10:36 +0100)]
Add default linker substitutions for ios like targets (#48215)
Marek Safar [Wed, 17 Feb 2021 09:34:06 +0000 (10:34 +0100)]
Update NonVersionableAttribute attribute trimming (#48213)
Sergey Andreenko [Wed, 17 Feb 2021 08:10:33 +0000 (00:10 -0800)]
SPMI fixes for missing info. (#48360)
* SPMI hacks/fixes.
* review response.
Jan Kotas [Wed, 17 Feb 2021 07:38:54 +0000 (23:38 -0800)]
Update comment and add test for Marshal.GetDelegateForFunctionPointer (#48362)
* Update comment and fix test for Marshal.GetDelegateForFunctionPointer argument validation
* Disable test on Mono
Elinor Fung [Wed, 17 Feb 2021 06:09:22 +0000 (22:09 -0800)]
Add staging job to build Android using native crypto instead of OpenSSL (#48373)
* Fix x86 build
Juan Hoyos [Wed, 17 Feb 2021 05:14:54 +0000 (21:14 -0800)]
Add intepretation of MOV ESP, EBX to unwindLazyState (#45906)
Eirik Tsarpalis [Wed, 17 Feb 2021 04:37:10 +0000 (04:37 +0000)]
PriorityQueue: Apply Comparer<T>.Default optimization (#48346)
* PriorityQueue: inline Comparer<T>.Default.Compare calls
* address feedback
* Update src/libraries/System.Collections/src/System/Collections/Generic/PriorityQueue.cs
Co-authored-by: Stephen Toub <stoub@microsoft.com>
* address feedback
* Update src/libraries/System.Collections/src/System/Collections/Generic/PriorityQueue.cs
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Andrew Au [Wed, 17 Feb 2021 03:54:42 +0000 (19:54 -0800)]
Rename LargeHeapHandle* to PinnedHeapHandle* to reflect what it actually does (#48371)
Fan Yang [Wed, 17 Feb 2021 02:04:30 +0000 (21:04 -0500)]
Add initial support for Vector64 on Arm64 and Amd64 (#47618)
Contributes to #42350
This change:
- Conditionally marks Vector64<T> as a SIMD type. Vector64<T> is treated as a
SIMD type on amd64 and arm64 only when the LLVM backend is in use. Vector128<T>
continues to be supported with both LLVM and mini on amd64, as before; on arm64,
it continues to only be supported with LLVM.
- Checks vector widths for compatibility when bitcasting.
- Slightly cleans up return value handling for SIMD value types--conversion
from an aggregate to an LLVM vector-typed value now happens in one location.
- Removes a 128-bit SIMD assumption in the lowering code for OP_SETRET.
- Renames `emit_vector128` to `emit_sri_vector` and makes it width-agnostic.
- Improves the generated IR for non-broadcasting Vector64/Vector128.Create; the
resulting code works entirely in registers and does not depend on temporary
stack storage for writing values into individual vector lanes.
Co-authored-by: Imran Hameed <imhameed@microsoft.com>
Elinor Fung [Wed, 17 Feb 2021 00:32:42 +0000 (16:32 -0800)]
Fix using .NET COM server with `dynamic` keyword (#48037)
Viktor Hofer [Wed, 17 Feb 2021 00:09:40 +0000 (01:09 +0100)]
Update incremental servicing condition for pkgs (#48330)
* Update incremental servicing condition for pkgs
Tomáš Rylek [Tue, 16 Feb 2021 23:01:14 +0000 (00:01 +0100)]
Switch over framework packaging to use Crossgen2 (#47349)
Elinor Fung [Tue, 16 Feb 2021 20:40:48 +0000 (12:40 -0800)]
Fix build errors with Android crypto native (#48359)
Viktor Hofer [Tue, 16 Feb 2021 18:53:40 +0000 (19:53 +0100)]
Remove net5 feeds (#41620)
https://github.com/dotnet/runtime/issues/41593
Egor Chesakov [Tue, 16 Feb 2021 18:44:56 +0000 (10:44 -0800)]
Set *ppIndirection to NULL in MethodContext::repGetAddrOfCaptureThreadGlobal() if there is corresponding GetAddrOfCaptureThreadGlobal LWM (#48260)
Egor Bogatov [Tue, 16 Feb 2021 18:35:22 +0000 (21:35 +0300)]
RyuJIT: Fix logic to test bits in a constant vector (Vector256) (#47385)
Co-authored-by: Sergey Andreenko <seandree@microsoft.com>
Newell Clark [Tue, 16 Feb 2021 18:33:44 +0000 (13:33 -0500)]
Fix undisposed enumerators (#48322)
-Fix converters not disposing enumerators (issue #46349)
-Add tests
Viktor Hofer [Tue, 16 Feb 2021 17:45:55 +0000 (18:45 +0100)]
Remove some duplicated installer.tasks tasks (#48339)
* Remove some duplicated installer.tasks tasks
in favor of Arcade's implementation.
monojenkins [Tue, 16 Feb 2021 17:10:42 +0000 (12:10 -0500)]
Don't assume result is non-NULL if its type is not TYPE_VOID when tracing. (#48335)
On a CEE_MONO_ICALL set to **mono_threads_detach_coop** (from native to managed), the profile code is always emitted without a return value, since it's not at a ret. This means it's never set, even if there actually is a return type (other than TYPE_VOID). When tracing, it's assumed that valid result types other than TYPE_VOID can be dereferenced, even though in this case no result has been set. This causes a null dereference fault.
Co-authored-by: g-insn <g-insn@users.noreply.github.com>
Eirik Tsarpalis [Tue, 16 Feb 2021 16:38:03 +0000 (16:38 +0000)]
fix task doc typo (#48332)
Kenneth Pouncey [Tue, 16 Feb 2021 16:13:44 +0000 (17:13 +0100)]
[mono] Bump emscripten to 2.0.12 (#48334)
Lennart Brüggemann [Tue, 16 Feb 2021 15:43:38 +0000 (16:43 +0100)]
Throw instead of returning null in XNodeReader.GetAttribute(int) (#44589)
* Throw exception on non-interactive mode and invalid index instead of returning null
* Adapt unit tests to exceptions
* Move tests from XCMLReaderAttrTest to XNodeReaderAttributeTests.
Remove these test cases from FunctionTests' children
* Migrate attribute tests toward XUnit
* Remove migrated tests and distinguish between int and string indexer
* Throw ArgumentOutOfRangeException when index is above upper bound and update tests
Neale Ferguson [Tue, 16 Feb 2021 15:12:12 +0000 (01:12 +1000)]
Multiple s390x fixes (#48329)
dotnet-maestro[bot] [Tue, 16 Feb 2021 12:40:50 +0000 (12:40 +0000)]
Update dependencies from https://github.com/mono/linker build
20210216.1 (#48327)
[master] Update dependencies from mono/linker
Stephen Toub [Tue, 16 Feb 2021 11:51:30 +0000 (06:51 -0500)]
Fix IndexOutOfRangeException in PriorityQueue.EnqueueDequeue (#48323)
Stephen Toub [Tue, 16 Feb 2021 11:48:03 +0000 (06:48 -0500)]
Avoid nulling out in PriorityQueue.Remove if it's not needed (#48324)
Viktor Hofer [Tue, 16 Feb 2021 11:24:23 +0000 (12:24 +0100)]
Use live dependencies for netcoreapp3.0 depencies (#48176)
* Use live dependencies for netcoreapp3.0 deps
Nikitin A. Kirill [Tue, 16 Feb 2021 10:41:16 +0000 (14:41 +0400)]
AssemblyLoadContext.CurrentContextualReflectionContext and instantiating AssemblyBuilder (#48072)
Added the ability to use AssemblyLoadContext.CurrentContextualReflectionContext when instantiating AssemblyBuilder
Kenneth Pouncey [Tue, 16 Feb 2021 08:34:13 +0000 (09:34 +0100)]
[mono] Adjust wasm gitignore (#48325)
- move the responsibility of ignoring wasm files to the mono/wasm .gitignore
Marek Safar [Tue, 16 Feb 2021 07:29:37 +0000 (08:29 +0100)]
Trim assembly level attributes which are not useful and can contain (#48301)
very long string value
Steve MacLean [Tue, 16 Feb 2021 04:23:07 +0000 (23:23 -0500)]
Update runparallel.sh for Apple Silicon bringup (#46935)
Use syntax available on OSX
Stabilize counting
Simplify termination logic
Simplify polling intermediate results
Andy Ayers [Tue, 16 Feb 2021 03:58:01 +0000 (19:58 -0800)]
JIT: allow inlinee profile scale-up (#48280)
We can't always be sure that callee entry counts will be greater than or equal
to call site counts. For example a callee could be tiered up before a caller,
and so have relatively smaller counts.
So, when computing inline scale, allow callee counts to be scaled up as well as
scaled down.
Marek Safar [Tue, 16 Feb 2021 02:48:40 +0000 (03:48 +0100)]
Remove some code duplication in System.Net.Http.Headers (#48297)
* Remove some code duplication in System.Net.Http.Headers
* Update src/libraries/System.Net.Http/tests/UnitTests/Headers/NameValueHeaderValueTest.cs
Co-authored-by: Karel Zikmund <karelz@microsoft.com>
* Apply suggestions from code review
Co-authored-by: Karel Zikmund <karelz@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Stephen Toub [Tue, 16 Feb 2021 02:03:30 +0000 (21:03 -0500)]
Add missing XML comments on PriorityQueue public API (#48316)
Stephen Toub [Tue, 16 Feb 2021 02:02:55 +0000 (21:02 -0500)]
Avoid QueueUserWorkItem allocation in rare Channel race condition (#48313)
Björn Harrtell [Tue, 16 Feb 2021 01:06:38 +0000 (02:06 +0100)]
Fix typo endinanness -> endianness (#48319)