platform/upstream/dotnet/runtime.git
2 years ago[mono][wasm] Remove unused targets from wasm/Makefile. (#63263)
Zoltan Varga [Sun, 2 Jan 2022 18:26:27 +0000 (13:26 -0500)]
[mono][wasm] Remove unused targets from wasm/Makefile. (#63263)

The real build now happens in runtime/CMakeLists.txt, the Makefile
contains only helper targets now.

2 years agoUpdate issue suppressions (#63248)
Michal Strehovský [Sat, 1 Jan 2022 18:33:38 +0000 (03:33 +0900)]
Update issue suppressions (#63248)

The test got renamed in #63178.

Should fix the Mono AOT CI failures seen in #63232.

2 years agoImprove SuperPMI error message for JIT asserts (#63229)
Bruce Forstall [Fri, 31 Dec 2021 23:58:15 +0000 (15:58 -0800)]
Improve SuperPMI error message for JIT asserts (#63229)

Currently, the method context numbers are output for each failure,
but the assert message is output separately, so if there are multiple
asserts that fire, and you want to investigate a particular one,
it's hard to figure out which method context number to use.

Add the method context number to the assert message, so the relationship
between the method context number and the assert is obvious.

E.g., you always get messages like the following (both before this change
and after):
```
ERROR: Exception thrown: DebugBreak or AV Exception 123
ERROR: main method 16501 of size 286 failed to load and compile correctly.
```

Before you might see an assert like:
```
ISSUE: <ASSERT> C:\gh\runtime6\src\coreclr\jit\fgbasic.cpp (4699) - Assertion failed '!"unexpected case 1"' in 'CancellationTokenSource:ExecuteCallbackHandlers(bool):this' during 'Update flow graph opt pass' (IL size 286)
```

Now, it will look like:
```
ISSUE: <ASSERT> #16501 C:\gh\runtime6\src\coreclr\jit\fgbasic.cpp (4699) - Assertion failed '!"unexpected case 1"' in 'CancellationTokenSource:ExecuteCallbackHandlers(bool):this' during 'Update flow graph opt pass' (IL size 286)
```

2 years agoBring over ILCompiler.Compiler unit tests (#63232)
Michal Strehovský [Fri, 31 Dec 2021 23:42:31 +0000 (08:42 +0900)]
Bring over ILCompiler.Compiler unit tests (#63232)

...from CoreRT repo since we skipped them in runtimelab.

2 years agoavoid ArgumentOutOfRangeException while processing invalid or incomplete TLS frame...
Tomas Weinfurt [Fri, 31 Dec 2021 23:02:24 +0000 (15:02 -0800)]
avoid ArgumentOutOfRangeException while processing invalid or incomplete TLS frame (#63184)

* avoid ArgumentOutOfRangeException while processing invalid or incomplete TLS frame

* feedback from review

2 years agoSpeed up crossgen2 by a couple percent (#63234)
Michal Strehovský [Fri, 31 Dec 2021 21:21:42 +0000 (06:21 +0900)]
Speed up crossgen2 by a couple percent (#63234)

I ran crossgen2 compiling a Release CoreLib under a profiler and this stood out quite a bit. The JIT-based CoreLib doesn't have the `Array<T>` type so `GetType` was walking all types in CoreLib.

I split this logic out to an ILC-specific file. I don't remember this showing up in the profiles for ILC, but I added a cache nevertheless.

2 years agoSwitch to objwriter from the dotnet/llvm-project repo (#63177)
Michal Strehovský [Fri, 31 Dec 2021 04:34:33 +0000 (13:34 +0900)]
Switch to objwriter from the dotnet/llvm-project repo (#63177)

2 years agoAdd ILLink.Shared project to Native AOT (#63230)
Tlakaelel Axayakatl Ceja [Fri, 31 Dec 2021 02:54:35 +0000 (18:54 -0800)]
Add ILLink.Shared project to Native AOT (#63230)

Change diagnostics to use ILLink.Shared utilities
Update ReferenceSource folder
Add method to obtain Requires attribute named argument URL

2 years agoAllow managed type system tests on Alpine (#63207)
Michal Strehovský [Thu, 30 Dec 2021 23:58:23 +0000 (08:58 +0900)]
Allow managed type system tests on Alpine (#63207)

This was disabled in https://github.com/dotnet/runtime/pull/38128/commits/d98d9a2f52f16a87fdc8a28a252e94eca796abb2. I don't think those problems exist anymore - targets are written differently, and we would likely see musl-arm64 failures if this was still a problem.

2 years agoRename test suppressions (#63210)
Michal Strehovský [Thu, 30 Dec 2021 23:56:58 +0000 (08:56 +0900)]
Rename test suppressions (#63210)

The tests were renamed in dotnet/runtime#63178.

Fixes #63202 (and also the CI breaks in Mono leg seen in e.g. dotnet/runtime#63207).

2 years agoFix ILVerify.ILVerifyTypeSystemContext.VerifyModuleName throws NullReferenceException...
masonwheeler [Thu, 30 Dec 2021 19:07:48 +0000 (12:07 -0700)]
Fix ILVerify.ILVerifyTypeSystemContext.VerifyModuleName throws NullReferenceException (#63222)

Fixes #62711

2 years agoFix regex test OOM (#63092)
Dan Moseley [Thu, 30 Dec 2021 18:36:50 +0000 (11:36 -0700)]
Fix regex test OOM (#63092)

2 years agoFix typos in comments (#63220)
Michael Ganss [Thu, 30 Dec 2021 16:25:32 +0000 (17:25 +0100)]
Fix typos in comments (#63220)

2 years agoDefine MCREGs for ARM64 macOS (#63209)
Michal Strehovský [Thu, 30 Dec 2021 16:06:10 +0000 (01:06 +0900)]
Define MCREGs for ARM64 macOS (#63209)

2 years agoAllow using ILCompiler without an IlcPath (#63211)
Michal Strehovský [Thu, 30 Dec 2021 15:34:41 +0000 (00:34 +0900)]
Allow using ILCompiler without an IlcPath (#63211)

This will allow specifying disjoint paths for the various inputs to ILC. We'll need this if we want to run ILC as part of the build to either build crossgen2 with ILC or selfhost ILC. Separate properties avoid having to lay out things on the file system the way IlcPath expects.

2 years agoFix NativeAOT multifile test run (#63183)
Michal Strehovský [Thu, 30 Dec 2021 08:07:40 +0000 (17:07 +0900)]
Fix NativeAOT multifile test run (#63183)

2 years agoCleanup in NativeAOT from x86 attempt (#63182)
Andrii Kurdiumov [Thu, 30 Dec 2021 08:06:35 +0000 (14:06 +0600)]
Cleanup in NativeAOT from x86 attempt (#63182)

This is retrofitting parts of https://github.com/dotnet/runtimelab/pull/1531

2 years ago[mono] Use Xcode path from xcode-select instead of hardcoding (#63076)
Alexander Köplinger [Wed, 29 Dec 2021 19:59:47 +0000 (20:59 +0100)]
[mono] Use Xcode path from xcode-select instead of hardcoding (#63076)

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

2 years agoFix _il suffix for _d/_r-variant ilproj tests (#63178)
Tomáš Rylek [Wed, 29 Dec 2021 16:01:07 +0000 (17:01 +0100)]
Fix _il suffix for _d/_r-variant ilproj tests (#63178)

2 years agoRemove unneeded ifdefs (#63160)
Bruce Forstall [Tue, 28 Dec 2021 23:22:34 +0000 (15:22 -0800)]
Remove unneeded ifdefs (#63160)

Remove ifdefs for always-on values: ASSERTION_PROP,
LOCAL_ASSERTION_PROP, OPT_BOOL_OPS, LARGE_EXPSET,
REDUNDANT_LOAD.

2 years agoUnify build mode for one previously missed form _opt_dbg / _opt_rel (#63175)
Tomáš Rylek [Tue, 28 Dec 2021 23:11:01 +0000 (00:11 +0100)]
Unify build mode for one previously missed form _opt_dbg / _opt_rel (#63175)

2 years agoUse shared strings for Array:Copy exception messages (#63163)
Marek Safar [Tue, 28 Dec 2021 21:20:30 +0000 (22:20 +0100)]
Use shared strings for Array:Copy exception messages (#63163)

2 years agoUse SIMD operations in InitBlkUnroll/CopyBlkUnroll and increase unroll limit up to...
Egor Chesakov [Tue, 28 Dec 2021 18:18:01 +0000 (10:18 -0800)]
Use SIMD operations in InitBlkUnroll/CopyBlkUnroll and increase unroll limit up to 128 bytes (#61030)

* Use SIMD operations in CodeGen::genCodeForInitBlkUnroll()

* Use SIMD operations in CodeGen::genCodeForCpBlkUnroll()

* Remove restrictions on offset values in Lowering::ContainBlockStoreAddress()

* Remove unused macros in src/coreclr/jit/instr.h

2 years agoDeduplicate JIT/Methodical/tailcall tests and make them mergeable (#63031)
Tomáš Rylek [Tue, 28 Dec 2021 08:42:38 +0000 (09:42 +0100)]
Deduplicate JIT/Methodical/tailcall tests and make them mergeable (#63031)

This change fixes mergeability of tailcall tests: apart from simple
deduplication of the test class names and visibility fixes
I have modified the pointer and reference tests to stop using
Environment.Exit for exiting the test as that kills the merged
wrapper in in-proc execution; I have also fixed them to have main
within a class. In two cases (recurse_ep_void and test_virt)
I found out that I had previously put the Fact attribute on the
wrong method so I fixed that too. I renamed the two C# test
projects to better match the test of tests (widen to widen_r to
indicate it's a release test and thread-race_il_r to thread-race_r
as it's not an IL test).

Thanks

Tomas

2 years agoImprove auto-formatting of ref/System.Runtime (#63139)
Jan Kotas [Tue, 28 Dec 2021 04:54:18 +0000 (18:54 -1000)]
Improve auto-formatting of ref/System.Runtime (#63139)

Run `dotnet build /t:GenerateReferenceSource` and kept the good deltas

2 years agoFixup some formatting in shared code (#63156)
Pranav K [Mon, 27 Dec 2021 23:08:58 +0000 (15:08 -0800)]
Fixup some formatting in shared code (#63156)

2 years agoMove System.Runtime.InteropServices.RuntimeInformation to CoreLib (#63140)
Jan Kotas [Mon, 27 Dec 2021 18:07:34 +0000 (08:07 -1000)]
Move System.Runtime.InteropServices.RuntimeInformation to CoreLib (#63140)

- Makes RuntimeInformation.ProcessArchitecture a JIT/AOT-time constant (constant returning property)
- Eliminates tiny netcoreapp assembly with just a few types

Fixes #57152
Contributes to #2138

2 years ago[mono] Fix a regression caused by 9ddd58a58d14a7bec5ed6eb777c6703c48aca15d. (#63084)
Zoltan Varga [Mon, 27 Dec 2021 06:47:12 +0000 (01:47 -0500)]
[mono] Fix a regression caused by 9ddd58a58d14a7bec5ed6eb777c6703c48aca15d. (#63084)

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

2 years agoNativeAOT: Do not run Vector version of Hardware Intrinsics when AVX2… (#62951)
Andrii Kurdiumov [Mon, 27 Dec 2021 00:37:17 +0000 (06:37 +0600)]
NativeAOT: Do not run Vector version of Hardware Intrinsics when AVX2… (#62951)

2 years agoDelete NativeAOT-specific CoreLib string resources (#63129)
Jan Kotas [Sun, 26 Dec 2021 10:58:11 +0000 (00:58 -1000)]
Delete NativeAOT-specific CoreLib string resources (#63129)

* Delete NativeAOT-specific CoreLib string resources

- Fix missing localization of resource strings
- Delete duplicate resource strings where possible
- Delete internal or redundant messages

* Use default AmbiguousMatchException message where possible

* Print error message for calling UnmanagedCallersOnly method from managed code.

2 years agoParse compiler version in init-compiler.sh (#63126)
Adeel Mujahid [Sun, 26 Dec 2021 04:30:45 +0000 (06:30 +0200)]
Parse compiler version in init-compiler.sh (#63126)

When user passes versioned native compiler argument such as
`-clang10.1` or `-gcc9.2` to the top-level `:/build.sh`,
`:/eng/build.sh` transforms that to msbuild property called
`<Compiler>` with raw/unprocessed value.

In coreclr, libs, corehost and tests partitions, we end up calling
`:/eng/native/build-commons.sh`, which slices the compiler name, major
and minor versions, then calls `:/eng/native/gen-buildsys.sh` with
individual components. That is just a pass-thru script for the final
`:/eng/common/native/init-compiler.sh`, where those arguments are
actually used.

In `mono.proj` and `NativeExports.csproj`, we do not use
`build-commons` script, but instead, invoke `init-compiler.sh` directly
with the raw `<Compiler>` property. That causes an error when versioned
native compiler is specified on the command line.

This PR fixes this issue by pushing version parsing code into
`init-compiler.sh` so all its consumers get the same behavior.

2 years agoFix libs.tests subset build on tizen arm64 (#63128)
Adeel Mujahid [Sat, 25 Dec 2021 19:12:31 +0000 (21:12 +0200)]
Fix libs.tests subset build on tizen arm64 (#63128)

In our cross-build setup, we use different heuristics to identify the
target platform first for ourselves, to be then able to set "toolchain
file" settings. Sometimes it is a file that is known to exist in
platform's sysroot directory pointed by `ROOTFS_DIR` (FreeBSD and
illumos), and for Tizen and Android it is `__DistroRid` environment
variable which is used for detection. This environment variable is set
only during the non-portable build.

In NativeExport.csproj, we call toolchain.cmake via
`output-toolchain-info.cmake` using `Exec` task to prepare native
compiler and linker arguments for DNNE project. It is invoked in script
mode where cmake engine does not initialize its built-in modules. For
the handful of build-in modules that we use in `toolchain.cmake`, we
have custom macros in `output-toolchain-info.cmake`.

Tizen build was broken because a) `__DistroRid` was not propagated in
the `Exec` task, b) we were missing custom macro for
`include_directories`.

This delta addresses the issue a) by unifying how different platforms
are detected in toolchain file and forgoes reliance of `__DistroRid`
which is an archiac concept when non-portable builds were the only
option, and issue b) by defining `include_directores` macro.

2 years agoDelete unused libs.native shims (#63132)
Adeel Mujahid [Sat, 25 Dec 2021 19:09:35 +0000 (21:09 +0200)]
Delete unused libs.native shims (#63132)

2 years agoUse System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting (...
Marek Safar [Sat, 25 Dec 2021 01:34:58 +0000 (02:34 +0100)]
Use System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting (#62903)

feature switch to keep native hosting ComponentActivator dependencies

2 years agoUpdate the apple testing doc (#63119)
Maxim Lipnin [Fri, 24 Dec 2021 12:33:24 +0000 (15:33 +0300)]
Update the apple testing doc (#63119)

2 years agoFix setting the configuration parameter in the apple test runner (#63102)
Maxim Lipnin [Fri, 24 Dec 2021 06:22:36 +0000 (09:22 +0300)]
Fix setting the configuration parameter in the apple test runner (#63102)

2 years agoReduce size of HttpHeaderValueCollection (#63057)
Geoff Kizer [Thu, 23 Dec 2021 19:49:33 +0000 (11:49 -0800)]
Reduce size of HttpHeaderValueCollection (#63057)

Reduce size of HttpHeaderValueCollection by removing and reworking _validator and _specialValue

2 years ago[main] Update dependencies from dotnet/linker (#63044)
dotnet-maestro[bot] [Thu, 23 Dec 2021 09:07:01 +0000 (10:07 +0100)]
[main] Update dependencies from dotnet/linker (#63044)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years ago[mono][interp] Remove null check during initblk/cpblk with size 0 (#63086)
Vlad Brezae [Thu, 23 Dec 2021 08:46:50 +0000 (10:46 +0200)]
[mono][interp] Remove null check during initblk/cpblk with size 0 (#63086)

2 years agoRemove unnecessary assignment of a value to local variables in SPC (#63020)
Marek Safar [Thu, 23 Dec 2021 08:24:04 +0000 (09:24 +0100)]
Remove unnecessary assignment of a value to local variables in SPC (#63020)

2 years agoDelete some dead code (#63087)
Adeel Mujahid [Thu, 23 Dec 2021 01:46:30 +0000 (03:46 +0200)]
Delete some dead code (#63087)

2 years agoOverride same attributes found at class and property level in ApplicationSettingsBase...
Buyaa Namnan [Wed, 22 Dec 2021 21:23:32 +0000 (13:23 -0800)]
Override same attributes found at class and property level in ApplicationSettingsBase (#63025)

2 years agodisable failing HTTP3 interop test (#63055)
Geoff Kizer [Wed, 22 Dec 2021 21:10:55 +0000 (13:10 -0800)]
disable failing HTTP3 interop test (#63055)

* disable failing HTTP3 interop test

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
Co-authored-by: Anton Firszov <antonfir@gmail.com>
2 years ago[tests] Cleanup copy/pasted assembly update test projects (#62970)
Aleksey Kliger (λgeek) [Wed, 22 Dec 2021 13:29:25 +0000 (08:29 -0500)]
[tests] Cleanup copy/pasted assembly update test projects (#62970)

* Cleanup copy/pasted assembly update test projects

* Keep the ProjectReferences as is

It's easier to grep and it's easier for the IDE to display them

Compute the TrimmerRootAssembly items from the project referferences

So to add a new test you just need to add a ProjectReference in one place

2 years ago[main] Update dependencies from dotnet/arcade dotnet/xharness (#63069)
dotnet-maestro[bot] [Wed, 22 Dec 2021 13:16:21 +0000 (14:16 +0100)]
[main] Update dependencies from dotnet/arcade dotnet/xharness (#63069)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years ago[wasm] fix sample make files & RunScript bash lowercase problem (#63062)
Pavel Savara [Wed, 22 Dec 2021 11:48:25 +0000 (12:48 +0100)]
[wasm] fix sample make files & RunScript bash lowercase problem (#63062)

* fix make
* fix lower case $Scenario

2 years ago[wasm] Tweak set timeout (#62898)
Marek Fišera [Wed, 22 Dec 2021 09:45:39 +0000 (10:45 +0100)]
[wasm] Tweak set timeout (#62898)

- Cache method lookup for TimerQueue.TimeoutCallback and ThreadPool.Callback.
- Remove unused parameter "id" from timer related functions.

2 years ago[main] Update dependencies from 5 repositories (#63043)
dotnet-maestro[bot] [Wed, 22 Dec 2021 09:26:14 +0000 (10:26 +0100)]
[main] Update dependencies from 5 repositories (#63043)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoHandle parameterless ctors in structs in STJ's ReflectionEmitMemberAccessor (#62989)
Egor Bogatov [Tue, 21 Dec 2021 18:11:20 +0000 (21:11 +0300)]
Handle parameterless ctors in structs in STJ's ReflectionEmitMemberAccessor  (#62989)

* Add boxing for parameterless ctors in structs (C# 10 feature) during dynamic code generation

* move tests to Common

* fix tests

* Address feedback

2 years ago[wasm] updated samples for ES6 and CJS (#62292)
Pavel Savara [Tue, 21 Dec 2021 17:44:41 +0000 (18:44 +0100)]
[wasm] updated samples for ES6 and CJS (#62292)

* samples for ES6 and CJS
* hack for in-tree linking
* binlog for samples

2 years agoExpose AppContext.SetData in ref assembly (#62996)
Robin Lindner [Tue, 21 Dec 2021 14:55:05 +0000 (15:55 +0100)]
Expose AppContext.SetData in ref assembly (#62996)

* Expose AppContext.SetData in ref assembly

* Implement test for Set/GetData

* Add doc comment

2 years ago[wasm][debugger] Run getter using Runtime.GetProperties (#62857)
Thays Grazia [Tue, 21 Dec 2021 12:19:48 +0000 (09:19 -0300)]
[wasm][debugger] Run getter using Runtime.GetProperties (#62857)

* Implementing support on running getters using Runtime.GetProperties as it's done by chrome.

* Addressing @radical comments.

* testing datetime

2 years agoMore static in System.ComponentModel.TypeConverter (#63017)
Marek Safar [Tue, 21 Dec 2021 12:19:33 +0000 (13:19 +0100)]
More static in System.ComponentModel.TypeConverter (#63017)

2 years agoUpdate ObjWriter package (#63035)
Michal Strehovský [Tue, 21 Dec 2021 05:09:01 +0000 (14:09 +0900)]
Update ObjWriter package (#63035)

The package we're currently using is missing https://github.com/dotnet/runtimelab/pull/1519.

2 years agoFix HAVE_PTHREAD_CONDATTR_SETCLOCK detection on Android (#62978)
Michal Strehovský [Tue, 21 Dec 2021 03:27:00 +0000 (12:27 +0900)]
Fix HAVE_PTHREAD_CONDATTR_SETCLOCK detection on Android (#62978)

Android puts pthread stuff into libc. Because this wasn't detected, we are using some iOS fallbacks in System.Native. I'm propagating how pthreads are detected in the CoreCLR PAL (that was fixed up for Android in the CoreCLR PAL a couple years ago).

Failure to properly detect it here was causing build breaks in CoreCLR on Android (that's how I found this).

2 years agoVarious WASM AOT changes (#62997)
Zoltan Varga [Mon, 20 Dec 2021 23:12:38 +0000 (18:12 -0500)]
Various WASM AOT changes (#62997)

* [mono] Add a mono_dummy_jit_icall_val () icall.

This can be used to trace values from AOT code during runtime
debugging.

* [mono] Avoid adding a try clause to vector alloc wrappers.

Previously, a try-catch clause was added to the vector Alloc
wrappers to convert the OverflowException thrown by the .ovf
opcodes to an OutOfMemoryException. This could cause EH problems on wasm
since on wasm no AOTed code should contain clauses, but this
wrapper was still AOTed for performance reasons.
Instead, add a new CIL opcode to make the .ovf opcodes throw the
OutOfMemoryException directly.

* Disable inline rgctx fetch in mono_decompose_vtype_opts () as well.

It can't handle the new bblocks added by the inline rgctx fetch code.

* [mono] Factor out the slow path of Array.Copy () into a separate method.

The slowpath contained a try-catch clause, preventing Array.Copy () from
being AOTed on WASM.

* [mono] Fix assigning a name to LLVM Alloca instructions.

* Add a V=1 makefile option to wasm/Makefile.

* Add a WasmAotProfilePath build property.

2 years agoFixed typo in remarks section of OnCompleted (#62982)
Liviu Mandras-Iura [Mon, 20 Dec 2021 19:44:24 +0000 (21:44 +0200)]
Fixed typo in remarks section of OnCompleted (#62982)

2 years ago[main] Update dependencies from dotnet/runtime (#63010)
dotnet-maestro[bot] [Mon, 20 Dec 2021 16:36:55 +0000 (17:36 +0100)]
[main] Update dependencies from dotnet/runtime (#63010)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agofix race condition in System.IO.Packaging (#63013)
Michał Makowski [Mon, 20 Dec 2021 16:18:05 +0000 (17:18 +0100)]
fix race condition in System.IO.Packaging (#63013)

2 years agoWinHttp: always read HTTP/2 streams to the end (#62870)
Anton Firszov [Mon, 20 Dec 2021 13:07:32 +0000 (05:07 -0800)]
WinHttp: always read HTTP/2 streams to the end (#62870)

By it's default behavior, WinHttp stops reading the stream when Content-Length is specified, this prevents us to read the remaining trailers. Opt-in into WINHTTP_OPTION_REQUIRE_STREAM_END, so WinHttpHandler reads HTTP2 streams to the end regardless of Content-Length.

2 years ago[main] Update dependencies from dotnet/linker (#62771)
dotnet-maestro[bot] [Mon, 20 Dec 2021 12:32:52 +0000 (13:32 +0100)]
[main] Update dependencies from dotnet/linker (#62771)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoImprove XML documentation (#62994)
bjornen77 [Mon, 20 Dec 2021 12:08:12 +0000 (13:08 +0100)]
Improve XML documentation (#62994)

Corrected return value type in XML documentation.

Fix #62993

Co-authored-by: Björn Sjögren <bjs@hms.se>
2 years ago[main] Update dependencies from dotnet/arcade (#62985)
dotnet-maestro[bot] [Mon, 20 Dec 2021 08:48:50 +0000 (09:48 +0100)]
[main] Update dependencies from dotnet/arcade (#62985)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoFix managed CoreCLR build on Android (#63002)
Michal Strehovský [Mon, 20 Dec 2021 04:02:03 +0000 (13:02 +0900)]
Fix managed CoreCLR build on Android (#63002)

2 years agoImplement isMoffset for emitOutputAM (#62896)
SingleAccretion [Sun, 19 Dec 2021 22:35:37 +0000 (01:35 +0300)]
Implement isMoffset for emitOutputAM (#62896)

2 years agoRemove small casts on the RHS of ASG(CLS_VAR) (#62693)
SingleAccretion [Sun, 19 Dec 2021 22:20:57 +0000 (01:20 +0300)]
Remove small casts on the RHS of ASG(CLS_VAR) (#62693)

2 years agoHave NativeAOT test execution project include SDK (#62927)
Michal Strehovský [Sat, 18 Dec 2021 23:57:31 +0000 (08:57 +0900)]
Have NativeAOT test execution project include SDK (#62927)

* Have NativeAOT test execution project include SDK

The SDK contains logic to configure trimming - we were skipping all of that. We couldn't previously include the SDK because it would reflection-root the entrypoint assembly. No longer the case after #62890.

2 years agoAdd 'w' and 's' bit to xarch instruction flags. (#61198)
anthonycanino [Sat, 18 Dec 2021 18:21:17 +0000 (10:21 -0800)]
Add 'w' and 's' bit to xarch instruction flags. (#61198)

Change encodes 'w' and 's' in the insFlags struct and INS_FLAG
entry for xarch instruction table. In addition, add methods to check
check if this flag is set for an instruction, which allows to start
simplifying some of the various ad-hoc checks for these bits that were
previously done per-instruction throughout emitxarch.cpp.

2 years ago[wasm] Testing with NodeJs on CI (#62779)
Pavel Savara [Sat, 18 Dec 2021 09:14:01 +0000 (10:14 +0100)]
[wasm] Testing with NodeJs on CI (#62779)

* enable testing with NodeJS on CI
* Fix task marshal tests.
Co-authored-by: Marek Fišera <mara@neptuo.com>
2 years agoSuppress OSR for crossgen2 execution (#62968)
Andy Ayers [Sat, 18 Dec 2021 07:09:36 +0000 (23:09 -0800)]
Suppress OSR for crossgen2 execution (#62968)

* Suppress OSR for crossgen2 execution

In CI testing, crossgen2 currently is run via a .NET 6 runtime, and
that runtime has some bugs in OSR.

Work around by suppressing OSR for the duration of the run. We should
be able to revert this once we update the crossgen2 runtime
to a .NET 7 version.

* add COMPlus exclusions for readytorun/multifolder

2 years agoAllow building libs against NativeAOT CoreLib (#62945)
Michal Strehovský [Sat, 18 Dec 2021 05:13:08 +0000 (14:13 +0900)]
Allow building libs against NativeAOT CoreLib (#62945)

To make sure ApiCompat tooling for NativeAOT's CoreLib runs at least in some legs, compile libs against NativeAOT CoreLib if we're building CLR, but not building the JIT flavor of the runtime.

The baselining is necessary because the reflection stack of NativeAOT doesn't live in CoreLib.

The CannotRemoveBaseTypeOrInteface baselining will go away once https://github.com/dotnet/runtime/issues/62944 gets fixed. It's one of the "overall goodness" things we can take out of NativeAOT and put it into all runtimes.

2 years agoHandle RunClassConstructor with nonreflectable cctor (#62947)
Michal Strehovský [Sat, 18 Dec 2021 04:59:42 +0000 (13:59 +0900)]
Handle RunClassConstructor with nonreflectable cctor (#62947)

This is now getting hit in #62927, so it's somewhat more urgent. (The feature switches from the SDK put us into the situation that triggers this bug around `RunClassConstructor` on an otherwise unused type.)

Fixes dotnet/runtimelab#987.

Remember what class constructor contexts we saw during scanning phase and if the owning type is also generated, assume `RunClassConstructor` could be used and ensure the cctor context is also generated in the compilation phase.

This is somewhat less precise, but introducing a new node type for "a type used with `RunClassConstructor`" that dataflow analysis could report doesn't seem worth it.

2 years agoUpdate shared trimming attributes with recently added/used types (#62911)
Marek Safar [Fri, 17 Dec 2021 22:26:34 +0000 (23:26 +0100)]
Update shared trimming attributes with recently added/used types (#62911)

2 years agoUnify implementation of string constructors accross runtimes (#62936)
Jan Kotas [Fri, 17 Dec 2021 22:25:23 +0000 (14:25 -0800)]
Unify implementation of string constructors accross runtimes (#62936)

String constructors implementation methods had a dummy this argument on CoreCLR, but not on other runtimes.  It required ifdefs in the implementation. This change removes the ifdefs and makes the string constructors implementation methods uniform accross all runtimes. It is possible to do this cleanup now since we have just bumped R2R version band.

2 years agoDeduplicate JIT/Methodical/explicit/coverage tests (#62867)
Tomáš Rylek [Fri, 17 Dec 2021 19:05:08 +0000 (20:05 +0100)]
Deduplicate JIT/Methodical/explicit/coverage tests (#62867)

This test set contains several project groups exercising various
primitive types using explicit and sequential layout. Each group
comprises a variant source file implementing a sequential or
explicit struct / class 'AA' with a field of the given type
(e.g. expl_byte_1.cs / seq_byte_1.cs) and a common source file
(body_byte.cs in this case) implementing a number of tests
manipulating the type 'AA' that is shared by the explicit and
the sequential variant of the project (e.q. expl_byte_1[_d/_r].csproj,
seq_byte_1[_d/_r].csproj).

The problem was that the Main method resided in the common source
file so that it was always present twice - once for the sequential
and once for the explicit variant of the test (ignoring the _d / _r
flavors). After experimenting with several ways to refactor the tests
I have come to the conclusion that the most straightforward way
of deduplicating them is just moving the Main method out of the shared
source code into the variant (explicit / sequential) sources that
aren't shared.

Thanks

Tomas

2 years agoJIT: handle more cases for MOD/DIV -> UMOD/UDIV transformation (#62394)
Egor Bogatov [Fri, 17 Dec 2021 18:36:24 +0000 (21:36 +0300)]
JIT: handle more cases for MOD/DIV -> UMOD/UDIV transformation (#62394)

* Introduce IsNeverNegative

* Address feedback

* Apply suggestions from code review

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
* Address feedback

* fix build on x86

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
2 years agoRemove forward-sub for hw intrinsics during inlining (#62883)
Egor Bogatov [Fri, 17 Dec 2021 18:36:00 +0000 (21:36 +0300)]
Remove forward-sub for hw intrinsics during inlining (#62883)

2 years ago[main] Update dependencies from dotnet/arcade llvm-project (#62842)
dotnet-maestro[bot] [Fri, 17 Dec 2021 17:33:07 +0000 (18:33 +0100)]
[main] Update dependencies from dotnet/arcade llvm-project (#62842)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoOSR support for Arm64 (#62831)
Andy Ayers [Fri, 17 Dec 2021 16:32:17 +0000 (08:32 -0800)]
OSR support for Arm64 (#62831)

* OSR support for Arm64

Enable OSR for Arm64:
* rename `FpToSpDelta` in `PatchpointInfo` to `TotalFrameSize` so it makes
sense for both x64 and Arm64.
* make it clear that the local offsets in `PatchpointInfo` are virtual
(relative to the top of the frame). Adjust recorded Arm64 offsets to match.
* add new jit config setting `JitEnableOSRRange` to allow selectively enabling
OSR for only a subset of jitted methods.
* Arm64 OSR method is passed Tier0 SP but not Tier0 FP, as Tier0 FP can point
either at top or bottom of Tier0 frame depending on frame type. For Arm64 the
OSR method establishes its own FP that chains to caller FP. (I will likely
revise x64 to work this way too, as it makes simple FP chain stackwalks work
out better).
* The Arm64 OSR epilog gets an extra SP adjustment to remove the Tier0 frame.
* The Arm64 OSR prolog gets a phantom SP adjustment in unwind to account for
being passed the Tier0 SP.
* pad OSR funclet frames with tier0 frame size so `PSPSym` ends up at the same
caller-SP relative offset as the OSR frame
* handle the large `fiSpDelta1` offsets from the funclet frame padding
* local/arg init for the OSR frame from the Tier0 frame was moved into a new
method `genEnregisterOSRArgsAndLocals`; implemented the ARM64 version.
* sequencing of this initialization in the prolog reordered slightly to prevent
inadvertent clobbering.
* comments/code that referred to `original` or `old` method were revised to
instead try and consistently use `tier0`.
* support the mixed-altjit case for OSR by allocating a local copy of the
patchpoint info with similar and plausible information.
* add symbol table note for locals in OSR methods that live on the Tier0 frame.
* fix `fgIsThrowHlpBlk` when called on an empty block
* broaden the jit-experimental testing matrix to include Arm64.

2 years agosetInternalRegsDelayFree only for candidate lclVars (#62884)
Kunal Pathak [Fri, 17 Dec 2021 15:00:53 +0000 (07:00 -0800)]
setInternalRegsDelayFree only for candidate lclVars (#62884)

2 years agoDisable some suspicious tests which might lead to OOM crashes on Android emulators...
Maxim Lipnin [Fri, 17 Dec 2021 12:35:23 +0000 (15:35 +0300)]
Disable some suspicious tests which might lead to OOM crashes on Android emulators and arm64 devices (#62767)

Just blindly disabling several crypto tests near which crashes have been observed for a while (based on a couple of the mobile targets rolling build runs).

Disabled tests:

- System.Security.Cryptography.Rsa.Tests.RSAKeyFileTests.ReadWriteDiminishedDPPrivatePkcs1
- System.Security.Cryptography.Rsa.Tests.RSAKeyFileTests.ReadEncryptedDiminishedDP_EmptyPassword
- System.Security.Cryptography.Rsa.Tests.RSAKeyFileTests.DecryptPkcs12PbeTooManyIterations
- System.Security.Cryptography.Rsa.Tests.RSAKeyFileTests.ReadWriteRsa2048EncryptedPkcs8_Pbes2HighIterations
- System.Security.Cryptography.Dsa.Tests.DSAKeyFileTests.cs.DecryptPkcs12PbeTooManyIterations
- System.Security.Cryptography.Dsa.TestsDSAKeyFileTests.cs.ReadWriteDsa1024EncryptedPkcs8_Pbes2HighIterations
- System.Security.Cryptography.Tests.ECKeyFileTests.DecryptPkcs12PbeTooManyIterations
- System.Security.Cryptography.Tests.ECKeyFileTests.ReadWriteEc256EncryptedPkcs8_Pbes2HighIterations
- System.Security.Cryptography.EcDsa.Tests.ECDsaTests_Span

See also https://github.com/dotnet/runtime/issues/62547.

2 years agoignore directories when building TPA (#62932)
Andy Ayers [Fri, 17 Dec 2021 06:03:58 +0000 (22:03 -0800)]
ignore directories when building TPA (#62932)

2 years agoRemove an unused .editorconfig entry. (#62905)
Theodore Tsirpanis [Fri, 17 Dec 2021 04:12:14 +0000 (06:12 +0200)]
Remove an unused .editorconfig entry. (#62905)

2 years agoCorrected the grammar/spelling mistake in autogenerated cs file. (#62934)
pyracanda [Fri, 17 Dec 2021 04:08:11 +0000 (07:08 +0300)]
Corrected the grammar/spelling mistake in autogenerated cs file. (#62934)

2 years agoIncrease iteration count in the FinalizeTest (#62924)
Michal Strehovský [Fri, 17 Dec 2021 02:20:58 +0000 (11:20 +0900)]
Increase iteration count in the FinalizeTest (#62924)

Iteration count was dropped to a smaller number in https://github.com/dotnet/corert/pull/2867. Looks like it's not enough because we see this test fail in the CI.

2 years agoAdd Pri-0 test suppressions for NativeAOT (#62926)
Michal Strehovský [Fri, 17 Dec 2021 02:18:48 +0000 (11:18 +0900)]
Add Pri-0 test suppressions for NativeAOT (#62926)

2 years agoHandle zero-sized unwind fragment candidates (#62931)
Bruce Forstall [Fri, 17 Dec 2021 01:54:39 +0000 (17:54 -0800)]
Handle zero-sized unwind fragment candidates (#62931)

Every unwind fragment should be non-zero sized. If we consider
splitting on a boundary that would create a zero-sized fragment,
don't report that one. This only occurs when setting the
stress mode JitSplitFunctionSize to something small.

2 years agoRemove the varargs-based mdarray helper. (#62855)
Jeremy Koritzinsky [Thu, 16 Dec 2021 23:11:50 +0000 (15:11 -0800)]
Remove the varargs-based mdarray helper. (#62855)

2 years agoFix duplicated FldSeq in block morphing (#62687)
SingleAccretion [Thu, 16 Dec 2021 22:16:46 +0000 (01:16 +0300)]
Fix duplicated FldSeq in block morphing (#62687)

* Fix duplicated FldSeq in block morphing

Reusing the address for the first field is problematic as
the first field is likely to be at a zero offset, thus a
zero-offset field sequence will be attached to it, and
subsequent copies of the same tree will pick it up, which
is incorrect.

Fix by reusing the address for the last field instead.

* Add a test

* Add a description of the issue to the test

2 years agoUpdate CODEOWNERS (#62928)
Michal Strehovský [Thu, 16 Dec 2021 21:54:54 +0000 (06:54 +0900)]
Update CODEOWNERS (#62928)

2 years agoFix InvokeMember corner case (#62891)
Michal Strehovský [Thu, 16 Dec 2021 21:06:41 +0000 (06:06 +0900)]
Fix InvokeMember corner case (#62891)

2 years agoImprove compatibility with IL Linker (#62890)
Michal Strehovský [Thu, 16 Dec 2021 21:06:14 +0000 (06:06 +0900)]
Improve compatibility with IL Linker (#62890)

`<TrimmerRootAssembly Include="myEntrypointAssembly" />` won't actually root anything with IL Linker. NativeAOT would do what it's instructed to do. This is showing up as a difference because the SDK auto-injects this root into all trimmed projects.

2 years ago[wasm] callback to make waiting on module load easier (#62904)
Pavel Savara [Thu, 16 Dec 2021 20:45:41 +0000 (21:45 +0100)]
[wasm] callback to make waiting on module load easier (#62904)

* callback to make waiting on module load easier

2 years agoDelete several duplicate test projects under JIT/Methodical (#62861)
Tomáš Rylek [Thu, 16 Dec 2021 18:28:51 +0000 (19:28 +0100)]
Delete several duplicate test projects under JIT/Methodical (#62861)

arithm32_cs_d: duplicate of arithm32_d
arithm32_cs_do: duplicate of arithm32_do

arithm64_cs_d: duplicate of arithm64_d with the only difference
that arithm64_d was Pri1. I have kept arithm64_d (due to the
shorter name) but I deleted the Pri1 specifier.

arithm64_cs_do: duplicate of arithm64_do with the only difference
that aritm64_do was Pri1. I have kept arithm64_d (due to the
shorter name) but I deleted the Pri1 specifier.

gc_nested: duplicate of gc_nested_d
nested: duplicate of nested_d
gcreport: duplicate of gcreport_d
native: duplicate of native_d
virtcall: duplicate of virtcall_d
refanyval: duplicate of refanyval_d

In all five cases I kept the version with _d for symmetry with
the other build options (_do / _r / _ro).

_XAssemblytest1-xassem: duplicate of _XModuletest1_xmod
_XAssemblytest2-xassem: duplicate of _XModuletest2_xmod
_XAssemblytest4-xassem: duplicate of _XModuletest4_xmod

In these three cases I kept the _XModuletest variants that have
compilation files and project references organized as two item groups
that is the most prevalent style in our projects. The _Xmoduletest
variants are apparently missing a boilerplate comment that is of
little use.

Thanks

Tomas

2 years ago[wasm] Add support for running debugger tests CI (#62431)
Ankit Jain [Thu, 16 Dec 2021 18:17:37 +0000 (18:17 +0000)]
[wasm] Add support for running debugger tests CI (#62431)

* [wasm] Don't emit warning if runtimeconfig.json cannot be found

Library projects don't have runtimeconfig.json files by default. So,
don't make it a warning. Instead, emit a low importance which might be
useful when debugging.

But library projects can have runtimeconfig.json, like the runtime test
projects. So, don't limit processing that by OutputType.

IOW, if it's found then use it.

* [wasm] Add timestamp to logs

* Download dotnet-install script for installing workloads

Instead of trying to use the script from `.dotnet`, download the script.
`.dotnet` might not exist, for example, when the `global.json` version
matches the system installed one.

* [wasm] WasmAppBuilder: catch UnauthorizedAccessException also

* [wasm] Fix bug in tests

Some helper methods have a `Action<JToken>` parameter. Many tests
pass an async lambda to this, expecting it to get awaited upon.

```csharp
    EvaluateAndCheck (Action<T> locals_fn)
    {
        ...
        locals_fn(); // no await
        ...
    }

    async Task Test()
    {
        EvaluateAndCheck( async (locals) => {
            ...
            CheckNumber(locals, ...);

            await CheckDateTime(locals, ..);
            ...

        } );
    }
```

In the above example, roslyn generates an async-void lambda, so the
compiler never complains about the async lambda being passed.
`EvaluateAndCheck` cannot, and does not await this, but if the lambda happens to
block, then it will return at that point, and the test(calling method) will end,
without ever completing the lambda. And for most tests, the actual
checks are done in that lambda.

This gets hit when `CheckDateTimeValue` tries to fetch properties of a
`DateTime` object. And it started to show up when adding
`ConfigureAwait(false)` to some calls.

* [wasm] Add Wasm.Debugger.Tests wrapper project

This is a proxy/wrapper project for `src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestSuite.csproj`.

- Building the project as part of the regular browser-wasm build
  presents some issues, because of part the tests need use the aspnet
  sdk, and that doesn't work with `browser-wasm`.
- This wrapper project essentially builds the `DebuggerTestSuite`
  project, with some
  properties(`TargetFramework;TargetFrameworks;Configuration;TargetOS;TargetArchitecture`)
  removed so they don't propogate from the parent build.
  - And it packages it up for running the tests on helix

- I did try to convert `DebuggerTestSuite` into a `Wasm.Debugger.Tests`,
  and make it use the library tests infrastructure, but ran into an
  issue
  - it built the project with no `testhost.dll`, so can't use `dotnet
    test`
  - it did get `xunit.console.dll`, but that would fail to run the tests
    because of missing `System.Runtime` (and I'm guessing, other
    assemblies)
    - attempts to publish the project failed
    - So, for now, this is what we have!

* [wasm][tests] Make them friendly to running outside the tree

.. like on helix.

Add new `DEBUGGER_TEST_PATH`, and `CHROME_PATH_FOR_DEBUGGER_TESTS` which
will be set for helix.

And change the appbundle directory name from the misleading `publish/`
to `AppBundle/`.

* [wasm] Tests.cs -> MiscTests.cs

* [wasm] Add support for submitting debugger tests to helix

Also, added `eng/testing/scenarios/WasmDebuggerTestsJobsList.txt` which
is a manually generated list of test classes. This will be changed to be
generated at runtime, in an upcoming PR.

* [wasm] Add debugger tests job for linux, and windows

They follow the same pattern as other wasm jobs:

- build when isFullMatrix
- build in runtime-manual
- Additionally, build when there are changes in:

```
  - src/mono/wasm/debugger/*
  - src/mono/wasm/runtime/*
  - src/mono/mono/*
```

* [wasm] Add new make targets to submit tests to helix

`submit-debugger-tests-helix`
`submit-tests-helix` - submits any library test archives

* Build Wasm.Debugger.Tests from src/libraries/tests.proj

* DebuggerTestSuite: Copy files for the test archive

* [wasm] Fix HarnessTests.BrowserClose

* [wasm] Fix building `ApplyUpdateReferencedAssembly` project on CI

Essentially, disable use of SourceLink which gets enabled by default
when using `-p:ContinuousIntegrationBuild=true`.

Issue: https://github.com/dotnet/runtime/issues/62618

* cleanup

* Wasm.Build.Tests: add missing file

* [wasm] sendtohelixhelp.proj: Error out if there is more than one zip

.. file when running for Wasm.Build.Tests, or Wasm.Debugger.Tests .

* [wasm] Disable DebuggerTests.ArrayTests on helix

Issue: https://github.com/dotnet/runtime/issues/62661

Using `[Trait..` instead of `ActiveIssue` because: https://github.com/dotnet/runtime/issues/62660

* disable non-wasma builds

* sendtohelixhelp.proj: guard against no payload found

* Disable more tests

* add back builds

* [wasm][debugger] Disable failing debugger test

`DebuggerTests.BreakpointTests.BreakpointInAssemblyUsingTypeFromAnotherAssembly_BothDynamicallyLoaded`

Issue: https://github.com/dotnet/runtime/issues/62823

* Try to fix windows command line

* Move debugger-tests for linux to runtime-staging

* Revert "[wasm][debugger] Fix source-link test (#62786)"

.. as it is breaking debugger tests build on windows.

Issue: https://github.com/dotnet/runtime/issues/62892
This reverts commit 815174072529c5183fc7418bec20dce61f2f6f15.

2 years agoDelete `GT_SIMD_CHK` and `GT_HW_INTRINSIC_CHK` (#62088)
SingleAccretion [Thu, 16 Dec 2021 17:59:26 +0000 (20:59 +0300)]
Delete `GT_SIMD_CHK` and `GT_HW_INTRINSIC_CHK` (#62088)

* Delete GT_SIMD_CHK and GT_HW_INTRINSIC_CHK

The former was unused, the latter - barely used.
Overall, there is no need for these to be separate
opers, it just leads to unnecessary `#ifdef`s.

* Remove IsArrayBoundsCheck

In loop cloning: redundant with the check for constant lengths below.

In assertion propagation: needless pessimization.

In range check: not needed. While it is not useful to search for the
array lengths from "new int[] { ... }" expressions, it is still useful
to look for assertions related to them.

* GTF_ARR_BOUND_INBND -> GTF_CHK_INDEX_INBND

* Fix formating

2 years agoMove 1604 docker based helix queues to 1804 (#62871)
Santiago Fernandez Madero [Thu, 16 Dec 2021 17:01:54 +0000 (11:01 -0600)]
Move 1604 docker based helix queues to 1804 (#62871)

2 years ago[wasm] Add a new supported signature for pinvokes (#61667)
Vlad Brezae [Thu, 16 Dec 2021 09:44:49 +0000 (11:44 +0200)]
[wasm] Add a new supported signature for pinvokes (#61667)

2 years agoDirectory.Delete: prefer DirectoryNotFoundException over UnauthorizedAccess IOExcepti...
Tom Deseyn [Thu, 16 Dec 2021 09:21:53 +0000 (10:21 +0100)]
Directory.Delete: prefer DirectoryNotFoundException over UnauthorizedAccess IOException. (#62396)

* Directory.Delete: prefer DirectoryNotFoundException over UnauthorizedAccess IOException.

* Refactor error handling.

2 years agodisable fragile http test on wasm (#62852)
Pavel Savara [Thu, 16 Dec 2021 07:47:53 +0000 (08:47 +0100)]
disable fragile http test on wasm (#62852)