Commit Graph
113643 Commits
Author SHA1 Message Date
Tomas 18a4e8f610 WIP: Fix type layout diagnostics in the CoreCLR runtime
In my change from the summer I added provisions to the type layout
check to support printing the differences as an aid for investigation
of this class of failures; I however put the diff display after the
assertion so that it actually doesn't get hit as the assertion tears
down the process. This change fixes the ordering and should let us
review the particular mismatch that occurs in the arm64 runs
(https://github.com/dotnet/runtime/issues/60036).

Thanks

Tomas

P.S. The change includes the instrumentation to unblock the
GenericsTest test that hits this issue to let me analyze the diff.
2021-10-12 18:52:25 +02:00
Zoltan Varga 6c09f34947 [mono][interp] Avoid calls to m_class_get_mem_manager () in get_virtual_method_fast () (#60229)
unless needed.
2021-10-10 16:09:37 +02:00
SingleAccretion 2e8615bd19 Fix a build break (#60222)
The other casts around gtReturnType should be cleaned
up as well, but that is left for another day.
2021-10-10 00:58:25 +02:00
Egor BogatovandAndy Ayers 93817770ab Add ISMETHOD and ISMETHODHASH macros (#59993)
Co-authored-by: Andy Ayers <[email protected]>
2021-10-09 23:07:35 +03:00
Vlad Brezae 9fbc728a93 [mono][interp] Fix unboxing during CALLI (#59747)
* [tests] Re-enable test

* [interp] Fix unboxing during CALLI

On interp we were storing function pointers as a simple InterpMethod. The problem is that, when loading an InterpMethod with a ldvirtftn opcode, the resulting method might need to have its this pointer unboxed, so this information needs to be embedded into the function pointer. We achieve this by tagging the InterpMethod whether we need to perform unboxing as part of calling it.
2021-10-09 19:03:40 +03:00
Theodore Tsirpanis 3de620787a Remove Net5CompatFileStreamStrategy. (#57735) 2021-10-09 01:18:01 -07:00
Parker Bibus c929be171f Finish59071 update ci argsh (#60206)
* 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.
2021-10-08 16:00:59 -07:00
Parker Bibus 3cffddd7e4 Rollback verify command changes. (#60203) 2021-10-08 15:07:06 -07:00
Andrew Au 905a08e2bd Fix GetGenerationWithRange when we have a gen 2 object in the ephemeral segment (#60189) 2021-10-08 14:57:21 -07:00
Juan Hoyos 83ec22b639 Mark TestHost as non-shipping (#60199) 2021-10-08 14:56:22 -07:00
David Wrighton 6e0e2d05ba Fix some of the issues around pgo data collection of stack trace data (#59970)
- Improve assembly name acquisition in dotnet-pgo
  - Use assembly name from AssemblyLoad event, and do not attempt to figure it out from the Module load event
- Collect MemoryRegionInfo for all method regions, not just the first.
- Add a concept to check a guid associated with the associated dll files to avoid data tearing
- Improve parsing of instantiated method signatures when reading an R2R file
  - Handle the subtly different format which is use for type signatures in the InstantiationMethodSignature portion of an R2R file
2021-10-08 14:45:31 -07:00
Zoltan Varga ce4eb48eb8 [mono][wasm] Add beginnings of support for WASI. (#59752)
* [mono][wasm] Add beginnings of support for WASI.

* Use mono_process_current_pid () instead of getpid ().

* Remove MONO_STRICT_IO_EMULATION option.

* Fix the build when eventpipe is disabled.

* Use HOST_BROWSER instead of HOST_WASM to protect emscripten only code.
2021-10-08 23:08:07 +02:00
Aaron Kunkle 61c204398c Fix Robocopy Verification (#60196)
* Fix robocopy exit code response

* Fix failure condition

* Rollback performance-setup.sh
2021-10-08 11:46:36 -07:00
Natalia Kondratyeva 17a1e383bc Fix WebSocket cancel test for non-browser (#60173)
Non-browser WS server used for ConnectAsync_Cancel_ThrowsCancellationException doesn't support "delay20sec", only "delay10sec". This basically reverts the change in this line from #58199 for non-browser platforms.

Contributes to #58355
2021-10-08 19:57:36 +02:00
SRVandGünther Foidl 22b516ca0a Spannified internals of BigInteger (#35565)
* Unsafe pointers replaced with managed pointers

* Duplicate code replaced with static local

* Spannified internals

* Spannified compare

* Spannified div/rem operations

* Minus two array allocations for each bitwise operation

* Removed redundant locals

* Code review feedback (code style)

* Code review feedback

* LeadingZeroes replaced with BitOperations

* stackalloc in Divide without remainder

* Reduced memory allocation for bitwise operations

* Managed pointer replaced with Span

* Removed namespace imports

* Removed delegate type

* Reduced memory allocation in the end of each bitwise operation

* Code review feedback

* Removed redundant array allocation

* Trivial division moved to stack alloc

* Reduced memory allocation for divide operator

* Reduced memory allocation for shift operations

* Array pooling for Square operation

* Fixed bound check for bitwise operations

* Multiply now uses array pooling

* Removed namespace import

* Reduced memory allocation for Add

* Removed swap of arguments

* Reduced memory allocations for multiply operator

* Reduced memory allocations for modulo operator

* Temporarily spannify ActualLength method

* Spannify FastReducer

* Spannify initial parts of GCD alg

* Simple GCD test for debugging

* Simple test for debugging

* Removed debug code

* Spannified GCD algorithm

* Removed arg passing by ref

* Complete migration of gcd to span

* Removed memory allocation for trivial case of GCD

* Reorganize utility code

* Removed redundant parameter

* Reduced memory alloc for trivial case of Pow alg

* Use span for trivial modulus pow case

* Use span for trivial cases of pow modulus

* Fixed buffer cleanup

* Reduced memory allocation of ModPow operations

* BitsBuffer replaced with span

* Reorganize utility methods

* Reduced visibility scope

* Removed temporary code for bits cleanup

* Fill leading bits with zeroes

* Unify order of parameters

* Unify order of parameters

* Unify order of parameters

* Reuse the same local var

* Removed whtespace

* Code review feedback

* Avoid misleading with Span.CopyTo

* Clarify purpose of slicing

Co-authored-by: Günther Foidl <[email protected]>

* Replace mentioning of uint[] in comments

* Fixed code formatting issues

* Share StackAllocThreshold const

* Ignore const threshold values in Release config

* Literal field cannot be discovered with TypeInfo.GetDeclaredField

* Removed invalid assertion

* Removed invalid assertion

* Removed invalid assertion

* Code review feedback

* Fixed header

* Fixed overflow of result buffer

* Reduced ctor visibility

* Eliminated bounds check

* Returned optimization using Math.DivRem

* Added braces to be consistent with other branches

* Fixed location of the comment

* Combine slice and conversion as the single line

* Combine slice and conversion as the single line

* Merge with parsing optimizations

* Reduced checks

* Removed redundant global const

* Replaced magic consts with their named equivalents

* Removed useless asserts

* Manual merge with #53984 PR

* Review feedback (use const for stackalloc)

* Review feedback

* Unsafe code replaced with span indexer where possible

* Removed unused local

* Review feedback

Co-authored-by: Günther Foidl <[email protected]>
2021-10-08 10:26:08 -07:00
Yusuke Ito 3649506d45 fix output log message as literal in MetricsEventSource (#60176) 2021-10-08 09:38:38 -07:00
Bruce Forstall cf2157dbe7 Add support for cloning loops with <= conditions (#60148)
* Add support for cloning loops with `<=` conditions

Loop cloning currently only handles loops using `<` limit comparison,
e.g., in loops like `for (i = c; i < n; i++)`. This change allows
for loop cloning for loops using `<=`. This happens frequently in the BenchF
benchmarks (which maybe had their origin long ago in 1-based array Fortran code?),
and some in the BenchI benchmarks. In real world code, it happens
in Visual Basic code.

There are perf wins and losses, with the usual existing issues for loop cloning.
For one case, BenchI.XPosMatrix, I see a loss due to various things, including:
1. Unfortunate register allocation and/or missing copy prop, leading to lots of
unnecessary copies.
2. Hitting jcc erratum
3. CSE leads to un-contained array length load in array bounds check

Even so, there is one fewer bounds check than the baseline. We could remove one more,
but a limitation in recognizing multi-dimensional jagged array components prevents loop
cloning from recognizing a legal-to-remove bounds check (https://github.com/dotnet/runtime/issues/54074).

* Handle aborting from loop cloning for statically false conditions

This change activated existing unused code that statically determined
a loop choice condition was false, leading to aborting the loop
cloning (and at runtime to an almost certain exception). (The test
case was `for (i = 1; i <= a.Length; i++) { a[i] = 1; }`)

If any choice condition is false, we shouldn't also check if all conditions
are true (that value is unreliable in this case).

There are no SPMI asm diffs from this change.
2021-10-08 09:35:48 -07:00
Eirik Tsarpalis 6732e2ee11 Add issue reporting guidelines to CONTRIBUTING.md (#60142)
* Add issue reporting guidelines to CONTRIBUTING.md

* address feeedback

* update README.md

* link bug report template to new CONTRIBUTING.md section
2021-10-08 17:16:41 +01:00
Andrew Au 6f1e649aee Fix gc.cpp compilation with BACKGROUND_GC disabled (#59958) 2021-10-08 08:52:44 -07:00
04f70d6fc5 [main] Update dependencies from 7 repositories (#59930)
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Marek Safar <[email protected]>
2021-10-08 16:38:09 +02:00
Eric Erhardt cc7f2f9c1a Check BackgroundService.ExecuteTask for null (#60139)
* Check BackgroundService.ExecuteTask for null

In some scenarios, derived classes might not have called base.StartAsync, and ExecuteTask will still be null. Ensure we don't fail in those cases.

Fix #60131
2021-10-08 09:12:11 -05:00
SingleAccretion de00deb924 Use IntegralRange in fgOptimizeCast (#59897)
* Set call return type in fgMorphIntoHelperCall

It was just forgotten.

* Introduce IntegralRange::ForNode

* Use Range::ForNode in assertion propagation

Couple good diffs from the handling of GT_CALL.

* Fix IntegralRange::ForCastInput

The comments are right, the code is wrong...

Fortunately, the bug was a pessimizing one, not a correctness issue.

* Use IntegralRange in fgOptimizeCast

And reap the benefits.
2021-10-08 15:21:18 +02:00
Tom Deseyn edc5a414f0 Socket: don't disconnect Socket for unknown/unsupported socket options. (#59925)
Fixes #59055.
2021-10-08 15:07:19 +02:00
Peter Sollich 971479e2a4 Fix issue in decommit_ephemeral_segment_pages (segment case). (#59989)
We assume that we can use half the free list space in gen 0 for new allocation. If that is too optimistic, we may allocate into decommitted memory and crash in the allocator. That is because there is a race condition between the allocating thread and the decommitting thread - we decided to avoid that by making sure we would never decommit memory that we may allocate in gen 0.

There are two reasons why assuming we can use half the free list space for new allocations may be too optimistic:
 - if we allocate large objects in gen 0, we may not have free spaces of the necessary size available.
- when background GC goes into background_ephemeral_sweep, it deletes and rebuilds the free list for gen 0. A thread trying to allocate during that time may see a completely empty free list.
2021-10-08 14:10:38 +02:00
Fan Yang 2880cc1d70 Stop running runtime tests on Android arm64 in main build (#59772) 2021-10-08 12:34:59 +02:00
Johan Lorensson 40ea97591e Disable rundownvalidation runtime test on MonoVM (#60117)
Disable rundownvalidation runtime test on MonoVM while working
on local repro.
2021-10-08 09:03:19 +02:00
Radek Doulik 8962551d07 [wasm] Do not strip dotnet.wasm in Debug build (#60134)
* [wasm] Do not strip dotnet.wasm in Debug build

In https://github.com/dotnet/runtime/commit/909880b5a7a737f86d388f263e0bfa8c2ddb186c
we started stripping `dotnet.wasm` unconditionally.

Make it conditional again. wa-info output shows the name and debug
sections are now present in Debug builds:

    Module: path: .\artifacts\bin\native\net7.0-Browser-Debug-wasm\dotnet.wasm
      size: 11,490,538
      binary format version: 1
      sections: 17
        ...
        id: Custom name: name size: 819,487
        id: Custom name: .debug_info size: 3,029,986
        id: Custom name: .debug_loc size: 148,406
        id: Custom name: .debug_ranges size: 100,294
        id: Custom name: .debug_abbrev size: 197,396
        id: Custom name: .debug_line size: 2,733,460
        id: Custom name: .debug_str size: 684,359

    Module: path: .\artifacts\bin\native\net7.0-Browser-Release-wasm\dotnet.wasm
      size: 2,432,319
      binary format version: 1
      sections: 10
        id: Type size: 2,140
        id: Import size: 661
        id: Function size: 8,868
        id: Table size: 7
        id: Memory size: 7
        id: Global size: 19
        id: Export size: 383
        id: Element size: 8,296
        id: Code size: 1,881,152
        id: Data size: 530,749

* Do not set EMSDK_PATH in Release build
2021-10-08 08:07:38 +02:00
Jakob Botsch Nielsen b66a11455c Support passing total code size through when doing SPMI diffs (#60124)
Currently the total code bytes shown for the base/diff is misleading
when SPMI is used because SPMI generates only .dasm files for method
contexts with diffs. This change:

* Adds -baseMetricsSummary and -diffMetricsSummary to SPMI, which
  specifies a file path to output metrics. Currently that's just the
  number of failing/succeeding compiles, and the total number of code
  bytes, but the hope is to use this for other metrics as well.
* Adds --override-total-base-metric and --override-total-diff-metric to
  jit-analyze, to support overriding the computed total base and total
  diff metric, since they are misleading when .dasm files are only
  created for differences
* Supports this from the superpmi.py wrapper script for asmdiffs when no
  explicit metric is provided: in this case, the script will get the
  metrics from SPMI and pass them to jit-analyze to override the
  computed totals.

The net result is that the displayed results from jit-analyze after SPMI
runs are less misleading and should be more comparable to similar PMI
runs.
2021-10-08 08:06:30 +02:00
Tarek Mahmoud Sayed eff8883c71 Fix TimeZones Test failure (#60140) 2021-10-07 16:28:28 -07:00
Jon Fortescue d2d98f0383 Switch to 1ES R&D pools on main (#59767) 2021-10-07 15:42:24 -07:00
Tomáš Rylek 8fdd22d33e Fix dependency of GenerateLayout on RestorePackages (#60136)
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
2021-10-07 23:02:18 +02:00
Santiago Fernandez Madero 82cf865af2 Move more pipelines to scheduled rather than rolling (#60099)
* Move more pipelines to scheduled rather than rolling

* PR Feedback
2021-10-07 13:50:11 -07:00
John Salem e98d71d51a Correctly Save GC Mode on Suspension on Windows for SampleProfiler (#59974) 2021-10-07 13:42:46 -07:00
Eirik Tsarpalis bcfa532e4c Use forms in bug report issue template (#60129) 2021-10-07 19:28:40 +01:00
Thays Grazia 51b4e3ef44 [wasm][debugger] Avoid using Uint8Array to set memory content (#60087)
* Creating a test case for PR https://github.com/dotnet/runtime/pull/59773
But I'm not using Uint8Array to set the content on memory allocated using malloc as @lewing suggested in the same PR.

* add lines in the eof

* Change the function that allocate memory.

* adding comment as suggested by @kg

* Accepting @lewing suggestion
2021-10-07 13:14:42 -05:00
SingleAccretion b36548cae1 Make field nodes unary (#60105)
* 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.
2021-10-07 10:47:07 -07:00
SingleAccretion 23e386f5b3 Remove dead code (#60095)
* 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 :(.
2021-10-07 10:33:12 -07:00
Kunal Pathak 4eb8d0ebec Fix an assert condition for UpperVectorSave/Restore (#60108)
* expand assert to take save upper vector in account

* jit format
2021-10-07 10:31:38 -07:00
Maryam Ariyan 00fcaa169d Regression Fix - Set the app name via an argument (#60053) 2021-10-07 09:49:30 -07:00
Marie Píchová 701c0422f0 [HTTP/3] Set EOF for 0-length response payload (#60120) 2021-10-07 17:43:45 +02:00
Robin Lindner 6195d98cad Optimize code readability by replacing ternary operator with logical or construct (#60071) 2021-10-07 09:14:03 -06:00
Tomáš Rylek 5ba59174ab Merge src/tests/run.proj into src/tests/build.proj (#60098)
* 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
2021-10-07 12:52:48 +02:00
Tomáš Rylek 9e9001812a Add R2RTest support for the perfmap-format-version Crossgen2 option (#60002) 2021-10-07 12:50:49 +02:00
Krzysztof Wicher fc20fc770d Do not check options values if options haven't been initialized in BindingDoesNotThrowIfReloadedDuringBinding test (#60062) 2021-10-07 11:27:16 +02:00
yowl 45fe1dece9 add PreciseRefCountsRequierd to better describe the intention (#60027)
The condition is different in NativeAOT, so this helps downstream.
2021-10-07 10:58:37 +02:00
Jakob Botsch Nielsen 367b006530 Support fast tailcalls in R2R (#56669)
* 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
2021-10-07 10:15:59 +02:00
Jakob Botsch Nielsen a258c4fe6b Fix benign assert in gtNewTempAssign (#59991)
The later part of this method correctly handles the GT_COMMA case, so we
just need to fix the assert.

Fix #59871
2021-10-07 10:15:11 +02:00
Zoltan Varga 36229d9d3a [mono][jit] Fix a JIT assert. (#59861)
Fixes https://github.com/dotnet/runtime/issues/57560.
2021-10-07 08:38:52 +02:00
Bruce Forstall fd69468ca7 Change loop cloning conditions codegen (#59886)
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.
2021-10-06 22:26:48 -07:00
Bruce Forstall f21a3155c2 Switch Windows Checked build to -O2 from -O1 (#59235)
That is, optimize for speed, not for size.

Don't do this for Windows x86, due to
https://github.com/dotnet/runtime/issues/59845
2021-10-06 22:15:14 -07:00