platform/upstream/dotnet/runtime.git
19 months agoChange RunningPublish property name to _IsPublishing (#79483)
Andy Gocke [Wed, 14 Dec 2022 12:01:27 +0000 (04:01 -0800)]
Change RunningPublish property name to _IsPublishing (#79483)

The crossgen publish capability currently uses a RunningPublish property
to signal that certain settings should be enabled. The SDK now provides a
property that serves the same purpose called '_IsPublishing'. By using the
SDK property, the right publish behavior will automatically happen if a user
runs 'dotnet publish' on the crossgen2 project.

19 months agoCreate Microsoft.NET.ILLink.Tasks package (#79609)
Viktor Hofer [Wed, 14 Dec 2022 11:55:15 +0000 (12:55 +0100)]
Create Microsoft.NET.ILLink.Tasks package (#79609)

* Create Microsoft.NET.ILLink.Tasks package

* Infrastructure support and repo clean-up

19 months agoLocalized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 206700...
dotnet bot [Wed, 14 Dec 2022 09:46:59 +0000 (01:46 -0800)]
Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2067005 (#79632)

19 months agoAdd kunalspathak mentionee for codegen-coreclr (#79635)
Kunal Pathak [Wed, 14 Dec 2022 09:15:14 +0000 (01:15 -0800)]
Add kunalspathak mentionee for codegen-coreclr (#79635)

19 months agoUse non-generic Array.Sort in EnumInfo on nativeaot (#79473)
Stephen Toub [Wed, 14 Dec 2022 07:00:38 +0000 (02:00 -0500)]
Use non-generic Array.Sort in EnumInfo on nativeaot (#79473)

* Use non-generic Array.Sort in EnumInfo on nativeaot

* Non-generic sort

* Update src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/NativeFormatEnumInfo.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
19 months agoAlways set `addlDelta` to zero on x86 (#79467)
SingleAccretion [Wed, 14 Dec 2022 00:26:48 +0000 (03:26 +0300)]
Always set `addlDelta` to zero on x86 (#79467)

* Always set "addlDelta" to zero on x86

The value is used to compensate for the additional instruction bytes,
which should only be relevant for RIP-relative addressing, while x86
uses absolute addressing.

* Re-enable the test

19 months ago[wasm] Disable running blazor template projects (#79536)
Ankit Jain [Tue, 13 Dec 2022 23:04:15 +0000 (18:04 -0500)]
[wasm] Disable running blazor template projects (#79536)

* [wasm] Print browser console messages to the test output to catch blazor issues

* WBT: Remove unused AppRefDir arguments

* Re-enable the tests without the blazor-run parts

* fix build

19 months agoFix ordering of checks in AppendInterpolatedStringHandler.AppendFormatted (#79539)
Stephen Toub [Tue, 13 Dec 2022 22:51:17 +0000 (17:51 -0500)]
Fix ordering of checks in AppendInterpolatedStringHandler.AppendFormatted (#79539)

We want to check for IsEnum first to avoid boxing the enum via ISpanFormattable.TryFormat.  This just swaps the two blocks.

19 months agoImplement DynamicMethod.RTDynamicMethod.CreateDelegate. (#79427)
madelson [Tue, 13 Dec 2022 21:04:56 +0000 (16:04 -0500)]
Implement DynamicMethod.RTDynamicMethod.CreateDelegate. (#79427)

* Implement DynamicMethod.RTDynamicMethod.CreateDelegate.

The implementation simply calls back to DynamicMethod.CreateDelegate.

fix #78365

* Refactor DynamicMethod to remove RTDynamicMethod.

See https://github.com/dotnet/runtime/pull/79427/files#r1044093019

* Remove redundant mono method

19 months agoTake EventListener.EventListenersLock in EventPipeEventDispatcher.SendCommand (#79185)
David Mason [Tue, 13 Dec 2022 21:01:28 +0000 (13:01 -0800)]
Take EventListener.EventListenersLock in EventPipeEventDispatcher.SendCommand (#79185)

19 months agoUse ReferencePathWithRefAssemblies for libs ILLink (#79595)
Viktor Hofer [Tue, 13 Dec 2022 18:54:23 +0000 (19:54 +0100)]
Use ReferencePathWithRefAssemblies for libs ILLink (#79595)

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

The libraries build invokes ILLink to perform "library" mode trimming. The libraries build step is expected to be runtime agnostic and shouldn't bind against a specific CoreLib runtime implementation.

During compilation, even though we have a ProjectReference pointing to the CoreLib/src project, we build against CoreLib/ref. But that ILLink invocation doesn't honor that as it uses the ReferencePath msbuild item instead of ReferencePathWithRefAssemblies.

19 months agosupport server ALPN on macOS (#79434)
Tomas Weinfurt [Tue, 13 Dec 2022 18:25:16 +0000 (10:25 -0800)]
support server ALPN on macOS (#79434)

* support server ALPN on macOS

* reset status

19 months agoFix memory leaks reported by static analyzer (#78492)
ws77.cho [Tue, 13 Dec 2022 16:26:35 +0000 (01:26 +0900)]
Fix memory leaks reported by static analyzer (#78492)

19 months agodo not free method name (#79608)
Pavel Savara [Tue, 13 Dec 2022 15:21:55 +0000 (16:21 +0100)]
do not free method name (#79608)

19 months agoFix mcs -dumpMap (#79571)
Jakob Botsch Nielsen [Tue, 13 Dec 2022 14:39:04 +0000 (15:39 +0100)]
Fix mcs -dumpMap (#79571)

This needs to be in sync with how printing in the JIT works to ensure
that we don't ask for data that the JIT did not make available.

Fix #79568

19 months agoFix #79556. (#79562)
Eirik Tsarpalis [Tue, 13 Dec 2022 14:38:01 +0000 (16:38 +0200)]
Fix #79556. (#79562)

19 months ago[wasm] Add few Span and String measurements (#79566)
Radek Doulik [Tue, 13 Dec 2022 14:21:24 +0000 (15:21 +0100)]
[wasm] Add few Span and String measurements (#79566)

Measure Span<T> SequenceEqual for bytes and chars
Measure string.Normalize for ASCII and non-ASCII

19 months ago[wasm] Let browser-bench post bootstrap flag (#79573)
Radek Doulik [Tue, 13 Dec 2022 14:17:47 +0000 (15:17 +0100)]
[wasm] Let browser-bench post bootstrap flag (#79573)

This helps our perf measurements infrastructure to detect successful
bootstrap of the bench run

19 months agoConsole.Unix: don't calculate cached cursor position from the last column. (#78466)
Tom Deseyn [Tue, 13 Dec 2022 13:36:02 +0000 (14:36 +0100)]
Console.Unix: don't calculate cached cursor position from the last column. (#78466)

After printing in the last column, setting CursorLeft is expected to
place the cursor back in that same row.

19 months ago[mono] Fix passing of NULL via mono_runtime_invoke to method expecting nullable ...
Vlad Brezae [Tue, 13 Dec 2022 13:17:29 +0000 (15:17 +0200)]
[mono] Fix passing of NULL via mono_runtime_invoke to method expecting nullable (#79597)

The code was always trying to unbox the boxed vt, not accounting for NULL.

19 months agoHandle RSA zero modulus for Android
Kevin Jones [Tue, 13 Dec 2022 12:50:54 +0000 (07:50 -0500)]
Handle RSA zero modulus for Android

19 months agoDon't require singlefilehost in host.native (#79565)
Andy Gocke [Tue, 13 Dec 2022 12:03:32 +0000 (04:03 -0800)]
Don't require singlefilehost in host.native (#79565)

* Don't require singlefilehost in host.native

The corehost project currently tries to build the singlefilehost with
the embedded DAC, which we can skip if we never built the
singlefilehost in the first place.

* Update corehost.proj

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
19 months ago[mono][interp] Fix some issues that are hit in tests when we tier up methods immediat...
Vlad Brezae [Tue, 13 Dec 2022 08:57:50 +0000 (10:57 +0200)]
[mono][interp] Fix some issues that are hit in tests when we tier up methods immediately (#79564)

* [mono][interp] Fix difference in behavior between tiered and untiered compilation

We were trying to get the vtable only in the tiered compilation case.

* Disable test that hits known interpreter limitation

19 months agoCondition some NamedPipe tests on COM support (#79578)
Michal Strehovský [Tue, 13 Dec 2022 08:26:55 +0000 (17:26 +0900)]
Condition some NamedPipe tests on COM support (#79578)

Fixes #79180.

19 months agoAdding new ReadyToRun helper for static cctor (#76898)
Brian Bohe [Tue, 13 Dec 2022 05:38:37 +0000 (00:38 -0500)]
Adding new ReadyToRun helper for static cctor (#76898)

* Adding new ReadyToRun helper for static cctor

When accessing a static field the static cctor of the class is
called. Then the helper CORINFO_HELP_READYTORUN_STATIC_BASE
was printed twice during the same block, the first for the cctor
and the second for the getter, as if they were two calls for the
same method.

* Removing helper CORINFO_HELP_STRCNS_CURRENT_MODULE

* Removing CORINFO_HELP_STRCNS_CURRENT_MODULE

* Changing TYP_BYREF to TYP_VOID

* Formatting files

* Splitting up R2R STATIC_BASE in more helpers

* Updating STATIC_BASE R2R helper with new helpers

* Extending getReadyToRunHelper support

Consider the new R2R helpers that were group in
CORINFO_HELP_READYTORUN_STATIC_BASE.

* Keeping the preffered R2R helper constructor

In some cases the R2R helpers already call to the
constructor. In those cases we can insert a repeated
call that will be eliminated by CSE. There are still
cases in which we may need to call the constructor.

* Extending value numbering with new helpers

* Renaming helper

* Replacing STATIC_BASE helper in ilc for NON_GC

* Fixing helper order

* Refactoring code

* Supporting R2R_STATIC_BASE helper in nativeaot

* Moving compiler var initialization to compCompile

* Using new helper names in ILC

* Encapsulating common method

* Removing CORINFO_HELP_READYTORUN_STATIC_BASE helper

* Removing comment

* Moving new helper function to shared code

* Setting undef helper as default

* Repeating same helper call for CSE optimization

Avoid hardcoding the Non-GC helper call, which is used just to
trigger the constructor if it is needed, and use the existing
helper call in the code, so CSE would persist only one.

* Update src/coreclr/jit/compiler.cpp

Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
* Update src/coreclr/tools/Common/Compiler/DependencyAnalysis/CorInfoHelpers.cs

Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
* Update src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
* Update src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
* Formatting jithelpers.h

* Renaming function

* Moving CorInfoHelper function to R2R/AOT interface

* Updating preferred helper when is not thread type

* Removing some helper value nums

Static base helper was removed and cctor returns
void.

* Formatting file

* Ensuring void return when the helper is cctor

* Updating preferred helper when when classes matches

* Removing cctor trigger helper from aot,vm and jit

* Updating m_prefferedInitCctor default value

It is initialized with CORINFO_HELP_UNDEF and set to R2R GC or NON
GC Static Base later.

* Updating comments

* Updating comments

Co-authored-by: Brian Bohe <brianbohe@microsoft.com>
Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
19 months agoFix versions of the .NET 8 ILC package (#79497)
Andrii Kurdiumov [Tue, 13 Dec 2022 04:25:01 +0000 (10:25 +0600)]
Fix versions of the .NET 8 ILC package (#79497)

* Fix versions of the .NET 8 ILC package

* Apply suggestions from code review

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
19 months agoPreparation for JIT\Regression test merging - assembly/file renames (#79489)
Mark Plesko [Tue, 13 Dec 2022 02:17:54 +0000 (18:17 -0800)]
Preparation for JIT\Regression test merging - assembly/file renames (#79489)

This is a collection of renames that can be merged independently of actual test merging.  Automated changes were done with the ILTransform tool (started by @trylek, my version at https://github.com/markples/utils/tree/for-PR-dotnet-runtime-79489, commit 131b3764).

- ILTransform -p
    - Standardize project suffixes since _d, etc., are special cases for test merging but -dbg is not
    - Rename a few tests where the project and IL files had CaSiNg differences
- ILTransform -ilfile
    - Rename IL files to match the .ilproj root name (which excludes suffixes such as _d)
    - Update the project files to refer to the new filenames using $(MSBuildProjectName) except src/tests/JIT/Regression/CLR-x86-JIT/V2.0-Beta2/b323557 where the IL file doesn't have the suffix
- ILTransform -m
    - Remove all .module (including extern) lines from IL files
- ILTransform -a
    - Rename IL .assembly names to match their filenames
    - Some lines were `.assembly foo // as "foo"` - remove those comments too
- ILTransform -n -a -ilfile
    - Deduplicate project names across JIT/Regression
        - If a set of duplicates is simply one csproj and one ilproj, then add _il to the ilproj and leave the csproj alone
        - Otherwise append the difference in the closest different directory names.  For example:
            - V1-M11-Beta1/b40347/b40347.ilproj -> b40347_M11-Beta1.ilproj
            - V1-M12-Beta2/b40347/b40347.ilproj -> b40347_M12-Beta2.ilproj
        - However, avoid creating foo_foo.  For example:
            - V1-M12-Beta2/b51875/b51875.csproj -> <unchanged>
            - V1-M12-Beta2/b51875/Desktop/b51875.csproj -> b51875_Desktop.csproj
    - Also rename IL files and .assembly names to match the new project names
- Manual fixes for IL->C# assembly references in tests dev11_132534 and dev11_145295

19 months agoFix up NativeAOT testing (#79523)
Michal Strehovský [Tue, 13 Dec 2022 00:26:27 +0000 (09:26 +0900)]
Fix up NativeAOT testing (#79523)

19 months agofix SslStream.IsMutuallyAuthenticated with cached credentials (#79128)
Tomas Weinfurt [Tue, 13 Dec 2022 00:09:16 +0000 (16:09 -0800)]
fix SslStream.IsMutuallyAuthenticated with cached credentials (#79128)

* fix SslStream.IsMutuallyAuthenticated with cached credentials

* nano

* protocol

* fix test

* Apply suggestions from code review

Co-authored-by: Radek Zikmund <32671551+rzikm@users.noreply.github.com>
Co-authored-by: Simon Rozsival <simon@rozsival.com>
* fix CertificateValidationClientServer_EndToEnd_Ok test

Co-authored-by: Radek Zikmund <32671551+rzikm@users.noreply.github.com>
Co-authored-by: Simon Rozsival <simon@rozsival.com>
19 months ago[wasm] Enable System.Numerics vectors SIMD (#78068)
Radek Doulik [Mon, 12 Dec 2022 22:21:55 +0000 (23:21 +0100)]
[wasm] Enable System.Numerics vectors SIMD (#78068)

This helps in cases where there's only S.N.Vector path in the BCL code, like `SpanHelpers.IndexOfChar(ref char searchSpace, char value, int length)`. In this case the `Span:IndexOf char` measurement improves from 0.0143ms to 0.0114ms.

* [wasm] Enable System.Numerics vectors SIMD

* Do not hardcode S.N.Vector IsHardwareAccelerated

19 months agoJIT: Add missing case to relational with constant optimization (#79541)
Jakob Botsch Nielsen [Mon, 12 Dec 2022 20:16:37 +0000 (21:16 +0100)]
JIT: Add missing case to relational with constant optimization (#79541)

Almost all cases of #11349 were fixed, except for this missing one.

Fix #11349

19 months ago[NativeAOT] Objective-C Marshal: object tracker support (#78280)
Austin Wise [Mon, 12 Dec 2022 20:02:59 +0000 (12:02 -0800)]
[NativeAOT] Objective-C Marshal: object tracker support (#78280)

* NativeAOT Objective-C Marshal: object tracker support
* Remove support for registering multiple begin/end callbacks, since the API was not designed with multiple managed worlds in mind.
* Use more asserts where it should not be possible for there to be no callback.
* Add missing GC-trigger disable when calling managed callouts.
* Simplify initialization logic
* Add comments to CoreCLR and NativeAOT about constants that should have the same size.
* Remove superfluous use of C++ templates.
* Use the C# unmanaged function pointer types in more places, improving type safety
* Add SuppressGCTransition and fix compile error by adding cast

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
19 months ago[mono][interp] Add unbox when calling valuetype method through delegate (#79445)
Vlad Brezae [Mon, 12 Dec 2022 17:25:39 +0000 (19:25 +0200)]
[mono][interp] Add unbox when calling valuetype method through delegate (#79445)

* [mono][interp] Add unbox when calling valuetype method through delegate

If we are calling an open instance delegate, where the target method is on a valuetype, we will need to unbox this pointer.

* [mono][interp] Remove redundant check

If we are calling a method of a valuetype, then we already know `this` pointer is an instantiation of a valuetype.

* [mono][interp] Remove dead opcode

* [tests] Add regression test

* [tests] Disable test on fullaot

19 months agoAdd explicit tail. prefix to a tailcall test (#79532)
Jakob Botsch Nielsen [Mon, 12 Dec 2022 17:00:42 +0000 (18:00 +0100)]
Add explicit tail. prefix to a tailcall test (#79532)

Otherwise any change can cause us to stop tailcalling conservatively,
e.g. due to new inlining introducing an address-taken local.

Fix #79517

19 months agoFix compression (#79412)
Katya Sokolova [Mon, 12 Dec 2022 15:48:59 +0000 (16:48 +0100)]
Fix compression (#79412)

* Fix compression

* Apply suggestions from code review

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
* Adding SendAsync to ref

* fix ws deflate tests

* Check bytes on server side

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
Co-authored-by: Natalia Kondratyeva <knatalia@microsoft.com>
19 months agoset the return type to match the definition in InternalCalls.cs - and return the...
yowl [Mon, 12 Dec 2022 15:13:21 +0000 (10:13 -0500)]
set the return type to match the definition in InternalCalls.cs - and return the value. (#79538)

19 months agoAdd weakly typed Serialize and Deserialize overloads accepting JsonTypeInfo. (#79397)
Eirik Tsarpalis [Mon, 12 Dec 2022 13:34:22 +0000 (15:34 +0200)]
Add weakly typed Serialize and Deserialize overloads accepting JsonTypeInfo. (#79397)

19 months agoRemove hard_limit_for_bookkeeping (#77480)
Peter Sollich [Mon, 12 Dec 2022 13:14:33 +0000 (14:14 +0100)]
Remove hard_limit_for_bookkeeping (#77480)

As it turns out, it's not so easy to set aside a hard limit for the GC's bookkeeping, because some regions will be partially comitted and so will need more bookkeeping information as a percentage.

So this removes the hard_limit_for_bookkeeping and associated fields, and instead commits memory for the mark array eagerly, even if BGC is not in progress.

The issue is that GC needs at least one free region, and it needs the mark array committed. So when it tries to get a region at the end, and we cannot commit the mark array, we cannot actually get a free region. Currently we AV in this case, but there really isn't a good option to recover at this point. So it's better to keep the mark array committed and perhaps fail with an OOM exception.

19 months ago[wasm] reduce MethodImplOptions.NoInlining (#79457)
Pavel Savara [Mon, 12 Dec 2022 12:13:44 +0000 (13:13 +0100)]
[wasm] reduce MethodImplOptions.NoInlining (#79457)

* reduce MethodImplOptions.NoInlining

19 months ago[wasm] Disable failing blazor tests (#79526)
Ankit Jain [Mon, 12 Dec 2022 11:22:43 +0000 (06:22 -0500)]
[wasm] Disable failing blazor tests (#79526)

Issue: #79514

19 months agoMark test Outerloop (#79528)
Ahmet Ibrahim AKSOY [Mon, 12 Dec 2022 11:20:00 +0000 (12:20 +0100)]
Mark test Outerloop (#79528)

19 months agoSplit library and package Readme (#78888)
MSDN.WhiteKnight [Mon, 12 Dec 2022 10:57:58 +0000 (15:57 +0500)]
Split library and package Readme (#78888)

* Split library and package Readme

* Fix punctuation

* Fix lint issues

* Automatically include package readme file if existent

* Rename README.md to PACKAGE.md

* Move PACKAGE.md into source directory

* Reinstate examples in README.md

* Update contributing guidelines

* Update docs/coding-guidelines/libraries-packaging.md

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
19 months ago[mono][interp] Throw invalid program if stack state is invalid (#73215)
Vlad Brezae [Mon, 12 Dec 2022 10:47:19 +0000 (12:47 +0200)]
[mono][interp] Throw invalid program if stack state is invalid (#73215)

Rather than printing warning and then overflowing the stack info buffer. Store error in TransformData to reduce code size.

19 months agoFixes remaining issues with DynamicDependency attribute and adds tests (#79398)
Vitek Karas [Mon, 12 Dec 2022 10:33:54 +0000 (02:33 -0800)]
Fixes remaining issues with DynamicDependency attribute and adds tests (#79398)

Ports over all DynamicDependencyAttribute tests we have in linker. All tests are now passing, two had to be partially disabled due to:
* copyused testing which NativeAOT doesn't really support
* known missing support for XML attribute files in AOT

Product changes:
* DynamicDependencyAttribute will produce a warning if it can't resolve the target of the dependency.
* Support for DynamicDependencyAttribute on fields

Small improvements to assembly checker - mainly ability to handle delegate types.

Add tests for reflection-only accessed fields and methods and DynamicDependency on them. Fixed the problem with those tests by also hooking up FieldMetadataNote and MethodMetadataNode.

19 months agoDelete unused FreeLibraryAndExitThread from PAL (#79452)
Jan Kotas [Mon, 12 Dec 2022 09:24:24 +0000 (01:24 -0800)]
Delete unused FreeLibraryAndExitThread from PAL (#79452)

19 months agoFix GC stress C on macOS arm64 (#79426)
Jan Vorlicek [Mon, 12 Dec 2022 09:21:17 +0000 (10:21 +0100)]
Fix GC stress C on macOS arm64 (#79426)

* Fix GC stress C on macOS arm64

Tests relying on SIGCHLD signal are intermittently hanging when
running with GC stress C enabled. Investigations have shown that
the problem is that while according to dtrace the SIGCHLD was
delivered to a thread, the signal handler for it was actually not
invoked. That caused tests waiting for child completion to wait
forever, thus the tests were hanging.
Further investigations have uncovered the real issue. The problem
is that when we return from the coreclr hardware exception handler
to PAL after processing an invalid instruction used by the GC stress
C machinery, we use MachSetThreadContext to update the context
of the thread and to resume its execution. The problem is that the
MachSetThreadContext uses the pattern of suspend thread / set
thread state / resume thread. This pattern is problematic when
async signals can be delivered to the thread. The kernel can update
the thread state to point to the signal handler even when the thread
is suspended. So in our case, the kernel has set the state to execute
the signal handler, but in race conditions, we have overwritten that
by our context, effectively going back to the managed code and
preventing the signal handler execution.
We are using MachSetThreadContext instead of RtlRestoreContext at
that place because we need all registers to be restored and it
is not possible to restore all the registers and jump to the target
in user mode code. We are left with at least one register containing
different value (the target address).

This change uses a trick to achieve full thread state restoration.
It invokes a new helper RestoreCompleteContext which contains just
a single invalid instruction. The hardware exception handling is
triggered by that, we detect that the fault address is the
RestoreCompleteContext address and we set the context of the faulting
thread to the desired context. In this case, the signal handling
cannot interfere with this process and so there is no race.

I have originally modified RtlRestoreContext instead of creating
the new RestoreCompleteContext, but it turned out that for the
other usages of RtlRestoreContext, it is too expensive. And for
the other usages, we don't require the full fidelity restoration.

* Changes from PR feedback

19 months agoadd --allconfigurations for portable source-build (#79400)
Oleksandr Didyk [Mon, 12 Dec 2022 07:35:55 +0000 (08:35 +0100)]
add --allconfigurations for portable source-build (#79400)

19 months agoLink static libstdc++ with libicuc in NativeAOT (#79501)
Adeel Mujahid [Mon, 12 Dec 2022 03:40:04 +0000 (05:40 +0200)]
Link static libstdc++ with libicuc in NativeAOT (#79501)

* Link static libstdc++ with libicuc in NativeAOT

* Address CR feedback

* Improve static related conditions

* Delete default

19 months ago[NativeAOT] Enable smoke tests on macOS (#76560)
Filip Navara [Mon, 12 Dec 2022 01:43:17 +0000 (02:43 +0100)]
[NativeAOT] Enable smoke tests on macOS (#76560)

19 months agoSelect libraries using the ICU build time version (#79259)
ws77.cho [Sun, 11 Dec 2022 23:54:30 +0000 (08:54 +0900)]
Select libraries using the ICU build time version (#79259)

19 months agoUse ArgumentOutOfRangeException.Throw helpers in more places (#79460)
Stephen Toub [Sun, 11 Dec 2022 14:11:02 +0000 (09:11 -0500)]
Use ArgumentOutOfRangeException.Throw helpers in more places (#79460)

* Use ArgumentOutOfRangeException.Throw helpers in more places

* Fix a few issues

* Fix another test

* Apply suggestions from code review

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
19 months agoimprove symlink handling in Ping (#79323)
Tomas Weinfurt [Sat, 10 Dec 2022 23:25:25 +0000 (15:25 -0800)]
improve symlink handling in Ping (#79323)

* improve symlink handling in Ping

* update comment

* feedback from review

19 months ago[wasm] terser setup
Pavel Savara [Sat, 10 Dec 2022 21:07:41 +0000 (22:07 +0100)]
[wasm] terser setup

- default terser config for smaller size (#79466)
- fix ProducVersion
- dotn't generate dummy linker functions

19 months agoOnly create MethodTable optional fields when needed (#79435)
Michal Strehovský [Sat, 10 Dec 2022 05:39:01 +0000 (14:39 +0900)]
Only create MethodTable optional fields when needed (#79435)

Noticed a difference between statically built and dynamically built `MethodTable` for `int*[]`.

19 months agoFix for COM Weakreference test failure under JIT stress. (#79476)
Vladimir Sadov [Sat, 10 Dec 2022 01:39:11 +0000 (17:39 -0800)]
Fix for COM Weakreference test failure under JIT stress. (#79476)

* Prevent methods from inlining when relying on life time of their locals.

* refactor local functions.

19 months agoEnable `runtime-coreclr jitstress-isas-avx512` pipeline on Linux (#79417)
Bruce Forstall [Sat, 10 Dec 2022 00:36:40 +0000 (17:36 -0700)]
Enable `runtime-coreclr jitstress-isas-avx512` pipeline on Linux (#79417)

Now our Linux x64 machines in CI are AVX-512 capable.

19 months agoMove the rearrange_uoh_segments call earlier so that distribute_free_regions can...
Andrew Au [Sat, 10 Dec 2022 00:10:26 +0000 (16:10 -0800)]
Move the rearrange_uoh_segments call earlier so that distribute_free_regions can take them into account (#79262)

19 months agoA gentle reminder that TraceGC is turned off (#79183)
Andrew Au [Fri, 9 Dec 2022 22:55:10 +0000 (14:55 -0800)]
A gentle reminder that TraceGC is turned off (#79183)

19 months agofix determin lib name varation logic (#79370)
ws77.cho [Fri, 9 Dec 2022 22:39:02 +0000 (07:39 +0900)]
fix determin lib name varation logic (#79370)

When checking whether the suffix is contained, the size calcuation is wrong.

In case of Linux, u".so" is defined to PLATFORM_SHARED_LIB_SUFFIX_W.
So, string length (3) should be added to iterator.
But, in the current implementation, ARRAY_SIZE(PLATFORM_SHARED_LIB_SUFFIX_W) (4) is added to iterator.

19 months agoFixing assert on variable live range for simd12 LCL / STORE_LCL (#79182)
Brian Bohe [Fri, 9 Dec 2022 19:57:12 +0000 (14:57 -0500)]
Fixing assert on variable live range for simd12 LCL / STORE_LCL (#79182)

* Adding jitdump for varible debug info

* Forcing home and live update after SIMD12 store lcl

Although LSRA is indicating the tree produces the
result in an xmm's register, we are storing vector3
always on stack, so its home on varDsc and liveness
information must be recorded accordingly. LSRA
seems not to has this information.

* Formatting file

* Add missing case of targetReg in genStoreLclTypeSIMD12()

* Fix liveness update for genStoreLclFld() and genStoreLclVar on x64

* Fix liveness update for genStoreLclTypeSIMD12() on arm64

* Fix and unifying genStoreLclFld/LclVar on x64

* Revert "Ignoring test regression runtime_63354 in x86 (#79358)"

This reverts commit 1dec6480669d2008cd4c067dc43fa9da31e779ac.

Co-authored-by: Brian Bohe <brianbohe@microsoft.com>
Co-authored-by: Kunal Pathak <Kunal.Pathak@microsoft.com>
19 months agoIncrease test coverage of System.Reflection.Context (#77999)
Josie Bigler [Fri, 9 Dec 2022 17:51:37 +0000 (11:51 -0600)]
Increase test coverage of System.Reflection.Context (#77999)

19 months ago[wasm] Add Vector128.Narrow intrinsics (#79447)
Radek Doulik [Fri, 9 Dec 2022 17:38:28 +0000 (18:38 +0100)]
[wasm] Add Vector128.Narrow intrinsics (#79447)

Add intrinsics for

    i8x16.narrow_i16x8_s(a: v128, b: v128) -> v128
    i8x16.narrow_i16x8_u(a: v128, b: v128) -> v128
    i16x8.narrow_i32x4_s(a: v128, b: v128) -> v128
    i16x8.narrow_i32x4_u(a: v128, b: v128) -> v128

These improve string handling, where the i16x8.narrow_i32x4_u is used.

Like:

    > wa-info -d -f corlib_System_Text_ASCIIUtility_ExtractAsciiVector_System_Runtime_Intrinsics_Vector128_1_uint16_System_Runtime_Intrinsics_Vector128_1_uint16 dotnet.wasm
    (func corlib_System_Text_ASCIIUtility_ExtractAsciiVector_System_Runtime_Intrinsics_Vector128_1_uint16_System_Runtime_Intrinsics_Vector128_1_uint16(param $0 i32, $1 i32, $2 i32, $3 i32))
       local.get $0
       local.get $1
       v128.load align:4    [SIMD]
       local.get $2
       v128.load align:4    [SIMD]
       i8x16.narrow.i16x8.u    [SIMD]
       v128.store    [SIMD]

    > wa-info -d -f corlib_System_Text_ASCIIUtility_NarrowUtf16ToAscii_Intrinsified_char__byte__uintptr dotnet.wasm
    (func corlib_System_Text_ASCIIUtility_NarrowUtf16ToAscii_Intrinsified_char__byte__uintptr(param $0 i32, $1 i32, $2 i32, $3 i32) (result i32))
       ...
       v128.load    [SIMD]
       local.tee $5
       v128.const 0xff80ff80ff80ff80ff80ff80ff80ff80    [SIMD]
       local.tee $6
       v128.and    [SIMD]
       v128.any.true    [SIMD]
       br.if
       local.get $1
       i32.eqz
       br.if
       local.get $1
       local.get $5
       local.get $5
       i8x16.narrow.i16x8.u    [SIMD]
       v128.store64.lane 0    [SIMD]
       ...

It is also measurable in the browser-bench, where
`Json, non-ASCII text deserialize` improves from 0.5048ms to 0.4428ms
for simd on chrome.

19 months ago[mono] Add a managed cache for flags in RuntimeType. (#78840)
Zoltan Varga [Fri, 9 Dec 2022 16:45:37 +0000 (11:45 -0500)]
[mono] Add a managed cache for flags in RuntimeType. (#78840)

19 months ago[wasm] Wasm.Build.Tests - build projects for net8.0 by default (#79254)
Ankit Jain [Fri, 9 Dec 2022 16:17:16 +0000 (11:17 -0500)]
[wasm] Wasm.Build.Tests - build projects for net8.0 by default (#79254)

* [wasm] Wasm.Build.Tests - build projects for net8.0 by default
* [wasm] Fix templates to use the correct tfm
* InstallWorkloadFromArtifacts: Share the nuget cache for installing all the workload combinations
* WBT: fix re-runs
* WBT: fix non-wasm console project tests
* Fix tfm used for blazor projects
* WBT: Update to use 7.0.0 version of the workload
* WBT: Update tests to remove workarounds for 7.0 that aren't needed anymore
* Fix BrowserBuildAndRun for 7.0
* WBT: Run a blazor template referencing a native lib
* WBT: Update SkiaSharp reference
* WBT: Use warnAsError for blazor builds
* WBT: Disable tests failing to run 8.0-sdk+tfm=net7 - https://github.com/dotnet/runtime/issues/79313

19 months ago[wasm] optimize interop startup and linker hints (#77256)
Pavel Savara [Fri, 9 Dec 2022 13:52:32 +0000 (14:52 +0100)]
[wasm] optimize interop startup and linker hints (#77256)

Prepare for making legacy interop optional and small optimization

19 months agoDon't embed bitcode on tvOS anymore (#79349)
Filip Navara [Fri, 9 Dec 2022 13:11:26 +0000 (14:11 +0100)]
Don't embed bitcode on tvOS anymore (#79349)

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
19 months ago[mono][tests] Throw InvalidProgramException when ENDFILTER has invalid value type...
Milos Kotlar [Fri, 9 Dec 2022 09:29:01 +0000 (10:29 +0100)]
[mono][tests] Throw InvalidProgramException when ENDFILTER has invalid value type or invalid number of values (#79394)

* Throw InvalidProgramException when ENDFILTER has invalid value type or invalid number of values

19 months agoFix creation of pointer arrays (#79433)
Michal Strehovský [Fri, 9 Dec 2022 09:16:51 +0000 (18:16 +0900)]
Fix creation of pointer arrays (#79433)

Creation of pointer arrays is on a similar plan to multi-dim arrays - we create them from a template type, but the template is slightly wrong. Previously, EETypeCreator would massage the bits into the correct shape, but now we mostly just copy the bits from the template. Use a more precise template for pointer arrays.

Without this, the base size and element type of pointer arrays was slightly wrong.

I'm also deleting the duplicated "use a special template for this one" logic.

19 months ago[main] Update dependencies from dotnet/linker (#79272)
dotnet-maestro[bot] [Fri, 9 Dec 2022 08:25:19 +0000 (09:25 +0100)]
[main] Update dependencies from dotnet/linker (#79272)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
19 months agoTemporarily disable NoCallback_RevokedCertificate_NoRevocationChecking_Succeeds ...
Radek Zikmund [Fri, 9 Dec 2022 01:45:57 +0000 (02:45 +0100)]
Temporarily disable NoCallback_RevokedCertificate_NoRevocationChecking_Succeeds (#79407)

The 3rd party service has expired certificate

19 months agoAdd ImmutableArray<T>.Builder.DrainToImmutable() (#79385)
Jeff Handley [Thu, 8 Dec 2022 21:50:09 +0000 (13:50 -0800)]
Add ImmutableArray<T>.Builder.DrainToImmutable() (#79385)

* Add ImmutableArray<T>.Builder.DrainToImmutable

* Refactor DrainToImmutable for a more optimized implementation

* Augment and refine DrainToImmutable unit tests

19 months ago[wasm] Ignore not relevant rollup warnings (#79396)
Marek Fišera [Thu, 8 Dec 2022 21:08:34 +0000 (22:08 +0100)]
[wasm] Ignore not relevant rollup warnings (#79396)

19 months agoFix wrong value in the comment (#79401)
Radek Doulik [Thu, 8 Dec 2022 20:58:58 +0000 (21:58 +0100)]
Fix wrong value in the comment (#79401)

19 months agoRemaining feedback part1 (#79011)
Tlakaelel Axayakatl Ceja [Thu, 8 Dec 2022 20:55:38 +0000 (12:55 -0800)]
Remaining feedback part1 (#79011)

* Delete remaining eng folder files
* Import repo root Directory.Build.props|targets
* Remove some of the duplicated package settings defined in the repo root Directory.Build.props
* Use shared new Roslyn ApiCompat infrastructure
* Disable some warning codes in illink editorconfig
* Disable warning about IL3000 since code is safe, it will never be used in single file
* Move ilasm.proj file outside of the eng folder
* Add missing analyzer generated tests and skip the CompilerGeneratedCodeSubstitutions test since it uses constant propagation that is not supported by the analyzer

19 months ago[wasm][debugger] Revert don't need to escape special characters anymore (#78320)
Thays Grazia [Thu, 8 Dec 2022 19:04:44 +0000 (16:04 -0300)]
[wasm][debugger] Revert don't need to escape special characters anymore (#78320)

* Trying to fix again

* Removing comment

* trying to fix CI

* implementing escaped string for dotnet:// as discussed with @radical

* addressing radical suggestion

* fix CI

* implementing test with colon as discussed with @radical.

* fix on windows

* pushing @radical changes and addressing @radical comments

* using ilona suggestion about conditionalfact

* Reverting one suggestion.

* Fixing behavior on mac

19 months agoFix startingStackpos tracking for loop in loop (#79382)
Stephen Toub [Thu, 8 Dec 2022 18:54:00 +0000 (13:54 -0500)]
Fix startingStackpos tracking for loop in loop (#79382)

* Fix startingStackpos tracking for loop in loop

This extends the fix made earlier around proper handling of the backtracking stack in EmitLoop.  If this loop is inside of another loop, then we need to preserve the startingStackpos on the backtracking stack upon successfully completing the loop, as the outer loop might iterate and cause another occurrence of this loop to run, which will then overwrite our single startingStackpos local.  If that iteration backtracks, we then need to be able to pop the previous iterations startingStackpos and restore its value.

* Update src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompiler.cs

19 months agoImplement unmanaged-to-managed direction for vtable stub generator (#77130)
Jeremy Koritzinsky [Thu, 8 Dec 2022 18:29:21 +0000 (10:29 -0800)]
Implement unmanaged-to-managed direction for vtable stub generator (#77130)

19 months agoUpdate doc to describe host_runtime_contract (#79374)
Elinor Fung [Thu, 8 Dec 2022 18:08:06 +0000 (10:08 -0800)]
Update doc to describe host_runtime_contract (#79374)

19 months agoDelete some remnants from fusion (#79380)
Elinor Fung [Thu, 8 Dec 2022 18:01:13 +0000 (10:01 -0800)]
Delete some remnants from fusion (#79380)

19 months agoDo not override content root with default (#79242)
Stephen Halter [Thu, 8 Dec 2022 17:41:51 +0000 (09:41 -0800)]
Do not override content root with default (#79242)

19 months ago[main] Update dependencies from dotnet/arcade (#79271)
dotnet-maestro[bot] [Thu, 8 Dec 2022 17:23:10 +0000 (12:23 -0500)]
[main] Update dependencies from dotnet/arcade (#79271)

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

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.22579.2 -> To Version 8.0.0-beta.22605.1

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

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.22579.2 -> To Version 8.0.0-beta.22606.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
19 months agoReplacing exception strings with those stored in the resx file (#79378)
Jan Kotas [Thu, 8 Dec 2022 17:14:59 +0000 (09:14 -0800)]
Replacing exception strings with those stored in the resx file (#79378)

* Replacing exception strings with those stored in the resx file

Contributes to #34056

* Update argument name

Co-authored-by: databunks <sahaq2001@gmail.com>
19 months agoConvert b08046 to C# and fix it (#79389)
Mark Plesko [Thu, 8 Dec 2022 16:24:31 +0000 (08:24 -0800)]
Convert b08046 to C# and fix it (#79389)

Resolves #5810

I verified manually that the original IL and original C# translation both failed. The C#-generated IL is very close though not identical the original IL.

19 months ago[mono][interp] Add intrinsic for string allocation (#79392)
Vlad Brezae [Thu, 8 Dec 2022 15:31:10 +0000 (17:31 +0200)]
[mono][interp] Add intrinsic for string allocation (#79392)

* [mono][metadata] Remove redundant use of coop handles

mono_string_new_size_handle was making use of handles for no reason, while mono_string_new_size_checked was just ignoring the created handle. Make mono_string_new_size_checked fast again.

* [mono][interp] Add intrinsic for string allocation

19 months ago[mono][interp] Remove some dead opcodes (#79343)
Vlad Brezae [Thu, 8 Dec 2022 14:42:45 +0000 (16:42 +0200)]
[mono][interp] Remove some dead opcodes (#79343)

* [mono][interp] Remove opcodes used only by the managed allocator

Which normally shouldn't be compiled with interpreter.

* [mono][interp] Remove unused branch opcodes

* [mono][interp] Remove dead opcode

* [mono][interp] Remove Array.IsPrimitive which is no longer used

* [mono][interp] Remove redundant ldelem.i/stelem.i

19 months ago[wasm] Lazy init of [JSExport] bindings (#77293)
Pavel Savara [Thu, 8 Dec 2022 13:25:14 +0000 (14:25 +0100)]
[wasm] Lazy init of [JSExport] bindings (#77293)

* don't trigger static ctor with JSExport init
* lazy init from JS
* fix for backward compatibility with Net7

19 months agoFix Sse3 => Ssse3 typo (#79368)
Miha Zupan [Thu, 8 Dec 2022 12:36:10 +0000 (13:36 +0100)]
Fix Sse3 => Ssse3 typo (#79368)

19 months agoRemove span pinning associated with string.Create (#78914)
Stephen Toub [Thu, 8 Dec 2022 11:45:18 +0000 (06:45 -0500)]
Remove span pinning associated with string.Create (#78914)

* Remove span pinning associated with string.Create

This is now possible with C# 11.

* Address PR feedback

19 months agoJIT: Allow cloning addresses even before initobj (#79341)
Jakob Botsch Nielsen [Thu, 8 Dec 2022 09:11:55 +0000 (10:11 +0100)]
JIT: Allow cloning addresses even before initobj (#79341)

Roslyn emits ldloca + dup + initobj when initializing structs. Normally
we clone address trees instead of creating a local for them (which will
address expose the local), but we treat this initobj pattern specially.

Remove this special treatment. It means we sometimes end up with
slightly larger code because we no longer have a register with the
address in it (could potentially be fixed by CSE), but avoiding the
address exposure seems like the right trade off to me.

Fix #42354
Fix #57055

19 months agoDelete parts of type system that deal with layouts (#79366)
Michal Strehovský [Thu, 8 Dec 2022 07:51:52 +0000 (16:51 +0900)]
Delete parts of type system that deal with layouts (#79366)

The layout of type is always the same as the template so we don't need the logic. This gets rid of uncertainities around "can I reliably ask type system questions around layouts" (see the deleted FieldLayoutAlgorithms). Now the answer is: "you can't ask those questions", which is better than "you could get an answer that you might not like" (an assert).

19 months ago[JIT] - Fixed sub-optimal optimization for `a % 1` to Zero (#77760)
Will Smith [Thu, 8 Dec 2022 06:21:01 +0000 (22:21 -0800)]
[JIT] - Fixed sub-optimal optimization for `a % 1` to Zero (#77760)

* Optimize a % 1 to Zero

* Update disasm tests

* Minor change

* Remove duplicate opt

* Use extract side effects

* Re-arranging mod optimizations

* Re-arranging mod optimizations

* Extended mod optimization with -1. Unsetting debug node morphed flag.

* Remove space

* Try catch the regression

* Use FULL-LINE for tests

* Remove '% -1' opt

* Updated vn for constant. Re-using op2 for zero constant.

* Do not optimize part of this if not global morph

* Checking side effect flag early

* Check for GT_CNS_LNG

* Update Regression1.csproj

* Recording issue for mono

* Update issues.targets

* Using SetIntegralValue, removed unrelated changes, transformation will not happen if optimizations are disabled

* Minor change

* Minor change

* Use IsIntegralConst

19 months agoAdd MemoryExtensions.Split (#79048)
Stephen Toub [Thu, 8 Dec 2022 03:49:24 +0000 (22:49 -0500)]
Add MemoryExtensions.Split (#79048)

* Add MemoryExtensions.Split

* Remove unnecessary IndexOf

* Fix a couple uses

* Use simpler pattern matching syntax instead of SequenceEqual

* Address PR feedback

19 months agoFix BN_is_zero for OpenSSL 1.0.2 non-portable build
Kevin Jones [Thu, 8 Dec 2022 02:00:38 +0000 (21:00 -0500)]
Fix BN_is_zero for OpenSSL 1.0.2 non-portable build

19 months agoAdd experimental Regex test based on SampleMatches (#79364)
Stephen Toub [Thu, 8 Dec 2022 01:23:59 +0000 (20:23 -0500)]
Add experimental Regex test based on SampleMatches (#79364)

This adds a (currently disactivated) test that takes the ~15K regexes in our pattern database, generates inputs for each using the NonBacktracking engine's sampler, and then validates all the engines with that pattern.  The sampler currently hangs on some patterns, and it asserts on others, so this is manual-only until such issues can be fixed.  Still, I was able to run another ~10K patterns through all the engines before it fell over with an assert.

19 months agoFix declaration of local in regex source generator (#79362)
Stephen Toub [Thu, 8 Dec 2022 01:22:04 +0000 (20:22 -0500)]
Fix declaration of local in regex source generator (#79362)

19 months agoFix dump creation on MacOS Ventura (#79356)
Mike McLaughlin [Wed, 7 Dec 2022 23:17:41 +0000 (15:17 -0800)]
Fix dump creation on MacOS Ventura (#79356)

Use the task_info(TASK_DYLD_INFO) API to get the dylinker info instead of
enumerating all the memory regions. This works on Ventura and simplifies
the module enumeration quite a bit.

19 months agoIgnoring test regression runtime_63354 in x86 (#79358)
Brian Bohe [Wed, 7 Dec 2022 21:59:45 +0000 (16:59 -0500)]
Ignoring test regression runtime_63354 in x86 (#79358)

* Ignoring test regression runtime_63354 in x86

* Adding doble * just in case

Co-authored-by: Brian Bohe <brianbohe@microsoft.com>
19 months agoUse static sealed vtable for dynamically created types (#79332)
Michal Strehovský [Wed, 7 Dec 2022 21:54:00 +0000 (06:54 +0900)]
Use static sealed vtable for dynamically created types (#79332)

The sealed vtable is identical for all canonically equivalent types. We had a to make a copy because in the presence of universal shared generics, new sealed vtables could be created for dynamic types and those need to use pointer-sized slots (the slots are relative pointers in the static case and have been since Redhawk times).

19 months agoUse IndexOfAnyExceptInRange in ZipHelper.GetEncoding (#79357)
Stephen Toub [Wed, 7 Dec 2022 21:51:16 +0000 (16:51 -0500)]
Use IndexOfAnyExceptInRange in ZipHelper.GetEncoding (#79357)

19 months agoFix handling of backtracking stack with some loops (#79353)
Stephen Toub [Wed, 7 Dec 2022 20:33:47 +0000 (15:33 -0500)]
Fix handling of backtracking stack with some loops (#79353)

With both RegexOptions.Compiled and the Regex source generator, Regex greedy loops with
- a minimum bound of at least 2
- no child constructs that backtrack
- and a child that's more than a one/notone/set (aka things that match a single character)

are possibly leaving state on the backtracking stack when:
- at least one iteration of the loop successfully matches
- but not enough iterations match to make the loop successful such that matching the loop fails

In that case, if a previous construct in the pattern pushed any state onto the backtracking stack such that it expects to be able to pop off and use that state upon backtracking to it, it will potentially pop the erroneously leftover state.  This can then cause execution to go awry, as it's getting back an unexpected value.  That can lead to false positives, false negatives, or exceptions such as an IndexOutOfRangeException due to trying to pop too much from the backtracking stack.

We already have the ability to remember the backtracking stack position when we initially enter the loop so that we can reset to that position later on.  The fix is simply to extend that to also perform that reset when failing the match of such a loop in such circumstances.