platform/upstream/dotnet/runtime.git
20 months agoIntroduce System.IO.Ports area (#78743)
Jeff Handley [Wed, 23 Nov 2022 22:17:48 +0000 (14:17 -0800)]
Introduce System.IO.Ports area (#78743)

20 months agoRemove members on `arguments_t` that are not related to the app itself (#78745)
Elinor Fung [Wed, 23 Nov 2022 22:00:05 +0000 (14:00 -0800)]
Remove members on `arguments_t` that are not related to the app itself (#78745)

20 months agoBump System.Data.SqlClient to 4.8.5 (#78774)
Alexander Köplinger [Wed, 23 Nov 2022 21:52:09 +0000 (22:52 +0100)]
Bump System.Data.SqlClient to 4.8.5 (#78774)

It addresses a component governance warning.

20 months agoConvert some instances of Unsafe.SizeOf and Unsafe.As to regular unsafe code (#78741)
Jan Kotas [Wed, 23 Nov 2022 21:38:23 +0000 (13:38 -0800)]
Convert some instances of Unsafe.SizeOf and Unsafe.As to regular unsafe code (#78741)

C# 11 allows use of managed types with pointers and sizeof. Replacing Unsafe.* with regular unsafe code makes the binaries a bit smaller and saves time and memory at runtime.

20 months agoUse Environment.IsPrivilegedProcess (#77847)
Ilya [Wed, 23 Nov 2022 20:02:34 +0000 (01:02 +0500)]
Use Environment.IsPrivilegedProcess (#77847)

* Use Environment.IsPrivilegedProcess

* Remove using System

20 months agoUse ASCII strings in source files (#78265)
Adeel Mujahid [Wed, 23 Nov 2022 19:59:22 +0000 (21:59 +0200)]
Use ASCII strings in source files (#78265)

20 months agoTar: Extra tests to confirm extra long paths are not treated as duplicate entries...
Carlos Sanchez [Wed, 23 Nov 2022 19:09:27 +0000 (11:09 -0800)]
Tar: Extra tests to confirm extra long paths are not treated as duplicate entries when the full path is in the extended attributes. (#78744)

Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
20 months ago[wasm] More jiterpreter cleanup (#78519)
Katelyn Gadd [Wed, 23 Nov 2022 18:24:19 +0000 (10:24 -0800)]
[wasm] More jiterpreter cleanup (#78519)

    Move more jiterpreter configuration and constants into options
    Fix should_generate_trace_here not scanning across multiple basic blocks
    Disable specialized JIT call in threaded wasm mode (though I think it might work, it's better to turn it off to be sure for now)
    Introduces genmintops.py, a script that automatically generates mintops.ts from mintops.def
    Adjust typescript config to make it able to find the generated mintops.ts (and fix ESLint on Linux)
    Unroll memsets below a certain size into raw wasm opcodes, because v8 generates expensive function calls for memset and memcpy. Unrolling memcpy is a TODO for later
    Rename "always generate" to "disable heuristic" to more accurately describe what it does
    Fix jiterpreter_dump_stats hiding errors if startup failed before cwraps were ready
    Misc. code cleanup

20 months agofix DualMode ReceiveFrom on macOS (#78261)
Tomas Weinfurt [Wed, 23 Nov 2022 17:52:02 +0000 (09:52 -0800)]
fix DualMode ReceiveFrom on macOS (#78261)

* fix DualMode ReceiveFrom on macOS

* style

* feedback from review

* rollback

* Update src/libraries/Common/src/System/Net/SocketAddress.cs

Co-authored-by: Ahmet Ibrahim AKSOY <aaksoy@microsoft.com>
Co-authored-by: Ahmet Ibrahim AKSOY <aaksoy@microsoft.com>
20 months agoReenable a test after 78358 is fixed. (#78697)
Zoltan Varga [Wed, 23 Nov 2022 16:07:45 +0000 (11:07 -0500)]
Reenable a test after 78358 is fixed. (#78697)

20 months agoJIT: Ignore source indir when checking interference for block store source address...
Jakob Botsch Nielsen [Wed, 23 Nov 2022 16:04:05 +0000 (17:04 +0100)]
JIT: Ignore source indir when checking interference for block store source address (#78763)

For block stores we can contain both the source and destination address.
Since the source is a value we will have an indirection on top of the
address, such as

```
N015 (  3, 12) [000014] I---------- t14 =    CNS_INT(h) long   0xd1ffab1e static box ptr REG x1 $200
                                          ┌──▌  t14    long
N017 (  6, 14) [000001] #---G------  t1 = ▌  IND       ref    REG x1 $240
                                          ┌──▌  t1     ref
N019 (  8, 17) [000003] -c--G------  t3 = ▌  LEA(b+8)  byref  REG NA
                                          ┌──▌  t3     byref
N021 ( 32, 39) [000004] nc-XG--N---  t4 = ▌  IND       struct REG NA
N023 (???,???) [000025] Dc--------- t25 =    LCL_FLD_ADDR byref  V03 tmp1         [+0] NA REG NA
                                          ┌──▌  t25    byref
                                          ├──▌  t4     struct
N025 ( 42, 46) [000017] sA---------       ▌  STORE_BLK struct<Xunit.StackFrameInfo, 16> (copy) (Unroll) REG NA
```

where [000004] is the source indirection and [000003] is the source
address. The existing containment check was checking interference of
[000003] with [000004], which is conservative given that the indirection
itself is always contained.

20 months ago[wasm] Use "node:crypto" to polyfill getRandomValues on older node (#78696)
Marek Fišera [Wed, 23 Nov 2022 13:09:36 +0000 (14:09 +0100)]
[wasm] Use "node:crypto" to polyfill getRandomValues on older node (#78696)

20 months agoJIT: Keep FieldSeq in AssertionDesc (#78616)
Egor Bogatov [Wed, 23 Nov 2022 12:01:59 +0000 (13:01 +0100)]
JIT: Keep FieldSeq in AssertionDesc (#78616)

Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
20 months agoUpdate NugetPackagingVersion to 6.2.2 (#78720)
Alexander Köplinger [Wed, 23 Nov 2022 10:21:40 +0000 (11:21 +0100)]
Update NugetPackagingVersion to 6.2.2 (#78720)

20 months agoAnonymous pipe resource leak when DisposeLocalCopyOfClientHandle is not called (...
Adam Sitnik [Wed, 23 Nov 2022 09:29:54 +0000 (10:29 +0100)]
Anonymous pipe resource leak when DisposeLocalCopyOfClientHandle is not called (#78562)

20 months agoFix the tiering delay to account for changing IL/native code versions during the...
Koundinya Veluri [Wed, 23 Nov 2022 05:21:28 +0000 (21:21 -0800)]
Fix the tiering delay to account for changing IL/native code versions during the delay (#78668)

- Added a check to see if the currently active native code version has a code entry point

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

20 months agoUse IndexOfAnyValues in Xml (#78664)
Miha Zupan [Wed, 23 Nov 2022 05:04:53 +0000 (05:04 +0000)]
Use IndexOfAnyValues in Xml (#78664)

* Use IndexOfAnyValues in Xml

* Avoid checking whitespace char twice

* More spans

20 months agoImprove IndexOfAnyAsciiSearcher ARM throughput (#78739)
Miha Zupan [Wed, 23 Nov 2022 05:02:57 +0000 (05:02 +0000)]
Improve IndexOfAnyAsciiSearcher ARM throughput (#78739)

* Improve IndexOfAnyAsciiSearcher ARM throughput

Also solves an edge-case bug for byte overloads on ARM64 where we'd get false positives (negatives for Except) when haystack values were exactly 128 above a value in the needle

* Remove type name asserts

20 months agoExtend preinitialization interpreter to support calling `string::Length` (#78680)
Michal Strehovský [Wed, 23 Nov 2022 03:25:14 +0000 (12:25 +0900)]
Extend preinitialization interpreter to support calling `string::Length` (#78680)

* Support `callvirt` to a non-virtual method
* Support accessing string's fields

20 months agoUse IndexOfAnyValues in Uri (#78666)
Miha Zupan [Wed, 23 Nov 2022 02:30:37 +0000 (02:30 +0000)]
Use IndexOfAnyValues in Uri (#78666)

* Use IndexOfAnyValues in Uri

* Fix CheckSchemeName typo

* Fix debug assert condition

* Fix DomainNameHelper

* Fix IRI domain name parsing for [80, 9F] chars

* PR feedback

20 months agoExplicitly omit RID from crossgen2 binary path (#78733)
Jan Kotas [Wed, 23 Nov 2022 01:02:40 +0000 (17:02 -0800)]
Explicitly omit RID from crossgen2 binary path (#78733)

Fixes https://github.com/dotnet/sdk/issues/29177

20 months agoFix netfx builds for S.S.C.Xml and System.Threading.AccessControl nuget packages
Jeremy Barton [Tue, 22 Nov 2022 22:19:34 +0000 (14:19 -0800)]
Fix netfx builds for S.S.C.Xml and System.Threading.AccessControl nuget packages

20 months agoAdd READMEs for System.Security* and related libraries
Jeremy Barton [Tue, 22 Nov 2022 22:12:21 +0000 (14:12 -0800)]
Add READMEs for System.Security* and related libraries

20 months agoDelete redundant check (#78702)
Jan Kotas [Tue, 22 Nov 2022 21:54:47 +0000 (13:54 -0800)]
Delete redundant check (#78702)

Fixes #78683

20 months agoTeach internal printf about 'z' (#78685)
Aaron Robinson [Tue, 22 Nov 2022 21:24:58 +0000 (13:24 -0800)]
Teach internal printf about 'z' (#78685)

In a previous PR, an attempt was made to remove
most Windows specific format flags. However, the
internal printf version we are using doesn't know
about the 'z' flag. In order to transition to the correct
flags so we can remove our printf, we need to teach
our printf about modern flags.

20 months agoRemove TrimStart in PAX extended attributes (#78707)
Carlos Sanchez [Tue, 22 Nov 2022 20:41:13 +0000 (12:41 -0800)]
Remove TrimStart in PAX extended attributes (#78707)

* Remove TrimStart in PAX extended attributes

* Adjust existing tests with two extra inline datas.

Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
20 months agoClean-up `Microsoft.Win32.Registry` and remove the non-Windows code. (#77996)
Theodore Tsirpanis [Tue, 22 Nov 2022 20:18:25 +0000 (22:18 +0200)]
Clean-up `Microsoft.Win32.Registry` and remove the non-Windows code. (#77996)

* Include the registry source files only on Windows.

* Merge the Windows-specific registry source files.

Some trivial methods with one caller were inlined.

* Inline the `Core` methods that get used only once.

* Clean-up some stuff.

* Use `nameof` in one place.

* Remove one mention of `SafeRegistryHandle.Windows.cs`.

20 months agoUse IndexOfAnyValues in CoreLib (#78678)
Miha Zupan [Tue, 22 Nov 2022 19:33:50 +0000 (19:33 +0000)]
Use IndexOfAnyValues in CoreLib (#78678)

* Use IndexOfAnyValues in CoreLib

* Avoid the init overhead of IndexOfAnyValues in string

20 months agoClean up members/signatures/visibility in deps_format/resolver (#78572)
Elinor Fung [Tue, 22 Nov 2022 19:12:56 +0000 (11:12 -0800)]
Clean up members/signatures/visibility in deps_format/resolver (#78572)

20 months agoCleanup GenFacades logic and don't bind against non-shipping contract assemblies...
Viktor Hofer [Tue, 22 Nov 2022 19:01:29 +0000 (20:01 +0100)]
Cleanup GenFacades logic and don't bind against non-shipping contract assemblies (#78703)

* Clean-up the ApiCompat and GenAPI logic

* Fix System.DirectoryServices.AccountManagement build

System.DirectoryServices.AccountManagement now builds against
src/System.DirectoryServices instead of ref/System.DirectoryServices
(because the package doesn't contain the ref assembly).

Because of that, the compiler now gets confused because of the
System.DirectoryServices.Interop namespace and the global Interop class.
This happens even though the DirectoryServices.Interop namespace doesn't include any
public types.

That results in the following erros:
src\libraries\System.DirectoryServices.AccountManagement\src\System\DirectoryServices\AccountManagement\AD\SidList.cs(50,26): error CS0246: The type or namespace name 'SID_AND_ATTRIBUTES' could not be found (are you missing a using directive or an assembly reference?)
src\libraries\System.DirectoryServices.AccountManagement\src\System\DirectoryServices\AccountManagement\interopt.cs(439,20): error CS0246: The type or namespace name 'UNICODE_INTPTR_STRING' could not be found (are you missing a using directive or an assembly reference?)

This commit fixes that by removing the System.DirectoryServices.Interop
namespace and moving the types into the parent namespace.

* Suppress nullable warnings in Serialization.Schema

Now that Schema compiles against the source assembly of System.CodeDom,
it receives nullability errors. I'm suppressing them manually for now
but am filing an issue to correctly fix those.

Related: https://github.com/dotnet/runtime/issues/78036

* Move SkipUseReferenceAssembly target up

20 months agoavoid alpn allocation on windows (#74619)
Tomas Weinfurt [Tue, 22 Nov 2022 18:58:09 +0000 (10:58 -0800)]
avoid alpn allocation on windows (#74619)

* avoid alpn allocation on windows

* updates

* remove dead code

* scoped

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Fix build breaks

* SetAlpn

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
20 months agoClarify System.Diagnostics.Process' README (#78719)
David Cantú [Tue, 22 Nov 2022 18:24:09 +0000 (12:24 -0600)]
Clarify System.Diagnostics.Process' README (#78719)

It should say that you shall not install a NuGet package if your TFM is Netstandard2.0 compatible.

20 months ago[hot_reload] Add instance fields (#76462)
Aleksey Kliger (λgeek) [Tue, 22 Nov 2022 14:57:03 +0000 (09:57 -0500)]
[hot_reload] Add instance fields (#76462)

* [hot_reload] Add new AddInstanceField test

* Add AddInstanceFieldToExistingType capability to runtime

* Add instance field: reflection and nested struct

* make TypedReference work with added fields

* Add FieldInfo.SetValue testcase

* make FieldInfo.SetValue work

* Implement LDFLDA opcode for added fields; add test

* Disable test on CoreCLR

*adding a wasm debugger test

* make the debugger test a bit more interesting

* implement a debugger test that gets/sets instance fields

* Clear the debugger type cache on EnC update

   we only need to clear the type on which fields or methods were added. but right now we just clear the whole cache

* [sdb] implement get/set field for added instance fields

* [handles] remove the field getter/setter macros

   They had no callers, and now we don't do things this way - we assume the enclosing object had been pinned by a stack reference.

* [metadata-update] comments on asserts

* implement mono_field_get_addr added field support

* remove last use of MONO_HANDLE_SET_FIELD_REF

* WeakAttribute is not picked up from added fields

* Add a test for an array with RVA

* Impl mono_metadata_field_info_full

* mono_class_get_field_token

* mono_field_get_rva

* Add SetValueDirect/GetValueDirect test (failing)

* Implement GetValueDirect - hot reload test passes now

* Added test for auto property; crashes in ves_icall_RuntimePropertyInfo_get_property_info

* add_props

   Note: we're not doing anything with the new PropertyMap row

   Note2: we get MethodSemantics rows for properties that got updated,
   and we're currently ignoring them.  Need to check that this is
   reasonable. (A test would be to use reflection to grab a getter or
   setter whose method body was changed and then try and invoke it and
   verify that we're calling the correct method.)

* fixup comment - repeated MethodSemantics rows can happen

* added properties iteration

* protect callers of mono_class_get_property_token

* make mono_class_get_property_token work for added props

* add test for adding instance event

* basic event reflection works

* Fire the new event, too

* make reflection MetadataToken work

* remove unused ifdefs and fix whitespace

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

20 months agoReduce private points of contact between frozen colelctions and ImmutableArray<T...
Martin Taillefer [Tue, 22 Nov 2022 14:47:38 +0000 (06:47 -0800)]
Reduce private points of contact between frozen colelctions and ImmutableArray<T>. (#78675)

This change is intended to make it easier to use the frozen collections in environments/conditions
when only the public API of ImmutableArray is available. There are two things which are changed:

1. Uses of the internal ImmutableArray ctor are replaced by the one-line ImmutableArrayFactory.Create
stub, which is easy to replace in above mentioned environments/conditions.

2. Uses of the internal ImmutableArray.array property are trivially eliminated by using the public API
surface.

Co-authored-by: Martin Taillefer <mataille@microsoft.com>
20 months agoPerformance improvements to vectorized Span.Reverse (#78650)
Jesper Meyer [Tue, 22 Nov 2022 14:32:39 +0000 (15:32 +0100)]
Performance improvements to vectorized Span.Reverse (#78650)

20 months ago[wasi] fix duplicate check (#78693)
Pavel Savara [Tue, 22 Nov 2022 14:21:00 +0000 (15:21 +0100)]
[wasi] fix duplicate check (#78693)

20 months ago[mono][wasm] Disable AOTing methods which contain catch clauses inside finally/filter...
Zoltan Varga [Tue, 22 Nov 2022 14:07:45 +0000 (09:07 -0500)]
[mono][wasm] Disable AOTing methods which contain catch clauses inside finally/filter clauses. (#78653)

When the ENDFINALLY opcode of the outer clause is encountered
while executing the inner catch clause from run_with_il_state (),
it will assert since it doesn't know where to continue execution.

20 months ago[wasm] propagate aborted startup to top most promise (#78644)
Pavel Savara [Tue, 22 Nov 2022 11:24:47 +0000 (12:24 +0100)]
[wasm] propagate aborted startup to top most promise (#78644)

20 months agowasm cleanup (#78643)
Pavel Savara [Tue, 22 Nov 2022 11:13:37 +0000 (12:13 +0100)]
wasm cleanup (#78643)

20 months agoFix FMA tests to use Math.FusedMultiplyAdd for fallback (#78672)
Egor Bogatov [Tue, 22 Nov 2022 10:33:05 +0000 (11:33 +0100)]
Fix FMA tests to use Math.FusedMultiplyAdd for fallback (#78672)

20 months agoAdd readmes for System.IO.Compression* (#78645)
David Cantú [Tue, 22 Nov 2022 10:09:39 +0000 (04:09 -0600)]
Add readmes for System.IO.Compression* (#78645)

* Add readmes for System.IO.Compression*

* Clarify NuGet package should not be used on ns2.0+

20 months agoCreate a shared apicompat suppression file for CoreLib (#78654)
Viktor Hofer [Tue, 22 Nov 2022 09:48:20 +0000 (10:48 +0100)]
Create a shared apicompat suppression file for CoreLib (#78654)

20 months agoFix the other jmp.il after #78501 (more for #78579) (#78656)
Mark Plesko [Tue, 22 Nov 2022 06:55:51 +0000 (22:55 -0800)]
Fix the other jmp.il after #78501 (more for #78579) (#78656)

(same fix as #78582)

20 months agoUse IndexOfAnyValues in X500NameEncoder (#78676)
Miha Zupan [Tue, 22 Nov 2022 04:57:45 +0000 (04:57 +0000)]
Use IndexOfAnyValues in X500NameEncoder (#78676)

20 months agoCache GenericTypeDefinition to improve perf (#78288)
LateApexEarlySpeed [Tue, 22 Nov 2022 04:14:32 +0000 (12:14 +0800)]
Cache GenericTypeDefinition to improve perf (#78288)

* Put GenericTypeDefinition into genericCache.

* Fix comment: change to use MT flags to check nullability.

* Not worth caching IsNullableOfT anymore

* Factor out the slow path into a non-inlineable method

* Port a few generic-related RuntimeType fcalls to C#

* Add comment

* Use seperate cache field for the type definition

There is a risk of activator cache and generic type definition cache colliding

* Tweak IsConstructedGenericType

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
20 months agoUse IndexOfAnyValues in Regex.Escape (#78667)
Miha Zupan [Tue, 22 Nov 2022 03:58:56 +0000 (03:58 +0000)]
Use IndexOfAnyValues in Regex.Escape (#78667)

* Use IndexOfAnyValues in Regex.Escape

* NET8_0_OR_GREATER => NET7_0_OR_GREATER

20 months agoUse IndexOfAnyInRange in StripBidiControlCharacters (#78658)
Miha Zupan [Tue, 22 Nov 2022 03:51:46 +0000 (03:51 +0000)]
Use IndexOfAnyInRange in StripBidiControlCharacters (#78658)

* Use IndexOfAnyInRange in StripBidiControlCharacters

* Simplify IsBidiControlCharacter

20 months agoIntroduce System.IO.Hashing and System.DateTime area labels (#78673)
Jeff Handley [Tue, 22 Nov 2022 03:50:41 +0000 (19:50 -0800)]
Introduce System.IO.Hashing and System.DateTime area labels (#78673)

* Introduce System.IO.Hashing and System.DateTime area labels

* Update notes for area-System.DateTime to mention more types

20 months agoUse IndexOfAnyValues in System.Net.Http (#78660)
Miha Zupan [Tue, 22 Nov 2022 02:20:42 +0000 (02:20 +0000)]
Use IndexOfAnyValues in System.Net.Http (#78660)

20 months agoIntroduce a System.Formats.Tar area (#78661)
Jeff Handley [Tue, 22 Nov 2022 01:09:27 +0000 (17:09 -0800)]
Introduce a System.Formats.Tar area (#78661)

20 months agoMore robust handling of CERT_CONTEXT with multiple threads
Kevin Jones [Mon, 21 Nov 2022 23:46:41 +0000 (18:46 -0500)]
More robust handling of CERT_CONTEXT with multiple threads

20 months ago[wasm] Update failure message for helix retry (#78655)
Ankit Jain [Mon, 21 Nov 2022 22:59:14 +0000 (17:59 -0500)]
[wasm] Update failure message for helix retry (#78655)

The message in the test report is:
```xml
<Message>System.IO.IOException : [testId: 34] Timed out after 20s waiting for the browser to be ready: C:\helix\work\correlation\chrome-win\chrome.exe</Message>
```

Update to use regex, and match the whole message.

20 months agoAdd IndexOfAnyValues (#78093)
Miha Zupan [Mon, 21 Nov 2022 21:59:44 +0000 (21:59 +0000)]
Add IndexOfAnyValues (#78093)

* Add IndexOfAnyValues

* Remove IAsciiSet special cases

* More tests

* Move expensive tests back to OuterLoop

* Tweak scalar paths

* Improve IndexOfAnyValues<T> summary

* Add temporary MONO workaround

* Simplify IndexOfAny{1, 2, 3}Values

* Remove redundant AND before shift

20 months agoSPMI: Avoid duplicate key lookups on replay (#78597)
Jakob Botsch Nielsen [Mon, 21 Nov 2022 20:11:18 +0000 (21:11 +0100)]
SPMI: Avoid duplicate key lookups on replay (#78597)

The commonly used pattern AssertMapAndKeyExists followed by map->Get
means we do two key lookups. Change the macros to return the value after
we have verified that the key exists. This makes replay 2-3% faster and
avoids some of the boilerplate.

20 months agoAdd check for ALC in native hosting tests (#78588)
Elinor Fung [Mon, 21 Nov 2022 20:10:27 +0000 (12:10 -0800)]
Add check for ALC in native hosting tests (#78588)

- Update native hosting tests to check the ALC in which an assembly is executed
- Pull out some helper functions for logging results of calls to hostfxr in host_context_test.cpp

20 months agoDisable a test on wasm until 78358 is fixed. (#78637)
Zoltan Varga [Mon, 21 Nov 2022 19:37:39 +0000 (14:37 -0500)]
Disable a test on wasm until 78358 is fixed. (#78637)

20 months agoupdate System.CommandLine and adopt to breaking changes (#78577)
Adam Sitnik [Mon, 21 Nov 2022 18:40:27 +0000 (19:40 +0100)]
update System.CommandLine and adopt to breaking changes (#78577)

* update System.CommandLine version

* adopt to recent System.CommandLine breaking changes

20 months agoAdd System.Diagnostics.Process README.md (#78525)
David Cantú [Mon, 21 Nov 2022 17:30:14 +0000 (11:30 -0600)]
Add System.Diagnostics.Process README.md (#78525)

* Add System.Diagnostics.Process README.md

* Fix typo

Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
20 months agoFix dependency graph viewer build and enable High DPI (#78642)
Vitek Karas [Mon, 21 Nov 2022 17:28:46 +0000 (09:28 -0800)]
Fix dependency graph viewer build and enable High DPI (#78642)

* Fix build of DependencyGraphViewer

The recent formatting/style changes in the repo now enforce more things. This project is not part of the main build so it was not fixed so far.

* Enable High DPI support

20 months agoPod Updates November 2022 (#78603)
Jeff Handley [Mon, 21 Nov 2022 17:24:43 +0000 (09:24 -0800)]
Pod Updates November 2022 (#78603)

* Adjust columns and formatting

* Nov 2022 area pod updates

20 months agoUpdate APICompat to be able to pass in multiple suppression files (#78610)
Viktor Hofer [Mon, 21 Nov 2022 17:05:41 +0000 (18:05 +0100)]
Update APICompat to be able to pass in multiple suppression files (#78610)

* Update APICompat to be able to pass in multiple suppression files

20 months agoMake optVNAssertionPropCurStmtVisitor post-order (#78630)
Egor Bogatov [Mon, 21 Nov 2022 16:08:51 +0000 (17:08 +0100)]
Make optVNAssertionPropCurStmtVisitor post-order (#78630)

20 months agoSPMI: Implement fallback schema layout (#78594)
Jakob Botsch Nielsen [Mon, 21 Nov 2022 15:30:19 +0000 (16:30 +0100)]
SPMI: Implement fallback schema layout (#78594)

Fallback to doing actual layout of the schema data when the schema does
not match the recorded schema. This ensures replays are still consistent
with the recording in cases where the JIT and environment variables
match, but that we can still succeed a replay on changes to these.

Fix #74718

20 months agoAdd support for standalone GC back compatibility (#78484)
Jan Vorlicek [Mon, 21 Nov 2022 14:34:36 +0000 (15:34 +0100)]
Add support for standalone GC back compatibility (#78484)

Currently, the version of the standalone GC has to match the version
that the runtime was compiled with. This change enables loosening that
requirement. Runtime is allowed to use any standalone GC as long as its
version is larger or equal to a defined minimum version. GC is now
passed the version of GC the runtime was compiled with and it can use it
to behave in a way compatible with that version. For example, if we add
new methods to the GC to EE interface, that GC can check the GC version
the runtime supports and skip calling the new methods if it is running
with an older runtime.

20 months agoRemove enumerator allocation in for (HashSet, HashSet) comparisons in SetEquals and...
madelson [Mon, 21 Nov 2022 12:46:21 +0000 (07:46 -0500)]
Remove enumerator allocation in for (HashSet, HashSet) comparisons in SetEquals and IsProperSupersetOf. (#78613)

* Remove enumerator allocation in for (HashSet, HashSet) comparisons in
SetEquals and IsProperSupersetOf.

* Address feedback from PR.

* https://github.com/dotnet/runtime/pull/78613#discussion_r1027464402
* https://github.com/dotnet/runtime/pull/78613#discussion_r1027367644

20 months agoUse helpers in Guid's ROS<byte> constructor (#78446)
Benjamin Moir [Mon, 21 Nov 2022 03:20:13 +0000 (14:20 +1100)]
Use helpers in Guid's ROS<byte> constructor (#78446)

* Use helpers in Guid's ROS<byte> constructor

* Condense Guid ROS<byte> constructor with a ternary

* Remove ReadGuidLittleEndian helper

* Add [StackTraceHidden] to Guid.ThrowArgumentException

* Revert accidental whitespace change

20 months agoAdds samples into `Microsoft.Extensions.*` readme files (#78567)
Maryam Ariyan [Mon, 21 Nov 2022 01:20:25 +0000 (20:20 -0500)]
Adds samples into `Microsoft.Extensions.*` readme files (#78567)

20 months agoFold "cns"[cns] for ROS<char> (#78593)
Egor Bogatov [Mon, 21 Nov 2022 00:41:05 +0000 (01:41 +0100)]
Fold "cns"[cns] for ROS<char> (#78593)

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
20 months agoAllow inline relocations in dehydrated data (#78545)
Michal Strehovský [Sun, 20 Nov 2022 23:32:49 +0000 (08:32 +0900)]
Allow inline relocations in dehydrated data (#78545)

This is a follow up to #77884. In the original pull request, all relocation targets went into a lookup table. This is not a very efficient way to represent rarely used relocs. In this update, I'm extending the dehydration format to allow representing relocations inline - instead of indirecting through the lookup table, the target immediately follows the instruction. I'm changing the emitter to emit this if there's less than 3 references to the reloc.

This produces a ~0.5% size saving. It likely also speeds up the decoding at runtime since there's less cache thrashing. On a hello world, the lookup table originally had about 11k entries. With this change, the lookup table only has 1700 entries.

If multiple relocations follow after each other, generate a single command with the payload specifying the number of subsequent relocations. This saves additional 0.1%.

20 months agoRevert "Improve Span.Reverse fast path performance (#70944)" (#78605)
Stephen Toub [Sun, 20 Nov 2022 15:33:42 +0000 (10:33 -0500)]
Revert "Improve Span.Reverse fast path performance (#70944)" (#78605)

This reverts commit 6ddd06c023574f298f21f4acde58bf4af337d309.

20 months agoCheck field's real type before we call getArrayOrStringLength (#78601)
Egor Bogatov [Sun, 20 Nov 2022 14:52:23 +0000 (15:52 +0100)]
Check field's real type before we call getArrayOrStringLength (#78601)

* return -1 in getArrayOrStringLength for unexpected types

* fix comment

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
20 months agoMake JIT<->EE printing methods consistent and support nested classes when printing...
Jakob Botsch Nielsen [Sun, 20 Nov 2022 12:28:28 +0000 (13:28 +0100)]
Make JIT<->EE printing methods consistent and support nested classes when printing class names (#76505)

* Switch `appendClassName`/`getClassName`, `getFieldName` and `getMethodName` into respectively `printClassName`, `printFieldName` and `printMethodName` that all are consistent with `printObjectDescription` in buffer handling, and all use UTF8

* Change `printClassName` to support nested classes, fixing the handling of these in the JIT (in particular for method sets)

* Factor handling in SPMI/ILC/crossgen2 for these methods now that they are consistent

* Add a JitTypeNameFormatter.cs for crossgen2/ILC that does exactly what `printClassName` needs to be consistent with the VM

* Remove concept of "native" `CORINFO_METHOD_HANDLE` (`eeMarkNativeTarget` and co.). This was unused before.

* Remove `CEEInfo::getHelperName`. We were keeping a list of this in the JIT anyway under `FEATURE_SIMD`, which is defined practically everywhere.

* Remove `includeNamespaces` in JIT printing that was always passed as `true`

* Change the `hackishX` names on missing SPMI data into `<unknown X>` instead, e.g. `<unknown method>`

20 months agoReplace MD5 with MurmurHash3_128 in SPMI (#78527)
Egor Bogatov [Sun, 20 Nov 2022 02:44:51 +0000 (03:44 +0100)]
Replace MD5 with MurmurHash3_128 in SPMI (#78527)

Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
20 months agoFix the name/assembly of XmlWriterInlineDataDiscoverer. (#78595)
Zoltan Varga [Sat, 19 Nov 2022 18:31:00 +0000 (13:31 -0500)]
Fix the name/assembly of XmlWriterInlineDataDiscoverer. (#78595)

20 months agoImplement abstraction for marshalling direction in the generator APIs (#78196)
Jeremy Koritzinsky [Sat, 19 Nov 2022 18:04:04 +0000 (10:04 -0800)]
Implement abstraction for marshalling direction in the generator APIs (#78196)

* Use MarshalDirection to provide a nice abstraction for determining whether we're marshalling a parameter/return value/etc from managed to unmanaged or vice versa. This abstraction will be useful when enabling unmanaged->managed stubs as we won't need to go update every marshalling generator to correctly understand what to do.

Also rename some members from "in/out/ref" to use the direction-based names.

* PR feedback

20 months agoChange IMarshallingGenerator.AsNativeType to return ManagedTypeInfo instead of TypeSy...
Jeremy Koritzinsky [Sat, 19 Nov 2022 17:57:05 +0000 (09:57 -0800)]
Change IMarshallingGenerator.AsNativeType to return ManagedTypeInfo instead of TypeSyntax (#78195)

20 months ago[Test] Collapse mono runtime tests into single builds using global-build-job template...
Nathan Ricci [Sat, 19 Nov 2022 17:43:40 +0000 (12:43 -0500)]
[Test] Collapse mono runtime tests into single builds using global-build-job template (#62863)

Make mono desktop runs use global build template (removes patching coreclr step).

20 months agoUse a list for tests in src/tests/run.py (#78463)
Jakob Botsch Nielsen [Sat, 19 Nov 2022 12:25:45 +0000 (13:25 +0100)]
Use a list for tests in src/tests/run.py (#78463)

Otherwise we may problems due to multiple test assemblies having tests
of the same name (e.g. due to _r, _ro versions of the same tests).

Fix #78462

20 months agoMissing KeepAlives (#78589)
Vladimir Sadov [Sat, 19 Nov 2022 05:03:25 +0000 (21:03 -0800)]
Missing KeepAlives (#78589)

20 months agoFix jmp.il after #78501 (#78582)
Mark Plesko [Sat, 19 Nov 2022 04:25:38 +0000 (20:25 -0800)]
Fix jmp.il after #78501 (#78582)

20 months agoRemove invalidation of whitespace in TryGetNextExtendedAttribute (#78465)
Stephen Toub [Sat, 19 Nov 2022 01:29:52 +0000 (20:29 -0500)]
Remove invalidation of whitespace in TryGetNextExtendedAttribute (#78465)

* Remove invalidation of whitespace in TryGetNextExtendedAttribute

* Add requested test

20 months agoPod Updates November 2022 (#78578)
Eric StJohn [Sat, 19 Nov 2022 00:52:13 +0000 (16:52 -0800)]
Pod Updates November 2022 (#78578)

20 months agoImprove the handling of Create, CreateScalar, and CreateScalarUnsafe for vectors...
Tanner Gooding [Fri, 18 Nov 2022 23:46:51 +0000 (15:46 -0800)]
Improve the handling of Create, CreateScalar, and CreateScalarUnsafe for vectors (#78236)

* Ensure we create GenTreeVecCon nodes where possible

* Expose gtNewSimdCreateScalarNode and gtNewSimdCreateScalarUnsafeNode

* Applying formatting patch

* Remove some unnecessary handling for simd create

* Responding to PR feedback

* Don't use numeric literal separators for C++

* Use simdType not retType

* Ensure the vector constant initialization logic sets the right indices

* Ensure gtNewSimdAbsNode correctly initializes the constant for f32

* Use InsertNewSimdCreateScalarUnsafeNode on Arm64

* Ensure the right stack index is checked for `CreateBroadcast`

* Workaround an issue with -0.0 on x86

* Revert "Remove some unnecessary handling for simd create"

This reverts commit b155fa5263ceb2bfb8ee4ec458abf05b68620e7e.

20 months agoMake sure to check for isUsedFromSpillTemp() before optimizing float comparison in...
Kunal Pathak [Fri, 18 Nov 2022 23:34:09 +0000 (15:34 -0800)]
Make sure to check for isUsedFromSpillTemp() before optimizing float comparison in code gen (#78548)

* Also check for isUsedFromSpillTemp()`

* Use isUsedFromReg() instead

20 months agoDelete temporary instrumentation for #76280 (#78537)
Jan Kotas [Fri, 18 Nov 2022 23:03:25 +0000 (15:03 -0800)]
Delete temporary instrumentation for #76280 (#78537)

Fixes #76280

20 months ago[mono][llvm] Fix usage of implicit pointer types in a few more places, enable for...
Zoltan Varga [Fri, 18 Nov 2022 20:48:12 +0000 (15:48 -0500)]
[mono][llvm] Fix usage of implicit pointer types in a few more places, enable for LLVM 15+. (#76878)

20 months agoImprove Span.Reverse fast path performance (#70944)
Jesper Meyer [Fri, 18 Nov 2022 19:24:59 +0000 (20:24 +0100)]
Improve Span.Reverse fast path performance (#70944)

20 months agoCode quality concerns (#78485)
Aaron Robinson [Fri, 18 Nov 2022 18:28:55 +0000 (10:28 -0800)]
Code quality concerns (#78485)

* Code quality concerns

* Add justification for suppression.

20 months agoRemove `ContextEntry` from assembly binder - store `Assembly` directly (#78533)
Elinor Fung [Fri, 18 Nov 2022 16:41:14 +0000 (08:41 -0800)]
Remove `ContextEntry` from assembly binder - store `Assembly` directly (#78533)

20 months agoFix commit accounting for large pages (#78531)
Andrew Au [Fri, 18 Nov 2022 16:08:52 +0000 (08:08 -0800)]
Fix commit accounting for large pages (#78531)

20 months agoDo not dehydrate data if CFG is enabled (#78546)
Michal Strehovský [Fri, 18 Nov 2022 15:50:31 +0000 (00:50 +0900)]
Do not dehydrate data if CFG is enabled (#78546)

Two reasons:
1. CFG is already bigger because of all the extra checks. It's by design.
2. We might prefer to keep as many things readonly as possible.
3. This way at least some testing will run to ensure we didn't regress the non-dehydrated configuration.

20 months agoFix freebsd cross build with cmake 3.25 (#78534)
Adeel Mujahid [Fri, 18 Nov 2022 15:21:53 +0000 (17:21 +0200)]
Fix freebsd cross build with cmake 3.25 (#78534)

20 months agoAdd support for dehydrated runtime data structures (#77884)
Michal Strehovský [Fri, 18 Nov 2022 07:31:41 +0000 (16:31 +0900)]
Add support for dehydrated runtime data structures (#77884)

This adds support for dehydrating pointer-rich data structures at compile time and rehydrating them at runtime.

NativeAOT compiler generates several pointer-heavy data structures (the worst offender being MethodTable). These data structures get emitted at compile time and used at runtime to e.g. support casting or virtual method dispatch.

We want to be able to generate structures that have pointers in them because e.g. virtual method dispatch needs to be fast and we don't want to be doing extra math to compute destination (just dereference a pointer in the data structure the compiler generated and call it).

But pointers are big, and there's extra metadata the OS needs in the executable file on top of that (2 bytes on Windows, 24 (!!) bytes on Linux/ELF).

This adds support for "dehydrating" the data structures with pointers at compile time (representing pointers more efficiently) and "rehydrating" them at runtime.

The rehydration is quite fast - I'm seeing 2.2 GB/s throughput on my machine. Hello world rehydrates under a millisecond.

The size savings are significant: 7+% on Windows, 30+% on Linux.

20 months agoCall RhNewArray through RuntimeImports (#78529)
Michal Strehovský [Fri, 18 Nov 2022 07:09:37 +0000 (16:09 +0900)]
Call RhNewArray through RuntimeImports (#78529)

RuntimeExports type is not accessible in the split Runtime.Base/System.Private.CoreLib mode (without INPLACE_RUNTIME defined in CoreLib.csproj).

This was the mode we used in .NET Native where Runtime.Base compiled into mrt100_app.dll and not into the app itself.

20 months ago[mono] Unify invoke code with coreclr (#72717)
Vlad Brezae [Fri, 18 Nov 2022 07:00:20 +0000 (09:00 +0200)]
[mono] Unify invoke code with coreclr (#72717)

* [mono] Add icalls to be used by new invoke machinery

* [mono] Fix IsInstanceOfType check

* [mono] Reuse most of the managed invoke path used by coreclr

* [mono] Implement new version of InternalInvoke icall

This version doesn't receive a MonoArray of params as objects, rather a simple array of byrefs. There is also no need for special handling for nullables. The runtime invoke wrapper receives a boxed nullable, this conversion happens in managed code using ReboxFromNullable and ReboxToNullable. This change might have some side effects on other API making use of the runtime invoke wrapper!

* [mono] Throw NRE for a null byref parameter

Behavior was changed recently.

* [tests] Enable reflection invoke tests on mono

* [mono] Avoid loading reflection invoke machinery during startup

Aside from perf optimization, this allows the usage of LocalAppContextSwitches for invoke tests. Before this change, invoke machinery was initialized before the appcontext properties were set, failing to detect ForceInterpretedInvoke and ForceEmitInvoke properties. CoreCLR also hardcodes string type param.

* [mono] Remove nullable handling case

This API already receives a boxed nullable now.

* [mono] Disable inlining into Invoke stubs

CoreCLR achieves this via NextCallReturnAddress. Add another intrinsic to be used for mono.

* [mono] Fix handling of nullables when invoking from debugger

* [mono] Update code for dyn runtime invokes and llvmonly invoke

Remove special handling for nullables and throwing of NullByRefReturnException.

* [mono] Remove old invoke code

Which was still used only by mono_runtime_invoke_array

* [mono] Move invoke code back in object.c

* [mono] Simplify nullable ctor case

Nullable<T> only has 1 param constructor that creates a boxed vtype

* [mono] Extract invoke code to be reused by mono_runtime_invoke_array

* [mono] Add back support for the embedding api

With same behavior as before, except we have to handle conversions between nullable and boxedvt ourserlves, since it is no longer done by the runtime invoke wrapper.

* [mono] Don't trigger ambiguous method exception when having duplicate method overrides

Seems to be possible via reflection, ex System.Reflection.Emit.Tests.MethodBuilderDefineMethodOverride.DefineMethodOverride_CalledTwiceWithSameBodies_Works

* Disable some warnings

* Disable tests on wasm aot since they rely on stacktraces

20 months agoAdd check for interval->writeThru in the assert (#78418)
Kunal Pathak [Fri, 18 Nov 2022 06:07:58 +0000 (22:07 -0800)]
Add check for interval->writeThru in the assert (#78418)

20 months agoPin FreeBSD build image to fix build break (#78526)
Jan Kotas [Fri, 18 Nov 2022 01:00:00 +0000 (17:00 -0800)]
Pin FreeBSD build image to fix build break (#78526)

Fixes #78522

20 months agoCreateSegment events (#78430)
Andrew Au [Fri, 18 Nov 2022 00:28:45 +0000 (16:28 -0800)]
CreateSegment events (#78430)

20 months agoRemove unused argument from IL test entrypoints (#78501)
Mark Plesko [Fri, 18 Nov 2022 00:26:31 +0000 (16:26 -0800)]
Remove unused argument from IL test entrypoints (#78501)

This is the IL version of #78478.

For test merging, program arguments require extra work. Removing any unused program parameters removes noise from that process. This removes them from IL tests. This was done with an ad-hoc tool. I scanned the diffs. Testing will provide basic checks (easy failure if an argument is used). Risk is if an unused argument was required to test the right thing.

Side effect of tool: BOM removed from ilasm/PortablePdb/TestFiles/TestPdbDebugDirectory2.il

20 months agoAdding EVEX encoding support for CV path. (#78044)
DeepakRajendrakumaran [Thu, 17 Nov 2022 23:33:23 +0000 (15:33 -0800)]
Adding EVEX encoding support for CV path. (#78044)

* Adding EVEX encoding support for CV path.

* Add EVEX encoding support for remaining paths.