Eirik Tsarpalis [Mon, 30 May 2022 10:34:44 +0000 (11:34 +0100)]
Add issue cleanup documentation and update automation (#69857)
Marek Fišera [Mon, 30 May 2022 10:25:35 +0000 (12:25 +0200)]
[wasm] Process WebSocket connection errors on NodeJS (#69858)
SingleAccretion [Mon, 30 May 2022 09:47:47 +0000 (12:47 +0300)]
Use the signature's struct handle for making outgoing arg copies (#69971)
* Do not depend on class handle in "fgMorphArgs"
Use the signature's handle when making an outgoing arg copy.
* Add a test
SingleAccretion [Mon, 30 May 2022 09:46:14 +0000 (12:46 +0300)]
Delete dead rationalizer transform (#69958)
Seems to have been a workaround for an issue long gone.
Peter Sollich [Mon, 30 May 2022 09:21:47 +0000 (11:21 +0200)]
Fix setting of DacpHeapSegmentData::highAllocMark on DAC side. (#69670)
Fix setting of DacpHeapSegmentData::highAllocMark on DAC side. Keep some logic for backward compat in dacprivate.h, the copy here and the one in the Diagnostics repo, so that a new SOS can work correctly with an older DAC.
The PR in the diagnostics repo is this: dotnet/diagnostics#3062.
Peter Sollich [Mon, 30 May 2022 09:20:24 +0000 (11:20 +0200)]
Add the repro case for github issue #68443 (https://github.com/dotnet/runtime/issues/68443) as a GC test case. (#69496)
Let's figure out later whether this test should be part of the GC stress test and/or be added to a CI config.
Jan Kotas [Mon, 30 May 2022 03:57:24 +0000 (20:57 -0700)]
Change dispenser policy for RuntimeAssembly to ReuseAlways (#69937)
This matches the policy used by all other runtime flavors.
Fixes #69743
Prasanta Chettri [Sun, 29 May 2022 17:15:01 +0000 (22:45 +0530)]
changed frequently used redhawk mentions. (#69962)
Huo Yaoyuan [Sun, 29 May 2022 13:12:49 +0000 (21:12 +0800)]
Convert Valuetype.FastEqualsCheck and GetHashCodeOfPtr to managed (#69723)
* Convert GetHashCodeOfPtr to managed
* Convert FastEqualsCheck to managed
* Add FCall to get object size
* Reduce local variable creation
* Change FCall to pass MethodTable*
* Sort ecallist and move to MethodTableNative
Jan Kotas [Sun, 29 May 2022 01:52:27 +0000 (18:52 -0700)]
Rename NativeMemory.ZeroMemory (#69948)
- Rename NativeMemory.ZeroMemory to NativeMemory.Clear. Contributes to #69606
- Delete internal Buffer.ZeroMemory and replace it with NativeMemory.Clear
Andy Ayers [Sun, 29 May 2022 00:39:01 +0000 (17:39 -0700)]
JIT: fix jit stress now that W^X is enabled (#69946)
One bit of code that only executes under stress was writing to the wrong
offset, causing the jit to crash.
Huo Yaoyuan [Sat, 28 May 2022 17:07:24 +0000 (01:07 +0800)]
Remove unused MissingMemberException.FormatSignature (#69890)
* Remove unused native code
* Remove FormatSignature
* Add comment and adjust message formatting
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
SingleAccretion [Sat, 28 May 2022 15:48:41 +0000 (18:48 +0300)]
Handle mis-sized structs in ARM/64 `PUTARG_STK` codegen (#69905)
* Handle mis-sized structs for PUTARG_STK on ARM/64
We will now generate a series of small loads as necessary
to handle "remainderSize"s of 3, 5, 6 and 7.
* Add tests
* Re-enable tests for 60705
Andy Ayers [Sat, 28 May 2022 15:16:19 +0000 (08:16 -0700)]
JIT: allow pinvoke calli helper in TreatAsShouldHaveRetBufArg (#69927)
If we have multiple cold pinvokes in return positions that return
structs by value and we are merging returns, we will end up querying
these calls post-morph, and may see them using CORINFO_HELP_PINVOKE_CALLI.
Fixes #69612.
SingleAccretion [Sat, 28 May 2022 15:04:49 +0000 (18:04 +0300)]
Relax the address exposure condition in forward substitution (#69818)
* Relax the AX condition in forward substitution
* Work around an issue with multi-regs in fwd sub
We only support calls or locals as sources of multi-reg returns.
Tanner Gooding [Sat, 28 May 2022 06:51:39 +0000 (23:51 -0700)]
Refactoring the generic-math CreateChecked/Saturating/Truncating APIs to match API review (#69756)
* Update MicrosoftNetCompilersToolsetVersion to 4.3.0-2.22270.4
* Moving System.Runtime.InteropServices.NFloat down to System.Runtime
* Removing the generic-math CreateChecked, CreateSaturating, CreateTruncating, and TryCreate implementations
* Removing the generic-math TryCreate tests
* Adding the TryConvertTo* and TryConvertFrom* generic math APIs for Checked, Saturating, and Truncating
* Filling out test coverage for the CreateChecked generic-math API
* Fix some edge cases for the CreateSaturating generic-math APIs
* Filling out test coverage for the CreateSaturating generic-math API
* Fix some edge cases for the CreateTruncating generic-math APIs
* Filling out test coverage for the CreateTruncating generic-math API
* Fixing some edge cases in converting BigInteger/Complex to the primitive types
* Filling out test coverage for converting BigInteger and Complex to the primitive types
* Fixing some 32-bit generic-math tests
* Removing the static virtual declarations since things are falling over
* Skipping some tests on Mono where it has bad behavior
* Revert "Removing the static virtual declarations since things are falling over"
This reverts commit
baf69de8576f8528125e6ddee518d3dd310e9e9b.
* Move NFloat back to System.Runtime.InteropServices based on feedback
* Fixing the Int128/UInt128 to Decimal tests
* Ensure `JIT_Dbl2ULng` correctly handles NaN
* Revert "Ensure `JIT_Dbl2ULng` correctly handles NaN"
This reverts commit
329834538e262318f5cf599d9e98a748b9f6a8b9.
* Explicitly ensure floating-point to ulong conversion returns 0 for NaN
Ankit Jain [Sat, 28 May 2022 06:02:07 +0000 (02:02 -0400)]
[wasm] Explicitly include mscorlib.dll, to support scanning assemblies (#69886)
* [wasm] Explicitly include mscorlib.dll, to support scanning assemblies
.. with mscorlib dependency.
This showed up when scanning `Dia2Lib` for icalls, which is indirectly
used by the microbenchmarks in `dotnet/performance`. It would fail with:
```
System.IO.FileNotFoundException: Could not find assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=
b77a5c561934e089'.
Either explicitly load this assembly using a method such as LoadFromAssemblyPath() or use a MetadataAssemblyResolver that returns a valid assembly.
at System.Reflection.TypeLoading.Ecma.EcmaResolver.ResolveAssembly(AssemblyReferenceHandle handle, EcmaModule module)
at System.Reflection.TypeLoading.Ecma.EcmaResolver.ComputeTypeRefResolution(TypeReferenceHandle handle, EcmaModule module)
at System.Reflection.TypeLoading.Ecma.EcmaResolver.ResolveTypeRef(TypeReferenceHandle handle, EcmaModule module)
at System.Reflection.TypeLoading.Ecma.EcmaModule.GetTypeFromReference(MetadataReader reader, TypeReferenceHandle handle, Byte rawTypeKind)
at System.Reflection.Metadata.Ecma335.SignatureDecoder`2.DecodeTypeHandle(BlobReader& blobReader, Byte rawTypeKind, Boolean allowTypeSpecifications)
at System.Reflection.Metadata.Ecma335.SignatureDecoder`2.DecodeType(BlobReader& blobReader, Boolean allowTypeSpecifications, Int32 typeCode)
at System.Reflection.Metadata.Ecma335.SignatureDecoder`2.DecodeType(BlobReader& blobReader, Boolean allowTypeSpecifications, Int32 typeCode)
at System.Reflection.Metadata.Ecma335.SignatureDecoder`2.DecodeMethodSignature(BlobReader& blobReader)
at System.Reflection.TypeLoading.Ecma.EcmaMethodDecoder.SpecializeMethodSig(IRoMethodBase roMethodBase)
at System.Reflection.TypeLoading.RoDefinitionMethod`1.ComputeMethodSig()
at System.Reflection.TypeLoading.RoMethod.get_ReturnType()
at SignatureMapper.MethodToSignature(MethodInfo method)
at IcallTableGenerator.<ProcessType>g__AddSignature|15_1(Type type, MethodInfo method)
at IcallTableGenerator.ProcessType(Type type)
at IcallTableGenerator.GenIcallTable(String runtimeIcallTableFile, String[] assemblies, String outputPath)
at ManagedToNativeGenerator.ExecuteInternal()
at ManagedToNativeGenerator.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)
```
This is thrown when `SignatureMapper.MethodToSignature` called
`method.ReturnType` for:
```
.method public hidebysig newslot virtual
instance void loadAndValidateDataFromPdb([in] string marshal( lpwstr) pdbPath,
[in] [mscorlib]System.Guid& pcsig70,
[in] uint32 sig,
[in] uint32 age) runtime managed internalcall
{
.override Dia2Lib.IDiaDataSource::loadAndValidateDataFromPdb
} // end of method DiaSourceClass::loadAndValidateDataFromPdb
```
We use `PathAssemblyResolver` with a closed set of assemblies, which
didn't include mscorlib.dll . So, we include that explicitly from the
runtime pack.
Fixes https://github.com/dotnet/runtime/issues/69861
* Add mscorlib.dll, only if it wasn't already there.
`System.Reflection.MetadataLoadContext.Tests` tests failed:
```
The "ManagedToNativeGenerator" task failed unexpectedly. [/datadisks/disk1/work/
9ABB086E/w/
BDA50A35/e/publish/ProxyProjectForAOTOnHelix.proj]
System.IO.FileLoadException: The assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=
b77a5c561934e089' has already loaded been loaded into this MetadataLoadContext. [/datadisks/disk1/work/
9ABB086E/w/
BDA50A35/e/publish/ProxyProjectForAOTOnHelix.proj]
at System.Reflection.MetadataLoadContext.LoadFromStreamCore(Stream peStream) [/datadisks/disk1/work/
9ABB086E/w/
BDA50A35/e/publish/ProxyProjectForAOTOnHelix.proj]
at System.Reflection.MetadataLoadContext.LoadFromAssemblyPath(String assemblyPath) [/datadisks/disk1/work/
9ABB086E/w/
BDA50A35/e/publish/ProxyProjectForAOTOnHelix.proj]
at PInvokeTableGenerator.GenPInvokeTable(String[] pinvokeModules, String[] assemblies, String outputPath) in /_/src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs:line 37 [/datadisks/disk1/work/
9ABB086E/w/
BDA50A35/e/publish/ProxyProjectForAOTOnHelix.proj]
at ManagedToNativeGenerator.ExecuteInternal() in /_/src/tasks/WasmAppBuilder/ManagedToNativeGenerator.cs:line 71 [/datadisks/disk1/work/
9ABB086E/w/
BDA50A35/e/publish/ProxyProjectForAOTOnHelix.proj]
at ManagedToNativeGenerator.Execute() in /_/src/tasks/WasmAppBuilder/ManagedToNativeGenerator.cs:line 56 [/datadisks/disk1/work/
9ABB086E/w/
BDA50A35/e/publish/ProxyProjectForAOTOnHelix.proj]
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/datadisks/disk1/work/
9ABB086E/w/
BDA50A35/e/publish/ProxyProjectForAOTOnHelix.proj]
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)
```
Michal Strehovský [Sat, 28 May 2022 05:31:50 +0000 (14:31 +0900)]
Implement LoadLibraryErrorTracker (#69842)
Finishes the LoadLibraryErrorTracker port from CoreCLR VM to C#.
This allows us to report more details about the reason of `DllImport` resolution failures at runtime.
The logic matches CoreCLR. There might be a slight behavior difference for empty string literal `DllImport`/`NativeLibrary.Load`. Not sure we care enough (I couldn't discern what the CoreCLR behavior is - I think we report an arbitrary old message from the last load attempt since we never even try to `dlopen` the empty string).
Instead of:
```
System.DllNotFoundException: Unable to load native library 'bruh' or one of its dependencies.
```
We can now do:
```
System.DllNotFoundException: Unable to load DLL 'bruh' or one of its dependencies: The process cannot access the file because it is being used by another process.
```
Zoltan Varga [Sat, 28 May 2022 03:50:14 +0000 (23:50 -0400)]
[mono][wasm] Pin thrown exceptions during EH. (#69916)
Fixes https://github.com/dotnet/runtime/issues/63749.
Kevin Jones [Sat, 28 May 2022 02:54:32 +0000 (22:54 -0400)]
Implement PemEncoding.WriteString
Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
Elinor Fung [Sat, 28 May 2022 02:46:16 +0000 (19:46 -0700)]
Pin char when UTF-16 marshalling is specified and runtime marshalling is disabled (#69837)
Olli Saarikivi [Sat, 28 May 2022 01:41:21 +0000 (18:41 -0700)]
Remove Or, And, Not + related fixes (#69839)
* Remove unordered Or, And and Not.
The SymbolicRegexNodeKind elements Or, And and Not as well as any related classes/functions have been removed.
This includes SymbolicRegexSet, TransitionRegex and SymbolicNFA.
SaveDGML, which depended on Or, has been reworked by pulling out the exploration logic into
SymbolicRegexMatcher.Explore, which does the exploration in the main transition structures of the matcher.
GenerateRandomMembers is now SampleMatches and has also been rewritten to use the transition logic from
SymbolicRegexMatcher.
SymbolicRegexMatcher is now a partial class and SaveDGML, Explore, and SampleMatches are implemented in
separate files as additions to the matcher.
* Remove negative sampling
Negative sampling in GenerateRandomMembers depended on Not.
* Rename OrderedOr to Alternate
* Fix and generalize FixedLengthMarker support
Logic to extract the fixed length out of an end state is now in SymbolicRegexNode.ResolveFixedLength. The new function
supports finding the fixed length marker on the path that the backtracking matcher would accept a match and also
supports conditional nullability.
Logic to add fixed length markers in RegexNodeConverter is now in a function
SymbolicRegexNode.AddFixedLengthMarkers, which made it easier to make more general.
Nathan Ricci [Sat, 28 May 2022 01:21:42 +0000 (21:21 -0400)]
[MONO] Factor marshal-lightweight out of marshal-ilgen (#69208)
Refactor marshaling code into marshal-ilgen and marshal-lightweight.
Bruce Forstall [Sat, 28 May 2022 00:40:15 +0000 (17:40 -0700)]
Optimize better with maximum array length (#69735)
* Optimize better with maximum array length
The maximum array length is 0x7FFFFFC7 (see
https://github.com/dotnet/runtime/pull/43301), which is slightly less than
the largest 32-bit signed integer. Use this value in range check and assertion
prop to optimize better. This is due do knowing that a value smaller than
the maximum array length plus a small constant will not overflow. This leads
to being able to remove some bounds checks.
* Use CORINFO_Array_MaxLength
* Consider both Span and array for bounds check limit
* Formatting
Eric Erhardt [Sat, 28 May 2022 00:16:45 +0000 (19:16 -0500)]
Fix Stream.ReadAtLeast perf regression in DataContractSerializer (#69879)
* Fix Stream.ReadAtLeast perf regression in DataContractSerializer
#69272 changed DCS to no longer call Stream.Read inside a loop, but instead call the new ReadAtLeast method. ReadAtLeast only takes a Span<byte>, and not a byte[]. This caused a regression because the internal encoding stream wrapper classes don't override Read(Span<byte>), so the base implementation is used. The base implementation is slower because it needs to rent a byte[] from the pool, and do 2 copies.
Overriding Read(Span<byte>) on the internal encoding stream wrapper classes allows ReadAtLeast to be just as fast.
Fix #69730
* Add Span overloads for Stream Read and Write implementations that don't currently override the Span overloads.
Elinor Fung [Fri, 27 May 2022 23:47:05 +0000 (16:47 -0700)]
Fix state buffer length in OdbcHandle.GetDiagnosticRecord (#69914)
Ankit Jain [Fri, 27 May 2022 22:58:37 +0000 (18:58 -0400)]
[wasm] Disable runtime test failing due to stack overflow (#69863)
* [wasm] Disable runtime test failing due to stack overflow
`JIT/Directed/tailcall/tailcall/tailcall.sh`
Issue: https://github.com/dotnet/runtime/issues/69517
* Also disable JIT/Directed/IL/Tailcall/ExplicitTailCallNoSO/ExplicitTailCallNoSO.sh
* try to fix the exclusion
* Fix path for exclusion
David Wrighton [Fri, 27 May 2022 22:23:54 +0000 (15:23 -0700)]
Remove CORCOMPILE_IMPORT_SECTION (#69881)
- Replace with direct use of ready to run data structures in runtime
- Remove pointer tagging that is not relevant in a R2R based world
Qiao Pengcheng [Fri, 27 May 2022 21:25:00 +0000 (05:25 +0800)]
[LoongArch64] enable the promote feature. (#69840)
SingleAccretion [Fri, 27 May 2022 18:33:44 +0000 (21:33 +0300)]
Do not recost and rethread trees inside `optRemoveRangeCheck` (#69895)
* Do not set order in "optRemoveRangeCheck"
All but one caller of the method (RangeCheck) already do so in
their "for (GenTree* node : stmt->TreeList())" loops, so it is
not necessary.
Additionally, re-threading the statement, when combined with
"gtSetEvalOrder", can have the consequence of redirecting said
loops, possibly causing them to miss some trees, which was
observed in early propagation when working on removing "GT_INDEX".
A few small diffs because we no longer recost when removing
range checks in loop cloning, which is generally not necessary
because cloning runs before the "global" costing is performed,
except there is one quirk in "gtSetEvalOrder" which was looking
as "compCurStmt", and that is not set during "fgSetBlockOrder".
* Work around a TP regression
Gets us back 0.13% (!!!) instructions according to PIN.
Aman Khalid [Fri, 27 May 2022 18:26:57 +0000 (11:26 -0700)]
Implement fake hot/cold splitting and corresponding stress mode (#69763)
* Implemented fake code splitting in JIT for testing without VM
* Implement stress mode for hot/cold splitting
Implementation splits after first basic block in method, assuming
there is more than one block. Accompanying this implementation are
the following fixes:
- Loop alignment is disabled for cold blocks, as moving blocks
into the cold section may invalidate the initial decision to align.
- Long jumps are no longer reduced to short jumps if crossing
hot/cold sections.
Co-authored-by: Aman Khalid <t-amankhalid@microsoft.com>
Stephen Toub [Fri, 27 May 2022 18:05:11 +0000 (14:05 -0400)]
A few tweaks to regex source generator comments / naming for lookbehinds (#69773)
* Improve loop comments to highlight when iterating in reverse
* Use more descriptive local for lookaround naming
* Address PR feedback
Jeremy Koritzinsky [Fri, 27 May 2022 17:20:06 +0000 (10:20 -0700)]
Don't pin managed collection objects when the contents are non-blittable. (#69696)
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
SingleAccretion [Fri, 27 May 2022 15:59:51 +0000 (18:59 +0300)]
Deleting field sequences from `LCL_FLD` and `VNF_PtrToArrElem` (#68986)
* Delete field sequences from GenTreeLclFld
* Delete field sequences from VNF_PtrToArrElem
* Clean up "DefinesLocalAddr"
Move the responsibility of determining "entireness" to
its only caller that needed to do that: "DefinesLocal".
Add function headers.
No diffs.
* Also clean up block morphing a little
No diffs.
* Fix a potential bug with return buffer numbering
Also address the TODO-CQ.
* Fix another "VN maintainance in morph" bug
Exposed by the more aggressive hoisting.
Kevin Jones [Fri, 27 May 2022 15:44:45 +0000 (11:44 -0400)]
Remove a few more unnecessary allocations in X.509
Marie Píchová [Fri, 27 May 2022 08:05:08 +0000 (10:05 +0200)]
[QUIC] Fix flags usage on Linux (#69874)
Ilona Tomkowicz [Fri, 27 May 2022 05:55:05 +0000 (07:55 +0200)]
Display parents' members on GetProperties. (#68907)
* Prepared tests with the same members as in Console App.
* Adding parents' members to match the expected result in tests.
* Increasing the timeout because some EvaluateOnCallFrameTests tests take up to 63 sec.
* Reverting timeout editions.
* Applied refactoring suggestions from @radical and @thaystg.
* Added new text cases with addnotation which fields are displayed incorrectly and should be fixed.
* More detailed error message for count mismatch.
* Reorganising tests with order: grouping similar members.
* Fixing override/new problem.
* Fixing test to reflect ConsoleApp behavior.
* Wrong name - it should be tested with the new class: 2.
* Applied @radical's suggestion about backingField.
* @radical's changes - refactor + one new test case.
* Checking Getter vals; AssertEqual(cnt) not needed.
* New test cases, some to be fixed in the follow-up issue.
* Added @radical's suggestions.
* Different DataTimes for each property.
Marek Fišera [Fri, 27 May 2022 05:41:25 +0000 (07:41 +0200)]
Make interp_to_native_signatures_count static (#69867)
Update ManageToNativeGenerator to produce interp_to_native_signatures_count as static variable.
Antoine Martin [Thu, 26 May 2022 22:32:43 +0000 (18:32 -0400)]
fixed distroRid having the last version digit for alpine (#62942)
Epsitha Ananth [Thu, 26 May 2022 22:24:22 +0000 (15:24 -0700)]
Restore internal tools (#69753)
* test restore internal tools
* test
* Retry
Jakob Botsch Nielsen [Thu, 26 May 2022 21:25:12 +0000 (23:25 +0200)]
Make SPMI collections work on crashes/assertion failures (#69494)
This changes SPMI to set up a PAL_TRY/PAL_FINALLY around the call to
ICorJitCompiler::compileMethod and save the method context in the finally. To
make this work we also need to pass COMPlus_JitThrowOnAssertionFailure=1 to
avoid the failfast so that the PAL_FINALLY is actually invoked.
To support hardware exceptions on non-Windows a little work was required:
* On non-Windows we were not passing an exports file when linking
superpmi-shim-collector leading to exporting the entire PAL and tons of
unnecessary functions. This would additionally mean we were calling
PAL_InitializeDll in two places: on load, the coreclr PAL loader would invoke
PAL_RegisterModule that does initialization, and then we would call it
manually again from jitStartup. While the double initialization was ok it made
reasoning about initialization difficult (and different from clrjit).
* We need to pass PAL_INITIALIZE_REGISTER_SIGNALS on initialization of the PAL
make sure it properly attaches signal handlers that translates hardware
exceptions to C++ exceptions. We cannot rely on the signal handler registered
by coreclr as the different PALs have different CPalThread structures attached
to the current thread. This means that coreclr's signal handler will not
translate hardware exceptions occurring in the JIT even when we have a PAL_TRY
in superpmi-shim-collector that tries to enable hardware exceptions. We need
to define FEATURE_ENABLE_HARDWARE_EXCEPTIONS.
In addition I have changed the recording to record contexts indiscriminately,
even when we don't return CORJIT_OK.
With these changes I have verified that collections generated when there are
either JIT assertion failures or segfault/AV in JIT generates a collection that
reproduces the problem on Windows, Ubuntu and macOS.
Fixes #41649
Buyaa Namnan [Thu, 26 May 2022 21:15:26 +0000 (14:15 -0700)]
Fix value type unboxing bug (#69815)
Adam Sitnik [Thu, 26 May 2022 20:33:22 +0000 (22:33 +0200)]
File system type fix (#69484)
Co-authored-by: Tom Deseyn <tom.deseyn@gmail.com>
Adeel Mujahid [Thu, 26 May 2022 19:57:35 +0000 (22:57 +0300)]
Update gcc leg to 12.1.0 (#69188)
* Update gcc leg to 12.1.0
* Fix -Wdangling-pointer
* Adjust gcc suppression
Radek Zikmund [Thu, 26 May 2022 19:22:29 +0000 (21:22 +0200)]
Redisable timouting MsQuic tests (#69843)
Elinor Fung [Thu, 26 May 2022 19:08:01 +0000 (12:08 -0700)]
[LibraryImportGenerator] Reduce unnecessary casting/locals in pinning path (#69804)
Qiao Pengcheng [Thu, 26 May 2022 19:03:33 +0000 (03:03 +0800)]
[LoongArch64] Fixed the exception's dispatch by EPC. (#69712) (#69712)
Mike McLaughlin [Thu, 26 May 2022 18:39:45 +0000 (11:39 -0700)]
Better createdump error messages (#69663)
Better createdump error messages
Redirect stderr when launching createdump to get any error text.
Added a new generate core dump ipc message that allows a error message string
to be returned for more detail on createdump errors.
Update test Microsoft.Diagnostics.NETCore.Client with new generate dump command
Jeremy Koritzinsky [Thu, 26 May 2022 17:29:00 +0000 (10:29 -0700)]
Remove extraneous diagnostic (#69830)
Jose Perez Rodriguez [Thu, 26 May 2022 16:20:35 +0000 (09:20 -0700)]
Adding analyzer/fixer for the Regex Source Generator (#68976)
* Adding analyzer/fixer for the Regex Source Generator
* Adding some tests to the analyzer and fixer
* Fix build and reference live ref pack
* Address remaining feedback and fix top-level statement programs
* Addressing PR Feedback
* Disabling the tests for Mono
Elinor Fung [Thu, 26 May 2022 14:18:36 +0000 (07:18 -0700)]
Some clean-up of host tests (#69802)
* Use shared test utilities for test artifacts and tracing
* Delete unused test utilities
Tomas Weinfurt [Thu, 26 May 2022 13:28:47 +0000 (15:28 +0200)]
pool async state in SslStream (#69418)
* pool async state in SslStream
* fix tests
* remove GetAwaiter from test
Ilona Tomkowicz [Thu, 26 May 2022 12:46:32 +0000 (14:46 +0200)]
Add EvaluationResult Scheme for arrays. (#67095)
* Test expanding the properties of a result returned by a method evaluated on a primitive type.
* Enable caching evaluationResult in scopeCache.
* Cache arrays that are returned as a method evaluation result.
* Enable getting evaluationResults from cache on request.
* Fixed Firefox test.
Radek Zikmund [Thu, 26 May 2022 06:20:15 +0000 (08:20 +0200)]
Disable failing MsQuic tests on Windows (#69798)
* Disable failing MsQuic tests on Windows
* Switch to SkipTestException
Andy Ayers [Thu, 26 May 2022 04:44:18 +0000 (21:44 -0700)]
Fix VM calling convention detection for some pinvokes (#69774)
* Fix VM calling convention detection for some pinvokes
The previous calling convention logic was written
assuming the CallConv* collection of types were
in FQTN, including an assembly. However, if the
type is being used in the assembly it is defined,
SPCL, then we fail to match the name of the type.
* Review feedback.
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
Michal Strehovský [Thu, 26 May 2022 03:44:22 +0000 (12:44 +0900)]
Add default method support to virtual statics (#69783)
Corresponds to #64717 that I somehow missed, despite commenting on it.
We still don't allow interfaces to implement methods of other interfaces. The CLR VM doesn't allow either.
Michal Strehovský [Thu, 26 May 2022 00:53:48 +0000 (09:53 +0900)]
Fix whitespace in repro project (#69825)
Undoes whitespace change from #69769.
Akhil Indurti [Wed, 25 May 2022 23:21:41 +0000 (16:21 -0700)]
Update 'main' branding to release/7.0-preview6 (#69813)
Levi Broderick [Wed, 25 May 2022 22:56:37 +0000 (15:56 -0700)]
Allow ToCryptographicException to create serializable exceptions (#69765)
Kevin Jones [Wed, 25 May 2022 22:02:21 +0000 (18:02 -0400)]
Use stack buffers and return data to pool in EC point encoding.
Vlad Brezae [Wed, 25 May 2022 21:55:56 +0000 (00:55 +0300)]
[mono][interp] Add tiering within interpreter (#68823)
* [mono][interp] Remove error argument from mono_interp_get_imethod
It is unused
* [mono][interp] Implement tiering at method execution start
For a single MonoMethod*, we can have two InterpMethod* instances, one with optimized flag false and the other with true. When tiering is enabled, when first getting an InterpMethod* for a MonoMethod* we set the optimized flag to false. When generatig code for this method, if optimized is false we must emit a special MINT_TIER_ENTER_METHOD at the start and later in the codegen process we skip applying optimizations to method code.
MINT_TIER_ENTER_METHOD opcode is invoked with every method start and it will bump a counter. Once we hit the limit, the method will be tiered up. This process consists of creating a new InterpMethod* instance which have optimized set and storing it in the interp_code_hash, changing the mapping from the old MonoMethod. The optimized and unoptimized method use the same argument space, so tiering the method up requires just to set the ip to the start of the tiered up method code.
An additional problem that happens with tiering is that we have to replace all instances of the untiered method from generated code. InterpMethod* instances are stored stored inside data_items of other methods and also inside vtables. When generating code for any method, we have to store in a hash table mappings from untiered InterpMethod* instance to addresses where this instance was stored. When we tier up the unoptimized method, we will traverse the list of addresses where this references is stored and update it to the optimized version.
* [mono][interp] Add option to enable/disable optimizations
Some optimizations might not be enabled by default, so add option to enable them.
* [mono][interp] Implement on stack replacement tiering up
In unoptimized code, we add a patchpoint instruction when entering basic blocks that are targets of backward branches, if the stack state is empty. This means that when tiering up a frame we just need to jump to the equivalent basic block in the tiered up method and execution can continue. Since the arguments and IL locals reside in the same space in both versions of the method (their offsets are computed in interp_method_compute_offsets)
* [mono][interp] Remove calc_section mutex
We always take jit_mm lock when finishing compilation of method, use it also for publishing InterpMethod* fields. This also prevents weird races where the method can be tiered up before the we take the jit_mm lock, resulting in publishing the seq_points for the untiered method
* [mono][interp] Fix incorrect linking of bblocks
Once we emit a tailcall, execution in the current bblock is finished.
* [mono][interp] Fix implicit conversion from i4 to native int
We were doing unsigned conversion before
* [mono][interp] Fix execution of clauses from il state when tiering is enabled
When invoking these clauses we obtained the InterpMethod from the MonoMethod* and make use of the jit info stored during frame unwinding. However, the method might have been tiered up since storing the jit info, so the native offsets stored there will no longer be relative to the optimized imethod. Fetch again the MonoJitInfo* from the imethod that we will be executing.
* [mono][interp] Enable tiering by default
Elinor Fung [Wed, 25 May 2022 21:14:20 +0000 (14:14 -0700)]
[LibraryImportGenerator] Allow span copy for char arrays instead of manual copy loop (#69764)
Aaron Robinson [Wed, 25 May 2022 20:49:29 +0000 (13:49 -0700)]
Fix memory issues detected with GCC 12.1 (#69778)
* Fix memory issues detected with GCC 12
Aaron Robinson [Wed, 25 May 2022 20:48:53 +0000 (13:48 -0700)]
Revert MSVC changes for libunwind (#69750)
* Revert MSVC changes to libunwind
Ankit Jain [Wed, 25 May 2022 20:23:57 +0000 (16:23 -0400)]
[wasm] First attempt at a wasm app host (#68696)
First attempt at implementing a wasm app host
Regular dotnet apps can be run with `dotnet run`. But this is not the case for
wasm apps. We use `xharness` to run the test apps that we generate for library
tests.
Templates for browser, and console wasm projects were added recently, but they
have to be run manually by either invoking a v8 script, or running a
`http-server` in the bundle directory. Though to use a debugger with this
requires starting the debug proxy separately, and connecting few bits.
# WasmAppHost
This PR adds a new `WasmAppHost`, which can be used through `dotnet run`:
- it can run "wasm app" from it's `AppBundle` directory, using various hosts
like `v8`, `node`, or a browser. An example use:
```
$ dotnet new wasmconsole
$ dotnet run
WasmAppHost --runtime-config /tmp/c0/bin/Debug/net7.0/browser-wasm/AppBundle//c0.runtimeconfig.json
[02:26:40] info: host[0] Running: node main.cjs
[02:26:40] dbug: host[0] Using working directory: /tmp/c0/bin/Debug/net7.0/browser-wasm/AppBundle
Incoming arguments:
Application arguments:
Debugger.Debug: DEBUGGING ENABLED
mono_wasm_runtime_ready
fe00e07a-5519-4dfe-b35a-
f867dbaf2e28
Could not find symbols file dotnet.js.symbols. Ignoring.
Initializing.....
Hello, Console!
```
The console template project is run with `node` by default.
- it supports a `--debug` parameter, which (for the browser case) would startup
a webserver, and the debug proxy for Chrome, and firefox.
```
$ dotnet new wasmbrowser
$ dotnet run --debug
WasmAppHost --runtime-config /workspaces/test/br0/bin/Debug/net7.0/browser-wasm/AppBundle//br0.runtimeconfig.json --debug --forward-console
Debug proxy for chrome now listening on http://127.0.0.1:9300/. And expecting chrome at http://localhost:9222/
Hosting environment: Production
Content root path: /workspaces/test/br0/bin/Debug/net7.0/browser-wasm/AppBundle
Now listening on: http://127.0.0.1:9300
Debug proxy for firefox now listening on tcp://127.0.0.1:6300. And expecting firefox at port 6000 .
App url: http://127.0.0.1:9000/index.html
App url: https://127.0.0.1:38331/index.html
```
- This enables using `dotnet run` with wasm samples, and library tests too.
## How do I try this out?
You'll need a dotnet with the updated packs. For now, you can use:
```
$ ./dotnet.sh build -p:TargetOS=Browser -p:TargetArchitecture=wasm -p:Configuration=Release src/tests/BuildWasmApps/Wasm.Build.Tests/Wasm.Build.Tests.csproj /t:InstallWorkloadUsingArtifacts
```
.. which would install a sdk in `artifacts/bin/dotnet-workload` with all the packs installed.
- Use that dotnet to create console, or browser wasm apps from templates, for example `dotnet new wasmconsole`, or `dotnet new wasmbrowser`.
### Debugging library tests
```
runtime$ ./artifacts/bin/dotnet-workload/dotnet run -f net7.0 -r browser-wasm -c $YourRuntimeConfig --project src/libraries/System.Buffers/tests/System.Buffers.Tests.csproj -p:DebuggerSupport=true --debug --host browser
```
- If the runtime was built in `Release` config, then you need to add `-p:DebuggerSupport=true`, so the pdbs would get deployed
- And use `--debug` to start the debugger
- Opening the url will show a `Run tests` button, which you can click after connecting with the IDE, to start running the tests
## Notes, and TODO
- `WasmAppHost`, along with the debug proxy are bundled in the `WebAssembly.Sdk` pack right now.
- This might be changed in the future to use the dotnet app host pack pattern, and with
additional support adding in the Sdk.
- This would also allow using `launchSettings.json`, similar to blazor
- `WasmAppHost` depends on host config in `runtimeconfig.json`, which can be
controlled by a `runtimeconfig.template.json` in the project directory.
- Needs more tests, cleanup, `--help` for command line arguments
- `app-support.*js` in templates, and `test-main.js` need more work to share the code
Fixes https://github.com/dotnet/runtime/issues/67236
Katelyn Gadd [Wed, 25 May 2022 20:17:58 +0000 (13:17 -0700)]
Reimplement I52/U52 in C, clean up and optimize range checks (#69624)
This PR reimplements the I52/U52 memory accessors in C since the JS got really complicated and we kept finding bugs. It also simplifies some of the range checks in the other accessors so they will have less overhead, and uses some unchecked accessors in a few hot paths.
- Move _zero_region to memory and export it. Zero the stack-allocated buffer used by converters
Jan Kotas [Wed, 25 May 2022 20:11:18 +0000 (13:11 -0700)]
Fold System.Private.Interop into CoreLib (#69508)
Margus Veanes [Wed, 25 May 2022 19:30:00 +0000 (12:30 -0700)]
Improve regex derivative construction (#69530)
* testing some ideas
* derivative computation updates
* Capture support with new derivative and fixes
Introduce new Effect node type that derivatives can include.
Logic around derivative functions to translate Effect nodes to
DerivativeEffect or just strip them away.
Remove old AddTransitions derivative logic.
Misc fixes to NFA support that was still assuming old unordered Or.
* Fix StripEffects and improve OrderedOr constructor
StripEffects now avoids repeated deduplication.
The OrderedOr in the builder now does deduplication efficiently.
* Add nothing rule for Effect nodes
* Generic subsumption check and rule in OrderedOr
* Got things to a state where all stress tests pass
* Strip out currently unused stuff and refactor
* Revert "Strip out currently unused stuff and refactor"
This reverts commit
11a2cfdad26e32a02ad1558282f64ed4a247e02d.
* Subsume and fold rule
* Make the subsumption fast by reordering rules
* added caching of pruning
* Small fix
* added comments
* Cleanup
* Fix bug introduced with cleanup in fold
Also remove concat loop rules
* More cleanup
* More cleanup
* Cleanup and revert some upcoming changes
* renaming ToString to ToStringHelper to avoid build break
* avoid overloading ToString
* forgotten if DEBUG inserted back
* Add lazy concat stress test and optimizations
* Comments
* Comments and a fix
* More comments
* Fix to ToString to match preferred Effect notation
* Add longer comments about Effects
* More comments and a code simplification
* Apply suggestions from code review
Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Syntax fix
* fixed remaining comments
Co-authored-by: Olli Saarikivi <olsaarik@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
monojenkins [Wed, 25 May 2022 18:45:45 +0000 (14:45 -0400)]
switch domain and thread TLS clearing in mono_thread_detach_internal (#69796)
Backported from https://github.com/mono/mono/pull/21482
* Set app context to null on thread detach
When a domain is unloaded, it is possible that an InternalThread
has a reference to an app context from the unloaded domain.
* There is no SET_APPCONTEXT in netcore
So the substantive portion of the mono/mono PR is gone. This just changes around the order in which we clear the domain and thread object TLS references.
Co-authored-by: bholmes <bholmes@users.noreply.github.com>
Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
Steve Pfister [Wed, 25 May 2022 18:32:29 +0000 (14:32 -0400)]
[iOS] Enable LLVM on device runs (#69504)
This change makes sure iOS & tvOS device runs enable LLVM mode
Marek Fišera [Wed, 25 May 2022 18:10:59 +0000 (20:10 +0200)]
[wasm] Consolidate interop tables generators (#69620)
Combine PInvoke, icall and ManagedToNative generators to a single MSBuild task.
Tom Deseyn [Wed, 25 May 2022 18:02:29 +0000 (20:02 +0200)]
OpenSslX509ChainProcessor: ignore NotSignatureValid if it occurs on a trusted root
The new RHEL/CentOS/Fedora RSA+SHA-1 policy causes us to report all chains ending in an RSA+SHA-1 root as invalid.
Since OpenSSL doesn't normally check signatures on self-issued certs, but we ask it to (for Windows/NetFX compat), we fail when tools like `curl` succeed.
So now we'll still ask OpenSSL to do the work, but if the NotSignatureValid is only on the last element, and we didn't get UntrustedRoot or PartialChain, then we ignore it and say that everything's copacetic.
Qiao Pengcheng [Wed, 25 May 2022 17:28:41 +0000 (01:28 +0800)]
[LoongArch64] Fix some errors for LA-ABI. (#69771) (#69771)
Lakshan Fernando [Wed, 25 May 2022 17:04:33 +0000 (10:04 -0700)]
Fix Repro to work with recent changes (#69769)
* Fix Repro to work with recent changes
* FB
Miha Zupan [Wed, 25 May 2022 17:00:16 +0000 (19:00 +0200)]
Apply MaxResponseHeadersLength limit to trailing headers (#69250)
* Apply MaxResponseHeadersLength limit to trailing headers
* PR feedback
* Drop 'envelope' from the error message
Radek Doulik [Wed, 25 May 2022 16:41:13 +0000 (18:41 +0200)]
[wasm] retrieve results from browser bench sample (#69673)
Add simple http server to serve files for the browser-bench sample and let it collect the results at the end.
The results are sent as POST requests and the simple server saves them to the host storage.
* Save the results with POST requests
* Add simple http server
It also saves POST requests and is used to collect results
of browser-bench sample
* Let RunSample target use the simple server
Wei Zheng [Wed, 25 May 2022 16:04:38 +0000 (00:04 +0800)]
Fix NRE in EmitCall for DynamicMethod (#69027)
Drew Kersnar [Wed, 25 May 2022 15:37:53 +0000 (10:37 -0500)]
Implement vpblendvb optimization in the JIT (#69509)
* Move conditonal select handling to lowering, reproduce current behavior
* WIP: adding optimization
* Add BlendVariable optimization to lowering
* Add new test that is optimized by this change
* Ran jit-format
* Fix test failures due to incorrect ordering of operands
* Address PR feedback
* Ran jit-format
Alexander Soldatov [Wed, 25 May 2022 15:31:43 +0000 (18:31 +0300)]
Add Tizen persons in charge (#69799)
Zoltan Varga [Wed, 25 May 2022 15:22:57 +0000 (11:22 -0400)]
[mono] Reenable tests for #63746. (#69646)
Radek Zikmund [Wed, 25 May 2022 15:05:08 +0000 (17:05 +0200)]
Re-enable some HTTP3 tests (#69789)
* Re-enable some HTTP3 tests
* Disable parallelization on MsQuic tests.
Tanner Gooding [Wed, 25 May 2022 15:01:25 +0000 (08:01 -0700)]
Fix the reference assembly so C++/CLI can still utilize System.Runtime (#69714)
Jakob Botsch Nielsen [Wed, 25 May 2022 14:49:52 +0000 (16:49 +0200)]
Switch extra platform coverage from windowsservercore-2004 to windowsservercore-ltsc2019 (#69480)
* Switch extra coverage in outerloop from windowsservercore-2004 to windowsservercore-ltsc2019
This should be the oldest server OS that we still support apart from
20H2 which is EOL in a couple of months.
* Disable SerialPort tests on Windows Server Core
Marie Píchová [Wed, 25 May 2022 12:28:02 +0000 (14:28 +0200)]
[HTTP/3] Added another H/3 server (#69786)
* Added another H/3 server
* Removed unused endpoint
SingleAccretion [Wed, 25 May 2022 12:26:11 +0000 (15:26 +0300)]
Skip COMMAs when creating non-null assertions (#69744)
It has been noticed that the compiler can sometimes generate "COMMA(..., LCL_VAR)"
under an indirection (as part of CSE, say), but then fail to take advantage of the
introduced precision in conservative VNs when creating assertions.
This change fixes that by skipping "COMMA"s when creating non-null assertions.
Michal Strehovský [Wed, 25 May 2022 08:13:38 +0000 (17:13 +0900)]
Don't use top level statements in the repro app (#69779)
I'm finding myself adding `class Program` too often. Top level statements are not helpful here.
Radek Zikmund [Wed, 25 May 2022 07:49:29 +0000 (09:49 +0200)]
Support optional client certificates for MsQuicConnection (#69603)
* Support optional client certificates for MsQuicConnection
* fixup! Support optional client certificates for MsQuicConnection
* Update Fedora image
* Remove DEFER_CERTIFICATE_VALIDATION flag
Michal Strehovský [Wed, 25 May 2022 03:58:08 +0000 (12:58 +0900)]
Speed up ValueType.Equals (#69768)
Inspired by #69723
`SpanHelpers` didn't exist when this part of NativeAOT was written (https://github.com/dotnet/corert/pull/5436#discussion_r170412863).
Aaron Robinson [Wed, 25 May 2022 03:49:30 +0000 (20:49 -0700)]
Libraryimport src gen audit (#69619)
* Convert buffer calculations to checked statements.
* Add comments to stages.
* Fix error when setting SetLastError - was ExactSpelling.
* Remove __ suffix from inner P/Invoke declaration.
* When possible, use Unsafe.SkipInit over default on out params.
Jeremy Koritzinsky [Wed, 25 May 2022 03:41:35 +0000 (20:41 -0700)]
Fix duplicate transition for reverse delegates and expand our profiler tests for transitions to cover this case. (#69761)
Andrew Au [Wed, 25 May 2022 03:33:20 +0000 (20:33 -0700)]
Remove destructors (#69628)
Pavel Savara [Wed, 25 May 2022 01:42:32 +0000 (03:42 +0200)]
[wasm] fix negative scenarios (#69742)
Fixed more scenarios for int52 and improved tests
Zoltan Varga [Wed, 25 May 2022 01:16:01 +0000 (21:16 -0400)]
[mono][llvm] Enable SIMD for vectors of nint/nuint. (#69647)
Kevin Jones [Wed, 25 May 2022 00:51:46 +0000 (20:51 -0400)]
Some cleanup on X509Certificate
Formatting improvements, clean up nullability annotations, and use hash one-shots for thumbprints.
Jo Shields [Wed, 25 May 2022 00:38:31 +0000 (20:38 -0400)]
Add Linux Bionic to official build, for runtime packs (#69749)
Aaron Robinson [Wed, 25 May 2022 00:31:05 +0000 (17:31 -0700)]
Use correct holder for ThreadLocalModule. (#69762)
Will Smith [Tue, 24 May 2022 22:45:34 +0000 (15:45 -0700)]
Added `--git_diff` option SPMI asm diffs (#69572)
* Added git diff file for SPMI asm diffs
* Added --git_diff option to asmdiffs. Using subprocess to launch git diff
Layomi Akinrinade [Tue, 24 May 2022 22:19:32 +0000 (18:19 -0400)]
Use SubtleCrypto API on browser DOM scenarios (#65966)
* Use SubtleCrypto API on browser DOM scenarios
* Add sync over async implementation
* Address misc feedback and make fixes
* Address pinvoke errors
* [Attempt] Correct execution of native digest API call at wasm layer
* [Fix up] Correct execution of native digest API call at wasm layer
* Update src/tests/BuildWasmApps/Wasm.Build.Tests/BuildTestBase.cs
* Address feedback and clean up
* Re-implement the crypto worker in ts
* Address feedback
* Revert "Re-implement the crypto worker in ts"
This reverts commit
6a743909605fb5b1194cae6bf571c2e6ff059409.
* * moved stuff around and renamed it
* initialization bit later
* Add code to handle errors in worker (particularly on init)
* Clean up
* Add crypto dll to wasm native project
* Add e2e test
* Adjust test to reflect lack of SharedArrayBuffer for Chrome in test harness
* Enable Chrome test and validate hashed value in tests
* fix merge to track assert being renamed to mono_assert
Co-authored-by: Eric StJohn <ericstj@microsoft.com>
Co-authored-by: pavelsavara <pavel.savara@gmail.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
Jeremy Koritzinsky [Tue, 24 May 2022 21:46:06 +0000 (14:46 -0700)]
Fix tracking for if a type has auto-layout fields for the managed type system. (#69451)
Eirik Tsarpalis [Tue, 24 May 2022 20:47:13 +0000 (21:47 +0100)]
Add integer type discriminator support to System.Text.Json polymorphism (#69326)
* Add integer type discriminator support in STJ polymorphism
* Incorporate API review feedback
* address feedback
* Incorporate API review feedback