platform/upstream/dotnet/runtime.git
20 months agoSplit generic virtual method slot use and impl tracking (#82222)
Michal Strehovský [Mon, 27 Feb 2023 23:49:37 +0000 (08:49 +0900)]
Split generic virtual method slot use and impl tracking (#82222)

* Split generic virtual method slot use and impl tracking

I'm looking at generic virtual method again because of #80602.

The analysis of generic virtual methods within the compiler is an N * M algorithm where N is the number of unique generic virtual method instantiations called and M is the number of types that implement generic virtual methods.

We use dynamic dependencies within the dependency analysis engine to model this relationship.

It is important to try to limit the N and M. Looking at things, I realized the N we're currently operating on is bigger than it needs to be:

```csharp
Foo f = new Bar();
f.Blah<int>();
f = new Baz();
f.Blah<double>();

class Foo { public virtual void Blah<T>() { } }
class Bar : Foo { public override void Blah<T> { } }
class Baz : Foo { public override void Blah<T> { } }
```

Previously, the analysis would see M = 3 and N = 6 because we would track each of the overrides as something that needs to be considered for each M. This changes the analysis to only look at the definition of the slot, i.e. N = 2 (one for int, other for double).

The result of the analysis will still be same, it will just take less time. The new GenericVirtualMethodImpl node responds false to HasDynamicDependencies and doesn't participate in expensive activities.

20 months agoReplace IlcHostArch with SDK-computed value (#82645)
Adeel Mujahid [Mon, 27 Feb 2023 23:00:34 +0000 (01:00 +0200)]
Replace IlcHostArch with SDK-computed value (#82645)

* Replace IlcHostArch with SDK-computed value

* Respect TPI in targetOS calculation

* Keep using OSArchitecture on Windows

* Simplify host vs. target package prop name

* Avoid mixing host/target

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Avoid mixing host/target

* Use _targetOS and _targetArchitecture in conditions

* .

* Derive _targetOS from RuntimeIdentifier

* Fix copy/paste error

* Remove condition that always evaluates to true

* Revert "Remove condition that always evaluates to true"

This reverts commit c9e910eb3e4340c968b84ccc1ab95569d8447f03.

---------

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
20 months agoPrevent tests from importing "normal" NuGet props/targets (#80573)
SingleAccretion [Mon, 27 Feb 2023 21:08:08 +0000 (00:08 +0300)]
Prevent tests from importing "normal" NuGet props/targets (#80573)

We import them manually from a shared location.

Usually this is not a problem because batch build (via the build script)
does its own restore thing, but it is a problem in case the project is
restored on its own, such as when it is built with "dotnet build".

20 months agoFix a typo. (#78105)
Zoltan Varga [Mon, 27 Feb 2023 21:03:47 +0000 (16:03 -0500)]
Fix a typo. (#78105)

20 months agoJust create the C# file with colon on name on Linux, keep the csproj always there...
Thays Grazia [Mon, 27 Feb 2023 20:05:16 +0000 (17:05 -0300)]
Just create the C# file with colon on name on Linux, keep the csproj always there (#82724)

20 months ago[wasi] Build cross compiler for wasi. (#82702)
Zoltan Varga [Mon, 27 Feb 2023 20:01:53 +0000 (15:01 -0500)]
[wasi] Build cross compiler for wasi. (#82702)

* [wasi] Build cross compiler for wasi.

* Disable building the cross compiler on windows for now.

20 months ago[wasm] don't call export_internal twice (#82713)
Aleksey Kliger (λgeek) [Mon, 27 Feb 2023 18:20:40 +0000 (13:20 -0500)]
[wasm] don't call export_internal twice (#82713)

20 months agoFix pthread_cond_wait race on macOS (#82709)
Jan Vorlicek [Mon, 27 Feb 2023 17:29:55 +0000 (18:29 +0100)]
Fix pthread_cond_wait race on macOS (#82709)

The native runtime event implementations for nativeaot and GC use
pthread_cond_wait to wait for the event and pthread_cond_broadcast
to signal that the event was set. While the usage of the
pthread_cond_broadcast conforms with the documentation, it turns out
that glibc before 2.25 had a race in the implementation that can
cause the pthread_cond_broadcast to be unnoticed and the wait
waiting forever. It turns out that macOS implementation has the
same issue.
The fix for the issue is to call pthread_cond_broadcast while the
related mutex is taken.

This change fixes intermittent crossgen2 hangs with nativeaot build of
crossgen2 reported in #81570. I was able to repro the hang locally in
tens of thousands of iterations of running crossgen2 without any arguments
(the hang occurs when server GC creates threads). With this fix,
it ran without problems over the weekend, passing 5.5 million iterations.

20 months agoSet VSDebugger_ValidateDotnetDebugLibSignatures (#82710)
Viktor Hofer [Mon, 27 Feb 2023 16:55:41 +0000 (17:55 +0100)]
Set VSDebugger_ValidateDotnetDebugLibSignatures (#82710)

When using the `-vs` switch, disable signature validation. See https://github.com/dotnet/runtime/blob/main/docs/workflow/building/libraries/README.md#debugging for more details

20 months ago[wasm] Make `WasmMainJSPath` optional (#81484)
Marek Fišera [Mon, 27 Feb 2023 15:43:11 +0000 (16:43 +0100)]
[wasm] Make `WasmMainJSPath` optional (#81484)

Use WasmMainJSPath only on command-like hosts like v8 or node.

Co-authored-by: Ankit Jain <radical@gmail.com>
20 months agopal_console.c: cast TIOCSWINSZ to int when HAVE_IOCTL_WITH_INT_REQUEST (#82676)
Antoine Martin [Mon, 27 Feb 2023 14:37:44 +0000 (09:37 -0500)]
pal_console.c: cast TIOCSWINSZ to int when HAVE_IOCTL_WITH_INT_REQUEST (#82676)

20 months agoTypo in DeniedValuesAttribute (#82665)
Ondřej Kubíček [Mon, 27 Feb 2023 14:37:28 +0000 (15:37 +0100)]
Typo in DeniedValuesAttribute (#82665)

* Typo in DeniedValuesAttribute

* PR feedback

20 months ago[mono][aot] Emit llvm intrinsic declarations lazily. (#82519)
Zoltan Varga [Mon, 27 Feb 2023 12:02:42 +0000 (07:02 -0500)]
[mono][aot] Emit llvm intrinsic declarations lazily. (#82519)

This makes llvm bitcode files a bit smaller and easier to read.

20 months agoPermit trailing data when parsing an X.509 certificate by DER content (#82688)
Kevin Jones [Mon, 27 Feb 2023 08:52:52 +0000 (03:52 -0500)]
Permit trailing data when parsing an X.509 certificate by DER content (#82688)

20 months agoFix juxtaposed command - correct value is noted in eng\build.ps1 (#81572)
Craig Johnson [Mon, 27 Feb 2023 08:48:40 +0000 (01:48 -0700)]
Fix juxtaposed command - correct value is noted in eng\build.ps1 (#81572)

20 months agoFix links in Portable PDB spec (#82683)
MSDN.WhiteKnight [Mon, 27 Feb 2023 00:59:46 +0000 (05:59 +0500)]
Fix links in Portable PDB spec (#82683)

20 months ago[wasm] CI: trigger wasm jobs on internal linker changes (#82655)
Ankit Jain [Sun, 26 Feb 2023 22:10:21 +0000 (17:10 -0500)]
[wasm] CI: trigger wasm jobs on internal linker changes (#82655)

* CI: trigger wasm jobs on internal linker changes

* Fix dependency

20 months ago[wasm] Remove unused AOTMode msbuild property. (#82675)
Zoltan Varga [Sun, 26 Feb 2023 20:26:11 +0000 (15:26 -0500)]
[wasm] Remove unused AOTMode msbuild property. (#82675)

20 months ago[main] Update dependencies from dotnet/roslyn-analyzers (#82477)
dotnet-maestro[bot] [Sun, 26 Feb 2023 17:38:06 +0000 (11:38 -0600)]
[main] Update dependencies from dotnet/roslyn-analyzers (#82477)

* Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20230221.1

Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers
 From Version 3.3.5-beta1.23117.2 -> To Version 3.3.5-beta1.23121.1

* Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20230224.1

Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers
 From Version 3.3.5-beta1.23117.2 -> To Version 3.3.5-beta1.23124.1

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
20 months agoFixing a FATAL_GC_ERROR in loh_allocate_in_condemned when in extremely low memory...
Maoni Stephens [Sun, 26 Feb 2023 07:54:25 +0000 (23:54 -0800)]
Fixing a FATAL_GC_ERROR in loh_allocate_in_condemned when in extremely low memory situations (#82418)

I'm running GCPerfSim with this commandline and this env -

corerun.exe GCPerfSim.dll -tc 60 -tagb 100 -tlgb 9.5 -lohar 0 -pohar 0 -sohsr 100-4000 -lohsr 102400-204800 -pohsr 100-204800 -sohsi 50 -lohsi 0 -pohsi 0 -sohpi 0 -lohpi 0  -sohfi 0 -lohfi 0 -pohfi 0 -allocType simple -testKind time

set COMPlus_GCServer=1
set COMPlus_GCHeapCount=1e
set COMPlus_GCHeapHardLimit=280000000

this causes us to hit this FATAL_GC_ERROR. We have one object which is at the very end of the region and we are asking for its size and padding of 2 * loh_padding_obj_size. since (heap_segment_allocated - heap_segment_mem) is (size + loh_padding_obj_size), loh_size_fit_p reports its not fitting so we call grow_heap_segment and at this point we are so low on memory we don't have ~16 pages left so we try to goto the next region and there's no more regions (in this case this is the only region in gen3).

We shouldn't be asking for (2 * loh_padding_obj_size) for padding because this is at the end of a region (same with segments).

20 months agoAdd stub for mini_is_gsharedvt_inst (#82678)
Adeel Mujahid [Sun, 26 Feb 2023 07:53:26 +0000 (09:53 +0200)]
Add stub for mini_is_gsharedvt_inst (#82678)

* Add guard around mini_is_gsharedvt_inst call

* Add stub for mini_is_gsharedvt_inst

20 months agomove fence to the right place (#82661)
Maoni Stephens [Sun, 26 Feb 2023 01:18:12 +0000 (17:18 -0800)]
move fence to the right place (#82661)

20 months ago[jiterp] cmpxchg opcodes are supported (#82674)
Aleksey Kliger (λgeek) [Sun, 26 Feb 2023 00:53:03 +0000 (19:53 -0500)]
[jiterp] cmpxchg opcodes are supported (#82674)

20 months ago[JIT] Fixed regression for `AND(X, CNS(-1))` lowering optimization (#82659)
Will Smith [Sat, 25 Feb 2023 20:26:37 +0000 (12:26 -0800)]
[JIT] Fixed regression for `AND(X, CNS(-1))` lowering optimization (#82659)

* Fixed regression for `AND(X, CNS(-1))` lowering optimization

* Feedback

* Feedback

20 months ago[NativeAOT] Implement thunk page generation and mapping for iOS-like platforms (...
Filip Navara [Sat, 25 Feb 2023 15:43:07 +0000 (16:43 +0100)]
[NativeAOT] Implement thunk page generation and mapping for iOS-like platforms (#82317)

* NativeAOT: Implement thunk page generation and mapping for iOS-like platforms

* Use minipal_getexepath instead of libproc

* Reimplement PalAllocateThunksFromTemplate to work inside shared libraries

* Specify correct rpath in tests for all Apple platforms

20 months agoAdd runtime file version to RuntimeInfo (#82648)
Mike McLaughlin [Sat, 25 Feb 2023 03:45:56 +0000 (19:45 -0800)]
Add runtime file version to RuntimeInfo (#82648)

The diagnostic tooling needs the runtime file version for single-file
applications to:

1) Build the long name DAC on Windows
2) SOS commands and other tooling need the version to adjust for different runtime behavior

20 months agoProvide more information to the user about usage of MonoPInvokeCallback (#82653)
Jb Evain [Sat, 25 Feb 2023 03:44:25 +0000 (19:44 -0800)]
Provide more information to the user about usage of MonoPInvokeCallback (#82653)

Unity's IL2CPP accepts a MonoPInvokeCallback constructor without any argument. When porting interop code from Unity's IL2CPP to Mono AOT this gives a hint to the user about what they need to fix.

20 months agoJIT: fix finally target flags after some flow graph updates (#82623)
Andy Ayers [Sat, 25 Feb 2023 02:33:42 +0000 (18:33 -0800)]
JIT: fix finally target flags after some flow graph updates (#82623)

In particular those done by profile instrumentation.

Fixes #82275.

20 months agoAdd CA 2021 into CodeAnalysis config (#82649)
Buyaa Namnan [Sat, 25 Feb 2023 01:25:26 +0000 (17:25 -0800)]
Add CA 2021 into CodeAnalysis config (#82649)

20 months agoUpdate GeneratedComInterfaceAttribute (#82647)
Jackson Schuster [Sat, 25 Feb 2023 00:54:30 +0000 (16:54 -0800)]
Update GeneratedComInterfaceAttribute (#82647)

20 months ago[JIT] X64 - Extend emitter peephole optimization of eliminating unnecessary `mov...
Will Smith [Sat, 25 Feb 2023 00:21:28 +0000 (16:21 -0800)]
[JIT] X64 - Extend emitter peephole optimization of eliminating unnecessary `mov` instructions (#79381)

20 months ago[wasi] provision.ps1: stop on error (#82641)
Ankit Jain [Fri, 24 Feb 2023 23:35:57 +0000 (18:35 -0500)]
[wasi] provision.ps1: stop on error (#82641)

Related - https://github.com/dotnet/runtime/issues/82627

20 months agoRemove some IAsyncResult implementations from System.Net.Mail (#82644)
Stephen Toub [Fri, 24 Feb 2023 23:35:32 +0000 (18:35 -0500)]
Remove some IAsyncResult implementations from System.Net.Mail (#82644)

Whittling away at our remaining APM implementations.

20 months agoConvert all usages of target_link_libraries to use PUBLIC/PRIVATE specifiers (#81924)
Jeremy Koritzinsky [Fri, 24 Feb 2023 23:33:00 +0000 (15:33 -0800)]
Convert all usages of target_link_libraries to use PUBLIC/PRIVATE specifiers (#81924)

Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
20 months ago[wasi] Misc fixes (#82569)
Ankit Jain [Fri, 24 Feb 2023 23:31:12 +0000 (18:31 -0500)]
[wasi] Misc fixes (#82569)

* [wasi] CI: Enable assert messages on CI

* Correctly set rid for ilproj on wasi

* Enable assert messages for wasi

* [wasi] Disable `System.Formats.Cbor.Tests.CborWriterTests` - crypto not

.. supported.

```
[00:52:00] fail: [FAIL] System.Formats.Cbor.Tests.CborWriterTests.CoseKeyHelpers_ECDsaExportCosePublicKey_HappyPath(expectedHexEncoding: "a501020326200121582065eda5a12577c2bae829437fe33870"..., hexQx: "65eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de1"..., hexQy: "1e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7"..., hashAlgorithmName: "SHA256", curveFriendlyName: "ECDSA_P256")
[00:52:00] info: System.PlatformNotSupportedException : System.Security.Cryptography is not supported on this platform.
[00:52:00] info:    at System.Security.Cryptography.HashAlgorithmName..ctor(String name)
[00:52:00] info:    at System.Formats.Cbor.Tests.CborWriterTests.CoseKeyHelpers_ECDsaExportCosePublicKey_HappyPath(String expectedHexEncoding, String hexQx, String hexQy, String hashAlgorithmName, String curveFriendlyName)
[00:52:00] info:    at System.Reflection.MethodInvoker.InterpretedInvoke(Object obj, IntPtr* args)
[00:52:00] info:    at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
```

* [wasi] Disable crypto tests - https://github.com/dotnet/runtime/issues/37669

20 months agoMake `TYP_SIMD32` be xarch only (#82624)
Tanner Gooding [Fri, 24 Feb 2023 23:11:32 +0000 (15:11 -0800)]
Make `TYP_SIMD32` be xarch only (#82624)

* Make `TYP_SIMD32` be xarch only

* Applying formatting patch

20 months agoFix host tests clean-up of test artifact parent directories (#82573)
Elinor Fung [Fri, 24 Feb 2023 22:36:11 +0000 (14:36 -0800)]
Fix host tests clean-up of test artifact parent directories (#82573)

20 months agoUse MarshallerHelpers method in ComInterfaceGenerator to make compiler friendly gener...
Jackson Schuster [Fri, 24 Feb 2023 21:26:14 +0000 (13:26 -0800)]
Use MarshallerHelpers method in ComInterfaceGenerator to make compiler friendly generic (#82582)

20 months agoFix handling of partial reads in SqlBytes (#82620)
Stephen Toub [Fri, 24 Feb 2023 20:52:33 +0000 (15:52 -0500)]
Fix handling of partial reads in SqlBytes (#82620)

20 months agoUse Array.Reverse<T> in ImmutableArray<T>.Builder.Reverse (#82629)
Stephen Toub [Fri, 24 Feb 2023 20:51:45 +0000 (15:51 -0500)]
Use Array.Reverse<T> in ImmutableArray<T>.Builder.Reverse (#82629)

20 months agoAdd cecil dependency to ILLink package (#82630)
Sven Boemer [Fri, 24 Feb 2023 20:40:35 +0000 (12:40 -0800)]
Add cecil dependency to ILLink package (#82630)

* Add cecil dependency to ILLink package

* Trigger libraries allConfigurations on illink changes

To run package validation (dependency closure verification)

20 months agoAdd a var_types_classification for simd (#82616)
Tanner Gooding [Fri, 24 Feb 2023 20:39:54 +0000 (12:39 -0800)]
Add a var_types_classification for simd (#82616)

* Add a var_types_classification for simd

* Ensure TYP_SIMD are actually marked VTF_VEC

20 months ago[mono][debugger] Show loaded symbols on VS module window (#82587)
Thays Grazia [Fri, 24 Feb 2023 20:06:06 +0000 (17:06 -0300)]
[mono][debugger] Show loaded symbols on VS module window (#82587)

* Fix 82417

* testing size of the ppdb

* Addressing @akoeplinger comments of 82555 PR

20 months agoFix Mono default interface methods with protected virtual class methods (#82577)
Bill Holmes [Fri, 24 Feb 2023 19:15:32 +0000 (14:15 -0500)]
Fix Mono default interface methods with protected virtual class methods (#82577)

Fixing the METHOD_ATTRIBUTE_PUBLIC flag check on the class method for
check_interface_method_override.

20 months agoImplement RSA.GetMaxOutputSize
Kevin Jones [Fri, 24 Feb 2023 18:41:51 +0000 (13:41 -0500)]
Implement RSA.GetMaxOutputSize

Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
20 months ago[NativeAOT] Delete .NET SDK 6 support (#82568)
Jan Kotas [Fri, 24 Feb 2023 18:24:25 +0000 (10:24 -0800)]
[NativeAOT] Delete .NET SDK 6 support (#82568)

No longer needed

20 months agoAdd tests that use the host's computed RID (#82574)
Elinor Fung [Fri, 24 Feb 2023 18:14:43 +0000 (10:14 -0800)]
Add tests that use the host's computed RID (#82574)

Add tests that rely on the host's computed RID (sets `DOTNET_RUNTIME_ID` to empty, which we treat as the same as not set) and use the fallback graph from the built `Microsoft.NETCore.App.deps.json`.

20 months agoRemove stale IAsyncResult implementation from tests (#82609)
Stephen Toub [Fri, 24 Feb 2023 17:16:51 +0000 (12:16 -0500)]
Remove stale IAsyncResult implementation from tests (#82609)

20 months agoAdd and use public TaskToAsyncResult helper type (#82557)
Stephen Toub [Fri, 24 Feb 2023 16:59:28 +0000 (11:59 -0500)]
Add and use public TaskToAsyncResult helper type (#82557)

* Add and use public TaskToAsyncResult helper type

* Disable thread blocking test on browser

20 months agoAdding HelloiOS sample for NativeAOT (#82249)
Ivan Povazan [Fri, 24 Feb 2023 16:42:55 +0000 (17:42 +0100)]
Adding HelloiOS sample for NativeAOT (#82249)

- The application is intended to be used by developers who work on enabling NativeAOT on iOS-like platforms and can serve as PoC
- Currently still relies on dotnet/runtime internals and requires local builds instead of package references

20 months ago[HTTP/3] Attempt at using newer image to allow H/3 Windows stress (#82226)
Marie Píchová [Fri, 24 Feb 2023 15:17:09 +0000 (16:17 +0100)]
[HTTP/3] Attempt at using newer image to allow H/3 Windows stress (#82226)

* Attempt at using newer image to allow H/3 Windows stress

* Failing docker experiments

* Removed testing print

20 months agoFix ilc package name for linux-musl (#82590)
Adeel Mujahid [Fri, 24 Feb 2023 15:02:08 +0000 (17:02 +0200)]
Fix ilc package name for linux-musl (#82590)

20 months agoFix warning/error with gcc11 in PalRedhawkUnix.cpp (#82596)
Alexander Köplinger [Fri, 24 Feb 2023 14:57:07 +0000 (15:57 +0100)]
Fix warning/error with gcc11 in PalRedhawkUnix.cpp (#82596)

Otherwise you get:

```
error: ignoring return value of ‘ssize_t write(int, const void*, std::size_t)’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
    681 |     write(STDERR_FILENO, message, strlen(message));
        |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

The same warning was already fixed for `alloca()` in encee.cpp as part of https://github.com/dotnet/runtime/commit/5d6d55977270b3d1549a5c2e454b191487bef5eb#diff-f1018f796e7e06f60f7f4558583ec116f8e394bc90e29177c9dbdbfd29b78ab5R670, applying the same fix here

20 months agoLet GenTreeCopyOrReload handle scenarios when FEATURE_MULTIREG_RET is disabled (...
Kunal Pathak [Fri, 24 Feb 2023 14:45:55 +0000 (06:45 -0800)]
Let GenTreeCopyOrReload handle scenarios when FEATURE_MULTIREG_RET is disabled (#82451)

* remove FEATURE_MULTIREG_RET check

* Remove comments

* updated comment

20 months ago[wasm][icu] ICU files sharding + custom icu data loading for WASM (#80421)
Ilona Tomkowicz [Fri, 24 Feb 2023 12:59:32 +0000 (13:59 +0100)]
[wasm][icu] ICU files sharding + custom icu data loading for WASM (#80421)

* User can set `GlobalizationShard`.

* Sample for sharding, might be transformed into a test.

* Option of custom shard file upload.

* Replaced sample with WBT.

* Remove unnecessary change.

* Fixed invariantMode + full custom path + nit.

* Draft of documentation.

* Rename to reflect usage better.

* Fix full path file loading to the Browser.

* Fixed WBT build errors.

* Docs: only one ICU file can be used.

* Fixed NodeJs: `navigator` is not defined.

* Paritial fix of sharding tests.

* RuntimePack can differ for AOT and Release.

* Fix `ja-JP` culture not found in CheckDateTimeLocale.

* Fixedculture not found in SatelliteAssemblyTests.

* Fixed culture not found in System.Runtime tests.

* `icudt.dat` should not be loaded when <IcuFileName> empty + EFIGS contains only some specific locales + `IsIcuFilePredefined` is not necessary.

* Improved doc readability using @radical's suggestions.

* Forgot to remove comments.

* Missing change for 5df3c9ccc851c45fbdbc3acfd96162c3237973c1.

* WBT: Applied review.

* Applied @pavelsavara's suggestion.

* Added `WasmIncludeFullIcuData` to work like Blazor.

* Another missing change for 5df3c9ccc851c45fbdbc3acfd96162c3237973c1.

* Missing change for b5a1308372ed00f1dea08dadd647e97dffe57e27.

* Fix debugger failures for real, previous flag was in the wrong place.

* Fixed most libraries that require full ICU.

* WBT should load full icu only when invariant off.

* Applied @radical's idea.

* Missing change for the last commit.

* Build args should not be edited inside of `BuildProject()` + Identity on a property does not exist.

* One flag for all lib tests instead of multiple changes.

* Revert comments for the prev commit.

* Fix for trimming tests.

* Rename + throwing when file not found.

* Fixed NoopNativeRebuildTest WBT.

* Forgotten logging.

* Tests with custom shard.

* Added more complex tests.

* Should fix wasm tests on helix.

* Fix WBT.

* [wasm] Update eng/testing/scenarios/BuildWasmAppsJobsList.txt

* [wasm] fix testassets path

* Default mode for tests should be the same as default mode for template apps.

* Checking preferred icu when assets are still not populated was incorrect.

* DataTimeFormat does not work well for browser + wrong condition.

* Removed empty space changes.

* WBT for automatic icu selection based on locale.

* Moved the full icu flag from libs to lib tests.

* Flag in tests.wasm.targets should be enough for trimming tests.

* Debugger tests in default globalization mode unless CJK needed. Firefox does not respect UILocale.

* Removing forgotten comment.

* Fixed sharding wbt.

* This should not be commented out.

* Sharding WBT do not make sense on v8 + fixed debugger tests on Linux + fixed WBT on Chrome on Windows.

* Fix test to have sense.

* Fixed tests to reflect expected behavior after removing predefinedCulturesOnly=true from WASM + added en-US to custom ICU.

* Fixed merge errors, removed redundant comment.

* Update docs, disable NodeJS in tests.

* @radical's review part 1: embedded comments.

* Test clean-up by @radical.

* Fix arg order in debugger + revert wasi sharding.
---------

Co-authored-by: Ankit Jain <radical@gmail.com>
20 months ago[wasm] Migrate jiterpreter LDELEMA1 and LDLEN from C helper to inline in traces ...
Katelyn Gadd [Fri, 24 Feb 2023 12:14:30 +0000 (04:14 -0800)]
[wasm] Migrate jiterpreter LDELEMA1 and LDLEN from C helper to inline in traces (#82576)

Inline ldelema1 and ldlen operations into traces instead of using a C helper, which should mitigate the regressions we saw in array-heavy benchmarks once turning on the jiterpreter
Clean up some correctness issues with null check optimization
Improve diagnostics and clean up some comments

20 months ago- remove custom startup sequence of blazor (#82532)
Pavel Savara [Fri, 24 Feb 2023 11:51:46 +0000 (12:51 +0100)]
- remove custom startup sequence of blazor (#82532)

- remove legacy mono_load_runtime_and_bcl_args
- unused MonoConfigError removal

20 months agoEnable constant folding in Tier0 (#82412)
Egor Bogatov [Fri, 24 Feb 2023 11:27:06 +0000 (12:27 +0100)]
Enable constant folding in Tier0 (#82412)

20 months agoFix missing changes in from ProducedBy enum change (#82575)
Tlakaelel Axayakatl Ceja [Fri, 24 Feb 2023 09:01:57 +0000 (01:01 -0800)]
Fix missing changes in from ProducedBy enum change (#82575)

20 months agoFix rva[cns] folding (#81854)
Egor Bogatov [Fri, 24 Feb 2023 08:48:24 +0000 (09:48 +0100)]
Fix rva[cns] folding (#81854)

20 months ago[wasm] Disable jiterpreter null check optimization for mid-method traces (#82585)
Katelyn Gadd [Fri, 24 Feb 2023 06:56:27 +0000 (22:56 -0800)]
[wasm] Disable jiterpreter null check optimization for mid-method traces (#82585)

* Disable null check optimization when starting mid-method since we don't know which locals have had their address taken
* Improve null check optimization diagnostics

20 months ago[workloads] Bump net7 package version (#82270)
Steve Pfister [Fri, 24 Feb 2023 03:17:51 +0000 (19:17 -0800)]
[workloads] Bump net7 package version (#82270)

20 months agoFixed the 3rd argument for TypedArray.fill(). (#82480)
shin1m [Fri, 24 Feb 2023 00:21:41 +0000 (09:21 +0900)]
Fixed the 3rd argument for TypedArray.fill(). (#82480)

`TypedArray.fill()` expects `end` as the 3rd argument.

20 months ago[mono][debugger] Support symbol server on mobile devices (#82555)
Thays Grazia [Fri, 24 Feb 2023 00:17:29 +0000 (21:17 -0300)]
[mono][debugger] Support symbol server on mobile devices (#82555)

* implementing support to symbol server on mobile devices

* Implementing support to symbol_server on mobile

* fix compilation

* keeping the \n

* keeping \n

* Fix command id

* fix id

20 months ago[main] Update dependencies from dotnet/llvm-project (#82545)
dotnet-maestro[bot] [Fri, 24 Feb 2023 00:17:18 +0000 (16:17 -0800)]
[main] Update dependencies from dotnet/llvm-project (#82545)

* Update dependencies from https://github.com/dotnet/llvm-project build 20230222.2

runtime.linux-arm64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.linux-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.linux-arm64.Microsoft.NETCore.Runtime.ObjWriter , runtime.linux-musl-arm64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.linux-musl-arm64.Microsoft.NETCore.Runtime.ObjWriter , runtime.linux-musl-x64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.linux-musl-x64.Microsoft.NETCore.Runtime.ObjWriter , runtime.linux-x64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.linux-x64.Microsoft.NETCore.Runtime.ObjWriter , runtime.osx-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.osx-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.osx-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.osx-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.win-arm64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.win-arm64.Microsoft.NETCore.Runtime.ObjWriter , runtime.win-x64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.win-x64.Microsoft.NETCore.Runtime.ObjWriter
 From Version 14.0.0-alpha.1.23114.1 -> To Version 14.0.0-alpha.1.23122.2

* Fix warning detection and adjust limits for current changes

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Andy Gocke <andy@commentout.net>
20 months agoAdd support for dumping native stacks with cdb (#82189)
Jeremy Koritzinsky [Fri, 24 Feb 2023 00:15:03 +0000 (16:15 -0800)]
Add support for dumping native stacks with cdb (#82189)

Co-authored-by: Dan Moseley <danmose@microsoft.com>
20 months agoAdd osx-arm64 to official RIDs in ILCompiler NuGet (#82558)
Filip Navara [Thu, 23 Feb 2023 23:45:44 +0000 (00:45 +0100)]
Add osx-arm64 to official RIDs in ILCompiler NuGet (#82558)

20 months agoAdd RCPC ISA detection on win-arm64 (#82527)
Egor Bogatov [Thu, 23 Feb 2023 23:37:50 +0000 (00:37 +0100)]
Add RCPC ISA detection on win-arm64 (#82527)

* Add RCPC ISA detection on win-arm64

* Address feedback

20 months ago[wasi] Add `wasi-experimental` workload, `wasiconsole` template, and `Wasi.Build...
Ankit Jain [Thu, 23 Feb 2023 23:36:37 +0000 (18:36 -0500)]
[wasi] Add `wasi-experimental` workload, `wasiconsole` template, and `Wasi.Build.Tests` (#81849)

* EmitWasmBundleObjectFile: Capture any clang output/errors
* [wasi] Add wasiconsole template
* [wasi] Add wasmtime support for WasmAppHost
* [wasi] Add wasi-experimental workload
- And Microsoft.NET.Runtime.WebAssembly.Wasi.Sdk
* [wasi] Add Wasi.Build.Tests
* [wasi] cleanup
* [wasi] liveBuilds.targets - add dotnet.wasm, and other files
* Add CI support for Wasi.Build.Tests
* fix build
* Link required libc++*.a from wasi-sdk
* Address earlier review feedback from @pavelsavara

20 months ago[workload] Upstream net7 manifest json and targets (#82267)
Steve Pfister [Thu, 23 Feb 2023 23:30:27 +0000 (15:30 -0800)]
[workload] Upstream net7 manifest json and targets (#82267)

The upstream version did not contain arm64 changes.

20 months agoReturn singleton enumerators from IEnumerable.GetEnumerator for empty collections...
Stephen Toub [Thu, 23 Feb 2023 23:00:59 +0000 (18:00 -0500)]
Return singleton enumerators from IEnumerable.GetEnumerator for empty collections (#82499)

* Return singleton enumerators from IEnumerable.GetEnumerator for empty collections

Change the `IEnumerable<T>.GetEnumerator()` implementations on our core collection types to special-case Count==0 in order to return a single enumerator instead of allocating one a new each time.  This saves an allocation when enumerating these collections via the interface in exchange for an extra length check as part of GetEnumerator.

* Address PR feedback

- Create helper function for empty enumerator
- Add tests for singletons

* Fix a few tests

20 months agoUse throw helpers in a few more places (#82533)
Stephen Toub [Thu, 23 Feb 2023 23:00:41 +0000 (18:00 -0500)]
Use throw helpers in a few more places (#82533)

* Use throw helpers in a few more places

* Update src/libraries/System.Private.CoreLib/src/System/String.cs

* Add missing cast

20 months agoRefactor common variables used for the "send runtime tests to helix" steps into a...
Jeremy Koritzinsky [Thu, 23 Feb 2023 22:49:18 +0000 (14:49 -0800)]
Refactor common variables used for the "send runtime tests to helix" steps into a shared template that all of our pipelines that run runtime tests can use. (#81926)

20 months ago[JIT] On importing a CEE_INITOBJ for a simd, construct a VecCon(0) (#81982)
Will Smith [Thu, 23 Feb 2023 22:21:59 +0000 (14:21 -0800)]
[JIT] On importing a CEE_INITOBJ for a simd, construct a VecCon(0) (#81982)

* On importing a CEE_INITOBJ for a simd, construct a VecCon(0) of that type

* Formatting

* Check layout to determine if type is a SIMD to avoid redundant impNormStructType call

* Fix assert

* Remove assert

* Update src/coreclr/jit/importer.cpp

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
* Update importer.cpp

---------

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
20 months ago[JIT] Always transform `AND(X, CNS(-1))` to `X` (#82276)
Will Smith [Thu, 23 Feb 2023 22:08:57 +0000 (14:08 -0800)]
[JIT] Always transform `AND(X, CNS(-1))` to `X` (#82276)

* Always skip emitting 'and reg0, -1' on x86

* Formatting

* Wrapping AreUpper32BitsZero and AreUpper32BitsSignExtended to be 64-bit only

* Added TryLowerAndNegativeOne

* minor tweak

* Update lowerxarch.cpp

* Remove peephole in favor of lowering opt

* Feedback and moved 'TryLowerAndNegativeOne' to lower.cpp

20 months agoRemove unnecessary _version++ from a few places (#82500)
Stephen Toub [Thu, 23 Feb 2023 22:03:01 +0000 (17:03 -0500)]
Remove unnecessary _version++ from a few places (#82500)

* Remove unnecessarion _version++ from a few places

In some collection types, resizing the backing store can affect in-flight enumerations, e.g. growing a queue will cause the implementation to relayout the elements contiguously from the beginning, which will invalidate indices stored in enumerators.  But for `List<T>` and `Stack<T>`, changing the backing array doesn't impact the index stored in an enumerator, nor does it impact what the enumerator will enumerate, so these operations needn't invalidate the enumerators.  `List<T>`'s `set_Capacity` and `TrimExcess` already didn't update the version, but its `EnsureCapacity` did, and `Stack<T>`'s `TrimExcess` and `EnsureCapacity` both updated the version.  This change just removes those unnecessary increments.

* Add a Stack.TrimExcess test

20 months agoRename ProduceBy enum to Tool (#82550)
Tlakaelel Axayakatl Ceja [Thu, 23 Feb 2023 21:38:39 +0000 (13:38 -0800)]
Rename ProduceBy enum to Tool (#82550)

20 months agoDon't spend cycles zeroing constrainedResolvedToken each iteration (#82531)
Tanner Gooding [Thu, 23 Feb 2023 21:36:16 +0000 (13:36 -0800)]
Don't spend cycles zeroing constrainedResolvedToken each iteration (#82531)

20 months agoAdd Microsoft.NET.ILLink package (#82407)
Tlakaelel Axayakatl Ceja [Thu, 23 Feb 2023 21:32:42 +0000 (13:32 -0800)]
Add Microsoft.NET.ILLink package  (#82407)

Add is Packable property to produce the lib part of illink
Add Target to produce the ref part of illink
Add compatibility suppressions file for now, til the actual warnings are fixed

20 months agoUse asynchronous lock in Parallel.ForEachAsync with synchronous enumerable (#82501)
Stephen Toub [Thu, 23 Feb 2023 20:54:44 +0000 (15:54 -0500)]
Use asynchronous lock in Parallel.ForEachAsync with synchronous enumerable (#82501)

* Use asynchronous lock in Parallel.ForEachAsync with synchronous enumerable

Avoid blocking threads while waiting for access to the enumerator in the case of a slower MoveNext.

* Update src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.ForEachAsync.cs

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
---------

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
20 months agoReplace some use of string.CompareOrdinal with string == (#82438)
Stephen Toub [Thu, 23 Feb 2023 20:54:08 +0000 (15:54 -0500)]
Replace some use of string.CompareOrdinal with string == (#82438)

* Replace some use of string.CompareOrdinal with string ==

* Update src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.Icu.cs

20 months agoJIT: don't optimize calls to CORINFO_HELP_VIRTUAL_FUNC_PTR for interface class lookup...
Andy Ayers [Thu, 23 Feb 2023 20:49:44 +0000 (12:49 -0800)]
JIT: don't optimize calls to CORINFO_HELP_VIRTUAL_FUNC_PTR for interface class lookups (#82209)

The jit currently replaces calls to `CORINFO_HELP_VIRTUAL_FUNC_PTR`
whose results are unused with null pointer checks.

But for interface classes this helper can throw a variety of exceptions, so this
optimization is incorrect.

Fixes #82127.

20 months ago[PERF] Fix perf pipeline runs from variable error (#82553)
Parker Bibus [Thu, 23 Feb 2023 20:33:50 +0000 (12:33 -0800)]
[PERF] Fix perf pipeline runs from variable error (#82553)

* Setup testing.
* Update variable insertion.
* Revert "Setup testing."

This reverts commit 252865d57ee376d338c9940f2ea53bf3384c74d8.

20 months agoAvoid locking on every ValidationAttributeStore lookup. (#82536)
Eirik Tsarpalis [Thu, 23 Feb 2023 19:48:23 +0000 (19:48 +0000)]
Avoid locking on every ValidationAttributeStore lookup. (#82536)

20 months agoAdd new System.ComponentModel.DataAnnotations features (#82311)
Eirik Tsarpalis [Thu, 23 Feb 2023 18:59:11 +0000 (18:59 +0000)]
Add new System.ComponentModel.DataAnnotations features (#82311)

* Add RangeAttribute.Minimum/MaximumIsExclusive properties.

* Add RequiredAttribute.DisallowAllDefaultValues.

* Add LengthAttribute implementation & tests.

* Add AllowedValuesAttribute & DeniedValuesAttribute

* Add Base64StringAttribute.

* Address feedback

* Address feedback.

* Reinstate culture-insensitive parsing

20 months agoRun check before generating the config file (#82435)
Adeel Mujahid [Thu, 23 Feb 2023 18:57:12 +0000 (20:57 +0200)]
Run check before generating the config file (#82435)

20 months agoUpdate ILLink wording (#82050)
Tlakaelel Axayakatl Ceja [Thu, 23 Feb 2023 18:44:50 +0000 (10:44 -0800)]
Update ILLink wording (#82050)

Update linker wording to disambiguate the term from native linker, switched to illink
Deleted illink steps-explained document since is no longer accurate
This change did not change attribute justification messages
Add changes to use same wording between shared files

20 months ago[Mono]: Add support for lazy runtime init in native-to-managed wrapper, similar to...
Johan Lorensson [Thu, 23 Feb 2023 17:11:23 +0000 (18:11 +0100)]
[Mono]: Add support for lazy runtime init in native-to-managed wrapper, similar to NativeAOT library build. (#82253)

* Add support for runtime init in native-to-managed wrapper.

NativeAOT supports library mode, building all needed runtime and
managed code into a static or shared library that can be loaded
and used by embedding applications. NativeAOT exports managed
functiond marked with UnmanagedCallersOnly attribute that can be
called by embedder to run managed code. NativeAOT runtime doesn't
need any initialization, meaning that calling the managed method
exported using UnmanagedCallersOnly attribute
will perform lazy runtime initialization on first call.

This commit add similar support to MonoVM giving it possibilities
to include a call to a runtime init function as part of
native-to-managed wrapper used for methods marked with
UnmanagedCallersOnly attribute + entry point. AOT compiler
accepts a new argument, runtime-init-callback, if used like
that, the native-to-managed wrapper will get a call to a default
invoke callback method implemented by runtime, that will call a
set callback once (thread safe). It is also possible to pass
runtime-init-callback=<custom symbol> to AOT compiler, and
in that case native-to-managed wrapper will call that function and its
up to implementor to do a thread safe implementation of runtime init.
This capability could be used in case where the library can't set the
callback before consumer of the library class the exported function.

Two new runtime API's have been added in this commit, one to set
the callback called by default runtime init implementation and the
other is the implementation of that function used in native-to-managed
wrapper if user doesn't use a custom runtime init callback function.
Since this integration scenario is mainly for library build scenarios
(we control the library builder), these methods are marked as
MONO_COMPONENT_API and not something that should be part of the public
API surface.

* Split mono_marshal_get_managed_wrapper into two functions.

* Drop runtime init for mono_marshal_emit_managed_wrapper.

* aquire/release semantics around runtime_init_callback.

* Detect MONO_JIT_ICALL_mono_dummy_runtime_init_callback in more places.

* Add description of new AOT compiler options.

20 months agoWasi icu loading (#82444)
Meri Khamoyan [Thu, 23 Feb 2023 16:54:12 +0000 (20:54 +0400)]
Wasi icu loading (#82444)

Added icu loading in WASI

20 months agoAdding more SIMD constant folding support (#82190)
Tanner Gooding [Thu, 23 Feb 2023 16:47:22 +0000 (08:47 -0800)]
Adding more SIMD constant folding support (#82190)

* Adding more SIMD constant folding support

* Adding tests for the new SIMD constant folding paths

* Ensure bitcasting float/double is using well-defined behavior

20 months agoPort remaining AOT tests (#82509)
Tlakaelel Axayakatl Ceja [Thu, 23 Feb 2023 15:58:55 +0000 (07:58 -0800)]
Port remaining AOT tests (#82509)

* Move GenericParameter testing from NativeAOT to illink
Add Kept By in order to account for illink behavior differences

* Fix test for illink and analyzer
Revert changes to the sln which break build from VS

---------

Co-authored-by: Tlakollo <tlcejava@microsoft.com>
Co-authored-by: vitek-karas <10670590+vitek-karas@users.noreply.github.com>
20 months agoJIT: Lift remaining cmov restrictions by introducing GT_SELECTCC (#82235)
Jakob Botsch Nielsen [Thu, 23 Feb 2023 13:13:43 +0000 (14:13 +0100)]
JIT: Lift remaining cmov restrictions by introducing GT_SELECTCC (#82235)

This introduces GT_SELECTCC and unifies its handling with GT_JCC. We no longer
use containment for GT_SELECT conditions in the xarch backend.

Additionally teaches liveness DCE about GT_SETCC and GT_SELECTCC by allowing it
to remove GTF_SET_FLAGS from the previous node when they are unused.

Minor diffs expected; the additional cases are really not that common. The main
benefit is that GT_SELECT is now fully on par with GT_JTRUE, and does not have
any odd limitations. The code to handle conditions is completely shared.

20 months agoFix passing Mac Catalyst -target flag to .mm builds (#82292)
Filip Navara [Thu, 23 Feb 2023 11:55:45 +0000 (12:55 +0100)]
Fix passing Mac Catalyst -target flag to .mm builds (#82292)

20 months agoFix build with old gcc (#82513)
Adeel Mujahid [Thu, 23 Feb 2023 11:26:43 +0000 (13:26 +0200)]
Fix build with old gcc (#82513)

20 months agoFix JIT pipeline issues with instantiation (#82512)
Juan Hoyos [Thu, 23 Feb 2023 10:02:22 +0000 (02:02 -0800)]
Fix JIT pipeline issues with instantiation (#82512)

20 months agoReplace RichNav with Code Index (#82088)
Alexander Köplinger [Thu, 23 Feb 2023 09:50:06 +0000 (10:50 +0100)]
Replace RichNav with Code Index (#82088)

RichNav is now known as Code Index: https://dev.azure.com/devdiv/DevDiv/_wiki/wikis/DevDiv.wiki/28554/Index-Your-Repo

The separate AzDO feed in nuget.config is not needed anymore which should make restore a bit faster.

Note that there's currently an error due to new MSBuild binlog version which is tracked by https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1746670/, so we decided to disable the pipeline for now.

20 months ago[jiterp] Fix stelem_ref not doing a type check (#82507)
Katelyn Gadd [Thu, 23 Feb 2023 04:26:35 +0000 (20:26 -0800)]
[jiterp] Fix stelem_ref not doing a type check (#82507)

Jiterpreter's implementation of stelem_ref wasn't doing a type check, now it does (via a C helper)

20 months agoAnnotation changes only (part 2) (#82388)
Maoni Stephens [Thu, 23 Feb 2023 04:22:59 +0000 (20:22 -0800)]
Annotation changes only (part 2) (#82388)

+ change the per heap/global fields to their detailed categories
+ fixed incorrect comments for fields like full_gc_approach_event
+ moved some fields are only used for segments under #ifndef USE_REGIONS
+fixed some fields that were mistakenly marked as methods from my last annotation PR (I forgot that some fields' declarations have '(' in them so my parser treated them as methods, eg, VOLATILE(size_t) n_eph_soh)
+ got rid of useless comments for these fields
+ got rid of useless fields

20 months agoDeduplicate platform lists in BuildIntegration (#82395)
Adeel Mujahid [Thu, 23 Feb 2023 04:15:17 +0000 (06:15 +0200)]
Deduplicate platform lists in BuildIntegration (#82395)

* Deduplicate platform lists in BuildIntegration

* Use exact matches in switch expression

* Treat linux-musl as linux like before

20 months agoDon't run non-wasm test lanes for jiterpreter-only changes (#82510)
Katelyn Gadd [Thu, 23 Feb 2023 03:18:50 +0000 (19:18 -0800)]
Don't run non-wasm test lanes for jiterpreter-only changes (#82510)

Don't run non-wasm lanes for jiterpreter-only changes. The C files are guarded with HOST_BROWSER