Jan Kotas [Sun, 2 Oct 2022 23:57:04 +0000 (16:57 -0700)]
Delete security object from GCInfo encoder/decoder (#76487)
Fixes #76482
Tanner Gooding [Sun, 2 Oct 2022 16:42:49 +0000 (09:42 -0700)]
Ensure NI_Vector128_AsVector128 (aka `Vector128<T> AsVector128(this Vector<T> value)`) doesn't have a side-effect in its assert (#76460)
* Ensure NI_Vector128_AsVector128 (aka `Vector128<T> AsVector128(this Vector<T> value)`) doesn't have a side-effect in its assert
* CorInfoType no var_types
Egor Bogatov [Sun, 2 Oct 2022 16:34:38 +0000 (18:34 +0200)]
JIT: A small CQ improvement for Equals/StartsWith unrolling (#76439)
SingleAccretion [Sun, 2 Oct 2022 16:08:26 +0000 (19:08 +0300)]
Process primitives in local morph (#76155)
* Process primitives in local morph
* Delete folding code from morph
* Enable BITCAST folding
Only for RETURN users for now.
* Fix BOOL <-> UBYTE mismatch
We should really delete TYP_BOOL.
* Disable const prop for local fields
The code isn't actually set up for this. No diffs.
* Remove incorrect asserts
Kevin Jones [Sun, 2 Oct 2022 05:38:34 +0000 (01:38 -0400)]
Attempt to fix native AOT with CryptoKit (#76499)
Jan Kotas [Sun, 2 Oct 2022 04:08:45 +0000 (21:08 -0700)]
Re-enable DynamicGenerics test on OSX (#76489)
Fixes #73299
Egor Bogatov [Sun, 2 Oct 2022 04:07:48 +0000 (06:07 +0200)]
Revert change in AddInternedString (#76496)
* Restore all logic for AddInternedString
Fixes #76494
yowl [Sat, 1 Oct 2022 19:19:07 +0000 (14:19 -0500)]
Reinstate strict prototypes warning (#76463)
* reinstate strict-prototype warning
* More fixes
* Need to keep the warning disabled for zlib
https://github.com/madler/zlib/issues/633
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Bruce Forstall [Sat, 1 Oct 2022 18:48:43 +0000 (11:48 -0700)]
Fix SuperPMI unit test error checking (#76411)
* Fix SuperPMI unit test error checking
We were ignoring test failures, and even ignoring if the test
we wanted to run under collection actually existed. This means
that at some point during recent test reconfigurations, we
stopped building 10w5d_cs_do.cmd/sh but we didn't notice. Because
Bytemark kept being built as before, we got at least some .mc
files.
Add more checking that the programs we want to run exist, and
that the tests we invoke pass.
* Adjust superpmi unit test collection tests
Add CscBench to get better C# coverage.
Disable 10w5d_cs_do.csproj due to https://github.com/dotnet/runtime/issues/76421
Gilles Grospellier [Sat, 1 Oct 2022 16:32:12 +0000 (18:32 +0200)]
[JIT] Fix potential division by zero in fgopt.cpp (#76424)
Division by zero in C++ is undefined behavior on some architecture and
should be avoided.
Co-authored-by: Andy Ayers <andya@microsoft.com>
Kevin Jones [Sat, 1 Oct 2022 16:02:03 +0000 (12:02 -0400)]
Implement ChaCha20Poly1305 with CryptoKit on macOS
Co-authored-by: Filip Navara <filip.navara@gmail.com>
Andy Ayers [Sat, 1 Oct 2022 15:16:53 +0000 (08:16 -0700)]
JIT: allow forward sub of QMARK nodes (#76476)
There is often a single-def single use temp consuming a QMARK (which in
turn often comes from expansion of `isinst` and friends). This temp
assignment tends to stay around and can inhibit redundant branch opts
in a number of interesting cases. It may also serve as an attractive
nuisance for copy prop.
While it would be ideal to generalize RBO to handle assignment side
effects, doing so appears quite challenging, as we would need to rewrite
possibly large chunks of the SSA and VN graphs. Forward sub eliminates
the temp and so clears the way for the existing RBO to remove more branches.
Addresses aspects of the "side effect" enhancements for RBO (see #48115).
Bruce Forstall [Sat, 1 Oct 2022 14:31:50 +0000 (07:31 -0700)]
Update jitrollingbuild.py (#76472)
Pick up changes made to superpmi.py for more general finding of
`main` branch.
Make "list" choose a default git hash if not specified.
Change `list --all` to show all the JITs for a particular git hash.
Add new `list --global_all` to show all JITs for all git hashes
(this was previously `list --all`).
Fix obsoleted `logging.warn`; use `logging.warning` instead.
Filip Navara [Sat, 1 Oct 2022 14:12:54 +0000 (16:12 +0200)]
Improve early bail-out logic in GCInfoDecoder (#76359)
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Jakob Botsch Nielsen [Sat, 1 Oct 2022 09:48:16 +0000 (11:48 +0200)]
JIT: Avoid internal register allocation when possible for PUTARG_SPLIT (#76443)
We can almost always avoid allocating an internal register, which may be
expensive if LR is picked since we cannot use thumb encoding for it.
The only case where we need an internal register is when we have a
source that is in a register, and we have a single taget register to
place that conflicts with that source register. The to-stack copies then
need an intermediate scratch register to avoid clobbering the source
register.
Bruce Forstall [Sat, 1 Oct 2022 03:26:37 +0000 (20:26 -0700)]
Fix DEBUG/non-DEBUG SuperPMI asm diffs (#76470)
Recorded SPMI method contexts include configuration environment variables
such as `COMPlus_JITMinOpts` that are replayed. However, when doing
asmdiffs replays to compare a Release to a Checked compiler (non-DEBUG
to DEBUG), there may be codegen-altering configuration variables
such as JitStress that are only read and interpreted by the DEBUG
compiler. This leads to asm diffs.
Introduce a `-ignoreStoredConfig` argument to superpmi.exe, and use it
in superpmi.py when doing Checked/Release asm diffs, that pretends there
are no stored config variables. This assumes that the stored config variables
only alter JIT behavior but that they JIT will succeed with or without them.
This is also slightly more than necessary: if there is a config variable
that the Release compiler knows about, we won't use that, either. However,
we have no easy way (currently) to distinguish which variables are DEBUG
and which are both DEBUG and non-DEBUG available.
Contributes to https://github.com/dotnet/runtime/issues/76347
Aaron Robinson [Sat, 1 Oct 2022 00:04:49 +0000 (17:04 -0700)]
Remove `IDispatchImplAttribute` API (#76416)
* Remove IDispatchImplAttribute API
This type has never been supported on .NET Core.
Removing all supporting code paths.
Bruce Forstall [Fri, 30 Sep 2022 23:37:04 +0000 (16:37 -0700)]
SuperPMI collections: exclude more files/directories (#76384)
* SuperPMI collections: exclude more files/directories
Exclude a few more native code files and the 'runtimes' directory
that contains uninteresting files, including native code files,
to reduce the number of PMI exceptions during collections.
* Use python 'list' constructor to avoid modifying global lists
Jeremy Barton [Fri, 30 Sep 2022 23:30:51 +0000 (16:30 -0700)]
Use BCrypt for ephemeral RSA on Windows
Windows CNG has two different libraries: bcrypt.dll (`BCrypt*` functions) for in-memory/ephemeral operations, and ncrypt.dll (`NCrypt*` functions) for persisted key operations. Since the NCrypt functions can also operate on ephemeral keys our cryptographic operations have generally been done in terms of NCrypt.
NCrypt's flexibility (to also work with persisted keys) comes at a cost. All key operations are done out-of-process (in lsass.exe), and that requires an (L)RPC call for every operation. It also means there are simply more moving parts, and thus more room for error.
With this change we will use BCrypt for RSA operations on Windows from `RSA.Create()` and `cert.GetRSAPublicKey()`. ECDSA/ECDH/DSA can any/all be changed to follow suit later.
For keys created from RSA.Create() a verification operation currently looks like
* Virtual invoke to RSAWrapper.VerifyHash
* Maybe-devirtualized invoke to RSACng.VerifyHash
* P/Invoke to NCryptVerifySignature
* "Virtual" invoke to MSKSPVerifySignature (or whatever it's really called)
* LRPC call
* Find key in the MRU ring
* Effectively a call to BCryptVerifySignature
After this change it is instead
* Virtual invoke to RSABCrypt.VerifyHash
* P/Invoke to BCryptVerifySignature
Removing all of those other indirections removes about 40us from a 50us operation (on my primary devbox).
As part of making some code be shared between RSACng and RSABCrypt, some allocating code changed to pooling code and some array code got spanified.
Aleksey Kliger (λgeek) [Fri, 30 Sep 2022 23:20:55 +0000 (19:20 -0400)]
[metadata] Skip null vtable entries when checking covariant return overrides (#76323)
* Add test for covariant reabstraction
* [metadata] Skip null vtable entires when checking covariant overrides
When there are covariant return overrides, we check the vtable slot in every
parent class for signature compatability with the proposed override.
However if one of the ancestor classes is abstract, it could have an
abstract override for hte method:
class Base {
public virtual Base Method() => this;
}
public abstract Intermediate : Base {
public override abstract Base Method();
}
public Leaf : Intermediate {
public override Leaf Method() => this;
}
In this case when we're checking that Leaf.Method is compatible with
the vtable slot in Intermediate, we will see a null method (since
Intermediate is abstract). In such cases we can skip over the class
and continue with its parent.
Fixes
https://github.com/dotnet/runtime/issues/76312
Filip Navara [Fri, 30 Sep 2022 21:31:11 +0000 (23:31 +0200)]
[NativeAOT] Enable CI for macOS x64/arm64 (#75421)
* [NativeAOT] Enable CI for macOS x64/arm64
* Update CppCompilerAndLinker condition
* Enable NativeAOT osx-arm64 build in regular runtime pipeline
* Enable cross-compilation on macOS
* Fix HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP when cross-compiling
* Update OSVersion_ValidVersion_OSX test on NativeAOT
The test tries to validate Environment.OSVersion.Version which works correctly. RuntimeInformation.RuntimeIdentifier, however, doesn't use versioned RIDs when NativeAOT is used.
* Add hack to stop linker from corrupting DWARF CFI, bump darwin version in triple to get compact unwinding tables generated
* Bump ObjWriter packages
* Disable MessageSendTests on NativeAOT
Co-authored-by: Adeel <3840695+am11@users.noreply.github.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Will Smith [Fri, 30 Sep 2022 20:08:17 +0000 (13:08 -0700)]
Quick disasm check CI JitStress fix (#76417)
Runtime_33972 was failing in ARM64 in JitStress because it turns off HWIntrinsic - so I force the test to enable it.
Jan Kotas [Fri, 30 Sep 2022 20:00:15 +0000 (13:00 -0700)]
Increase timeouts for runtime-dev-innerloop legs (#76453)
Increase timeouts for runtime-dev-innerloop legs to compensate for intermittently slow build machines.
Fixes https://github.com/dotnet/arcade/issues/11072
yowl [Fri, 30 Sep 2022 18:30:54 +0000 (13:30 -0500)]
NativeAOT: Conversion for opcode conv_u4 is unsigned (#76386)
* fix probable type for conv_u4 to match conv_u8 regards unsigned conversion
* Fix conv_u as well
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Drew Scoggins [Fri, 30 Sep 2022 17:41:46 +0000 (10:41 -0700)]
Remove reliance on deactivated A64 queue (#76457)
SingleAccretion [Fri, 30 Sep 2022 15:36:35 +0000 (18:36 +0300)]
Always expose parents of exposed promoted fields (#76181)
* Remove the special case
* Simplify code
* Add tests
Brian Bohe [Fri, 30 Sep 2022 15:30:19 +0000 (08:30 -0700)]
Removing short name column from compphases.h (#76030)
* Avoiding the use of JIT phases shorName
* Removing shortName from JIT phases description
* Avoiding memory allocation
* Renaming variable
Andy Ayers [Fri, 30 Sep 2022 15:18:57 +0000 (08:18 -0700)]
JIT: increase slop tolerance when computing edge weights (#76409)
Up the tolerance a bit to get past some jit stress errors we're seeing.
Fixes the main case in #74169.
Alexander Köplinger [Fri, 30 Sep 2022 14:11:13 +0000 (16:11 +0200)]
[mono] Fix iOS/tvOS build with Xcode 14 (#76433)
Before Xcode 14 the `objc_super` struct definition in the SDK headers looked like this:
```
#if !defined(__cplusplus) && !__OBJC2__
/* For compatibility with old objc-runtime.h header */
__unsafe_unretained _Nonnull Class class;
#else
__unsafe_unretained _Nonnull Class super_class;
#endif
```
With Xcode 14 however the iOS/tvOS SDK header was changed to only define `super_class`, but the MacOSX SDK stayed the same.
Added CMake detection of this case so we can compile both on older and newer Xcode SDKs across platforms.
Steve Harter [Fri, 30 Sep 2022 13:51:44 +0000 (08:51 -0500)]
Support running Reflection tests within Visual Studio (#75915)
Kevin Jones [Fri, 30 Sep 2022 12:56:57 +0000 (08:56 -0400)]
Implement AuthenticationTagMismatchException exception
Co-authored-by: Filip Navara <filip.navara@gmail.com>
Ankit Jain [Fri, 30 Sep 2022 12:37:41 +0000 (08:37 -0400)]
[wasm] Add a workaround for issue#76429 to fix CI (#76432)
Radek Zikmund [Fri, 30 Sep 2022 12:19:03 +0000 (14:19 +0200)]
Add QuicError.AlpnInUse member (#74754)
* Import new MsQuic interop
* Detect the new QUIC status
* Use correct values for ALPN_IN_USE in interop shim
* Update alpine-3.14-helix-amd64 image to newer
Ankit Jain [Fri, 30 Sep 2022 08:27:04 +0000 (04:27 -0400)]
[wasm] Pass --web-server-use-cop for threading samples (#76419)
* [wasm] Pass --web-server-use-cop for threading samples
* CI: Add wasm samples to wasm specific paths list
Radek Zikmund [Fri, 30 Sep 2022 08:21:58 +0000 (10:21 +0200)]
Fix filtered exceptions when checking for ip forwarding (#76383)
Jan Vorlicek [Fri, 30 Sep 2022 08:00:01 +0000 (10:00 +0200)]
Fix edit and continue in VS with hardware exceptions (#76401)
There is a subtle bug in hardware exception handling in the runtime
that causes the debugged process to crash when a user tries to use the
"unwind to this frame" on the frame where the exception happened.
This issue was introduced by the recent changes that modified hardware
exception handling.
The problem turned out to be in how we update the exception and context
records in the HandleManagedFaultFilter when we re-raise the exception
using RaiseException from the VEH. Updating the context is both not
necessary and wrong. All we need to update is the `ExceptionAddress` in
the `EXCEPTION_RECORD`, since the RaiseException puts the address of
itself there and we need the address of the original access violation to
be there.
The context should stay untouched as we are unwinding from the
RaiseException.
The context copying was originally made to mimick the code in the
`NakedThrowHelper` used before the exception handling change. That one
needed the context update, as it was used to fix unwinding over the
NakedThrowHelper that was a hijack helper. In the current state, nothing
like that is needed.
With this fix, the VS debugger works as expected.
Shay Rojansky [Fri, 30 Sep 2022 07:15:06 +0000 (09:15 +0200)]
Distributed transaction fixes (#76310)
* Retake lock when using a dependent transaction from a
TransactionScope (#76010).
* Reset TransactionTransmitter and Receiver before reusing them
(#76010).
* Increase MSDTC startup timeout from 2.5 to 30 seconds (#75822)
Fixes #76010
Fixes #75822
Matous Kozak [Fri, 30 Sep 2022 06:04:40 +0000 (08:04 +0200)]
[mono] Add Vector128 Negate and OnesComplement intrinsics for amd64 (#74993)
* Vector128 Negate intrinsics (two's complement)
* AMD64 OnesComplement intrinsics for Vector128/64
* Negate + OnesComplement operands,fix missing break
* Simplify OP_AMD64_NEGATION
* Conditional Select for amd64, refactor arm64 code
* Re-use Arm64 code for Negate and OnesComplement
* rename ones complement
* Update src/mono/mono/mini/mini-ops.h remove space
Co-authored-by: Fan Yang <52458914+fanyang-mono@users.noreply.github.com>
* remove space mini-ops.hs
* remove blank line
Co-authored-by: Fan Yang <52458914+fanyang-mono@users.noreply.github.com>
Aaron Robinson [Fri, 30 Sep 2022 05:00:13 +0000 (22:00 -0700)]
Remove the GenericComPlusCall mechanism (#76415)
Remove unused asm constants.
Remove comments about context-bound objects and remoting.
Use common constants for VtblGap concept.
Michal Strehovský [Fri, 30 Sep 2022 04:49:26 +0000 (13:49 +0900)]
[NativeAOT] Fix System.Runtime.InteropServices tests (#75669)
Zoltan Varga [Fri, 30 Sep 2022 02:28:26 +0000 (22:28 -0400)]
[mono][jit] For beforefieldinit classes, only field accesses trigger initialization. (#76335)
Stephen Toub [Fri, 30 Sep 2022 02:14:30 +0000 (22:14 -0400)]
Remove some dead code from Array.IndexOf (#76388)
Tanner Gooding [Fri, 30 Sep 2022 01:24:23 +0000 (18:24 -0700)]
Remove GT_ADDEX and replace with more generalized containment handling (#76273)
* Remove GT_ADDEX and replace with more generalized containment handling
* Handle small types for (extended register) instructions
* Remember to handle IsRegOptional
* Applying formatting patch
* Preference containing the CAST of `ADD(op1, CAST(op2))` rather than the op2 of CAST
* Update src/coreclr/jit/lowerarmarch.cpp
* Adding a test covering the caught fuzzlyn scenario
* Ensure the new test returns 100
* Skip a Fuzzlyn generated regression test on Mono wasm/llvmaot/llvmfullaot
Peter Sollich [Thu, 29 Sep 2022 23:27:21 +0000 (01:27 +0200)]
Disable gen 1 budget accounting fix for segments, so the segments implementation of GC behaves like .NET 6.0 did. (#76365)
Mitchell Hwang [Thu, 29 Sep 2022 20:01:59 +0000 (16:01 -0400)]
[tests] Disable source generator tests mobile (#75609)
* Disable Source generator tests on all mobile platforms
* Remove redundant source generator test suite exclusions
Andy Ayers [Thu, 29 Sep 2022 18:03:53 +0000 (11:03 -0700)]
JIT: optimize redundant branches by looking through phis (#76283)
In some cases the value of a block's branch predicate is correlated with the
predecessor of the block. Often this correlation is hinted at by the presence
of phis in the predicate's tree and/or phi VNs in in the predicate's VN graph.
For each predecessor of a block, we evaluate the predicate value number using
the values brought to the block by that predecessor. If we find correlations,
we use them to drive the existing jump threading optimization.
Make sure that when we search local PHIs we also match the ssa def
number to ensure we're looking at the right PHI.
Also, if we end up partially disambiguating such that there is just one
remaining predecessor, update the value number of the predicate to reflect
the values that flow in from that predecessor.
Fixes #75944.
Contributes to #48115.
Tanner Gooding [Thu, 29 Sep 2022 17:56:28 +0000 (10:56 -0700)]
Ensure that StoreInd for contained HWIntrinsics has the constant "fit in byte" (#76385)
Jakob Botsch Nielsen [Thu, 29 Sep 2022 17:24:34 +0000 (19:24 +0200)]
SPMI: Improve speed significantly for large diffs (#76238)
This starts communicating more information about diffs back from
superpmi and starts using it in the driver. The current information is
the base size, diff size, base instructions, diff instructions and
context size.
The driver uses the base size/diff size to pick a small number of
interesting contexts and only creates disassembly for these contexts.
jit-analyze is then also invoked on only these contexts, but the
contexts are picked so that they overlap with what jit-analyze would
display. Additionally, we also pick the top 20 smallest contexts (in
terms of context size) -- I frequently use the smallest contexts with
diffs to investigate my change.
The new behavior is only enabled when no custom metrics are specified.
If custom metrics are specified we fall back to producing all
disassembly files and leave it up to jit-analyze to extract and analyze
the metrics specified.
Also, the retainTopFilesOnly option is no longer necessary since our CI
pipeline will at most produce 100 .dasm files now. Another benefit is that
this means that all contexts mentioned in the jit-analyze output will now be
part of the artifacts.
The net result is that we can now get SPMI diffs for changes with even
hundreds of thousands of diffs in the same time as it takes to get diffs
for a small change.
Fix #76178
Stephen Toub [Thu, 29 Sep 2022 16:44:23 +0000 (12:44 -0400)]
Return s_defaultResultTask from Task.FromResult in more cases (#76349)
* Return s_defaultResultTask from Task.FromResult in more cases
Today we return a cached task from Task.FromResult when the TResult is a primitive and its value is 0. But it needn't be constrained to only being a primitive; what matters is that we need to be able to efficiently compare its bit pattern to 0. And we can do that easily now by using Unsafe.SizeOf to check if the size is the same as a primitive, Unsafe casting to that primitive, and then comparing against 0.
* Update tests
kasperk81 [Thu, 29 Sep 2022 16:24:02 +0000 (19:24 +0300)]
remove explicit LangVersion from a few projects (#75806)
* remove explicit LangVersion from a few projects
* feedback
* net7.0
* net7.0
Co-authored-by: kasperk81 <kasperk81 83082615+kasperk81@users.noreply.github.com>
Co-authored-by: kasperk81 <kasperk81 kasperk81 83082615+kasperk81@users.noreply.github.com>
Alexander Köplinger [Thu, 29 Sep 2022 16:19:45 +0000 (18:19 +0200)]
Delete malformed package.json used for tests, it confuses Component Governance tooling (#76309)
Eric StJohn [Thu, 29 Sep 2022 15:34:51 +0000 (08:34 -0700)]
Updating owners (#76330)
Ilya [Thu, 29 Sep 2022 15:23:24 +0000 (20:23 +0500)]
Remove some extra static arrays used in Split() (#76003)
* Remove some extra static arrays used in Split
* Remove const
Michal Strehovský [Thu, 29 Sep 2022 14:35:34 +0000 (23:35 +0900)]
Fix using DependencyGraphViewer with AOT compilers (#76357)
The `readonly` addition was one of the 3600 diffs in #74825. `MarkStrategy` can have mutable state that was getting lost because Roslyn considers it valid to put `_marker` into a temporary before calling instance methods on it.
This resulted in DependencyGraphViewer hanging after seeing tens of thousands of new graphs being added.
James S. Wang [Thu, 29 Sep 2022 14:18:09 +0000 (10:18 -0400)]
Fix value type with static method fails to load (#76262)
* Allow static methods if checking type equivalence
* Add test for loading value type with static method
* Add test in which loading a value type with an instance method should throw a TypeLoadException
Michal Strehovský [Thu, 29 Sep 2022 14:17:23 +0000 (23:17 +0900)]
Generate single interface dispatch map per canonical form (#76362)
The dispatch maps are identical because canonically-equivalent types have the same vtable layouts.
Eirik Tsarpalis [Thu, 29 Sep 2022 14:05:52 +0000 (17:05 +0300)]
Make KeysCollection.Contains methods public. (#76319)
Ilya [Thu, 29 Sep 2022 13:36:12 +0000 (18:36 +0500)]
Bring back ReadOnlySpan in QuicStream (#76088)
Ryan Thomas [Thu, 29 Sep 2022 12:34:24 +0000 (07:34 -0500)]
Issue #75070 - Add PriorityQueue DequeueEnqueue Method (#75993)
* Issue #75070 - Add a DequeueEnqueue method to the System.Collections.Generic.PriorityQueue public api and unit test cases for the new method
* Issue #75070 - Remove unnecessary PriorityQueue DequeueEnqueue property test case and update DequeueEnqueue test assertion and xunit attribute
* Item #75070 - Revert the unnecessary name changes to the PriorityQueue.PropertyTests.cs test case method names
Stephen Toub [Thu, 29 Sep 2022 11:37:41 +0000 (07:37 -0400)]
Reduce Enum.GetEnumName overheads (#76162)
* Reduce Enum.GetEnumName overheads
This also helps Enum.ToString(), Enum.IsDefined, etc. Many enums are composed of sequential values starting at 0 (half of all enums in corelib, for example, meet this criteria). Today when looking up a value, we search the array of values, but if an enum is known to have such sequential values, we can instead just index into the array at the appropriate location.
* Address PR feedback
Stephen Toub [Thu, 29 Sep 2022 11:37:10 +0000 (07:37 -0400)]
Reduce allocations around empty ReadOnlyCollections (#76097)
* Reduce allocations around empty ReadOnlyCollections
- Add an internal (for now) `ReadOnlyCollection<T>.Empty`
- Return the singleton `ReadOnlyCollection<T>.Empty` from `Array.AsReadOnly` when the source is empty
- Return a singleton empty enumerator from an empty `ReadOnlyCollection<T>`
- Fix up some reflection code to avoid unnecessary `ReadOnlyCollection<T>` allocations (e.g. just to wrap empty arrays)
- Fix a null reference bug in RuntimeCustomAttributeData.NamedArguments (I don't know if it's actually reachable, but this property shouldn't be returning null)
- Avoid a few unnecessary allocations in TimeZoneInfo.GetSystemTimeZones
* Address feedback, fix faulty tests, improve ConcurrentDictionary
* Fix reflection test expecting specific type for IList
* Address PR feedback
Ankit Jain [Thu, 29 Sep 2022 09:44:43 +0000 (05:44 -0400)]
[wasm] Update templates to work for multiple versions (#76124)
Peter Sollich [Thu, 29 Sep 2022 09:09:01 +0000 (11:09 +0200)]
Fix distribute free regions (#74916)
As it turns out, distribute_free_regions does not do a very good job distributing free regions if there are fewer than the budget demands. There are several reasons:
- there is a bug in the adjustment_per_heap computation that causes the value to be too large - that is because dividing a negative number already rounds towards zero, and hence towards positive infinity, thus adding (n_heaps-1) before dividing is wrong.
- if the overall budget is not a multiple of the number of heaps, trying to fill each heap to the budget will allow heaps with higher numbers to have significant shortfalls.
- if the budget is not enough to cover the higher generations, heaps with high budget in these generations may cause other heaps to be unable to even cover their gen 0 budget.
The fix addresses these shortcomings:
- once we cover the budget for a generation, this is considered the minimum, higher generation budgets on other heaps are not allowed to reduce it below that minimum. So lower generations take priority, we are essentially trying to delay running out of budget as long as possible.
- we use a better algorithm to distribute a budget shortfall or surplus over all heaps. there is still a slight tendency for the last heap to receive fewer regions in the case of a shortfall.
Ilona Tomkowicz [Thu, 29 Sep 2022 08:56:31 +0000 (10:56 +0200)]
[wasm][debugger] Tests for static inherited members. (#75512)
* New tests: static inherited + fixed logic for them.
* Remove internal option after merge with main.
* Missing after-merge change.
Co-authored-by: Ankit Jain <radical@gmail.com>
Matous Kozak [Thu, 29 Sep 2022 08:15:54 +0000 (10:15 +0200)]
[mono] Fix missing defined and SIMD checks in Sqrt, Floor, Ceiling intrinsics (#76177)
* add missing defined
* SSE intrinsics check
* fix typo
* remove spaces
* add missing defined
* remove SSE and SSE2 checks
Marek Fišera [Thu, 29 Sep 2022 07:42:19 +0000 (09:42 +0200)]
[wasm] Templates nits (#76182)
- Add template descriptions.
- Unify string quotes.
Pavel Savara [Thu, 29 Sep 2022 07:17:19 +0000 (09:17 +0200)]
[wasm] new unit test for duplicate call to ImportAsync (#76179)
* new unit test
Filip Navara [Thu, 29 Sep 2022 07:06:28 +0000 (09:06 +0200)]
[Mono] Implement eager finalization of WeakReference (#76173)
* [Mono] Implement eager finalization of WeakReference
* Make the finalization really eager
* Move the eager finalization a bit earlier - to sgen_finalize_in_range (PR suggestion)
Co-authored-by: vsadov <8218165+VSadov@users.noreply.github.com>
Hyungju Lee [Thu, 29 Sep 2022 05:02:34 +0000 (14:02 +0900)]
Fix not to create unnecessary `thread_params` (#76007)
Tanner Gooding [Thu, 29 Sep 2022 04:28:21 +0000 (21:28 -0700)]
Adding a debug only config knob for testing loop unrolling limits (#76288)
* Adding a debug only config knob for testing loop unrolling limits
* Responding to PR feedback
* Fix a name
* Fixing the name of the JitConfig knob
* Apply formatting patch
Nathan Ricci [Thu, 29 Sep 2022 02:21:18 +0000 (22:21 -0400)]
[Mono][Test]Disable failing iossimulator tests (#74889)
Disable Added failing ioosimulator tests.
Stephen Toub [Thu, 29 Sep 2022 02:11:08 +0000 (22:11 -0400)]
Add List<T> AddRange, InsertRange, and CopyTo extensions for spans (#76274)
* Move CollectionExtensions to corelib
* Add CollectionExtensions.AddRange/InsertRange/CopyTo
* Update src/libraries/System.Private.CoreLib/src/System/Collections/Generic/CollectionExtensions.cs
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
* Update src/libraries/System.Private.CoreLib/src/System/Collections/Generic/CollectionExtensions.cs
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
Kevin Jones [Thu, 29 Sep 2022 01:59:00 +0000 (21:59 -0400)]
Dispose of key when importing X.509 certificate from PEM
Adeel Mujahid [Thu, 29 Sep 2022 00:14:35 +0000 (03:14 +0300)]
Add custom ResponseFile handler (#76271)
* Add custom ResponseFile handler
* Move handler to helpers and use in CG2
* Strip leading and trailing quotes from value
Co-authored-by: Jon Sequeira <jonsequeira@gmail.com>
Eric Erhardt [Wed, 28 Sep 2022 21:30:44 +0000 (16:30 -0500)]
Fix DiagnosticSource to work with NativeAOT (#76109)
* Fix DiagnosticSource to work with NativeAOT
There were 2 problems:
1. The use of MakeGenericType doesn't work when a property is a ValueType.
An app will crash when a listener is enabled and DiagnosticSourceEventSource tries
writing values.
2. The properties on KeyValuePair were not being preserved correctly, so the Arguments
of the DiagnosticSourceEventSource methods were not being serialized correctly.
Add test (and infrastructure) to ensure DiagnosticSource works in a NativeAOT app
Fix #75945
* Enable new NativeAotTests in CI
- Only run them in Release configuration
- Suppress IL2026 warning
* Don't run NativeAot published app tests on OSX since it isn't supported
Set EventSourceSupport only on the projects that need it.
Vlad Brezae [Wed, 28 Sep 2022 21:08:11 +0000 (00:08 +0300)]
[mono][interp] Replace sign extending moves to normal moves (#75837)
* [mono][interp] Replace sign extending moves to normal moves
If the source var doesn't have its address taken. These opcodes are very frequent (even over 5%) and they cannot be optimized out and block copy propagation.
* [mono][interp] Add implicit conversions when returning short ints
* [mono][interp] Make sure ret.i4.imm correctly handles short int returns
Will Smith [Wed, 28 Sep 2022 21:07:01 +0000 (14:07 -0700)]
More disasm check CI fixes (#76276)
* More disasm check CI fixes
* Quick fix
* More fixes. Force failure.
* Update Runtime_34937.cs
Bruce Forstall [Wed, 28 Sep 2022 21:03:32 +0000 (14:03 -0700)]
Don't run superpmi unit test if it appears a SPMI collection is in progress (#76311)
Maoni Stephens [Wed, 28 Sep 2022 20:40:05 +0000 (13:40 -0700)]
fix div by zero (#76294)
for regions generation size can be 0 since we don't have the gen start object anymore.
fixes #76257.
Anthony Shaw [Wed, 28 Sep 2022 18:40:13 +0000 (04:40 +1000)]
Replace GetFile() with GetPEAssembly() call in gdb (#76293)
Fixes #76291
David Cantú [Wed, 28 Sep 2022 18:39:44 +0000 (13:39 -0500)]
Use UTF8 encoding on Tar string fields (#75902)
* Use UTF8 encoding on Tar string fields
* Slice destination on Checksum
* Use Encoding.GetByteCount as fast path
* Use escape sequences on hardcoded UTF8 characters
* Fix ustar prefix logic and throw if name would be truncated
* Address feedback
* Fix truncation and prefix logic
* Fix nits
* Add async tests
* Add tests for unseekable streams
* Address feedback
Ken Dale [Wed, 28 Sep 2022 18:20:24 +0000 (14:20 -0400)]
Remove duplicate length words from xmldoc (#76315)
Eirik Tsarpalis [Wed, 28 Sep 2022 17:57:48 +0000 (20:57 +0300)]
Add missing xml documentation (#76191)
Kevin Jones [Wed, 28 Sep 2022 15:03:11 +0000 (11:03 -0400)]
Cache KeySizes array for EC types
Individual KeySizes instances themselves are immutable, so we can re-use instances there.
Arrays are mutable, so continue to return a copy of the array each time.
Will Smith [Wed, 28 Sep 2022 14:51:36 +0000 (07:51 -0700)]
Update disasm-checks documentation (#76286)
* Update disasm-checks documentation with limitations and future improvements
* Include not about anchors
* Update disasm-checks.md
Jamie Magee [Wed, 28 Sep 2022 14:51:15 +0000 (07:51 -0700)]
Add `$schema` to `cgmanifest.json` (#74933)
Co-authored-by: Jamie Magee <jamie.magee@microsoft.com>
Peter Sollich [Wed, 28 Sep 2022 14:33:11 +0000 (16:33 +0200)]
Gradual decommit in wks (#73620)
* Initial version of gradual decommit for WKS.
This is the regions version modeled after the behavior of the segments version.
Idea is simply to limit the amount of decommitted memory based on the time since the last GC.
* Change decommit_step to take a step_milliseconds parameter - this makes the logic for the WKS decommit more straightforward.
* Only do decommits at most every 100 milliseconds to limit the number of decommitted regions.
* Address code review feedback: disable the logic in decommit_ephemeral_segment_pages for WKS, some changes in distribute_free_regions as a consequence.
* Remove unused static field ephemeral_elapsed.
* Fix typo in comment.
Alexander Köplinger [Wed, 28 Sep 2022 14:28:21 +0000 (16:28 +0200)]
Use existing variable for SpecialFolder.UserProfile (#76299)
While looking at https://github.com/dotnet/runtime/pull/76250 I noticed that we were querying the HOME env variable for SpecialFolder.UserProfile but we're already doing that in PersistedFiles.GetHomeDirectory()
Michał Bryłka [Wed, 28 Sep 2022 14:17:26 +0000 (16:17 +0200)]
Fix #76260 Add nullable annotation to INumberBase<>.TryParse (#76272)
Miepee [Wed, 28 Sep 2022 11:19:50 +0000 (13:19 +0200)]
Make "Personal" on Android also point to a Documents folder (#76250)
#68610 moved `Personal`/`MyDocuments` on Unix systems from HOME to the documents folder.
However, it didn't do so for Android systems, which was only noticed after tests later failed. This fixes it.
Jo Shields [Wed, 28 Sep 2022 10:37:55 +0000 (06:37 -0400)]
Only bundle OpenSSL Android on actual Bionic builds (#76266)
Closes: #75080
Zoltan Varga [Wed, 28 Sep 2022 10:18:57 +0000 (06:18 -0400)]
[mono][llvm] Avoid making the 'this' variable in gshared methods volatile, the generated llvm code already saves it to separate variable for using during EH. (#76284)
Tom Deseyn [Wed, 28 Sep 2022 09:48:11 +0000 (11:48 +0200)]
Pass TargetRid and SourceBuildNonPortable to the native scripts (#74504)
* Pass SourceBuild TargetRid and SourceBuildPortable args through the native script.
* Rename -packagerid to -distrorid.
* Fix init-distro-rid.sh.
* Use OutputRid instead of PackageRid.
* Drop unnecessary Condition.
* Try passing --distrorid as OutputRid.
* NativeExport: use PackageRID for AppHostRuntimeIdentifier.
* Rename --distrorid to --outputrid.
* Fix SourceBuild.props.
* Undo changes to init-distro-rid.sh.
* Let source-build leg build 'banana-x64' rid.
* SourceBuild.props: don't force a RuntimeOS.
* SourceBuild.props: set AdditionalRuntimeIdentifierParent.
* Build banana.24-x64 instead.
* Fix SourceBuild.props.
* SourceBuild.props: try fix AdditionalRuntimeIdentifier* usage.
* source-build.yml: add runtimeOS parameter.
* SourceBuild.props: derive RuntimeOS from NETCoreSdkRuntimeIdentifier.
* Undo using NETCoreSdkRuntimeIdentifier.
* Update eng/pipelines/common/global-build-job.yml
Co-authored-by: Jeremy Koritzinsky <jkoritzinsky@gmail.com>
Co-authored-by: Jeremy Koritzinsky <jkoritzinsky@gmail.com>
Zoltan Varga [Wed, 28 Sep 2022 09:18:20 +0000 (05:18 -0400)]
[wasm] Run System.Runtime tests in a deterministic order to work around https://github.com/dotnet/runtime/issues/74302. (#76287)
Michal Strehovský [Wed, 28 Sep 2022 06:26:25 +0000 (15:26 +0900)]
Align repro project settings with SDK defaults (#76233)
Small quality-of-life improvement since the SDK default means less code to compile and faster compile times.
Matous Kozak [Wed, 28 Sep 2022 05:02:15 +0000 (07:02 +0200)]
increase number of Apple trampolines to 40000 (#76246)
Michal Strehovský [Wed, 28 Sep 2022 00:34:15 +0000 (09:34 +0900)]
Remove IlcTrimMetadata=false from a couple tests (#76234)
Contributes to https://github.com/dotnet/runtime/issues/71506.
Michal Strehovský [Wed, 28 Sep 2022 00:15:28 +0000 (09:15 +0900)]
Fix diagnostic for properties on instantiated types (#76227)
There was a bug in the code that maps accessor names to property names when the method is on an instantiated type. We would incorrectly demangle getters into setters.
Also made this do the same thing for events.
Also changed the throw to an assert. We don't really want to crash the compiler if there's a bug here.
Zoltan Varga [Tue, 27 Sep 2022 23:26:43 +0000 (19:26 -0400)]
[wasm] Keep all icall wrappers in profile only mode, the generated code depends on it. (#75918)
James S. Wang [Tue, 27 Sep 2022 23:23:29 +0000 (19:23 -0400)]
Change comments from COMPlus to DOTNET when referring to prefixes of env vars (#76264)