platform/upstream/dotnet/runtime.git
2 years agoAdd some diagnostics for EFS tests (#63243)
Dan Moseley [Tue, 4 Jan 2022 01:55:18 +0000 (18:55 -0700)]
Add some diagnostics for EFS tests (#63243)

* diagnostics

* make outerloop

* fix linux build

* space

* feedback

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2 years agoRevert SafeBuffer change around pointer initialization (#63289)
Stephen Toub [Tue, 4 Jan 2022 01:38:58 +0000 (20:38 -0500)]
Revert SafeBuffer change around pointer initialization (#63289)

2 years agoA few minor tweaks to Regex source generator rendering (#63276)
Stephen Toub [Tue, 4 Jan 2022 01:38:43 +0000 (20:38 -0500)]
A few minor tweaks to Regex source generator rendering (#63276)

* Do addition for EndZ matching at compile time

* Tweak rendering of optional loops to say "Optional" rather than "Loop optionally"

* Remove "at least X" from loop description when X is 0

* Add a missing blank line at the beginning of a back reference

* Rename ReturnFalse to NoStartingPositionFound

* Delete stale comments

* Address PR feedback

2 years agoExtend case optimization in MatchCharacterClass to all chars that differ by one bit...
Stephen Toub [Tue, 4 Jan 2022 01:38:30 +0000 (20:38 -0500)]
Extend case optimization in MatchCharacterClass to all chars that differ by one bit (#63275)

2 years agoExtend CPU capabilities detection for osx-arm64 (#62832) (#62958)
neon-sunset [Tue, 4 Jan 2022 01:12:39 +0000 (03:12 +0200)]
Extend CPU capabilities detection for osx-arm64 (#62832) (#62958)

* Extend CPU capabilities detection for osx-arm64 (#62832)

* Revert uncoditional enable for dczva on osx-arm64

2 years agoRobustify a name resolution test (#63259)
Dan Moseley [Tue, 4 Jan 2022 01:05:10 +0000 (18:05 -0700)]
Robustify a name resolution test (#63259)

* fix TryGetAddrInfo_HostName_TryGetNameInfo()

* Fix network test

2 years agomake sure OpenSSL is initialized before Tls13Supported code runs (#62973)
Tomas Weinfurt [Tue, 4 Jan 2022 00:37:46 +0000 (16:37 -0800)]
make sure OpenSSL is initialized before Tls13Supported code runs (#62973)

* make sure OpenSSL is initialized before Tls13Supported code runs

* feedback from review

* Update src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2 years agoDelete ILCompiler.TypeSystem.ReadyToRun project (#63313)
Michal Strehovský [Tue, 4 Jan 2022 00:31:00 +0000 (09:31 +0900)]
Delete ILCompiler.TypeSystem.ReadyToRun project (#63313)

Replaced with a single ILCompiler.TypeSystem shared between crossgen2 and ilc.

2 years agoUpdate COM host to match RegAsm registration behavior (#63292)
Aaron Robinson [Mon, 3 Jan 2022 23:36:50 +0000 (15:36 -0800)]
Update COM host to match RegAsm registration behavior (#63292)

* Update COM host to match RegAsm registration behavior

2 years agoFixed ILVerify incorrectly flagging valid default interface implementations (#61185)
Benjamin Bartels [Mon, 3 Jan 2022 23:36:18 +0000 (23:36 +0000)]
Fixed ILVerify incorrectly flagging valid default interface implementations (#61185)

* Added logic for default interface method traversal to ILVerify method discovery

* Added Tests for DefaultImplFix

* Moved call to default interface impl resolution outside of ResolveInterfaceMethodTarget

2 years agotransform sgen_get_descriptor to parallel safe version in job_major_mod_union_preclea...
monojenkins [Mon, 3 Jan 2022 21:54:19 +0000 (16:54 -0500)]
transform sgen_get_descriptor to parallel safe version in job_major_mod_union_preclean (#63293)

Fixes mono/mono#21369
Related to https://github.com/xamarin/xamarin-android/issues/6546

job_major_mod_union_preclean can race with the tarjan bridge
implementation that changes the vtable pointer by settings the three
lower bits. this results in invalid loading of the vtable
(shifted by 7 bytes)  which in turn give a wrong desc to the scan
functions

This change is released under the MIT license.

Co-authored-by: tmijieux <tmijieux@users.noreply.github.com>
2 years agoDo not create non-null assertions from location nodes (#62743)
SingleAccretion [Mon, 3 Jan 2022 21:03:55 +0000 (00:03 +0300)]
Do not create non-null assertions from location nodes (#62743)

2 years agoUse SAL2 _In_, _Out_ to prevent conflicts (#63261)
NN [Mon, 3 Jan 2022 20:29:30 +0000 (22:29 +0200)]
Use SAL2 _In_, _Out_ to prevent conflicts (#63261)

2 years agoUnify threading between crossgen2 and ilc (#63282)
Michal Strehovský [Mon, 3 Jan 2022 20:00:43 +0000 (05:00 +0900)]
Unify threading between crossgen2 and ilc (#63282)

They don't have to differ in the `--parallelism` vs `--singlethreaded` argument.

2 years agoFix user => use typo in comments (#63288)
Stephen Toub [Mon, 3 Jan 2022 19:56:44 +0000 (14:56 -0500)]
Fix user => use typo in comments (#63288)

2 years agoUse pattern matching to reduce some duplication (#63278)
Stephen Toub [Mon, 3 Jan 2022 19:02:58 +0000 (14:02 -0500)]
Use pattern matching to reduce some duplication (#63278)

2 years ago[mono] Don't access MonoClassField:parent directly (#63081)
Aleksey Kliger (λgeek) [Mon, 3 Jan 2022 19:01:21 +0000 (14:01 -0500)]
[mono] Don't access MonoClassField:parent directly (#63081)

Rename it to parent_ and add m_field_get_parent / m_field_set_parent accessors.

(The intention is to borrow the bottom bit of the pointer for an EnC metadata
update flag)

2 years agoMark Go override as SkipLocalsInit if possible (#63277)
Stephen Toub [Mon, 3 Jan 2022 18:32:34 +0000 (13:32 -0500)]
Mark Go override as SkipLocalsInit if possible (#63277)

It can have so many locals that zero-initing is measurable.

2 years agoadd missing PTEST docs (#62122)
Clinton Ingram [Mon, 3 Jan 2022 18:17:32 +0000 (10:17 -0800)]
add missing PTEST docs (#62122)

2 years agoLast ILCompiler.TypeSystem <-> ILCompiler.TypeSystem.ReadyToRun diff (#63281)
Michal Strehovský [Mon, 3 Jan 2022 16:28:03 +0000 (01:28 +0900)]
Last ILCompiler.TypeSystem <-> ILCompiler.TypeSystem.ReadyToRun diff (#63281)

After this and dotnet/runtime#63280 there will be no differences between ILCompiler.TypeSystem and ILCompiler.TypeSystem.ReadyToRun and we can unify them.

2 years agoFix issues in PAL (#62625)
Andrii Kurdiumov [Mon, 3 Jan 2022 13:54:45 +0000 (19:54 +0600)]
Fix issues in PAL (#62625)

2 years ago[wasm][debugger] Add Browsable Attribute support. (#62045)
Ilona Tomkowicz [Mon, 3 Jan 2022 12:43:26 +0000 (13:43 +0100)]
[wasm][debugger] Add Browsable Attribute support. (#62045)

* Description of DebuggerBrowsable behavior.

* Added test for browse attributes.

* Corrected typos in the doc.

* Added Browse Never feature. Corrected Collapse test. ToDo: RootHidden.

* Draft of RootHidden solution.

* Added Array to test cases as it behaves differently than Collection.

* Added name concatenation to make array/list elemetns in debug window unique.

* Update docs/design/mono/debugger.md

Co-authored-by: Ankit Jain <radical@gmail.com>
* Applied PR review suggestions.

* Added a reference to regular Browsable attribute behavior in .net.

* Applied most of review suggestions.

* Stopping GetFieldsValue early.

* Remove unintentional change to the original code.

* Do not skip fields that don't have browsable attributes.

* Changing the expected behavior to match Console Application. EventHandlers are Browsable.Never by default.

* Changed the place of checking if objetc is an array.

* Update src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs

Co-authored-by: Ankit Jain <radical@gmail.com>
* Removed unused variables.

* Removing space and unused import.

* Partially addressed @radical comments.

* Addressed the comment about extension instead of Union.

* Removed string cultural vunerability.

* Added Properties dictionary, the same as for fields.

* Fixed the bug I made by using dynamc.

* Applying @radical comments about refactoring.

* Corrected typo.

* Added tests for properties.

* Draft of changes for properties handling - never and root hidden failing.

* Fix for RootHidden properties.

* Added tests for static fields decorated with Browsable.

* Correct a typo.

* Undo merge unintentional changes.

* Changing expected behavior for MulticastDelegateTest - in Console Application EventHandler is Browsable.Never by default so we should not expect it to be visible in the debug window.

* Removing not relevant changes created after merge with main.

* Remove file added in merge with main.

* Revert "Removing not relevant changes created after merge with main."

This reverts commit b1acf8b546d1b95bea101290c25ec7f15cb78799.

* Revert.

* Revert revert.

* One broken test for custom getter.

* Ugly fix to make all the tests work.

* Refactored JArray aggregation to Dictionary.

* Better naming.

* Remove not connected to PR file.

* Applied @thaystg suggestions.

* Removed comments.

Co-authored-by: Ankit Jain <radical@gmail.com>
2 years agoMove things from ILCompiler.TypeSystem to ILCompiler.Compiler (#63280)
Michal Strehovský [Mon, 3 Jan 2022 11:52:46 +0000 (20:52 +0900)]
Move things from ILCompiler.TypeSystem to ILCompiler.Compiler (#63280)

IL generation (stubs/thunks) is not part of the core type system and these files are not included in ILCompiler.TypeSystem.ReadyToRun. Somehow we accumulated them in ILCompiler.TypeSystem but they can be pretty cleanly moved to ILCompiler.Compiler (left one TODO for a subsequent cleanup since some of what's in Common\TypeSystem should actually be in ILCompiler.Compiler proper).

2 years ago[mono][wasm] Allow methods with finally clauses to be AOTed. (#63065)
Zoltan Varga [Mon, 3 Jan 2022 11:44:48 +0000 (06:44 -0500)]
[mono][wasm] Allow methods with finally clauses to be AOTed. (#63065)

* [mono][wasm] Allow methods with finally clauses to be AOTed.

This is implemented by running the finally clause with the interpreter.
Methods with clauses have additional code generated, which:
* Saves the IL state (pc+arguments+locals) into a MonoMethodILState
structure.
* Pushes an LMF frame on the LMF stack of type MONO_LMFEXT_IL_STATE.
  The LMF frame points to the il state.

During EH, if such an LMF frame is found, and the IL pc in the
il state points inside a clause, then an interpreted version
of the method is created, and the finally clause is ran using
the interpreter using the il state as the starting state.

* Disable a few test suites which now cause emscripten to OOM when building with AOT.

2 years ago[main] Update dependencies from dotnet/linker (#63166)
dotnet-maestro[bot] [Mon, 3 Jan 2022 10:31:41 +0000 (11:31 +0100)]
[main] Update dependencies from dotnet/linker (#63166)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoFix nullability annotations on ProcessModule.FileName/ModuleName (#63272)
Stephen Toub [Mon, 3 Jan 2022 09:32:09 +0000 (04:32 -0500)]
Fix nullability annotations on ProcessModule.FileName/ModuleName (#63272)

2 years agoUse interpolated strings in place of `StringBuilder.AppendFormat` where possible...
Theodore Tsirpanis [Mon, 3 Jan 2022 08:10:38 +0000 (10:10 +0200)]
Use interpolated strings in place of `StringBuilder.AppendFormat` where possible. (#62160)

2 years agoImplement DiagnosticName in NativeAOT code (#63271)
Michal Strehovský [Mon, 3 Jan 2022 06:03:03 +0000 (15:03 +0900)]
Implement DiagnosticName in NativeAOT code (#63271)

When `DiagnosticName` was introduced into the type system, I didn't want to deal with it and compiled it out of the NativeAOT version of the type system.

In order to have a single ILCompiler.TypeSystem assembly that can be used with both crossgen2 and ILC, this needs to be implemented.

I've also reduced the number of diffs between ILCompiler.TypeSystem.csproj and ILCompiler.TypeSystem.ReadyToRun.csproj.

2 years agoFix strings typo (#63269)
Dan Moseley [Mon, 3 Jan 2022 04:56:39 +0000 (21:56 -0700)]
Fix strings typo (#63269)

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.