platform/upstream/dotnet/runtime.git
21 months agoLive apphost issues with NativeExports
Viktor Hofer [Fri, 25 Nov 2022 11:58:38 +0000 (12:58 +0100)]
Live apphost issues with NativeExports

21 months agoClean-up shared CoreLib suppression file
Viktor Hofer [Tue, 22 Nov 2022 20:57:08 +0000 (21:57 +0100)]
Clean-up shared CoreLib suppression file

21 months agoMerge remote-tracking branch 'upstream/main' into Net8ChangesSecondAttempt
Viktor Hofer [Tue, 22 Nov 2022 20:56:53 +0000 (21:56 +0100)]
Merge remote-tracking branch 'upstream/main' into Net8ChangesSecondAttempt

21 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>
21 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`.

21 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

21 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)

21 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

21 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>
21 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.

21 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

21 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>
21 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)

21 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)

21 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.

21 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)

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

21 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)

21 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+

21 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)

21 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)

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

21 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>
21 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

21 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

21 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

21 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)

21 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)

21 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

21 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.

21 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

21 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.

21 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

21 months agoUseLiveAppHost
Viktor Hofer [Mon, 21 Nov 2022 20:03:33 +0000 (21:03 +0100)]
UseLiveAppHost

21 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)

21 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

21 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>
21 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

21 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

21 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

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

21 months agoAdd trimmingTests.props
Viktor Hofer [Mon, 21 Nov 2022 15:48:45 +0000 (16:48 +0100)]
Add trimmingTests.props

21 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

21 months agoMake trimming tests use the live built apphost
Viktor Hofer [Mon, 21 Nov 2022 14:43:02 +0000 (15:43 +0100)]
Make trimming tests use the live built apphost

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

21 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.

21 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

21 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

21 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)

21 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>
21 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%.

21 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.

21 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>
21 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>`

21 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>
21 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)

21 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

21 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)

21 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).

21 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

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

21 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)

21 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

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

21 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.

21 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

21 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

21 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)

21 months agoUpdate ymls
Viktor Hofer [Fri, 18 Nov 2022 20:27:47 +0000 (21:27 +0100)]
Update ymls

21 months agoUpdate 'net7.0' usages in the repo
Viktor Hofer [Fri, 18 Nov 2022 20:24:56 +0000 (21:24 +0100)]
Update 'net7.0' usages in the repo

21 months agoFix libraries build because of ILLink warning
Viktor Hofer [Fri, 18 Nov 2022 20:24:28 +0000 (21:24 +0100)]
Fix libraries build because of ILLink warning

21 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)

21 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.

21 months agoMerge remote-tracking branch 'origin/main' into Net8ChangesSecondAttempt
Viktor Hofer [Fri, 18 Nov 2022 17:15:12 +0000 (18:15 +0100)]
Merge remote-tracking branch 'origin/main' into Net8ChangesSecondAttempt

21 months agoUpdate suppression files for tfm change
Viktor Hofer [Fri, 18 Nov 2022 17:14:45 +0000 (18:14 +0100)]
Update suppression files for tfm change

21 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)

21 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)

21 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.

21 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)

21 months agoSet maximum version early enough for SDK features
Viktor Hofer [Fri, 18 Nov 2022 14:52:37 +0000 (15:52 +0100)]
Set maximum version early enough for SDK features

21 months agoUpdate reference source projects with new tfm
Viktor Hofer [Fri, 18 Nov 2022 14:52:18 +0000 (15:52 +0100)]
Update reference source projects with new tfm

21 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.

21 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.

21 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

21 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)

21 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

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

21 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

21 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.

