1. 06 4月, 2023 22 次提交
    • J
      Disable nullability checks in file shared between the managed type system and... · e45e5db9
      Jeremy Koritzinsky 提交于
      Disable nullability checks in file shared between the managed type system and ILVerificationTests (#84382)
      
      This file is shared between the managed type system and the ILVerificationTests suite.
      The managed type system doesn't have nullable checks turned on, but ILVerificationTests does. This was causing build failures in PRs that build the ILVerificationTests.
      
      We should enable nullable checking in the future in the managed type system as a whole at some point, but we aren't there yet.
      e45e5db9
    • Z
      [mono][aot] Fix an assert. (#84385) · ab57c57b
      Zoltan Varga 提交于
      This is hit when AOTing GitHub_27678.dll.
      ab57c57b
    • M
      Fix ThunkGenerator (#84390) · f0fbcc28
      Michał Petryka 提交于
      * Fix ThunkGenerator
      
      Fixes:
      ```
       error CA1859: Change type of parameter 'tr' from 'System.IO.TextReader' to 'System.IO.StreamReader' for improved performance
       error CA1859: Change return type of method 'ParseInput' from 'System.Collections.Generic.IEnumerable<Thunkerator.FunctionDecl>' to 'System.Collections.ObjectModel.ReadOnlyCollection<Thunkerator.FunctionDecl>' for improved performance
      ```
      
      * Fix typo
      f0fbcc28
    • E
      Make WindowsServiceLifetime gracefully stop (#83892) · f5895b30
      Eric StJohn 提交于
      * Make WindowsServiceLifetime gracefully stop
      
      WindowsServiceLifetime was not waiting for ServiceBase to stop the service.  As a result
      we would sometimes end the process before notifying service control manager that the service
      had stopped -- resulting in an error in the eventlog and sometimes a service restart.
      
      We also were permitting multiple calls to Stop to occur - through SCM callbacks, and through
      public API.  We must not call SetServiceStatus again once the service is marked as stopped.
      
      * Alternate approach to ensuring we only ever set STATE_STOPPED once.
      
      * Avoid calling ServiceBase.Stop on stopped service
      
      I fixed double-calling STATE_STOPPED in ServiceBase, but this fix will
      not be present on .NETFramework.  Workaround that by avoiding calling
      ServiceBase.Stop when the service has already been stopped by SCM.
      
      * Add tests for WindowsServiceLifetime
      
      These tests leverage RemoteExecutor to avoid creating a separate service
      assembly.
      
      * Respond to feedback and add more tests.
      
      This better integrates with the RemoteExecutor component as well,
      by hooking up the service process and fetching its handle.
      
      This gives us the correct logging and exitcode handling from
      RemoteExecutor.
      
      * Honor Cancellation in StopAsync
      
      * Fix bindingRedirects in RemoteExecutor
      
      * Use Async lambdas for service testing
      
      * Fix issue on Win7 where duplicate service descriptions are disallowed
      
      * Respond to feedback
      
      * Fix comment and add timeout
      f5895b30
    • S
      Arm64: Optimize pairs of "str wzr" to "str xzr" (#84350) · 0be7d599
      SwapnilGaikwad 提交于
      Optimise following patterns
      
      ```
      stp     wzr, wzr, [x2, #0x08]       =>     str     xzr, [x2, #0x08]
      ```
      
      and
      
      ```
      stp     wzr, wzr, [x14, #0x20]
      str     xzr, [x14, #0x18]           =>     stp     xzr, xzr, [x14, #0x18]
      ```
      0be7d599
    • S
      Add ArgumentOutOfRangeException.ThrowIf{Not}Equal (#83853) · aca3fcc1
      Stephen Toub 提交于
      * Add ArgumentOutOfRangeException.ThrowIf{Not}Equal
      
      * Address PR feedback
      
      * Address PR feedback
      aca3fcc1
    • S
      Add back IComparable-based optimization to FrozenDictionary/Set (#84301) · 2d05a601
      Stephen Toub 提交于
      * Add back IComparable-based optimization to FrozenDictionary/Set
      
      We previously had an optimization in FrozenDictionary/Set that special-cased a small number of value types when the default comparer is used... if that type was IComparable, we would sort the types, which would then a) enable us to immediately reject items larger than the known max, and b) enable us to stop searching once we hit an item larger than the one for which we were searching (which then implicitly also immediately rules out items smaller than the known min).
      
      We removed that optimization in general because some prominent IComparable implementations don't always work, in particular container types like ValueTuple that implement IComparable but then it's only functional if the contained types are also comparable.  This commit puts it back for an allow-list of types.
      
      * Address PR feedback
      2d05a601
    • M
      Speed up named type lookups in managed type system (#84285) · 18e2c5fd
      Michal Strehovský 提交于
      When the type system needs to resolve a named type in a module, it will do a `foreach` loop over all types in the module looking for the type. This can get mildly hot and I've seen it in CPU profiles but it never looked too important to address (despite the TODO).
      
      But when MIBC files are passed to the compiler, this gets ridiculously hot. Compile Hello world by default: 0.98 seconds. Compile hello world with 5 MIBC files: 9.1 seconds.
      
      This adds a hashtable to the lookup and drops the MIBC case to 1.4 seconds (we'll want to parallelize the MIBC loading on a background thread to get rid of the last mile, but first things first).
      18e2c5fd
    • S
      [Android] Free up more disk space on CI builds (#84354) · 2c37a2df
      Steve Pfister 提交于
      The android builds are running out of disk space when building the library test apps.  This change tries to recoup some of that space by deleting artifacts after each test was built.
      2c37a2df
    • J
      dba28264
    • P
      Removed pipeline dependencies and steps for running Maui-iOS as it has been... · 4f4dd93e
      Parker Bibus 提交于
      Removed pipeline dependencies and steps for running Maui-iOS as it has been moved to the performance repo. (#84363)
      
      4f4dd93e
    • A
      3309b0a9
    • E
      Implement the JsonSerializer.IsReflectionEnabledByDefault feature switch (#83844) · 0f112127
      Eirik Tsarpalis 提交于
      * Implement the STJ.DisableDefaultReflection feature switch.
      
      * Reinstate accidentally stripped attribute
      
      * Address feedback.
      
      * Address feedback.
      
      * Add a trimming test for STJ
      
      * Move trimming test to existing trimming tests folder.
      
      * Add source gen serialization test case to Trimming test.
      
      * Fix style.
      
      * Expose the feature switch as a property on JsonSerializer -- rename feature switch to match namespace.
      
      * Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Helpers.cs
      Co-authored-by: NEric Erhardt <eric.erhardt@microsoft.com>
      
      * Update src/libraries/System.Text.Json/tests/System.Text.Json.Tests/TrimmingTests/IsReflectionEnabledByDefaultFalse.cs
      Co-authored-by: NEric Erhardt <eric.erhardt@microsoft.com>
      
      * Address feedback.
      
      * Address feedback.
      
      * Add entry to feature-switches.md
      
      ---------
      Co-authored-by: NEric Erhardt <eric.erhardt@microsoft.com>
      0f112127
    • W
      [JIT] X86/X64 - Eliminate redundant 'cmp' instructions (#82750) · 042a3509
      Will Smith 提交于
      * Fixed improper peephole zero-extension removal when cdq/cdqe/cwde instructions are involved
      
      * Update regression test
      
      * Formatting
      
      * Handle cdq differently
      
      * Handle cdq differently
      
      * Handle cdq differently
      
      * Initial commit to eliminate redundant 'cmp' instructions
      
      * Take into account cmpxchg
      
      * Take into account cmpxchg
      
      * Feedback
      
      * Temporarily disable cmp opt if we encounter a mov
      
      * Allow checking for mov
      
      * Allow regardless of targetReg
      
      * Allow regardless of targetReg
      
      * Checking if an instruction resets a flag.
      
      * Remove useless comment
      
      * Minor fix
      
      * Abort are checking cmp
      
      * Some refactoring. Taking into account any instruction that modifies flags.
      
      * Minor cleanup
      
      * Remove function from header
      
      * Quick fix
      
      * Sync
      
      * Formatting
      
      * Only look for 'cmp reg, reg'
      
      * Added comment
      
      * Update src/coreclr/jit/emitxarch.cpp
      Co-authored-by: NBruce Forstall <brucefo@microsoft.com>
      
      * Update src/coreclr/jit/emitxarch.cpp
      Co-authored-by: NBruce Forstall <brucefo@microsoft.com>
      
      ---------
      Co-authored-by: NBruce Forstall <brucefo@microsoft.com>
      042a3509
    • T
      [wasm][debugger] Retry after timeout on debugger tests on CI (#84080) · 5130ba98
      Thays Grazia 提交于
      * retrying if timeout OpenSessionAsync.
      * Update src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs
      Co-authored-by: NLarry Ewing <lewing@microsoft.com>
      
      ---------
      Co-authored-by: NLarry Ewing <lewing@microsoft.com>
      5130ba98
    • D
    • A
      Caching settings.pause_mode to avoid deadlock (#84189) · c86c19f2
      Andrew Au 提交于
      c86c19f2
    • Z
      [mono][aot] Fix an assert in the aot compiler. (#84343) · ba401925
      Zoltan Varga 提交于
      Happens when AOT-ing Regression_1.dll from the JIT test suite.
      ba401925
    • J
    • A
      Avoid clearing uncommitted mark array (#83623) · 243724fd
      Andrew Au 提交于
      243724fd
    • J
      JIT: Ensure tail merging does not add preds to scratch block (#84353) · 30f75118
      Jakob Botsch Nielsen 提交于
      Fix issue seen in #83388 where tail merging ended up adding new
      predecessors to the scratch block, making adding more "initialization
      IR" impossible for downstream phases.
      30f75118
    • R
      [wasm] Freeze the emscripten cache (#84356) · da7fbb76
      Radek Doulik 提交于
      This fixes https://github.com/dotnet/runtime/issues/83655
      
      We prime the cache before packaging the emsdk cache package and also
      in docker images, so we don't need to update the cache, which might be
      in read-only location anyway.
      
      The underlying issue was problem with the cache lock:
      
          "C:/helix/work/correlation/build/emsdk/upstream/bin\clang.exe" --version
          cache:WARNING: Accessing the Emscripten cache at "C:\helix\work\correlation\build\emsdk\upstream\emscripten\cache" (for "sanity") is taking a long time, another process should be writing to it. If there are none and you suspect this process has deadlocked, try deleting the lock file "C:\helix\work\correlation\build\emsdk\upstream\emscripten\cache\cache.lock" and try again. If this occurs deterministically, consider filing a bug.
          cache:WARNING: Accessing the Emscripten cache at "C:\helix\work\correlation\build\emsdk\upstream\emscripten\cache" (for "sanity") is taking a long time, another process should be writing to it. If there are none and you suspect this process has deadlocked, try deleting the lock file "C:\helix\work\correlation\build\emsdk\upstream\emscripten\cache\cache.lock" and try again. If this occurs deterministically, consider filing a bug.
      da7fbb76
  2. 05 4月, 2023 17 次提交
    • K
      [wasm] Implement the ENDFINALLY opcode in the jiterpreter (#84273) · 66211eb2
      Katelyn Gadd 提交于
      * Mark the opcode following CALL_HANDLER interpreter opcodes as a back branch target
      * In the jiterpreter, record each CALL_HANDLER location when compiling them
      * Then when compiling an ENDFINALLY opcode check to see whether the branch target is one we recognize and if so do a branch, otherwise bail out
      * Tweak CFG to filter out branch targets that are never used
      * Add browser-bench measurement for try-finally
      66211eb2
    • R
      [wasm] Simd refactoring (#84170) · 6114f193
      Radek Doulik 提交于
      * [wasm] Simd refactoring
      
      Rename few opcodes to contain `_SIMD_`.
      
      Use more SimdIntrinsic fields to simplify the code.
      
      * Fix build
      
      * Fix narrowing intrinsics
      
      * Verbose aot compilation
      
      * Feedback
      
      * Make it verbose on helix
      
      * Do not set op for narrowing methods
      
      Because `emit_hardware_intrinsics` doesn't call custom emit in such case
      and so we endup with code emitted with wrong zero c0.
      
      * Feedback
      
      * Be quiet again :-)
      6114f193
    • V
    • E
    • B
      Suppress linker warnings properly (#84272) · 3e6ad475
      Buyaa Namnan 提交于
      * Suppress linker warnings properly
      
      * Update core assembly types handling
      
      * Update src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/SignatureHelper.cs
      
      ---------
      Co-authored-by: NJan Kotas <jkotas@microsoft.com>
      3e6ad475
    • E
      f2d5967c
    • A
      JIT: use synthesis to repair some reconstruction issues (#84312) · 4b5491eb
      Andy Ayers 提交于
      In particular, run synthesis in repair mode for cases where there are profile
      counts within the method but zero counts in `fgFirstBB`.
      
      Recall that sparse profiling effectively probes return blocks to determine the
      method entry count.
      
      So the zero-entry but not zero-everywhere case can happen if we have a method
      with a very long running loop plus sparse profiling plus OSR -- we will only
      get profile counts from the instrumented Tier0 method, and it will never return
      (instead it will always escape to an OSR version which will eventually return,
      but that version won't be instrumented).
      
      I originally was a bit more ambitious and ran repair for a broader set of
      reconstruction issues, but lead to a large number of diffs, in part because
      repair doesn't cope well with irreducible loops.
      
      Leaving the entry count zero can have fairly disastrous impact on the quality
      of optimizations done in the method.
      
      Addresses quite a few of the worst-performing benchmarks in #84264.
      4b5491eb
    • V
      [NativeAOT] Remove unused native memcopy helpers. (#84314) · 70d00e44
      Vladimir Sadov 提交于
      * Remove unused (and in some cases broken) RhpCopy helpers.
      
      * PR feedback
      70d00e44
    • J
      JIT: Handle some "field offset computation" patterns (#81998) · 337999d5
      Jakob Botsch Nielsen 提交于
      Both during local morph and during VN.
      
      Fix #40021
      
      Saves 3 KB on BasicMinimalApi after #84095 (there's 1111 __GetFieldHelper functions). About 0.04%. There's still a null check kept for each offset computation, which we cannot really get rid of, but NAOT could maybe emit the IL such that there is a dominating null check so that only one is emitted.
      
      Example:
      Base:
      ```
      .managed:0000000140347CC0 loc_140347CC0:                          ; CODE XREF: S_P_CoreLib_System_Collections_Generic_KeyValuePair_2_System_Net_Security_System_Net_Security_SslSessionsCache_SslCredKey__System___Canon_____GetFieldHelper+23↑j
      .managed:0000000140347CC0                                         ; DATA XREF: .rdata:__readonlydata_S_P_CoreLib_System_Collections_Generic_KeyValuePair_2_System_Net_Security_System_Net_Security_SslSessionsCache_SslCredKey__System___Canon_____GetFieldHelper↓o
      .managed:0000000140347CC0                 lea     rax, ??_7Boxed_System_Net_Security_System_Net_Security_SslSessionsCache_SslCredKey@@6B@ ; jumptable 0000000140347CB3 case 0
      .managed:0000000140347CC7                 mov     [r9], rax
      .managed:0000000140347CCA                 cmp     [rcx], cl
      .managed:0000000140347CCC                 lea     rax, [rcx+8]
      .managed:0000000140347CD0                 sub     rax, rcx
      .managed:0000000140347CD3                 add     rsp, 8
      .managed:0000000140347CD7                 retn
      ```
      Diff:
      
      ```
      .managed:0000000140347AA0 loc_140347AA0:                          ; CODE XREF: S_P_CoreLib_System_Collections_Generic_KeyValuePair_2_System_Net_Security_System_Net_Security_SslSessionsCache_SslCredKey__System___Canon_____GetFieldHelper+23↑j
      .managed:0000000140347AA0                                         ; DATA XREF: .rdata:__readonlydata_S_P_CoreLib_System_Collections_Generic_KeyValuePair_2_System_Net_Security_System_Net_Security_SslSessionsCache_SslCredKey__System___Canon_____GetFieldHelper↓o
      .managed:0000000140347AA0                 lea     rax, ??_7Boxed_System_Net_Security_System_Net_Security_SslSessionsCache_SslCredKey@@6B@ ; jumptable 0000000140347A93 case 0
      .managed:0000000140347AA7                 mov     [r9], rax
      .managed:0000000140347AAA                 cmp     [rcx], cl
      .managed:0000000140347AAC                 mov     eax, 8
      .managed:0000000140347AB1                 add     rsp, 8
      .managed:0000000140347AB5                 retn
      ```
      
      Local morph changes handle the pattern for local structs -- VN changes handle the pattern for classes (and more complicated struct cases, like storing them in locals, which there are a few examples of in #40021).
      337999d5
    • D
      Improve XmlDictionaryWriter UTF8 encoding performance (#73336) · e0c94f84
      Daniel Svensson 提交于
      * Speed up text encoding
      
      * Update implementation
      
      * Add tests for binary xml strings
      
      * limit counting code to 256 bit vectors
      
      * reword comment
      
      * rename test
      
      * move bytesmax
      
      * Fix bytesMax after moving variable initialization
      
      * use unicode escape value in test
      
      * fix test typo "*" -> "+"
      
      * Update src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlStreamNodeWriter.cs
      Co-authored-by: NStephen Toub <stoub@microsoft.com>
      
      * Remvoe vectorized code from UnsafeGetUTF8Length
      
      * Fix overfload
      
      * use for loop which seems faster
      
      * remove vector loop
      
      * make sealed encoding to allow devirtualisation
      
      * back some changes
      
      * use uint for UnsafeGetUTF8Chars comparison
      
      * revert more changes
      
      * Fix cutoff based on new measurements
      
      * use BinaryPrimitives.ReverseEndianness as suggested
      
      * Update cutoff from 24 to 32 chars before calling, due to regression for text based DataContractSerializer
      
      * Remove sealed encoding since it only improves XmlConvert
      
      ---------
      Co-authored-by: NStephen Toub <stoub@microsoft.com>
      e0c94f84
    • T
    • E
      Fast-path in String.Trim (#84300) · e9357808
      Egor Bogatov 提交于
      e9357808
    • D
      Use similar types for self-referential generics instead of the exact canonical type (#83995) · bc887b38
      David Wrighton 提交于
      - Take advantage of work done a few years ago to simplify the interaction with the interop subsystem
      - In the problematic case, simulate loads with two different types as instantiations which are unrelated in field layout, and see if they match up. Only enable this code in a few very small isolated parts of the runtime
      - Filter more of the type loader logic through the byvalue class cache which should improve performance a bit
      - Similarly when considering blittability, tweak the logic to use the special load path
      
      - Support for self-recursive generics is not enabled for static fields, as that requires a somewhat different tweak, and there is less apparent demand. (For that scenario self-referential generics really should support having fields of type T.)
      - Support for indirect self-recursive generics is also not enabled. The approach taken here is not practical for that, and there does not appear to be significant demand for that either.
      
      Fixes #6924
      bc887b38
    • M
      Add error check for skipped tests in merged groups (#84284) · 735ddeaf
      Mark Plesko 提交于
      If I test is written in the old style (with a Main and OutputType==Exe without an attribute such as RequiresProcessIsolation) in a merged test group directory, it will be skipped. This change adds a check to detect those cases.
      
      I have struggled with ways to automatically set OutputType. Directory.Build.props is too early (the test project file will override it). Directory.Build.targets is too late as the C# targets files will already have been processed and set other variables based on the value of OutputType. This Target doesn't execute until later, but since it is an error it doesn't matter how those additional properties were set.
      
      Since this adds more boilerplate to each merged test directory, I created a src/tests/Directory.Merged.props to share all of that.
      
      This catches 3 tests that aren't currently executing.
      
      Unrelated:
      
      - Use GetPathOfFileAbove in nearby locations for Directory.Build.props chaining rather than specific paths
      - Fix two easy IL warnings that appeared in my local build of all tests
      
      Resolves https://github.com/dotnet/runtime/issues/84182
      735ddeaf
    • W
      [JIT] Fix re-use val zero on GC tracking (#84051) · 00f921d4
      Will Smith 提交于
      * Initial work
      
      * Added genCodeForReuseVal
      
      * Only create a label if the current IG is not empty
      00f921d4
    • W
      [JIT] ARM64/X64 - Add `IsVNNeverNegative` (#83694) · 4f4fed0e
      Will Smith 提交于
      * Initial work
      
      * Handle arrlen case
      
      * Added ifdef
      
      * Additional cases
      
      * Additional cases
      
      * Add assert to IsVNNeverNegative
      
      * Update src/coreclr/jit/valuenum.cpp
      Co-authored-by: NBruce Forstall <brucefo@microsoft.com>
      
      * Additional cases
      
      ---------
      Co-authored-by: NBruce Forstall <brucefo@microsoft.com>
      4f4fed0e
    • T
      don't load MsQuic unless needed by HttpClient (#83494) · 56196485
      Tomas Weinfurt 提交于
      * don't load MsQuic unless needed by HttpClient
      
      * feedback from review
      56196485
  3. 04 4月, 2023 1 次提交
    • B
      Fix parallel SuperPMI output handling (#84219) · 50c9dca3
      Bruce Forstall 提交于
      Previously, parallel SuperPMI parsed very few kinds of output from
      the child processes, and ignored and discarded the rest. Change this
      so all output from the child processes is output by the parent
      process.
      
      For example, this allows the child process JIT to print out statistics,
      disasm, etc., and have it visible by the parent invoker.
      50c9dca3