Parker Bibus pinged me earlier today to report a bug caused by my
test cleanup - using generatelayoutonly without previously
building the managed tests ends up failing the build due to
unrestored packages. This was due to the fact that I overlooked
that CopyDependenciesToCoreRoot needs the support projects to be
restored; in usual scenarios, they usually got restored as part
of another build step like managed test build so that I didn't hit
that in my local and lab testing.
Thanks
Tomas
* Make GenTreeField a unary op
There is no reason for it to be a GTK_SPECIAL op, a concept that
is needed only for nodes with special operand iteration semantics.
There is a quirk in this change, in gtCloneExpr, it is needed to
make this commit a zero-diff one (which it is).
* Remove the quirk
The old implementation of cloning for fields had
an interesting hidden pessimization in it: it set
GTF_GLOB_REF unnecessarily on the cloned tree, even
if the original tree did not have the flag.
This was because "gtNewFldRef", when passed "nullptr"
for the "FldObj", added the aforementioned GTF_GLOB_REF
to the node, presuming it was a static field access.
But we do not need to do that, and this commits removes
the quirk, getting some good diffs in the process.
* Remove dead code
- Delete unused GTF_NOP_DEATH.
- Delete dead code handling GT_INDEX_ADDR as a
GTK_SPECIAL node, it has always been GTK_BINOP.
- Remove the unused Compiler* parameter from GenTreeQmark's constructor.
- Remove the unused Compiler* parameter from LIR::Use::ReplaceWith,
ever so slightly improving its performance.
There are a handful of expected diffs with this change,
they are due to proper costing for INDEX_ADDR causing
fgMorphArgs to make slightly different decisions.
* Use more strong typing in GenTreeQmark
* Call the base constructor
MSVC apparently does not detect this :(.
* Merge src/tests/run.proj into src/tests/build.proj
In my previous change I modified the test-related scripts to always
use build.proj as the "front-end", the run.proj became something
like a targets file just used internally by build.proj. As both
MSBuild scripts are rather short and the boundary between test
building and running is rather blurred, I propose merging their
contents into the build.proj script and removing the run.proj
script to simplify developer navigation around the multitude of
test-related scripts.
Based on PR feedback I separated out those parts of the build
script that deal with emission of the XUnit wrappers to a separate
targets file "xunit-wrappers.targets". The expectation is that this
file can be removed once we refactor the XUnit wrapper logic
to more dynamic test grouping.
Thanks
Tomas
* Remove XML metadata per Santi's PR feedback
* Separate out xunit wrapper emitter into a new script
* Move the target CreateAllWrappers to xunit-wrappers.targers per Santi's PR feedback
* Support fast tailcalls in R2R
Partially addresses #5857
* Support ARM64
* Run jit-format
* Fix non-R2R ARM build
* Fix recursive-call-to-loop optimization with non-standard args
* Implement new delay load helper for fast tailcalls
* Minor changes and fix build break
* Switch to a define for tailcall register
* Fix x86
* Implement DefType.IsUnsafeValueType
* Emit rex.jmp for tailcall jumps on x64
* Refactor non standard args + refix recursive tailcall opt
* Set nonStandardArgKind for stack args also
* Regenerate JIT interface
* Improve recursion-to-loop decision about which args need to be reassigned
* Use INS_tail_i_jmp for func token indir
* More efficient arm64 VSD fast tailcalls, fix some bad merging
Also fix logic since we removed tailcall register. For ARM64 that means
we now use the single temp reg that is available for R2R/VSD calls, and
in LSRA we ensure this goes into a volatile register.
* Take R2R indirection into account for tail call profitability
On x64 an R2R indirected direct call normally disassembles the call site
to determine the indirection cell, so it is more expensive to do tail
calls in this scenario as the indirection cell needs to be passed in a
register. Take this into account: if there is no tail. prefix, do normal
calls, and otherwise use tail calls.
* Disallow tailcalls via JIT helper in R2R builds
* Revert "Take R2R indirection into account for tail call profitability"
This reverts commit 863ad4d344bcdacebb00c8c921c7345fd63c7d7b.
Let's not divert on the behavior here. It is not clear that having a
smaller call site is better than tail calling albeit with a larger call
site.
* Add SPMI support, clean up mcPackets enum
* Take necessary conditions into account in canTailCall
Do not do implicit tailcalls when
* The caller is the entry point
* The caller is marked NoInline
* The callee requires security object
Add an option, statically determined at compile time,
to generate loop cloning loop choice conditions into one block
per condition instead of using bitwise `and` operators that
execute all non-dependent conditions in a single block. Set the
condition to use the one-block-per-condition mode.
This leads to code size reduction in the generated condition code,
generally performance improvements in the microbenchmarks,
as well as making it easier to understand.
* Change profilers to use thread local evacuation counters
Change to prefix increment
* get rid of lambdas
* Fix jit inlining, fix R2R too
* Remove VolatilePtr<> from helpers
* Get rid of additionalData argument
* Override `corehost_resolve_component_dependencies` and `corehost_set_error_writer` PInvokes in singlefile scenario.
* fix for GCC
* Fixes the test failures when hostpolicy is used at runtime.
Co-authored-by: vitek-karas <[email protected]>
* [CoreLib] Move ComponentActivator to the shared area
* [mono] Implement coreclr_create_delegate hosting API
Related to https://github.com/dotnet/runtime/issues/59815
* Mark IsolatedComponentLoadContext as unsupported on mobile and browser
Should make ComponentActivator work without them (depends on AssemblyDependencyResolver, which depends on hostpolicy or hostpolicy pinvoke redirects)
* Also unsupported on MacCatalyst
* Annotate src
* Annotate ref
* Fix FakeConfigurationProvider
* Don't use using in ref
* DisableImplicitAssemblyReferences
* Update ConfigurationExtensions.cs
* TryGet can return null
* Remove not used namespace
This change moves most test build logic from the scripts src/tests/build.cmd and src/tests/build.sh into the common MSBuild script src/tests/build.proj; the scripts stay in place but now they only deal with parsing the command-line parameters and building native test components, all remaining functionality is delegated to the common project.
Thanks
Tomas
* Updated channel passed to ci_setup in the performance-setup.sh file.
* Removed spaces from assignments so they are seen as actual variabls, and tested locally.
The win-x64 ABI requires allocating 32 bytes of outgoing argument
stack space for every call, which can be used by callees. In the case
where there are no calls in a function, there is no need to allocate
that space. The JIT computes the required argument space during
`fgSimpleLowering` by processing the IR and looking for call instructions,
but also accounting for a few special cases where calls are not visible
in the IR. One case was missing, leading to a zero-sized outgoing argument
space even though a call was still generated. This can cause corruption in the
caller stack frame. The case is where there are no explicit calls but the
JIT is going to generate a PInvoke frame initialization helper call. This
shouldn't happen, however, it occurs because the JIT eliminates a PInvoke
that is statically dead code, but still generates the prolog setup code.
A general solution would be to eliminate the PInvoke setup code if there
are no remaining PInvokes in the function. The simple change made here is
to ensure there is sufficient outgoing argument space for the PInvoke helper
call if that will be generated.
This was found by seeing test crashes due to stack corruption when
building the CLR with the VC++ compiler `-O2` optimization switch, which
stored data in the incoming argument stack space of the PInvoke helper function
(with PR https://github.com/dotnet/runtime/pull/59235).
There are 5 SPMI diffs: 2 in coreclr tests (the ones that failed at runtime),
2 in libraries tests, and 1 in System.Net.Http.WinHttpChannelBinding:.ctor(SafeWinHttpHandle):this
* Add optimize alternation path to regex source generator
If all branches of an alternation begin with a fixed character, we can emit a switch over just that character and save on potentially lots of failed match attempts, especially if the C# compiler can lower the switch into an IL switch or otherwise optimize the search based on first character.
* Improve alternation extraction of prefixes
Given an expression like "ab|ac|ade", we already reduce this to "a(?:b|c|de)" in order to factor out the starting "a". But given an expression like "ab|acd|ef|egh", we don't currently extract the individual prefixes, e.g. "a(?:b|cd)|e(?:f|gh)", which would be valuable for a few reasons. Primarily, it enables more efficient processing of the alternation, as a failed match in one branch then has to explore fewer branches, and we can potentially make that initial branch selection even faster if all the branches start with unique, fixed characters.
* Improve reduction for atomic alternations
The primary change here is an additional reduction for atomic alternations that enables subsequent optimizations to do more. We previously added an optimization for alternation reduction that enables extraction of a common prefix from a contiguous sequence of branches in an alternation. Such extraction isn't possible if there's a branch in between two that could otherwise be combined, and in the general case, we can't reorder the branches as that breaks the semantics of ordering being visible. However, for atomic alternations, where no backtracking back into the node is possible, if we can prove that the intermediate branch can't match the same things as the other branches, reordering is fine. Thus, for atomic alternations, we can reorder branches that begin with the same character as long as we can prove that the intermediate branches may never match that same character. For now, we stick to fixed characters, though in the future this could be extended to sets/notones as well.
This also adds a minor optimization for atomic alternations that trims away all branches after an empty branch.
And it tweaks the pass that finds nodes to mark as atomic, ensuring that a top-level alternation is marked atomic so that the aforementioned optimizations kick in.
* Address PR feedback
* Update dependencies from https://github.com/dotnet/linker build 20211004.1
Microsoft.NET.ILLink.Tasks
From Version 7.0.100-1.21501.1 -> To Version 7.0.100-1.21504.1
* Update dependencies from https://github.com/dotnet/linker build 20211004.4
Microsoft.NET.ILLink.Tasks
From Version 7.0.100-1.21501.1 -> To Version 7.0.100-1.21504.4
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
This change adds control flow to ensure that an OSR method for a patchpoint
nested in try regions enters those regions try from the first block of each
try rather than mid-try.
This lets these OSR methods conform to the data flow expectations that the
only way control flow can enter a try is via its first block.
See #33658 for more details on the approach taken here.
Fixes#35687.
* Loosen strict KeyValuePair deserialization logic (#59450)
* Moved KeyValuePairConverter logic back to the KeyValuePairConverter.cs (#59450)
* Removed unnecessary code in KeyValuePairConverter (#59450)
* Cleaned up some mistakes (#59450)
* Add back the nethost archive.
This archive makes it a bit easier for developers to pull down nethost in a non-.NET environment (without NuGet). We had this in 3.1, but it was lost at some point between then and now with all of the large infrastructure changes.
* Fix symbols copying.
* Create the symbols archive for nethost
* Update src/installer/pkg/archives/dotnet-nethost.proj
Co-authored-by: Juan Hoyos <[email protected]>
* Update src/installer/pkg/archives/dotnet-nethost.proj
Co-authored-by: Elinor Fung <[email protected]>
* Update src/installer/pkg/archives/dotnet-nethost.proj
* Symbols are in the PDB folder.
* Fix symbol paths for xplat.
* Update src/installer/pkg/archives/dotnet-nethost.proj
* Update src/installer/pkg/archives/dotnet-nethost.proj
Co-authored-by: Viktor Hofer <[email protected]>
* Update src/installer/pkg/archives/dotnet-nethost.proj
Co-authored-by: Viktor Hofer <[email protected]>
Co-authored-by: Juan Hoyos <[email protected]>
Co-authored-by: Elinor Fung <[email protected]>
Co-authored-by: Viktor Hofer <[email protected]>