21 months ago[main] Update dependencies from dotnet/llvm-project dotnet/xharness dotnet/roslyn...
dotnet-maestro[bot] [Thu, 17 Nov 2022 23:10:02 +0000 (18:10 -0500)]
[main] Update dependencies from dotnet/llvm-project dotnet/xharness dotnet/roslyn (#78486)

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

runtime.linux-arm64.Microsoft.NETCore.Runtime.JIT.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.ObjWriter , runtime.osx.11.0-arm64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.osx.11.0-arm64.Microsoft.NETCore.Runtime.ObjWriter , runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.ObjWriter , 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.ObjWriter
 From Version 1.0.0-alpha.1.22561.3 -> To Version 1.0.0-alpha.1.22566.1

* Update dependencies from https://github.com/dotnet/xharness build 20221116.1

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.22558.1 -> To Version 1.0.0-prerelease.22566.1

* Update dependencies from https://github.com/dotnet/roslyn build 20221114.5

Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
 From Version 4.5.0-1.22559.12 -> To Version 4.5.0-1.22564.5

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
21 months agoAdd ability for crossgen2 to synthesize PGO histograms (#77683)
Jakob Botsch Nielsen [Thu, 17 Nov 2022 21:27:53 +0000 (22:27 +0100)]
Add ability for crossgen2 to synthesize PGO histograms (#77683)

Add an option --synthesize-random-mibc. When passed, crossgen2 will use
metadata from the compilation group to synthesize PGO histograms for
methods that did not have any input profile data. Also supported for --embed-pgo-data,
in which case the synthesized PGO data gets embedded.

Adds a synthesizepgo argument to the src/tests/run.cmd/src/tests/run.sh scripts which
enable this mode for compatible tests. So testing can be done locally via:

.\src\tests\build.cmd crossgen2 checked
.\src\tests\run.cmd checked runcrossgen2tests synthesizepgo

21 months agoMove illink documentation to runtime's documentation location (#78520)
Tlakaelel Axayakatl Ceja [Thu, 17 Nov 2022 21:08:29 +0000 (13:08 -0800)]
Move illink documentation to runtime's documentation location (#78520)

Fix links to point to new locations

21 months agoUse forattributename jsgenerator (#78136)
Chris Sienkiewicz [Thu, 17 Nov 2022 19:01:39 +0000 (11:01 -0800)]
Use forattributename jsgenerator (#78136)

* Use ForAttributeWithMetadataName instead of CreateSyntaxProvider

* Remove unused code

* Update export generator too

21 months agoFix the TimeSpan comment about internal representation. (#78364)
Rui Fan [Thu, 17 Nov 2022 17:37:55 +0000 (01:37 +0800)]
Fix the TimeSpan comment about internal representation. (#78364)

21 months ago[mono] Fix support for generic custom attributes. (#78091)
Zoltan Varga [Thu, 17 Nov 2022 17:36:13 +0000 (12:36 -0500)]
[mono] Fix support for generic custom attributes. (#78091)

* [mono] Fix support for generic custom attributes.

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

* Reenable tests.

21 months agoFix fgOptimizeSwitchJumps (#78494)
Bruce Forstall [Thu, 17 Nov 2022 17:10:53 +0000 (09:10 -0800)]
Fix fgOptimizeSwitchJumps (#78494)

This function was corrupting tree links by doing tree modifications
(especially, "stealing" a node from one statement/block to another)
without rethreading the nodes. This happened in a case where a switch
with a dominant (peeled) case (due to PGO info) had a non-trivial
switch condition, leading to inserting a COMMA node.

Fixes #78322

21 months agoRemove some Windows specific formatters (#78434)
Aaron Robinson [Thu, 17 Nov 2022 17:06:12 +0000 (09:06 -0800)]
Remove some Windows specific formatters (#78434)

* Remove remaining Windows printf modifiers

* Remove some uses of %S.

21 months agoRemove unused arguments from C# test Mains (#78478)
Mark Plesko [Thu, 17 Nov 2022 17:01:31 +0000 (09:01 -0800)]
Remove unused arguments from C# test Mains (#78478)

For test merging, program arguments require extra work.  Removing any unused program parameters removes noise from that process.  This removes them from C# 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.

Manually updated the template JIT/Regression/JitBlue/Runtime_64125/Runtime_64125.tt for Runtime_64125.cs

Side effects of tool:

CoreMangLib/system/delegate/miscellaneous/co6010delegateequalstwo.cs converted from UTF16 to UTF8

The following tests had leading bytes (presumably BOM) removed:
- GC/Stress/Tests/DictionaryGrowth.cs
- Interop/PInvoke/SetLastError/SetLastErrorTest.cs
- Interop/PInvoke/SetLastError/SetLastErrorTest.cs
- JIT/IL_Conformance/Convert/TestConvertFromIntegral.cs
- JIT/Intrinsics/BMI1Intrinsics.cs
- JIT/Math/Functions/Program.cs
- JIT/opt/ForwardSub/switchWithSideEffects.cs
- JIT/opt/perf/doublenegate/GitHub_57470.cs
- JIT/opt/perf/doublenegate/doublenegate.cs
- JIT/Regression/JitBlue/GitHub_65690/GitHub_65690.cs
- JIT/Regression/JitBlue/Runtime_45090/Runtime_45090.cs
- JIT/Regression/JitBlue/Runtime_49078/Runtime_49078.cs
- JIT/Regression/JitBlue/Runtime_49780/Runtime_49780.cs
- JIT/Regression/JitBlue/Runtime_51612/Runtime_51612.cs
- JIT/Regression/JitBlue/Runtime_52320/Runtime_52320.cs
- JIT/Regression/JitBlue/Runtime_54647/Runtime_54647.cs
- JIT/Regression/JitBlue/Runtime_62249/Runtime_62249.cs
- JIT/Regression/JitBlue/Runtime_64125/Runtime_64125.cs
- JIT/Regression/JitBlue/Runtime_74773/Runtime_74773.cs

21 months agoJIT: Fix too wide loads on arm64 for small structs (#76341)
Egor Bogatov [Thu, 17 Nov 2022 12:32:52 +0000 (13:32 +0100)]
JIT: Fix too wide loads on arm64 for small structs (#76341)

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
21 months agoRemoving outdated unused r2rdump tests (#78431)
Brian Bohe [Thu, 17 Nov 2022 04:58:45 +0000 (20:58 -0800)]
Removing outdated unused r2rdump tests (#78431)

* Removing outdated unused r2rdump tests

* Remove project file and script

Co-authored-by: Brian Bohe <brianbohe@microsoft.com>
21 months ago[wasm] Jiterpreter cleanup (#78482)
Katelyn Gadd [Thu, 17 Nov 2022 04:24:47 +0000 (20:24 -0800)]
[wasm] Jiterpreter cleanup (#78482)

Expand options.h api with ability to convert current option values to a JSON blob.
Migrate jiterpreter configuration to options.h
Disable jiterpreter automatically after multiple JIT failures