platform/upstream/dotnet/runtime.git
15 months agoInclude TypeNameBuilder.cs from CoreLib instead of copying the file over (#89144)
Buyaa Namnan [Tue, 25 Jul 2023 23:23:47 +0000 (16:23 -0700)]
Include TypeNameBuilder.cs from CoreLib instead of copying the file over (#89144)

15 months agoDelete an unused Span class from object.h (#89464)
SingleAccretion [Tue, 25 Jul 2023 22:40:47 +0000 (01:40 +0300)]
Delete an unused Span class from object.h (#89464)

15 months agoFix failure to generate ngen pdb in crossgen (#89415)
David Wrighton [Tue, 25 Jul 2023 21:30:50 +0000 (14:30 -0700)]
Fix failure to generate ngen pdb in crossgen (#89415)

* Fix issue in R2R compilation where we would compile a method we could not generate a name for
- This is caused by the the type of a parameter having a generic parameter which derived from a type not found in the compilation information
- There are 2 fixes here
  1. Change the logic for computing the set of compilable methods to require that all parameters are loadable
  2. Change the implementation of loadable types to check generic instantiations for loadability
    - This required implementing a stack system to check types for loadability, as loading can require circular references to be resolved.
    - Add a check that the instantiation types of an instantiated generic are loadable.
    - Generic interfaces on arrays work now, so enable the the constraint checking logic.

15 months ago[mono] Disable gsharing when Unsafe.ReadUnaligned/WriteUnaligned () is used with...
Zoltan Varga [Tue, 25 Jul 2023 21:26:43 +0000 (17:26 -0400)]
[mono] Disable gsharing when Unsafe.ReadUnaligned/WriteUnaligned () is used with generic structures. (#89417)

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

For a method like
```
    static void Write<T>(ref byte b, T value) => Unsafe.WriteUnaligned<T>(ref b, value);
```
And an instance ```Write<GStruct<string>>```, generic sharing will create a ```Write<T_INST>```
instance where T_INST is constrained to GStruct<T_REF>. The JIT currently calls
```mini_get_underlying_type ()``` in many places which transform T_INST into GStruct<T_REF>.
This causes problems at runtime in the generic sharing code, which expects to find T_INST.
I.e. ```inflate_info ()``` can inflate ```T_INST``` to ```GStruct<string>```, but it can't inflate
```GStruct<T_REF>``` to ```GStruct<string>```.

As a workaround, disable gsharing in (some) of these cases.

15 months agoAddress unused suppressions (#89216)
Eric StJohn [Tue, 25 Jul 2023 20:31:37 +0000 (13:31 -0700)]
Address unused suppressions (#89216)

* Address unused suppressions

* Remove unnecssary MaybeNullAttribute

* Ensure ApiCompatSuppressionFile is set in outer build

15 months agoAllow multiple kmask registers to be allocated and cleanup some codegen around them...
Tanner Gooding [Tue, 25 Jul 2023 20:14:21 +0000 (13:14 -0700)]
Allow multiple kmask registers to be allocated and cleanup some codegen around them (#89059)

* Allow multiple kmask registers to be allocated and cleanup some codegen around them

* Apply formatting patch

* Fix an assert to include TYP_STRUCT

* Ensure kmask registers aren't in the default killset

* Apply formatting patch

* Move the kmask optimizations up to morph

* Ensure unique VN for ConvertMaskToVector

* Ensure some basic other handling for kmask testing is handled

* Improve the implementation for some managed Vector512 code paths

* Apply formatting patch

* Ensure that the knot intrinsic is inserted into the IR

* Apply formatting patch

* Ensure the conversion of CompareEqualMask(x, zero) to Test(x, x) doesn't happen for floating-point

* Have callee/callerSaveRegs() use an array based lookup

* Respond to PR feedback and try to reduce TP regression more

* Ensure PTEST doesn't try to handle something utilizing embedded broadcast

15 months ago[browser] detect SIMD and EH support (#89387)
Pavel Savara [Tue, 25 Jul 2023 19:04:35 +0000 (21:04 +0200)]
[browser] detect SIMD and EH support (#89387)

Co-authored-by: Ankit Jain <radical@gmail.com>
15 months ago[browser] only trace ExitStatus stack trace if `diagnosticTracing` is true (#89432)
Pavel Savara [Tue, 25 Jul 2023 19:01:23 +0000 (21:01 +0200)]
[browser] only trace ExitStatus stack trace if `diagnosticTracing` is true (#89432)

15 months agoRemove nullable return from ConstructorInvoker.Invoke() (#89448)
Steve Harter [Tue, 25 Jul 2023 18:32:36 +0000 (13:32 -0500)]
Remove nullable return from ConstructorInvoker.Invoke() (#89448)

15 months agoSupport non-ascii in fgVNBasedIntrinsicExpansionForCall_ReadUtf8 (#89383)
Egor Bogatov [Tue, 25 Jul 2023 17:59:52 +0000 (19:59 +0200)]
Support non-ascii in fgVNBasedIntrinsicExpansionForCall_ReadUtf8  (#89383)

15 months agoGet the normal event accessors generated (#89441)
Mike Voorhees [Tue, 25 Jul 2023 17:50:53 +0000 (13:50 -0400)]
Get the normal event accessors generated (#89441)

Because System.Threading.dll was not referenced, this led to Roslyn generating the Delegate.Combine based accessor which does not have any locals.  https://github.com/dotnet/roslyn/blob/520e2f10078ab0e5f85c78fdd95d786d78b9676a/src/Compilers/CSharp/Portable/Compiler/MethodBodySynthesizer.cs#L323-L520

In our UnityLinker test framework we have 2 cases currently.  Mono, which will reference mscorlib.dll, and Roslyn will find `System.Threading.Interlocked.CompareExchange` and use the normal approach.

And currently I have our coreclr tests referencing System.Threading.dll for no great reason.  This is how I stumbled on this.

While this change isn't strictly necessary, I think it's better to have coverage on the `System.Threading.Interlocked.CompareExchange` approach because that's what would normally be generated.  It's also the more complex case for the linker to handle since it has to clear the locals.

15 months agoFixes for outerloop-mono.yml (#88743)
Alexander Köplinger [Tue, 25 Jul 2023 17:39:04 +0000 (19:39 +0200)]
Fixes for outerloop-mono.yml (#88743)

Consolidate configurations and disable failing tests with ActiveIssue.

15 months ago[Mono] UnsafeAccessor: Support ambiguous method match (#89217)
Fan Yang [Tue, 25 Jul 2023 17:25:55 +0000 (13:25 -0400)]
[Mono] UnsafeAccessor: Support ambiguous method match (#89217)

* Support Ambiguous Match

* Stop unsafe accessor method lookup from walking the type hierarchy. And address the review feedback

* Handle the AmbiguousMatchException

* Fix test failure

* Adjust Mono function pointer comparison behavior to match with CoreCLR

* Fix ambiguous match

* Enable Verify_InheritanceMethodResolution

* Remove redundant curly braces

* Address review feedback

15 months agoDisable failing test. (#89442)
Eirik Tsarpalis [Tue, 25 Jul 2023 16:49:48 +0000 (17:49 +0100)]
Disable failing test. (#89442)

15 months agoEnable Mono for using faster invoke stubs (#89108)
Steve Harter [Tue, 25 Jul 2023 15:46:11 +0000 (10:46 -0500)]
Enable Mono for using faster invoke stubs (#89108)

15 months ago[wasm] WBT fixes, and rationalization to allow improved testing (#89360)
Ankit Jain [Tue, 25 Jul 2023 15:32:39 +0000 (11:32 -0400)]
[wasm] WBT fixes, and rationalization to allow improved testing (#89360)

* Move DotNetFileName.cs, and TestUtils.cs to Common

* Move some types from BuildTestBase.cs to separate files

- FileStat
- BuildPaths
- BlazorBuildOptions
- GlobalizationMode

* Move AssertTestMainJsAppBundleOptions.cs to Common

* Instead of globalizationMode=null use GlobalizationMode.Default

* Merge behaviors for the various project types

- Move parsing bootjson, checking icu assets, symbols to ProviderBase, so it can
  be used by all the project types. These come from WasmAppBuilder which
  is shared by all the projects.

- Instead of multiple separate ways to build the project, use one
  `BuildTestBase.BuildWithoutAssert` method that uses `DotNetCommand` to
  build. And all the project types can use this.
  - This allows having any build customizations or fixes to be in once
    place, and the outputs to be consistent.

- Instead of having `UseWebcil` in various option types, use it directly
  as needed, because this setting is *not* changed per test, rather it
  is fixed per run.

- Rationalize figuring out bin framework directories

Known limitations:
- Wasm template tests use a TestMainJs provider to assert the bundle
  because the templates are not yet based on wasm sdk.
- Blazor has a bug due to which all the icu assets get deployed
  irrespective of settings, so asserting that is disabled.
- Also, blazor does not yet support symbols file.

* Update tests to track api changes
* CI: don't trigger jobs when WasmBuild.sln changes

* Address feedback from @ilonatommy
* Address feedback from @ilonatommy - simplify icu assert code

15 months agoAdding test for #80049 (#89399)
Thays Grazia [Tue, 25 Jul 2023 15:21:58 +0000 (12:21 -0300)]
Adding test for #80049 (#89399)

15 months agoRun Antigen/Fuzzlyn on Saturdays too (#89426)
Jakob Botsch Nielsen [Tue, 25 Jul 2023 14:57:51 +0000 (16:57 +0200)]
Run Antigen/Fuzzlyn on Saturdays too (#89426)

Up the frequency of the Antigen and Fuzzlyn runs to also run on
Saturdays during these last weeks of .NET 8 development.

15 months agoFix System.BinaryData tests failing in AOT. (#89381)
Eirik Tsarpalis [Tue, 25 Jul 2023 11:29:56 +0000 (12:29 +0100)]
Fix System.BinaryData tests failing in AOT. (#89381)

15 months ago[NativeAOT] Refactor Linq feature switches (#89308)
Ivan Povazan [Tue, 25 Jul 2023 11:27:31 +0000 (13:27 +0200)]
[NativeAOT] Refactor Linq feature switches (#89308)

15 months agofix NodeJS fetch detection (#89393)
Pavel Savara [Tue, 25 Jul 2023 10:52:49 +0000 (12:52 +0200)]
fix NodeJS fetch detection (#89393)

15 months ago[wasm] Make PackedSimd.Shuffle internal (#89401)
Radek Doulik [Tue, 25 Jul 2023 10:39:31 +0000 (12:39 +0200)]
[wasm] Make PackedSimd.Shuffle internal (#89401)

We don't want it public until we fix the llvm/aot compiler crash

15 months agoBump timeout in runtime-extra-platforms-ioslike.yml (#89400)
Alexander Köplinger [Tue, 25 Jul 2023 09:16:47 +0000 (11:16 +0200)]
Bump timeout in runtime-extra-platforms-ioslike.yml (#89400)

15 months agoRemove InstructionSet_VectorT256 if AVX2 is disabled via env var
Egor Bogatov [Tue, 25 Jul 2023 08:20:10 +0000 (10:20 +0200)]
Remove InstructionSet_VectorT256 if AVX2 is disabled via env var

15 months agoEnable events for LogAlways (#89326)
Nickolas McDonald [Tue, 25 Jul 2023 08:06:07 +0000 (04:06 -0400)]
Enable events for LogAlways (#89326)

15 months agoMake textual stack trace metadata smaller (#89377)
Michal Strehovský [Tue, 25 Jul 2023 04:49:44 +0000 (13:49 +0900)]
Make textual stack trace metadata smaller (#89377)

When we need to generate a textual stack trace in NativeAOT, we rely on two things - reflection metadata for methods, or a supplementary stack trace metadata format.

The reflection metadata case is simple - reflection keeps track of method addresses and the associated metadata like names and signatures. We ask for metadata handles (tokens, basically) and we get the handles back. We then walk the metadata and format textual strings.

When reflection metadata is not available, we have to emit some other metadata in the compiler. We use the same metadata format and conceptually the closest thing were unresolvable `MemberReference`s, so we basically generated a pair of method pointer + MemberReference handle for each method body that doesn't have reflection metadata. It's a lot less metadata than for a resolvable definition, but is still quite a bit wasteful.

This change avoids generating full `MemberReference` and instead inlines owning type/name/signature handle/token into the mapping table. We also do it in a way that avoids emitting owning type/name/signature if it's the same as the record before that.

15 months agoDelete NativeAOT_StaticInitialization (#89291)
Michal Strehovský [Tue, 25 Jul 2023 00:56:24 +0000 (09:56 +0900)]
Delete NativeAOT_StaticInitialization (#89291)

Undoes workaround from dotnet/runtimelab#270. Since bootstrapper no longer ships as a static library (it's an object file instead), we should no longer need this hack to force linker into looking at the archive.

15 months agoFixed python warning: DeprecationWarning: There is no current event loop (#89404)
Will Smith [Tue, 25 Jul 2023 00:17:50 +0000 (17:17 -0700)]
Fixed python warning: DeprecationWarning: There is no current event loop (#89404)

* Fixed python warning: DeprecationWarning: There is no current event loop

* Update superpmi.py

15 months agoDo not show a pop-up dialog when an assertion occurs in SuperPMI collection (#89336)
Will Smith [Mon, 24 Jul 2023 23:41:40 +0000 (16:41 -0700)]
Do not show a pop-up dialog when an assertion occurs in SuperPMI collection (#89336)

15 months agoFix config src-gen issues with binding nullable values (#89397)
Layomi Akinrinade [Mon, 24 Jul 2023 23:18:26 +0000 (16:18 -0700)]
Fix config src-gen issues with binding nullable values (#89397)

15 months ago[browser][mt] Release all proxies of C# and JS objects (#88052)
Pavel Savara [Mon, 24 Jul 2023 20:03:13 +0000 (22:03 +0200)]
[browser][mt] Release all proxies of C# and JS objects (#88052)

15 months agoTweak and fix physical promotion test environments (#89380)
Jakob Botsch Nielsen [Mon, 24 Jul 2023 18:32:52 +0000 (20:32 +0200)]
Tweak and fix physical promotion test environments (#89380)

- Physical promotion is enabled by default now, so switch the scenario to one
  that tests physical promotion without old promotion

- JitStressModeNames was missing from DOTNETVariables, which meant that after
  the switch from JitEnablePhysicalPromotion to JitStressModeNames we stopped
  testing the right thing

15 months agoDisable mock test on aot (#89390)
Natalia Kondratyeva [Mon, 24 Jul 2023 18:20:27 +0000 (19:20 +0100)]
Disable mock test on aot (#89390)

15 months agoDependencyGraphViewer: Feature add same window navigation for NodeForm (#84542)
Mitch Capper (they, them) [Mon, 24 Jul 2023 18:18:35 +0000 (11:18 -0700)]
DependencyGraphViewer: Feature add same window navigation for NodeForm (#84542)

* DependencyGraphViewer: Feature add same window navigation for NodeForm

Add ability to reuse current window rather than open new, added history
(forward/back) and arrow key accelerators as well.

* Fix code formatting

---------

Co-authored-by: David Wrighton <davidwr@microsoft.com>
15 months agoAdded 'DOTNET_JitDisasmTesting' knob. (#89373)
Will Smith [Mon, 24 Jul 2023 17:07:29 +0000 (10:07 -0700)]
Added 'DOTNET_JitDisasmTesting' knob. (#89373)

* Added 'DOTNET_JitDisasmTesting' knob.

* Formatting

15 months agoImplement new streaming APIs for the `System.Net.Http.Json` extensions (#89258)
David Pine [Mon, 24 Jul 2023 16:51:40 +0000 (11:51 -0500)]
Implement new streaming APIs for the `System.Net.Http.Json` extensions (#89258)

* Contributes to #87577

* More updates

* Added unit tests, generated ref, and minor clean up

* Added missing triple slash comments

* Update src/libraries/System.Net.Http.Json/tests/FunctionalTests/HttpClientJsonExtensionsTests.cs

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
* Correct the preprocessor directives, and delegate to JsonTypeInfo overload - per peer feedback.

* Refactor for deferred execution, remove helper methods since they're no longer needed

* Add test to ensure deferred execution semantics, updates from Miha.

* Apply suggestions from code review

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
* Update src/libraries/System.Net.Http.Json/src/System/Net/Http/Json/HttpClientJsonExtensions.Get.AsyncEnumerable.cs

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
* Update test per Miha's feedback

* A few more updates from peer review, Eirik's nits.

* No need for the length limit read stream.

* Add limit per invocation, not element. Share length limit read stream logic.

---------

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
15 months agoMake checks for compiler-generated types more specific (#89327)
Sven Boemer [Mon, 24 Jul 2023 16:29:43 +0000 (09:29 -0700)]
Make checks for compiler-generated types more specific (#89327)

The only types we want to consider for the compiler-generated
state handling are lambda display classes, and state machine
types. We used to treat all types with compiler-generated names
this way, but this was too broad of a filter because it would
include file-scoped classes (which get names like
`<GeneratedConfigurationBinder_g>F86B5F805A26B32373DA5BA80136649730AD5F76CC2979BFEE086BEB55048B927__CoreBindingHelper`,
for the configuration binder source generator).

15 months agoUse JIT intrinsic for UTF8 encoding in Utf8.TryWrite's AppendLiteral (#89376)
Stephen Toub [Mon, 24 Jul 2023 16:23:56 +0000 (12:23 -0400)]
Use JIT intrinsic for UTF8 encoding in Utf8.TryWrite's AppendLiteral (#89376)

* Use JIT intrinsic for UTF8 encoding in Utf8.TryWrite's AppendLiteral

* Remove IsKnownConstant

15 months ago[mono][ios] Drop marshal-ilgen from iOS builds if it is not needed (#88903)
Jan Dupej [Mon, 24 Jul 2023 15:48:12 +0000 (17:48 +0200)]
[mono][ios] Drop marshal-ilgen from iOS builds if it is not needed (#88903)

* MarshallingPInvokeScanner is applied to Apple toolchains.

* HelloiOS example uses simpler string marshaling.

* Removing marshal-ilgen from HelloWorld.

* Runtime components and runtime library paths are now decided in the correct order relative to building the native runtime.

* RuntimeComponents is manipulated through an ItemGroup.

* Cleaned up commented old code.

* Reordered runtime components section.

* Addressed more feedback.

15 months agoLocalized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 222704...
dotnet bot [Mon, 24 Jul 2023 15:14:50 +0000 (17:14 +0200)]
Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2227046 (#89321)

15 months ago[NativeAOT] Replace GVMLookupForSlot internal cache with generic cache similar to...
Vladimir Sadov [Mon, 24 Jul 2023 13:14:23 +0000 (06:14 -0700)]
[NativeAOT] Replace GVMLookupForSlot internal cache with generic cache similar to CastCache (#89331)

* factored out CastCache to be able create several.

* Cache impl

* generic cache

* some refactoring

* separated GenericCache

* comments

* less refs

* do not store hash

* fix CoreCLR and some more refactoring

* PR feedback

* remove no longer needed CastCache wrapping constructor

* remove auto-inserted unused usings.

* remove unused ActivatorCreateInstanceAny

15 months agoBump word-wrap from 1.2.3 to 1.2.4 in /src/mono/sample/wasm/node-webpack (#89198)
dependabot[bot] [Mon, 24 Jul 2023 10:19:13 +0000 (12:19 +0200)]
Bump word-wrap from 1.2.3 to 1.2.4 in /src/mono/sample/wasm/node-webpack (#89198)

15 months agoAvoid BYREF trees in ByteOffset (#89324)
Michał Petryka [Mon, 24 Jul 2023 08:50:31 +0000 (10:50 +0200)]
Avoid BYREF trees in ByteOffset (#89324)

Solves the particular problematic case from #84291.

15 months ago[mono][jit] Enabled more intrinsics for V4 on arm64 (#88912)
Vlad-Alexandru Ionescu [Mon, 24 Jul 2023 08:46:36 +0000 (10:46 +0200)]
[mono][jit] Enabled more intrinsics for V4 on arm64 (#88912)

* Enabled more intrinsics for V4

Signed-off-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-5.local>
---------

Signed-off-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-5.local>
Co-authored-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-5.local>
15 months agoDon't always do optimistic HW intrinsic expansion (#89282)
Michal Strehovský [Mon, 24 Jul 2023 01:54:30 +0000 (10:54 +0900)]
Don't always do optimistic HW intrinsic expansion (#89282)

"Optimistic" expansion means we generate a method body for `IsSupported` that returns true/false depending on the currently running CPU. Don't do this when `--instruction-set:native` was specified because native should mean "exactly this". Also don't do this when optimizing for size (saves 0.6% on hello world). I was going back and forth whether to do this when user specifies instruction sets manually, but decided it would be a "breaking" change.

15 months ago[Mono] [RISCV] Fix abi issues (Monthly pr) (#88649)
VincentWu [Mon, 24 Jul 2023 01:17:07 +0000 (11:17 +1000)]
[Mono] [RISCV] Fix abi issues (Monthly pr) (#88649)

* update makefile

* add format file

* use mul inst instead of emulate mul
process stack size larger than imm32

* emit get_throw_trampoline

* mono_riscv_throw_exception

* fix error of stack trace

* test case

* output inst idiv
fix mono_riscv_emit_branch_exc

* implement mono_arch_get_throw_corlib_exception

* fix rdiv

* move ArgOnStack arg at prologue
lowering OP_XOR_IMM&OP_IXOR_IMM

* fix emit_imm

* test imm

* update test case

* use swich to process return value

* fix unwind inst def_cfa

* fmt

* lowering OP_LMUL_IMM

* make file for webapiclient

* lowerng&output
- OP_FCONV_TO_I8
- OP_LXOR_IMM
- OP_ISHR

* lowerng&output
- relaxed_nop
- float_cle
- long_shl
- OP_ICONV_TO_R_UN
- OP_LCONV_TO_I2
- OP_FBGE
- OP_IDIV_IMM

* fix this_pointer in vcall with valuetype returned
- The ABI specify that If the reture value would have been passed by reference, the caller will allocates memory for the return value, and passes the address as an implicit first parameter.
- The Mono will treat first parameter as this_pointer reference to `mono_vcall_trampoline()`.  They are conflict a bit.

* process param type: ArgVtypeOnStack & ArgVtypeByRef

* lowering OP_LCONV_TO_I2

* OP_IREM_UN_IMM
OP_ATOMIC_LOAD_U1
OP_IREM_UN_IMM

* fix output of OP_IREM & OP_IREM_UN
OP_IREM -> riscv_remw
OP_IREM_UN -> riscv_remuw

* use `lw` to load u4 value on the stack
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#integer-calling-convention

* optmise lw+zext -> lwu

* fix patch_full
use mono_riscv_emit_loadu to emit lwu
fix rem

* fix `mono_arch_build_imt_trampoline` when `item->is_equals==false`

* FIXME: reg got crashed wetween `this` and return ref

* fix `mono_arch_build_imt_trampoline`

* float_sub & float_div

* OP_FNEG,OP_LADD_OVF,OP_FBEQ, OP_COND_EXC_OV

* fix mono_arch_emit_outarg_vt

* process ArgVtypeOnStack in emit_move_args

* add sample status

* fix valid imm check of OP_L.*_IMM

* OP_LCONV_TO_R_UN

* update

* fix the param order stored o stack

* fix the param size of MONO_TYPE_I & MONO_TYPE_U when RV64

* add test task for makefile

* update .clang-format

* fmt

* fix merge

* TMP

* clean pr

* keep  this_pointer always be RISCV_A0

15 months agoJIT: Intrinsify UTF16->UTF8 conversion for string literals (Encoding.UTF8.TryGetBytes...
Egor Bogatov [Sun, 23 Jul 2023 21:45:14 +0000 (23:45 +0200)]
JIT: Intrinsify UTF16->UTF8 conversion for string literals (Encoding.UTF8.TryGetBytes) (#85328)

Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
15 months agoFix potential BitCast bug for platforms without unaligned reads (#89364)
Michał Petryka [Sun, 23 Jul 2023 18:20:38 +0000 (20:20 +0200)]
Fix potential BitCast bug for platforms without unaligned reads (#89364)

BitCast could potentially make an invalid read when reinterpreting a type to another that requires higher alignment, which could possibly cause a fault on Mono ARMv6.

15 months agoFix EventPipe utf8 conversion methods to match between JIT and AOT (#89353)
Jan Kotas [Sun, 23 Jul 2023 16:27:36 +0000 (09:27 -0700)]
Fix EventPipe utf8 conversion methods to match between JIT and AOT (#89353)

15 months agoIntrinsify Unsafe.Read/Write/Copy, handle struct BitCast (#85562)
Michał Petryka [Sun, 23 Jul 2023 14:51:47 +0000 (16:51 +0200)]
Intrinsify Unsafe.Read/Write/Copy, handle struct BitCast (#85562)

Co-authored-by: Egor Bogatov <egorbo@gmail.com>
15 months agoUnify hardware feature detection between CoreCLR JIT and AOT (#89342)
Jan Kotas [Sun, 23 Jul 2023 04:13:29 +0000 (21:13 -0700)]
Unify hardware feature detection between CoreCLR JIT and AOT (#89342)

Follow up on #87865

15 months agoProperly close PKCS12 files when enumerating stores
Kevin Jones [Sun, 23 Jul 2023 03:42:40 +0000 (23:42 -0400)]
Properly close PKCS12 files when enumerating stores

15 months agoUpdate PAL and GC `BitScanForward` to use `__builtin_clz` (#89350)
Andy Ayers [Sat, 22 Jul 2023 22:20:55 +0000 (15:20 -0700)]
Update PAL and GC `BitScanForward` to use `__builtin_clz` (#89350)

The existing PAL code was using `__builtin_clzl` which is intended for platforms
where `long` is 64 bits. Instead use `__builtin_clz`.

The GC version had a similar issue so I've changed that too. The JIT version
was already using `__builtin_clz`.

Fixes #89340.

15 months agoSet BaseSize of interfaces to 0 (#89343)
Michal Strehovský [Sat, 22 Jul 2023 12:54:19 +0000 (21:54 +0900)]
Set BaseSize of interfaces to 0 (#89343)

We were computing these as the minimum object size. This number is meaningless because they don't get allocated on the GC heap. A zero compresses better. Surprisingly saves like 0.1% on Hello World despite being such an insignificant thing.

15 months agoFix exe size for Mach-O files (#89325)
Andy Gocke [Sat, 22 Jul 2023 06:44:11 +0000 (23:44 -0700)]
Fix exe size for Mach-O files (#89325)

The extra size appears to be the export list, which is zeroed
but not removed when the file is stripped. Exes shouldn't have
any exported symbols by default, but ld will include everything
by default. We'll fix it up using an ld flag.

Fixes #86707

15 months agoRemove incorrect flag setting (#88878)
Michal Strehovský [Sat, 22 Jul 2023 06:19:11 +0000 (15:19 +0900)]
Remove incorrect flag setting (#88878)

This was added in https://github.com/dotnet/runtime/pull/85743#discussion_r1215117945. Setting this flag is not the right thing to do. It sweeps issues under the carpet. Also, we're only doing it for signature type variables, not method variable. And since no tests seem to be failing, it might not even be necessary.

15 months agoFix TestGenericAddStaticField (#89145)
mikelle-rogers [Fri, 21 Jul 2023 21:39:12 +0000 (14:39 -0700)]
Fix TestGenericAddStaticField (#89145)

* Fix TestGenericAddStaticField

* use the correct Method Table to gather fields

15 months agoUpstream some changes to portable allocation helpers (#89269)
SingleAccretion [Fri, 21 Jul 2023 20:53:06 +0000 (23:53 +0300)]
Upstream some changes to portable allocation helpers (#89269)

15 months ago[RISC-V][JIT] Fix NaN canonicalization issue (#88510)
Dong-Heon Jung [Fri, 21 Jul 2023 20:31:35 +0000 (05:31 +0900)]
[RISC-V][JIT] Fix NaN canonicalization issue (#88510)

* [RISC-V][JIT] Fix canonical NaN issue

* [RISC-V][JIT] Update to use helpers

* [RISC-V][JIT] Update conversion functions

* [RISC-V][JIT] Update

15 months agoBlock inlining of IntroSort (#89310)
Andy Ayers [Fri, 21 Jul 2023 20:06:10 +0000 (13:06 -0700)]
Block inlining of IntroSort (#89310)

With PGO and (via #88749) one level of recursive inlining enabled, the jit sees
the recursive call made by `IntroSort` as an attractive inline candidate,
but it isn't.

Fixes #89106.

15 months agoJIT: Fix handling of filter successors (#89275)
Jakob Botsch Nielsen [Fri, 21 Jul 2023 20:04:58 +0000 (22:04 +0200)]
JIT: Fix handling of filter successors (#89275)

Filters are run during the first pass of EH which makes determining
their successors complicated, and the JIT did not get this right.  In
particular, after running filters as part of first-pass EH, control may
flow to any enclosed finally or fault handler as part of second-pass EH.
Thus, these should be considered as EH successors. This adds a
BasicBlock::VisitEHSecondPassSuccs to visit these successors.

The logic was mostly extracted from liveness that (almost) got it right:
there was a condition that meant the logic did not run for top-level
try-filter clauses. This change folds in Bruce's change to fix this
scenario as well.

There was one more bug in the logic in liveness: to determine the
enclosed fault/finally blocks, the logic iterates backwards in the EH
table while looking for enclosed clauses. However, this was only
checking for clauses enclosed in the try region when it should also
check for clauses enclosed in the handler region.

Fix #86538
Fix #88168

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
15 months agoCopy tool build fix from performance repo to runtime repo. (#89323)
Parker Bibus [Fri, 21 Jul 2023 19:46:37 +0000 (12:46 -0700)]
Copy tool build fix from performance repo to runtime repo. (#89323)

This doesn't include any changes to non-runtime-perf infra and changes have been tested in the performance pipeline, merging.

15 months agoRemove etw --exclude-feature tests. (#89107)
Mike Voorhees [Fri, 21 Jul 2023 19:04:23 +0000 (15:04 -0400)]
Remove etw --exclude-feature tests. (#89107)

`--exclude-feature` logic was removed.  If there is no intent to support this with coreclr bcl then we won't worry about it either.

While we do need UnityLinker to continue to handle mono class libraries for awhile longer, the `--exclude-feature` functionality is a niche thing we can drop now.

15 months agoUse utf conversions from minipal (#89036)
Lakshan Fernando [Fri, 21 Jul 2023 18:46:14 +0000 (11:46 -0700)]
Use utf conversions from minipal (#89036)

* Support for utf conversion

* cast fix

* FB

* FB

* Update src/coreclr/nativeaot/Runtime/eventpipe/ep-rt-aot.h

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Apply suggestions from code review

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* FB

* FB

* FB

---------

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
15 months agoEmit a diagnostic when attributes deriving from JsonConverterAttribute are being...
Eirik Tsarpalis [Fri, 21 Jul 2023 16:23:44 +0000 (17:23 +0100)]
Emit a diagnostic when attributes deriving from JsonConverterAttribute are being used. (#89199)

* Emit a diagnostic when attributes deriving from JsonConverterAttribute are being used.

* Address feedback.

15 months agoFix System.Net.Http.Json tests in AOT (#89307)
Eirik Tsarpalis [Fri, 21 Jul 2023 16:21:47 +0000 (17:21 +0100)]
Fix System.Net.Http.Json tests in AOT (#89307)

15 months agoMove full facade assemblies into src/libraries/shims (#89184)
Viktor Hofer [Fri, 21 Jul 2023 15:58:42 +0000 (17:58 +0200)]
Move full facade assemblies into src/libraries/shims (#89184)

* Move full facade assemblies into src/libraries/shims

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

1. Move all full facade assemblies (which only contain type forwards)
   into src/libraries/shims.
2. Merge assemblies (ref+src) which typeforward to the same
   destination.
3. They inherently now don't produce a documentation file anymore (as
   shims only contain type forwards).

This minimizes the build graph (makes the libs build faster) and moves
the focus away from full facade assemblies that need to be kept for
compat reasons.

* Trigger CI for all legs

* Remove obsolete slns and undo CI change

* PR feedback from Eric

* Change System.ValueTuple type fowrard dest

* Collapse ref and src shims further

As discussed with Eric offline, typeforwarding to System.Runtime and
System.Xml.ReaderWriter makes it possible to collapse the following
ref and src projects into just src:

System.AppContext
System.Buffers
System.Diagnostics.Debug
System.Diagnostics.Tools
System.Globalization
System.Globalization.Calendars
System.IO.UnmanagedMemoryStream
System.Reflection
System.Resources.ResourceManager
System.Runtime.CompilerServices.Unsafe
System.Runtime.Extensions
System.Security.Principal
System.Text.Encoding
System.Threading.Timer
System.Xml.XmlDocument

The destination then handles the type fowarding to the private assembly
implementation.

15 months ago[mono][tests] Parallel AOT compilation of runtime tests on iOS platforms (#86089)
Milos Kotlar [Fri, 21 Jul 2023 15:56:47 +0000 (17:56 +0200)]
[mono][tests] Parallel AOT compilation of runtime tests on iOS platforms  (#86089)

The Helix payload is generated using the runtime pipeline. Then, the libraries pipeline is utilized to AOT compile and execute the tests on Helix. The build-runtime-tests-and-send-to-helix.yml is updated with the compileOnHelix parameter, which if set, uses the libraries/helix.yml template instead of the runtime send-to-helix-step.yml template. The runtime and libraries pipelines are updated to support AOT compilation of runtime tests on Helix.

15 months agoVectorize Enumerable.Range initialization, take 2 (#87992)
neon-sunset [Fri, 21 Jul 2023 15:10:47 +0000 (18:10 +0300)]
Vectorize Enumerable.Range initialization, take 2 (#87992)

* Vectorize Enumerable.Range initialization

* Address PR feedback

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
15 months agoOptimize MemoryMarshal.ToEnumerable for arrays and strings (#89274)
Stephen Toub [Fri, 21 Jul 2023 13:32:48 +0000 (09:32 -0400)]
Optimize MemoryMarshal.ToEnumerable for arrays and strings (#89274)

15 months ago[wasm] Add index of string span measurement (#89294)
Radek Doulik [Fri, 21 Jul 2023 13:26:09 +0000 (15:26 +0200)]
[wasm] Add index of string span measurement (#89294)

15 months agoRemove feature exclude xml tests (#89111)
Mike Voorhees [Fri, 21 Jul 2023 12:22:03 +0000 (08:22 -0400)]
Remove feature exclude xml tests (#89111)

illink dropped the exclude feature functionality, so will we.

I believe Unity was the last user of these tests so it's safe to delete them now.

15 months ago[RISC-V] Fix GetArgLoc (#88657)
t-mustafin [Fri, 21 Jul 2023 11:04:50 +0000 (14:04 +0300)]
[RISC-V] Fix GetArgLoc (#88657)

15 months agoUse RegDeleteTree in RegistryKey.DeleteSubKeyTree (#82598)
Huo Yaoyuan [Fri, 21 Jul 2023 09:12:59 +0000 (17:12 +0800)]
Use RegDeleteTree in RegistryKey.DeleteSubKeyTree (#82598)

* Use RegDeleteTree in RegistryKey.DeleteSubKeyTree

* Restore self delete behavior

* Call RegDeleteTree on subkey to simulate permission behavior.

* Adjust comment and add tests.

15 months agoVirt call unsafe accessor tests (#89220)
Aaron Robinson [Fri, 21 Jul 2023 02:13:24 +0000 (19:13 -0700)]
Virt call unsafe accessor tests (#89220)

* UnsafeAccessors are limited to lookup on
the defined typed.

* Update documentation for attribute.

---------

Co-authored-by: vitek-karas <10670590+vitek-karas@users.noreply.github.com>
16 months agoAdd HttpMethod.Parse (#89270)
Stephen Toub [Thu, 20 Jul 2023 21:47:50 +0000 (17:47 -0400)]
Add HttpMethod.Parse (#89270)

16 months agoJIT: Cache memory dependencies for VN map selects (#89241)
Jakob Botsch Nielsen [Thu, 20 Jul 2023 21:04:37 +0000 (23:04 +0200)]
JIT: Cache memory dependencies for VN map selects (#89241)

Hoisting relies on being able to look at which memory dependencies a
candidate is dependent upon. VN tracks these during the map select
logic; however, it fails to do so when the map selection hits the cache.
This changes the logic to make sure the memory dependencies are cached.

Fix #75442

16 months agoJIT: Expand inlined delegate calls in correct order (#89175)
Jakob Botsch Nielsen [Thu, 20 Jul 2023 20:29:46 +0000 (22:29 +0200)]
JIT: Expand inlined delegate calls in correct order (#89175)

The access of the target instance was incorrectly inserted right after
the location of the delegate instance. Since this indirection can throw
a NRE this is incorrect; to get the proper inlined behavior, the
indirection must happen only after all arguments have been evaluated.

Fix #75832

16 months agoFire AssemblyUnloadStarted event (#87890)
Eduardo Velarde [Thu, 20 Jul 2023 20:08:02 +0000 (13:08 -0700)]
Fire AssemblyUnloadStarted event (#87890)

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

AssemblyUnloadStarted event is now being fired

16 months ago[main] Update dependencies from dotnet/arcade dotnet/xharness (#89235)
dotnet-maestro[bot] [Thu, 20 Jul 2023 20:00:12 +0000 (15:00 -0500)]
[main] Update dependencies from dotnet/arcade dotnet/xharness (#89235)

* Update dependencies from https://github.com/dotnet/arcade build 20230719.2

Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions
 From Version 8.0.0-beta.23364.2 -> To Version 8.0.0-beta.23369.2

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23360.1 -> To Version 1.0.0-beta.23368.1 (parent: Microsoft.DotNet.Arcade.Sdk

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

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 8.0.0-prerelease.23363.3 -> To Version 8.0.0-prerelease.23370.1

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
16 months ago[mono][interp] Add lock when allocating from method mempool (#89231)
Vlad Brezae [Thu, 20 Jul 2023 18:02:40 +0000 (21:02 +0300)]
[mono][interp] Add lock when allocating from method mempool (#89231)

MonoMemPool does not support multithreaded allocation. We lock on default jit_mm lock for convenience, since it is widely used in interpreter. We might want to consider using a separate lock.

16 months agoWorkaround a C++/CLI bug involving DIMs (#89253)
Tanner Gooding [Thu, 20 Jul 2023 17:24:11 +0000 (10:24 -0700)]
Workaround a C++/CLI bug involving DIMs (#89253)

16 months agoFilter list of candidate invocations for parsing in binding generator (#89226)
Layomi Akinrinade [Thu, 20 Jul 2023 17:13:51 +0000 (10:13 -0700)]
Filter list of candidate invocations for parsing in binding generator (#89226)

16 months ago[JIT] Fix - Do not remove `CAST` nodes on store if the `LCL_VAR` is a parameter or...
Will Smith [Thu, 20 Jul 2023 16:22:37 +0000 (09:22 -0700)]
[JIT] Fix - Do not remove `CAST` nodes on store if the `LCL_VAR` is a parameter or struct field (#85734)

* Do not remove CAST nodes on assignment if the LCL_VAR is a parameter.

* Added NormalizeOnLoad rules from SingleAccretion. Added description of why we cannot remove CAST nodes from parameters.

* Remove morph optimization for NormalizeOnLoad in fgMorphLocalVar. Update test.

* Do not OptimizeCastOnStore for params and struct fields

* Update src/coreclr/jit/morph.cpp

Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
* Formatting

---------

Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
16 months ago[PERF] Finish fixing PerfBDNApp, continuation of #89057 (#89135)
Parker Bibus [Thu, 20 Jul 2023 16:12:05 +0000 (09:12 -0700)]
[PERF] Finish fixing PerfBDNApp, continuation of #89057 (#89135)

Move performance repo clone to before the csproj update and pull out the BDNVersion value from the performance Versions.props.

16 months agoEnable CLS Compliance on Diagnostics Libraries (#89214)
Tarek Mahmoud Sayed [Thu, 20 Jul 2023 15:53:48 +0000 (08:53 -0700)]
Enable CLS Compliance on Diagnostics Libraries (#89214)

16 months agoBump main version to RC1 (#89151)
Carlos Sánchez López [Thu, 20 Jul 2023 15:12:37 +0000 (08:12 -0700)]
Bump main version to RC1 (#89151)

16 months agoRemove more duplicate assets from NativeAOT runtime pack build (#89239)
Alexander Köplinger [Thu, 20 Jul 2023 15:08:12 +0000 (17:08 +0200)]
Remove more duplicate assets from NativeAOT runtime pack build (#89239)

16 months agoFix service accessor scope validation for the emit-based version
Pavel Ivanov [Thu, 20 Jul 2023 13:57:55 +0000 (18:57 +0500)]
Fix service accessor scope validation for the emit-based version

16 months agoFix incorrect nativeaot event thread / sequence number on shutdown (#88941)
Elinor Fung [Thu, 20 Jul 2023 13:44:01 +0000 (06:44 -0700)]
Fix incorrect nativeaot event thread / sequence number on shutdown (#88941)

16 months agoSBLK_MASK_LOCK_THREADID allow tid up to 65535 (#88772)
DIcKeNs [Thu, 20 Jul 2023 13:31:12 +0000 (21:31 +0800)]
SBLK_MASK_LOCK_THREADID allow tid up to 65535 (#88772)

* SBLK_MASK_LOCK_THREADID allow tid up to 65535

* copy comment from NativeAOT ObjectHeader.cs

---------

Co-authored-by: dickens <dickens.tam@pulsartradingcap.com>
16 months agoBroaden use of SearchValues in TryFindNextPossibleStartingPosition in Regex (#89205)
Stephen Toub [Thu, 20 Jul 2023 13:23:23 +0000 (09:23 -0400)]
Broaden use of SearchValues in TryFindNextPossibleStartingPosition in Regex (#89205)

SearchValues has been updated to have an ASCII fast-path for inputs that are not only ASCII.  This means we can simplify TryFindNextPossibleStartingPosition in Regex to not track AsciiSet specially and instead just increase the number of characters we query the set for (from 5 to 128).  That way, we'll use SearchValues rather than emitting our own helper up until a (semi-arbitrary) point where we deem it impossible or infeasible to enumerate all the chars that make up the set.

16 months ago[AndroidAppBuilder] add missing includes to template (#89197)
Aleksey Kliger (λgeek) [Thu, 20 Jul 2023 13:03:51 +0000 (09:03 -0400)]
[AndroidAppBuilder] add missing includes to template (#89197)

* [AndroidAppBuilder] add missing includes to template

Treat missing protoype warnings as errors so this doesn't happen again.

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

* also fixup library mode template

16 months ago[browser] Allow download retry+throttling in unified code with Blazor (#88910)
Marek Fišera [Thu, 20 Jul 2023 12:51:07 +0000 (14:51 +0200)]
[browser] Allow download retry+throttling in unified code with Blazor (#88910)

16 months agoAdd support for `--instruction-set:native` (#87865)
Michal Strehovský [Thu, 20 Jul 2023 08:15:02 +0000 (17:15 +0900)]
Add support for `--instruction-set:native` (#87865)

This allows compiling for the ISA extensions that the currently running CPU supports.

16 months agoReduce ProbabilisticWithAsciiCharSearchValues overhead on non-ASCII texts (#89224)
Miha Zupan [Thu, 20 Jul 2023 03:01:07 +0000 (05:01 +0200)]
Reduce ProbabilisticWithAsciiCharSearchValues overhead on non-ASCII texts (#89224)

16 months agoPoint ActiveIssues to moved issues (#89158)
Michal Strehovský [Thu, 20 Jul 2023 00:49:49 +0000 (09:49 +0900)]
Point ActiveIssues to moved issues (#89158)

We moved some issues from runtimelab to runtime. Re-point the tests to those.

16 months agoAdd more tests for complex dict element binding by generator (#89210)
Layomi Akinrinade [Thu, 20 Jul 2023 00:26:18 +0000 (17:26 -0700)]
Add more tests for complex dict element binding by generator (#89210)

16 months agoUpdate UserTypeMarshallingV2.md (#89222)
Jeremy Koritzinsky [Wed, 19 Jul 2023 23:49:40 +0000 (16:49 -0700)]
Update UserTypeMarshallingV2.md (#89222)

16 months agoFix the default behavior to trim the RCW interop by default (#89128)
Jeremy Koritzinsky [Wed, 19 Jul 2023 22:59:34 +0000 (15:59 -0700)]
Fix the default behavior to trim the RCW interop by default (#89128)