* [runtime] Treat calling a non-virtual method through an open delegate the same as the normal case instead of the OPEN_VIRTUAL case.
* [amd64] Fix the return value mapping in gsharedvt calls, the return address might be in different registers in the caller and callee.
* [runtime] Always initialize del->method_ptr even if interp_method is set, JITted code makes calls through it in mixed mode.
* Add a test for open delegates and gsharedvt.
* Increase nrgctx trampoline count, its needed by dynamic-method-churn.exe in full-aot-interp mode.
* Initial commit to migrate libgc to bdwgc.
* Fix submodule url
* Don't force Boehm as runtime wrapper. Was just for testing locally.
* Build bdwgc as single object file. Helps with performance.
* Bump bdwgc submodule.
* Attempt to fix windows MSVC based build.
* Remove any references to GC_INSIDE_DLL as we manually managed threads on Windows.
* Allow building boehm on Windows amd64.
* Allow building boehm with msvc.
* Bump bdwgc to fix line endings
* Use LF for sh, am, m4, and ac files in bdwgc
* Bump bdwgc & libatomic_ops with fix for cygwin
* Bump bdwgc to fix mono-boehm being generated as libtool wrapper script.
* Link the static boehm library.
* Revert "Link the static boehm library."
This reverts commit 1f90d81d08308a61c890743cd79d8f6bb791bc99.
* Use --export-all-symbols on cygwin/mingw to fix issues with boehm causing mono symbols not to be exported.
* Fix
* [wasm] Compile corelib as 32 bit.
* [wasm] Add a netcore cross compiler.
* [wasm] Add netcore+aot support.
* [aot] Load the dedup module lazily instead of at startup.
The previous version didn't work on netcore because it couldn't resolve references to corlib etc.
since they were not yet registered in the root domain at the time of loading.
* Add more icall trampoline signatures.
* Add more netcore pinvokes.
* Fix the build.
* Add more icall trampoline signatures.
* Add an --embed-file option to the packager.
* Add more netcore pinvokes.
* [interp] Return FALSE for IsDynamicCodeCompiled.
* Add a netcore project and targets for running BenchmarkDotNet.
* Fix pinvoke tables.
* Add missing files.
* Fix make clean.
* Add a comment.
* Revert "Fix pinvoke tables."
This reverts commit 998065e77614b7e621d2873510aabc3930669ca9.
* Make xunit-runner into a dotnet project. Add a netcore version.
[interp] fix array_element_size intrinsic
`mono_class_array_element_size` gives us the size of the provided MonoClass if it would be an array element. But here we want the element size of a given array's MonoClass. That's what `mono_array_element_size` is returning.
This leads to all kind of weird crashes otherwise, specifically here:
https://github.com/mono/mono/blob/2c20649539ac16e069a65f2a750c793eb341e50f/netcore/System.Private.CoreLib/src/System/Array.Mono.cs#L64
Which is then used later to compute the size to memset in order to clear the content of an array. If it's larger than it should be, then this will cause memory corruption. For example this would crash eventually:
```csharp
using System;
using System.Collections.Generic;
namespace HelloWorld {
class Program {
static void Main(string[] args) {
for (int j = 0; j < 0x1000; j++) {
var d = new Dictionary<string, string> ();
for (int i = 0; i < 197; i++)
d.Add (i + "", i + "foo");
d.Clear ();
}
}
}
}
```
Thanks to @EgorBo for reporting.
`remove_gc_finalizing` wasn't initialized so its value is undefined.
The `count_thread_check_gc_finalizer()` function only sets it in some cases so we could end up with the variable having an undefined (and probably not 0) value.
This resulted in the returned thread count from the debuggee being wrong because we'd decrement `count` even though we shouldn't.
Regression from https://github.com/mono/mono/pull/15618
It looks like the mirror didn't fully quiesce prior to snapping coreclr/corefx for the runtime consolidation. As a result the libraries build is breaking.
Signed-off-by: dotnet-bot <[email protected]>
* Forced filesystem creation
* [Wasm] Added new hello-io sample
- Goal is testing file preloading through System.IO
- Filesystem is now always forced to support later file preloading
- build-io-sample target showcases such
* Added --enable-fs flag to packager.exe
* Update packager.md
Fix NetStandard issue in System.IO.FileSystem.AccessControl
We built the fix incorrectly so that it would only apply for netcoreapp3.0 but customer needs it on netstandard2.0 (desktop + core). Customer impact is that they’ll see a PlatformNotSupported exception rather than the new API.
Signed-off-by: dotnet-bot <[email protected]>
* Updating Vector128.AsVector3 to have a functioning implementation
* Adding test template metadata covering the new methods for converting between S.Numerics and S.R.Intrinsics
* Regenerating the existing tests
* Generating the new Vector conversion tests
Signed-off-by: dotnet-bot <[email protected]>
* Add span-based CopyTo and CopyToAsync methods
* Update according to feedback
* Add span-based CopyTo overrides for MemoryStream
* Improve span-based CopyTo arguments validation
To avoid code duplication
* Update according to second review
Stream API is changed
* Resolve InternalReadSpan/Memory inlining
* Refactor ValidateCopyToArgs
* Update according to third review
* Update after fourth review
* Override span CopyTo for UnmanagedMemoryStream
* Apply suggestions from code review
Co-Authored-By: Stephen Toub <[email protected]>
* Update after fifth review
* Add cross sync/async support for span-based CopyTo
* Call sync action directly in async context
* Rework cross sync/async support for span-based CopyTo
Co-Authored-By: Stephen Toub <[email protected]>
Signed-off-by: dotnet-bot <[email protected]>
* Method Add(ref BigInteger lhs, uint value, ref BigInteger result) would store most of the result blocks into lhs instead of result.
* Method ShiftLeft(ulong input, uint shift, ref BigInteger output) with a shift argument exceeding 32 would generally compute the higher blocks incorrectly.
* Multiply(ref BigInteger lhs, uint value, ref BigInteger result) would not set result._length in some cases.
* IsZero() would incorrectly return false for non-canonical zeros with _length > 0.
Fix:
* Inline Add(ref BigInteger, uint, ref BigInteger) into Add(uint).
* Inline ShiftLeft(ulong, uint, ref BigInteger) into Pow2.
* Inline ExtendBlock and ExtendBlocks into Pow2.
* Properly handle 0 in SetUInt32 and SetUInt64.
Signed-off-by: dotnet-bot <[email protected]>
FileStream has two modes, decided upon at construction time. When it's created in non-async mode, the Read/WriteAsync methods end up queueing work items to invoke the synchronous Read/Write methods. To do this, the base methods on Stream delegate to Begin/EndRead/Write (since they were around first) and then the resulting IAsyncResult is wrapped. However, Stream has an optimization that checks to see whether the derived stream actually overrides Begin/EndXx, and if it doesn't, then it skips using those and goes straight to queueing a work item to Read/Write. However, FileStream does override those, but when it delegates to the base implementation because it's in non-async mode (rather than because it's a type derived from FileStream), going through Begin/EndXx is just unnecessary overhead. So, in the right circumstances, we can call to Stream's special helper instead.
Signed-off-by: dotnet-bot <[email protected]>
* When we try to call a method to get the async_id to do an async debug and we are trying to do this in a generic method like this:
async Task<T> ExecuteAsync_Broken<T>()
{
await Task.Delay(2);
return default;
}
We need to inflate the generic type before call the method or we will get the error: Could not execute the method because the containing type 'System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[T_REF]’, is not fully instantiated.
Fixes#17549Fixes#17569
* [llvm] Use explicit null checks with LLVM.
When the LLVM backend is used for a method, explicit null checks will
unconditionally be used at the mini IR level. We had previously used
implicit null checks at the mini IR level combined with llvm-volatile
loads and stores to avoid mis-optimization of the generated code.
During AOT compilation, LLVM's `ImplicitNullChecks` pass is enabled.
This conservatively elides these explicit null checks. This pass only
modifies branches tagged with `make.implicit` metadata.
Null check branches are now tagged with `make.implicit` metadata, with
three exceptions:
1. For platforms with backends that do not support zero page fault
handling, null check branches are not tagged with `make.implicit`.
2. This commit also adds a `MONO_DEBUG` option:
`llvm-disable-implicit-null-checks`. When it is enabled, null check
branches are not tagged with `make.implicit`.
3. This commit alters the behavior of the `explicit-null-checks`
`MONO_DEBUG` option. Enabling `explicit-null-checks` also implies
`llvm-disable-implicit-null-checks`, because this option is documented
(e.g. in https://www.mono-project.com/docs/debug+profile/debug/) to
completely disable signal/seh-based null checks.
* Add llvm-disable-implicit-null-checks to the MONO_DEBUG help string.
* Add llvm-disable-implicit-null-checks to mono.1.
* Don't tag null checks in EH regions with `make.implicit`.
This relocates the logic formerly used to guard individual LLVM-level
loads and stores with explicit null checks inside EH regions.
* Use atomic/volatile loads and stores for the terimation flag in thread-suspend-suspended.
LLVM was hoisting the load of and branch against `finished` out of
thread t1's loop, resulting in an infinite spin.
* Use ImplicitNullChecks with LLVM JIT.
* Suppress emission of the .llvm_faultmaps section.
Bump external/llvm to release_60
(7a8dc89adbe7e123220e070a527e096ee91e66d5).
* [ci] use LLVM built from repository
* [wasm] Change netcore support to use a prebuilt corefx runtime.
* [wasm] Build and test netcore support on CI.
* [wasm] Disable netcore tests on CI for now.
* [wasm] Add an error check.
* [wasm] Add a linker exclusion.
* [wasm] Add netcore runtimes to the nupkg.
* Rewrite the rest of the array non-generic fast paths in C# (#27703)
* Rewrite the rest of the array non-generic fast paths in C#
* Add missing resource string
* Use CorElementType and handle native ints to match the unmanaged implementation
* Avoid try pattern for Sort and Reverse
* Match the native implementation more closely
Signed-off-by: dotnet-bot <[email protected]>
* Rewrite Enum.CompareTo in C# (dotnet/coreclr#27792)
* Rewrite Enum.CompareTo in C#
* Handle floating point too for match the existing native implementation
Signed-off-by: dotnet-bot <[email protected]>
* Remove unused argument from GetRegionDisplayName (dotnet/coreclr#27806)
* Remove unused argument from GetRegionDisplayName
* Address race conditions in CultureData
While most of the race conditions in this file are benign, in these cases, a thread could end up returning an intermediate value due to multiple potential writes to the same field.
Signed-off-by: dotnet-bot <[email protected]>
* Fix StyleCop rule SA1129 ("Do not use default value type constructor") (#27716)
Will enable the rule in corefx once these changes have propagated.
Signed-off-by: dotnet-bot <[email protected]>
* Remove non-shared Enum.CompareTo/InternalCompareTo implementation, add new Array icalls used by shared code
This has the following benefits:
* Clearer structure for mirroring
* Slight build time improvement on bundled zlib use (as it only builds once)
* Removes pages of subdir-objects spew from autogen
[WinForms] Fix#10559 In MaskedTextBox wrong Lines value when Mask se…
<!--
Thank you for your Pull Request!
If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.
Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
* [WinForms] Fix#12249 scroll orientation was not defined in ScrollEventArgs of ScrollBar.cs
* [WinForms] Fix 12249 scroll orientation was not defined in ScrollEventArgs of DataGridView.cs
It tried to use dynamic codegen which is not available in FullAOT.
We can use the `RuntimeFeature.IsDynamicCodeSupported` to check for this, added a JIT intrinsic which returns false in FullAOT.
Used a linker friendly way to check for TypeBuilder by adding an `internal virtual IsTypeBuilder` method in the `Type` class which returns false, and overwrote it in `TypeBuilder`.
* [wasm] Bump emscipten to 1.39.2.
* Disable some code in libtest.c which causes emscripten to fail.
* [wasm] Source emscripten env before make install as well.
* Add EventWaitHandle creation extension method that takes an ACL (#42213)
* Add EventWaitHandle creation extension method that takes an ACL
* Call OpenExisting, add basic unit tests, move MAX_PATH in csproj for all Windows platforms, ensure same exceptions are thrown in both netcore and netfx.
* Address suggestions: using for the created handle, simplify try finally, merge methods, remove an unnecessary Debug.Assert
* simplify using, reorganize PInvokes a bit, let VS format resx as it expects it, remove BOM from csproj
* Add more unit tests
* Save basic access rights in a constant, generate name randomly
* Use FullControl (EVENT_ALL_ACCESS); update unit tests to use EventWaitHandleRights
* Apply suggestion of creating an EWH, then replacing its SWH.
* Remove using causing chaos, add more unit tests, remove null string unit test.
* spacing
* Address comments
* Remove unnecessary checks/exceptions, update unit tests
* Fix netfx x86 ut failure - different exception for mode validation.
* Small documentation fix
* Remove documentation for exception thrown with null security
* more documentation fixes
* New file for unit tests
* Dispose and remove windows only attributes in tests
* suggestion to not use var
* Remove duplicate resx after merge
* Readd cs files lost during merge
* Remove resx modification since it was untouched for this PR
* Address test comments
Signed-off-by: dotnet-bot <[email protected]>
* Move NativeLibrary.Free null check to managed (dotnet/coreclr#27744)
Signed-off-by: dotnet-bot <[email protected]>
* Arm64: Add S.P.CoreLib instrinsics UnzipEven and UnzipOdd (#27731)
Signed-off-by: dotnet-bot <[email protected]>
Approved API Proposal: #41662
Description
We don't currently have a way to create a Semaphore with a given ACL in .NET Core. We can modify the ACL, but it would be more secure to have the proper ACL on the object from the start.
Customer impact
Before this change, customers had to create a Semaphore, then set its ACLs. This presents a few problems:
- Potential security hole as semaphores can be accessed between creation and modification.
- Porting difficulties as there isn't a 1-1 API replacement
This change addresses those problems by adding a new extension method that allows creating a Semaphore and ensuring the provided ACLs are set during creation.
Signed-off-by: dotnet-bot <[email protected]>
* [reflection] Pass assembly load context through mono_reflection_get_type_with_rootimage
The entry points are mono_reflection_type_from_name_checked and
mono_reflection_get_type_checked which for now pass in an ambient ALC, but
should be updated to take an ALC argument.
Internally mono_reflection_get_type_with_rootimage is recursive through a half
dozen helper functions which all get an ALC argument too.
The principle place where the ALC is used is in
_mono_reflection_get_type_from_info which passes it to
mono_assembly_loaded_internal and to replace the call to mono_assembly_load by
a direct call to mono_assembly_request_byname with an explicit ALC set in the
request.
* Mark mono_assembly_load as external only
* Pass an alc through non-static reflection functions
* Fix usage in wasm debugger
* Relax assertions due to wasm
- Allows the on-device runner to work with the xunit framework in preparation for netcore.
- Added a simple UI to show the test run progress
- Report the test result XML back to the host so we can process it on Jenkins/AzDO
* [profiler] Add test case for pinvokes and reverse pinvokes
* [profiler] Fix crash in native to managed wrappers
When we call back to managed from a pinvoke, we're in GC Safe mode and the
profiler instrumentation is inserted in the wrapper before it does the
transition to GC Unsafe. So we need an extra transition before the profiler
calls its locking functions
Fixes https://github.com/mono/mono/issues/17687
* [coop] Mark internal GC Unsafe functions with MONO_PROFILER_API
Allow the profiler to transition to GC Unsafe mode
* [profiler] ptestrunner.pl fix profiler modules directory
we used to specify mono/mini/.libs but that's not where the profiler plugins live, they're in mono/profiler/.libs. We probably picked up the profiler plugins from the system Mono install.
Approved API Proposal: #41662
Description
We don't currently have a way to create a Mutex with a given ACL in .NET Core. We can modify the ACL, but it would be more secure to have the proper ACL on the object from the start.
Customer impact
Before this change, customers had to create a Mutex, then set its ACLs. This presents a few problems:
Potential security hole as mutexes can be accessed between creation and modification.
Porting difficulties as there isn't a 1-1 API replacement
This change addresses those problems by adding a new extension method that allows creating a Mutex and ensuring the provided ACLs are set during creation.
Signed-off-by: dotnet-bot <[email protected]>
Running Start-Process, Wait-Process on msbuild.exe have showed a couple
of hangs in the build script. This is most likely due to msbuild.exe
spawned child processes (like compile servers) running longer than
spawned msbuild.exe process. Since there is no specific requirements
when spawning the process from build.ps1, switch to regular process
exec and LastExitCode.
* Add Span<T>.Sort
Shares existing Array-based implementation by changing that implementation to be span based.
* Additional work to enable span-based sorts
- Cleans up changes from the previous commit, e.g. corrects nullable annotations, removes TODOs, using GetRawSzArrayData instead of GetRawArrayData, etc.
- Passes spans around rather than spans+lo+hi.
- Deletes the native TrySZSort, preferring to use the managed implementation in all cases.
Signed-off-by: dotnet-bot <[email protected]>
* Prevent DivideByZeroException in EventCounter.ToString()
Maybe it should print something other than 0. Maybe "Mean" should be excluded. But at least with this it doesn't divide by zero. Ternary operator in interpolated string is not super readable; didn't know if making the code more descriptive would have performance implications.
* Update src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventCounter.cs
Co-Authored-By: Stephen Toub <[email protected]>
Signed-off-by: dotnet-bot <[email protected]>
* [mini] Fix Coverity CID 1455161 & 1455162
> Null-checking "ji" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
* do not rely on assert to guard ji-nullness. refactor a bit
* Fix correct accumulated time for parallelized jobs in SGEN.
Current implementation incorrectly accumulate time for scan jobs for
the follow metrics when running parallel minor GC:
time_minor_scan_major_blocks,
time_minor_scan_los,
time_major_scan_mod_union_blocks,
time_major_scan_mod_union_los
Commit fix so updates are atomic making sure values are correct in cases
where parallel minor GC is used.
* Implement 64-bit atommic add fallback in SGEN.
We didn't do this because it had some issues when GetType was invoked through reflection. This issue would also be present with jit but, because jit doesn't use direct wrappers, the GetType call can't be intrinsified in that scenario. See https://github.com/mono/mono/pull/5350 for the context of the issue.
Discovered by Coverity:
```
>>> CID 1455205: (CONSTANT_EXPRESSION_RESULT)
>>> The expression "flag && 2" is suspicious because it performs a
Boolean operation on a constant other than 0 or 1.
```
Support for Windows Mono NetCore build/test wihtout any need for
cygwin/wsl/automake just MSBuild and MSVC. Windows build support mirror
technologies used by coreclr/aracade builds msbuild + powershell.
Windows only Mono NetCore build, makes a port of existing build.sh and
Makefile, implementing a build.ps1 and build.targets. So far full build
support + execution of corefx test suite is implemented. Other make file
rules can be added when needed.
MSVC build runtime seems to hits a couple of additional test failures
in corefx test suite that needs to be investigated further.
Building NetCore Mono on Windows can now be done without cygwin or wsl.
Build depends on regular VS install (or build tools), if xunit summary
is requested, python needs to be installed.
Move MonoError from managed wrappers to native wrappers.
Move MonoError from managed wrappers (ilgen) to native wrappers (C preprocessor).
Alternative to https://github.com/mono/mono/pull/15869.
Which says: Previously, we would emit a call to memset
since the struct is large (> 100 bytes). Only the error code
field needs to be initialized.
Which that PR and this PR both fix, in different ways.
In the past:
- This did not work due to a possible dependency on precise GC,
interacting with what gets zeroed or not here.
That is why I put it on the managed side.
We'll see if that reproduces.
(https://github.com/mono/mono/pull/11294/files#diff-efe0070415f3f0c0f24ed0221aa1962aR339
external/coreclr/tests/src/CoreMangLib/cti/system/weakreference/weakreferenceisaliveb.exe.)
- Some indication that embedding API should expose MonoError
and not set_pending_exception. This does not seem relevant
presently, and the code seems better structured and
more efficient this way. It can revisited if/when new public API
is the dominant concern, or do it this way for these functions,
and another way for actual public functions.
(https://github.com/mono/mono/pull/11294#issuecomment-432443485)
* [netcore] Remove the type_info field from RuntimeType, extend the TypeCache structure instead.
* [netcore] Remove some linker exclusions which are not needed.
Doing this we avoid using slow ldrmfld in the common case of loading fields from instance methods, when we execute on the real object. We could do this also for strmfld but we need to track on the stack if the instance object is this, which is not worth the trouble.
* [interp] Optimize void calls
By avoiding setting of retval
* [interp] Avoid computing param count for every call
* [interp] Remove wrong profiler check
From the times when interp had its own EH mechanism. We raise this event from mono_handle_exception_internal for interp.
* [interp] Remove profiling check code from method exit
We emit MINT_PROF_EXIT opcode when under profiler. Unify profiling enter/exit with tracing enter/exit since they are very similar.
* Modify run-jenkins.sh to adapt wasm build for the OSX CI lane
* Round 2... Go
* Make ENABLE_WASM_DYNAMIC_RUNTIME conditional on non-OSX
* Add runtime-threads target
* Ignore 'multiple rules generate' on osx
* Fix typo
* Remove blank line
* Exclude CoreXml.Test.XLinq.FunctionalTests.EventsTests.EventsReplaceNodes.XElementReplaceNodes
* Revert "Ignore 'multiple rules generate' on osx"
This reverts commit 5010721bd710d6955aaee47aa7f49ad7845763fc.
* Check if OSX lane can follow general build flow
On top of https://github.com/mono/corefx/pull/369 this improves the execution time of `System.Core-xunit` on Linux/ARM64 by 2x, so from:
```console
$ make -C mcs/class/System.Core run-xunit-test
[...]
=== TEST EXECUTION SUMMARY ===
net_4_x_System.Core_xunit-test Total: 48774, Errors: 0, Failed: 0, Skipped: 6, Time: 131.143s
```
to
```console
$ make -C mcs/class/System.Core run-xunit-test
[...]
=== TEST EXECUTION SUMMARY ===
net_4_x_System.Core_xunit-test Total: 48774, Errors: 0, Failed: 0, Skipped: 6, Time: 74.636s
```
This is only relevant for non-netcore. The CoreCLR folks just recently fixed something similar (thanks to Marek sharing this link): https://github.com/dotnet/coreclr/pull/27543
* [wasm] Error out on duplicate assemblies in the packager.
* [wasm] Switch search path order to avoid duplicate references to assemblies.
* Copy all xunit binaries to test_lib_dir.
* Revert "Copy all xunit binaries to test_lib_dir."
This reverts commit b15b03c16b508c04dc6121196fddca0e6d949e2f.
* [interp] Don't print NOPs during cprop
They can become numerous and distracting.
* [interp] Fix mono_interp_print_code
Regressed after code_size was changed to byte count instead of short count.
The default behavior on .NET Framework is _HotkeyPrefix.None_ when creating a _TabControl_ element (ampersands not escaped).
If an user wants to override this behavior, he has to declare a _DrawItemEventHandler_ (with _DrawMode = OwnerDrawFixed_).
Fixes#16206
- Use string.IndexOf rather than an open-coded, unsafe loop.
- Avoid an unnecessary SequenceEquals at the end: we're only at this point if a `%` was found highlighting that something escaped was found.
- Use stack memory for smaller inputs if possible, to avoid unnecessary ArrayPool interaction
- Remove an unnecessary argument to a helper function.
- Fix ValueStringBuilder.Grow to only copy the contained data.
Signed-off-by: dotnet-bot <[email protected]>
* [netcore] Move corlib around to match CoreCLR directory layout better
This is a prerequisite to making a sane migration of this whole
directory from mono.git to coreclr.git
* Revert removal of SuppressGCTransition from SystemNative_GetTimestamp() (#27473)
* Revert removal of SuppressGCTransition from SystemNative_GetTimestamp()
* Insert GC_POLL before statement with unmanaged call.
* JIT test for insertion of GCPoll
Signed-off-by: dotnet-bot <[email protected]>
* Add file creation method that takes an ACL (dotnet/corefx#42099)
Approved API Proposal: #41614
Related change for directory creation method that takes an ACL: #41834 -merged and ported to 3.1 Prev2
Description
We have extension methods in System.IO.FileSystem.AclExtensions that let the user get and set ACLs for existing files, but we do not have methods that create files with predefined ACLs.
.NET ACL (Access Control List) support is Windows specific. This change will reside inside the System.IO.FileSystem.AccessControl assembly.
Customer impact
Before this change, customers had to create a file or filestream, then set its ACLs. This presents a few problems:
Potential security hole as files can be accessed between creation and modification.
Porting difficulties as there isn't a 1-1 API replacement
Stability issues with background processes (file filters) can prevent modifying ACLs right after creation (typically surfaces as a security exception).
This change addresses those problems by adding a new extension method that allows creating a file and ensuring the provided ACLs are set during creation.
This change is expected to be backported to 3.1.
Signed-off-by: dotnet-bot <[email protected]>
* [runtime] Add a stub for MacOsIPInterfaceProperties::ParseRouteInfo icall on non-osx platforms to fix the wasm aot build.
* [wasm] Avoid generating invalid ninja build files if an assembly is specified on the command line and its also an implicit reference.
* Put back and ifdef.
* Fix the windows build.
1. Fix NullReferenceException. When the filter args exceeded the
hard-coded size limit GetDataFromController would return data = null.
The code previously asserted that data was not null and triggered NRE
when it was. The fix correctly null checks the value instead of
asserting and uses an empty args dictionary in this case, the same as if
filter args had been empty to begin with.
2. ETW has always limited filter args to 1024 bytes but EventPipe has no
such restriction. When using DiagnosticSourceEventSource it can be
useful to specify a larger filter arg blob. I can't do anything about
ETW's restriction but there is no need for the runtime to force
EventPipe to be equally limited. The larger size also reduces the chance
that we need to hit the fallback path above causing filter args to be
ignored.
Signed-off-by: dotnet-bot <[email protected]>
ReadAsyncInternal is correctly passing its token into the two call sites where it delegates directly to the underlying stream, but in one place it calls through ReadBufferAsync, which is currently not defined to take a token. Fix that, and pass the token through.
Signed-off-by: dotnet-bot <[email protected]>
The stubbed out SecurityElement implementation does not support extensibility that ISecurityElementFactory was designed for.
Signed-off-by: dotnet-bot <[email protected]>
[mini] Initial tiered compilation work
Enable it with `./autogen.sh --enable-experiment=tiered`.
Let's consider `Simple.cs`:
```csharp
using System.Runtime.CompilerServices;
using System;
public class Simple {
public static void Main (string []args) {
HotMethod ();
Console.WriteLine ("cnt: " + cnt);
HotMethod ();
Console.WriteLine ("cnt: " + cnt);
}
static int cnt = 0;
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void HotMethod () {
for (int i = 0; i <= 1000; i++)
cnt += i;
}
}
```
```console
$ csc Simple.cs
$ MONO_LOG_LEVEL=debug MONO_LOG_MASK=tiered ./mono/mini/mono-sgen --trace=M:Simple:HotMethod --interp=-all Simple.exe
[0x10ec275c0: 0.00000 0] ENTER:i Simple:HotMethod ()()
Mono: tiered: queued Simple:HotMethod ()
[0x10ec275c0: 0.00010 0] LEAVE:i Simple:HotMethod ()(
Mono: tiered: patching 0x7fe855803224 with patch_kind=INTERP @ tier_level=0
Mono: -> caller= Simple:Main (string[]) [{0x7fe85420df88} + 0x34 interp] (0x7fe8558031f0 0x7fe855803258) [0x7fe85420c880 - Simple.exe]
Mono: -> callee=Simple:HotMethod ()
Mono: tiered: patching 0x7fe8558031f2 with patch_kind=INTERP @ tier_level=0
Mono: -> caller= Simple:Main (string[]) [{0x7fe85420df88} + 0x2 interp] (0x7fe8558031f0 0x7fe855803258) [0x7fe85420c880 - Simple.exe]
Mono: -> callee=Simple:HotMethod ()
cnt: 500500
[0x10ec275c0: 0.04093 0] ENTER:c Simple:HotMethod ()()
[0x10ec275c0: 0.04095 0] LEAVE:c Simple:HotMethod ()(
cnt: 1001000
```
Note the suffix after `ENTER:`
* `i` indicates it's executed by the interpreter
* `c` indicates it's a compiled method (JIT)
Another example:
```console
$ make -C mono/mini gshared.exe
$ ./mono/mini/mono-sgen --interp=-all --stats ./mono/mini/gshared.exe
Regression tests: 84 ran, 0 failed in Tests
[...]
Tiered statistics
Methods promoted : 68
```
It's a basic proof-of-concept for now. An incomplete list of future work items:
* Right now it only works for direct calls, need to expand it to virtual/interface calls.
* Calls of the JIT leading into the interpreter again can't be patched yet.
* Kind of related, no concept of versioning compiled methods does exist yet. The interpreter maintains its own table of "transformed" methods, however, when doing the transition from JIT->interpreter, the wrapper+interpmethod will end up in the JIT table. We need a way to have multiple JIT compilation results for the same MonoMethod exist.
* Investigate actual performance. We might have to optimize the interp<>JIT transition.
* Patching is racy. Need to make that atomic.
* All the FIXMEs in this PR
<!--
Thank you for your Pull Request!
If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.
Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
* Add newLine parameter to StringCoda methods
* Update Options.cs to handle both kinds of newlines
* Add test to OptionSetTest
* Directly handle \r\n instead of using the TextWriter.NewLine
* Additional and adjusted logging for parallel minor GC.
When running parallel minor GC we currently get incorrect timing
on several loggings and counters due to work being put on thread pool
and accumulated. This commit fix so that the logging is accurate
when running with and without parallelization. In parallel mode a new
logging is also added to show the accumulated split between major and los
remset scan jobs.
The counters time_minor_scan_remsets and time_minor_scan_roots are only
updated when not running parallel GC since they are not correct when
running parallel GC.
* Fix WASM build error.
The offsets-tool.py uses some magic to map `typename` to `<underscore>typename` for looking up runtime types.
This caused issues on netcore because we aliased it to a different name.
To fix this let's keep the `_MonoInternalThread` name instead and just fix the one location where `_MonoThread` is used.
* dump_native_stacktrace should always register the sigterm handler.
Cherry picked from the https://github.com/mono/mono/pull/17310
* [merp] Introduce a new 'dump mode' that allows different signal behavior when dumping
The primary reason for this is gaining the ability to interpret SIGTERM properly as a crashing signal when outside of 'dump mode', and as a utility signal during the 'thread summarizer' dumping process.
When embedders call mono_runtime_quit or mono_jit_cleanup, we need to do unbalanced transitions to GC Unsafe, because after mini_cleanup runs we don't have GC thread states anymore and MONO_EXIT_GC_UNSAFE will assert.
* [runtime] Do an unbalanced GC Unsafe transition in mono_jit_cleanup
After mini_cleanup, we don't have GC thread states anymore because all that
stuff was cleaned up, so MONO_EXIT_GC_UNSAFE would assert
* [runtime] Mark mono_runtime_quit external only.
Runtime should use mono_runtime_quit_internal.
After we call the quit_function (aka mini_cleanup) we don't have any GC thread
states anymore because all that stuff got cleaned up. So MONO_EXIT_GC_UNSAFE
can't work.
- The code passed to `CompileFunction` is not a function definition. Instead it must create and return a function instance.
- Solves the problem of accessing `Node.js` functionality as defining a JavaScript function executes in the global space and does not get `Node.js` access.
- Returning a function instance allows the function to initialize and maintain encapsulated state.
* [interp] Optimize stelem instructions
* [intepr] Optimize stelem_ref and slowpath casts
mono_object_isinst_checked uses coop handles and is very slow. Attempt to use the straightforward mono_class_is_assignable_from_checked.
Makes stelem_ref 5x faster.
* always use -place-safepoints pass in JIT mode
* ignore loaded llvm
* remove gc.safepoint_poll after optimizations
* fix typo
* cleanup
* cleanup
* cleanup
* cleanup
* Do not emit safepoints on entry thus simple functions (without calls and loops) won't have them at all
* Undo -spp-no-entry=true
* fix failing tests
* do not emit sp in Allocators
* Fix `System.Diagnostics.Trace.TraceError` crash.
- WASM does not have access to the command line arguments through the browser so the length is 0 causing index out of range error.
- The zero index of the command line arguments is what decides the `AppName` so under WASM the AppName will be blanks.
* Address review comments
* Remove #ifdef for WASM only.
- Addresses review note.
- As per channel discussion some embedding scenarios might be the same.
Some of the includes already were unconditional, including both on Win32 and Unix.
It is part of ANSI C 89, albeit in a reduced form compared to typical Unix (no sigaction).
Remove configuration of MSG_NOSIGNAL which has no other uses.
Preserve configuration of signal.h temporarily due to other uses of ifdef HAVE_SIGNAL_H.
i.e. LLVM?
* [cxx][x86] Another int/ptr cast.
* More casts. Notice these are under
`#if defined (MONO_ARCH_USE_SIGACTION) && !defined (MONO_CROSS_COMPILE)`
which would explain them not showing up.
* use GC.AllocateUninitializedArray for allocating internal char buffers
* force inlining of AllocateUninitializedArray to have no perf hit on the small buffers hot path
* insrease the threshold from 256 to 2048 bytes
* use Unsafe.As instead of a cast
* remove the size precondition from AllocateNewArray method, the called AllocateSzArray is responsible for handling negative size
Signed-off-by: dotnet-bot <[email protected]>
* Updating S.P.Corelib to start building Vector2/3/4 and supporting types
* Removing HAS_INTRINSICS usages from Matrix4x4
Signed-off-by: dotnet-bot <[email protected]>
### Overview
After the removal of the Legacy TLS Provider, we can make some cleanups and improvements to the `SslStream` class. Since both the remaining providers use the internal `MobileAuthenticatedStream` and support Task-async code, we can get rid of some of the Begin/End async logic and the the underlying
`Stream` class handle it instead.
This also fixes a nasty issue with some of those task objects leaking unobserved exceptions. The problem was that `SslStream.Dispose()` needs to clear out all resources, but in doing so also nulls out the `Impl` handle to the `MobileAuthenticatedStream` - so a subsequent `End*()` call will not reach it's corresponding `TaskToApm.End()` method.
There are also some cleanups in the internal APIs that were only ever used internally and not intended for public consumption.
### Mono.Security.dll
* `Mono.Security.Interface`: removed internal `ICertificateValidator2` interface.
* `Mono.Security.Interface.IMonoSslStream`: this internal interface is only used by the web-tests, which only use it as a way to get the `SslStream` instance, so all those `Begin/End` async methods are now gone.
* `Mono.Security.Interface.IMonoSslStream2`: removed another internal interface.
* `Mono.Security.Interface.MonoTlsProvider`: removed some `internal abstract` methods; these have been moved into a new `Mono.Net.Security.MobileTlsProvider` inside `System.dll`.
### System.dll
* `Mono.Net.Security.MobileTlsProvider`:
New abstract internal base class, which received the aforementioned abstract internal methods. The naming is such to make it consistent with the already existing `MobileTlsContext` and `MobileAuthenticatedStream`.
Since both `AppleTlsProvider` and `BtlsProvider` now have an abstract internal base class inside `System.dll`, they can use the `ChainValidationHelper` class directly and we can also avoid some `Mono.Security` dances like for instance that `MonoSslPolicyErrors` enum.
This will also help make the code easier to read and maintainer.
* `Mono.AppleTls.AppleTlsProvider` and `Mono.Btls.MonoBtlsProvider`: change base class into `MobileTlsProvider` and reflect above mentioned overload changes.
* `Mono.AppleTls.AppleCertificateHelper`: use `ChainValidationHelper` as well.
* `Mono.Net.Security.ChainValidationHelper`: only implement `ICertificateValidator`.
The `ICertificateValidator` interface is still required because it is in use by the web-tests, but the previous `ICertificateValidator2` was an internal dance.
* `Mono.Net.Security.MobileAuthenticatedStream`: largely cleaned up this class.
- we now implement the current slimmer version of `IMonoSslStream`.
- moved all those overloads into `SslStream` that only fill in default values for some of their arguments and then call another overloaded version of their own.
- removed lots of `Begin/End` methods that are not used anymore.
* `Mono.Net.Security.MonoTlsProviderFactory`: use `MobileTlsStream` everywhere.
* `Mono.Net.Security.MonoTlsStream`: cleanup `SslStream` creation logic; instead of going throw `provider.CreateSslStream()`, we can now use an internal constructor directly, thus avoiding the `IMonoSslStream` interface while also making the code a lot easier to read and understand.
* `System.Net.Mail.SmtpClient`: same here.
* `System.Net.HttpWebRequest`: use `MobileTlsProvider`.
* `System.Net.Security.SslStream`: largely cleaned up this class.
- we now use `MobileAuthenticatedStream` directly instead of the `IMonoSslStream` interface and therefore could also get rid of `IMonoSslStream2`.
- cleanup constructor logic to allow the internal constructor being used with a `MobileTlsProvider` instead of going through `provider.CreateSslStream()`.
- all those overloads that are only filling in default values for some of their arguments before calling another overloaded version of their own now live here instead of in the `MobileAuthenticatedStream` class. The reason is to simply that `MobileAuthenticatedStream` is already quite a complex and difficult class, and removing some of that complexity out of it will make it easier to understand.
- handle the `TaskToApm.Begin()` / `TaskToApm.End()` here to ensure that we are not leaking any task objects with unobserved exceptions.
- removed `BeginRead()` and `BeginWrite()` overloads to let the underlying `Stream` class handle these.
* Bump API snapshot submodule
* [csproj] Update project files
* fix eglib on AIX/PASE
* Work around access(2) syscall bug on PASE
On PASE, X_OK will always returns true. This is contrary to
how AIX behaves (though corresponds to documentation!). This
is probably because it's an upcall to the ILE version of
access, and that seemingly always returns true.
* Always export the dummy function in the test suite
The AIX linker didn't export this properly, without using the
giant sledgehammer of -bexpall. Write an export file and use
it. This required some build system changes to expose an
AIX-only automake conditional.
* Use a file that exists on PASE for tests
PASE doesn't use Unix-style DNS resolution, so /etc/hosts is
missing. Use /etc/magic, since that seems to be present.
* Don't use /bin on AIX/PASE for tests
This is a symlink to /usr/bin, and it seems chdir/getcwd
follows links. Use /usr instead, that is unlikely to be a
symlink.
* Make a note what directory we're in if we fail test_cwd
* Change manual executable access check change per Jay
* Change test on POSIXy platforms to always use root directory
* [interp] Add also floating versions for stloc.np
* [interp] Add super instructions for stfld
When storing into a field of a local or an argument (ldloc/ldarg -> random instructions that end up pushing one value -> stfld). We add this instruction to the cprop pass because the instructions that are optimized together are not consecutive and we need the stack information to be able to access the instruction that loaded the argument / local and to make sure that the local wasn't dirtied. Alternatively we could make the super instruction pass stack aware, which we should probably do if more super instruction candidates turn out to require stack state information.
* [interp] Enable cprop for methods without locals
We do some optimizations here that don't apply to locals.
* [interp] Fix result stack type of CEE_CONV_OVF_I_UN
With this change we will get the following logging on level 1:
2019-10-22 15:46:59 Start nursery collection 38898 00000205A0000000-00000205A1000000, size: 16777216
2019-10-22 15:46:59 restarted (pause time: 2728 usec, max: 689233 usec)
showing the pause time and when runtime was restared, before this fix
we will only see the start log message on level 1.
* Wire up the managed side of the portable thread pool
* Remove old native thread pool code
* Fix non-netcore build
* Fix Thread.IsThreadPoolThread
* Fix MSVC builds
* Code style fix
* Make the locking primitives uninterruptible
* Revert icall changes for non-netcore
* Implement Thread.ResetThreadPoolThread
* Compile out more thread pool code for netcore
* Remove ThreadPoolBoundHandle, it is shared now
* Address PR feedback on code style
Today `async ValueTask/ValueTask<T>` methods use builders that special-case the synchronously completing case (to just return a `default(ValueTask)` or `new ValueTask<T>(result))` but defer to the equivalent of `async Task/Task<T>` for when the operation completes asynchronously. This, however, doesn't take advantage of the fact that value tasks can wrap arbitrary `IValueTaskSource/IValueTaskSource<T>` implementations.
This commit gives `AsyncValueTaskMethodBuilder` and `AsyncValueTaskMethodBuilder<T>` the ability to use pooled `IValueTaskSource/IValueTaskSource<T>` instances, such that calls to an `async ValueTask/ValueTask<T>` method incur 0 allocations (ammortized) as long as there's a cached object available.
Currently the pooling is behind a feature flag, requiring opt-in via the DOTNET_SYSTEM_THREADING_POOLASYNCVALUETASKS environment variable (setting it to "true" or "1"). This is done for a few reasons:
- There's a breaking change here, in that while we say/document that `ValueTask/ValueTask<T>`s are more limited in what they can be used for, nothing in the implementation actually stops a `ValueTask` that was wrapping a `Task` from being used as permissively as `Task`, e.g. if you were to `await` such a `ValueTask` multiple times, it would happen to work, even though we say "never do that". This change means that anyone who was relying on such undocumented behaviors will now be broken. I think this is a reasonable thing to do in a major release, but I also want feedback and a lot of runway on it.
- Policy around pooling. Pooling is always a difficult thing to tune. Right now I've chosen a policy that limits the number of pooled objects per state machine type to an arbitrary multiple of the processor count, and that tries to strike a balance between contention and garbage by using a spin lock and if there's any contention while trying to get or return a pooled object, the cache is ignored. We will need to think hard about what policy to use here. It's also possible it could be tuned per state machine, e.g. by having an attribute that's looked up via reflection when creating the cache for a state machine, but that'll add a lot of first-access overhead to any `async ValueTask/ValueTask<T>` method. For now, it's tunable via the `DOTNET_SYSTEM_THREADING_POOLASYNCVALUETASKSLIMIT` environment variable, which may be set to the maximum number of pooled objects desired per state machine.
- Performance validation. Preliminary numbers show that this accomplishes its goal, having on-par throughput with the current implementation but with significantly less allocation. That needs to be validated at scale and across a variety of workloads.
- Diagnostics. There are several diagnostics-related abilities available for `async Task/Task<T>` methods that are not included here when using `async ValueTask/ValueTask<T>` when pooling. We need to evaluate these (e.g. tracing) and determine which pieces need to be enabled and which we're fine omitting.
Before shipping .NET 5, we could choose to flip the polarity of the switch (making it opt-out rather than opt-in), remove the fallback altogether and just have it be always on, or revert this change, all based on experimentation and data we receive between now and then.
Signed-off-by: dotnet-bot <[email protected]>
* Removing all fixes to fix#15203 and #17083, and trying a new approach to fix this #17084, together.
The thing is when we are executing on hybrid suspend the caller is executed inside try catch in the runtime_invoke_ method that is generated. And this try catch should be ignored for the debugger exception, otherwise it's the last try catch in main thread, but should always be considered to generate the stack trace.
Fixes#17084
* This test check the case that we were missing. On preemptive this test always runs perfectly, on Hybrid, never run well until this PR.
* Changing how call unit test.
Changing variable name.
Scanning LOS list as part of minor GC didn't parallelize well since
all scan jobs needed to walk the complete LOS list. This led to touching
a lot of memory walking the list, increasing minor GC pause times
when the number of items in the LOS list increased. As an example,
stressing LOS data structure using ~600 MB's of random sized byte arrays
caused minor GC pause times between ~20ms without parallelization and ~19ms
with parallelization. NOTE, the more work each job gets (more memory to scan)
we will get a better parallelization, but still a lot of room for improvement.
Changing from a normal linked list to a SgenArrayList makes it more effective
to parallelize the scan jobs and since the list is using sequential
memory, this will also reduce cache misses for each thread iterating LOS
objects. Tagging objects in SgenArrayList with reference information reduce
cache misses dramatically in cases where objects not including references
exists on the list, since scanning jobs can skip these items without any
need to touch object memory causing cache misses.
Same scenario running with fix gives us minor GC pause times, without
parallelization in ~7ms (down from 20~ms) and with parallelization,
< 5ms (down from 19ms). NOTE, the more work each job gets (more memory to scan)
we will get a better result using parallelization, so the delta will increase
between using and not using parallelization, this scenario primarily stress
the extreme case where most LOS objects doesn't have references.
In total, this optimization reduce minor GC pause time 4x, from ~19ms when
using parallelization down to < 5ms.
[wasm] Avoid adding an extra arg to native-to-managed wrappers.
Fixes https://github.com/mono/mono/issues/17389.
<!--
Thank you for your Pull Request!
If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.
Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
* Adding SkipInit to Internal.Runtime.CompilerServices.Unsafe
* Updating the runtime to handle Unsafe.SkipInit
* Updating Decimal.DecCalc to use Unsafe.SkipInit
* Removing 'workaround for CS0165' comments
Signed-off-by: dotnet-bot <[email protected]>
Together with a few very simple super instructions. We replace common instruction patterns to avoid indirection via interp stack, instruction dispatch overhead and to allow the compiler to generate better code for the instruction.
When replacing a stloc with a pop, we should retry the pass, since it is very likely that we will be able to kill the instruction that pushed that value on the stack.
* [test] GetCustomAttributes on generic type definition
* [reflection] mono_method_get_base_method on a GTD should use canonical ginst
The issue is in how we pass along the generic instantiation. So there are two
parts here: we start with a method on a GTD which has to decompose into the GTD
and it's instantiation with its own generic parameters, and then we go up to
its parent and grandparent inflating and decomposing the resulting
instantiation. The instantiations keep passing the last parameter as the number
of parameters shrinks so that the gparam index from the original type is now
out of bounds for the parent and grandparent. If we mess up, we'll get a
BadImageFormatException from the runtime
Fixes https://github.com/mono/mono/issues/17278
* [checked] Mask the thread state in GC thread state assertions
Because we have extra bits (like suspend count and the no_checkpoints bit) on
the thread state, we have to mask it to get the actual thread state enum value
* [coop] Use bitfields to represent coop thread state
Instead of using a 32-bit int, use bitfields and type-punning through a union
type. We need to type pun because we need to access the entire state as a 32-bit int so that we can do atomic CAS.
* use atomic load of thread state in unwrap_thread_state.
Saw one stack trace on CI on the full coop lane where check_thread_state saw STATE_RUNNING
but with a positive suspend count. Another thread was starting a GC a
the time. Seems like we saw the state as runnning, but the suspend
count as if we were already in async_suspend_requested.
Thread 22 (Thread 0x7f43c03ff700 (LWP 39860)):
- Merge RuntimeImports that has just a few FCalls into Buffer.
- Delete assembly implementation of memcpy for ARM. The implementation was outdated and it was used only on Windows ARM and only for fraction of memcpy callsites.
- Delete unnecessary PInvoke into SysStringLen. We have a managed equivalent on System.Runtime.InteropServices.Marshal.
- Delete large amount of redundant code between SecureString.Windows.cs and SecureString.Unix.cs, and switch SecureString to use Spans
- Fold null check into IsWin32Atom
Signed-off-by: dotnet-bot <[email protected]>
* Rewrite Buffer.BlockCopy in C#
Fixes#27106
* Workaround to enable type check optimizations for BlockCopy only
Signed-off-by: dotnet-bot <[email protected]>
* Updating double.IsNaN and float.IsNaN to just `return x != x`
* Updating x86 codegen to optimize `x != x` for floating-point
* Changing the isnan optimization to only check the operand assigned registers
Signed-off-by: dotnet-bot <[email protected]>
* Wrap MoveNext Action for TPL event tracing
Wraps the MoveNext action of the AsyncStateMachineBox in a
continuation wrapper when async causality tracing is on so that the
TPL event source can find the task that is associated with a
continuation. Does not wrap otherwise.
* Clarifying comment
* removing trailing whitespace
* code review feedback.
Makes AsyncMethodBuilderCore.TryFindContinuationTask check to
whether the target of a continuation is itself a task, as a fall-back
to checking to see if the continuation is a ContinuationWrapper
* Got rid of unnecessary null checks
Signed-off-by: dotnet-bot <[email protected]>
* Provide mechanism to remove the GC transition from a P/Invoke.
New Attribute: 'System.Runtime.InteropServices.SuppressGCTransitionAttribute'
Signed-off-by: dotnet-bot <[email protected]>
* [jit] Avoid running mono_handle_native_crash () on the altstack, it can't produce a backtrace. AMD64 only for now.
* Fix checks so stack overflows work again.
In file included from /Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android/mono/metadata/icall.c:42:
/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android/mono/metadata/icall-internals.h:89:10: fatal error: 'type_traits' file not found
- The checking for the existence of the object is incorrect: Missing parens around undefined.
- Modify error description returned back to managed code.
- Fix capitalization in global object check error.
* `MonoTlsProviderFactory` now treats "legacy" as an alias for "default".
* `Mono.Net.Security/LegacySslStream`: Removed. This class also wasn't using the `MobileAuthenticatedStream` base class, thus preventing cleanups simplifications in that area.
* `Mono.Net.Security/LegacyTlsProvider`: Removed.
* `Mono.Security/Mono.Security.Protocol.Tls*`: Removed all the old legacy code.
* `Mono.Security.Interface.MonoTlsProviderFactory`: Bump internal version to 4.
If we have coverage profiling enabled for a method (mono_profiler_coverage_instrumentation_enabled, with coverage_filter callback), then we should be able to allocate a coverage info structure (mono_profiler_coverage_alloc). After https://github.com/mono/mono/commit/52429673dc617fd437518757c04c7448211075e9, coverage_filter was reporting wrapper methods as ok to profile, while mono_profiler_coverage_alloc was refusing to allocate the necessary structure, leading to crashes.
* [corlib] Mark YieldAwaitable struct readonly
Make it consistent with .NET Standard/Core which makes future API Compat runs report one less difference.
* Bump API snapshot submodule
* [interp] Move instructions together
For easy check if an instruction is unary or binary operation. We consider conversion instructions to be unary operators and compare instructions to be binary operators.
* [interp] Add stloc.np also for longs
* [interp] Add stats for total number of emitted instructions
Also make the killed_instructions counter actually track the total amount of killed instructions. It was not previously tracking instructions killed as part of addition of stloc.np / movloc.
* [interp] Improve logging during cprop
Make dumping instruction support also InterpInst's not just compacted instructions.
* [interp] Constant folding of common unary operators
* [interp] Constant fold binary operations
* [interp] Remove MINT_CONV_U8_I4 opcode
It is equivalent with MINT_CONV_I8_U4.
This commit avoid unnecessary memory barriers on x86 and amd64.
Volatile writes have release semantics, volatile reads have acquire semantics. Organize the code a little bit to indicate this. On x86 and amd64 we don't require barrier for acquire and release semantics since they are provided by the arch, so we can skip them. Ideally we should have 3 memory barrier interp instructions for each type, but, currently, they would all seem to call mono_memory_barrier so it is useless at this point.
Changes will default Windows SDK version as well as Platform Toolset to
the default versions used in the targeted VS version. If the projects are
opened up in VS2015, it should default to Windows SDK 8.1 and v140, but if
the same projects are opened in VS2019, it will default to latest Windows SDK 10
and v142. This way the project files should adapt to used VS version, meaning
that we could still build them using VS2015 (what's currently used on CI) but also
using VS2017 and VS2019. There should not be a need to install any previous versions
of build tools, unless an older version is targeted. It is also possible to set
PlatformToolset when calling msbuild and that should adapt to corresponding default
Windows SDK version for targeted toolset version.
Commit makes many changes and adjustments, aligning all vcxproj files but changes
should not affect build output.
In https://github.com/mono/mono/pull/17341 we change the caller of
CompareExchange_T<T>(ref T, ...) to call CompareExchange (ref object, ...), but
didn't delete the declaration.
It's already deleted in unmanaged and in the netcore version of this file.
* Update dependencies from https://github.com/dotnet/core-setup build 20191015.17
- Microsoft.NETCore.App - 5.0.0-alpha1.19515.17
* Update dependencies from https://github.com/dotnet/corefx build 20191015.14
- Microsoft.Private.CoreFx.NETCoreApp - 5.0.0-alpha1.19515.14
* Reenable a test that was fixed
* [bcl][jit] implement Interlocked.Exchange<T> in terms of object
Exchange<T> is supposed to be picked up as an intrinsic. But if it isn't,
since T has a class constraint, call the `Exchange (ref object, ref object, ref
object)` overload instead.
This works around a limitation in the JIT:
https://github.com/mono/mono/blob/82a07273c22b996b08fa88ee2e6632d782ac2242/mono/mini/mini-trampolines.c#L704-L713
if we're in the common call trampoline, and the caller is generic method and
the callee is a generic method, if we're using generic sharing for the caller,
but there's no generic jit info for the callee, we will not patch the call
site.
In this case we had Exchange<T> calling Exchange_T<T>
where the callee is an icall (and evidently didn't have generic jit info).
So every time we called Exchange<T>, we would go through the trampoline when
trying to call Exchange_T<T> without patching the call site.
Addresses part of https://github.com/mono/mono/issues/17334
* Bump Mono
* Also drop CompareExchange_T<T>
* Sprinkle some Unsafe magic.
Mark the non-icall methods that we expect the JIT to treet as intrinsics with [Intrinsic]
* aot-runtime doesn't need Volatile.Read<T>/Write<T> code
Both of those methods are implemented as calls to the object overload of Volatile.Read/Write
Follow-up to https://github.com/mono/mono/pull/17331.
We were running nuget pack and tests explicitly in the Azure Pipelines
config so we weren't capturing failure telemetry.
Replace mono_assembly_name_free use with mono_assembly_name_free_internal.
Maybe just remove the GC mode change and remove the internal form.
We don't really equate malloc/free with GC/locks/hangs, though arguably we should. Arguably this change is right.
* [interp] Make StackValue more intuitive
Replace the opcode field with an enum which will represent what type of value is contained (STACK_VALUE_LOCAL, STACK_VALUE_I4 etc)
* [interp] Add the mint type to the local data
Makes the emitting code easier and we no longer compute the mint type for each local access, which is fairly expensive.
* [interp] Handle indirect locals saner during cprop
Instead of checking for the indirect flag when loading from a local, simply never store a StackValue into such a local since we can't use it. We use the same logic when not pushing on the stack values for such locals.
* [interp] Add constant folding for integers
We decode the values from LDC_I4 and LDC_I8 opcodes and track/propagate the values on the stack and in the locals using the existing infrastructure. When loading a local, we try to load using the known constant value instead, so we might get to kill that local.
* [interp] Similar to stloc.np we can optimize pop/push pairs
If the pushing instruction pushes the same value that was popped by the previous instruction, we can kill them both
* [tests] Remove issue that seems to have been fixed for a while
* Fix SafeHandle marshalling in ref/in/out parameters
* Reorder code to make it exception safe, update comments
* Revert the code reordering because it breaks the invariant that new handle returned from native code should always create new SafeHandle on the managed side
* Fix test_0_safehandle_ref test. The test was expecting incorrect behavior, verified on .NET Core 3 and .NET Framework 4.8.
* Address PR feedback
* Fix cut & paste error
* Fix build
* Really fix the test_0_safehandle_ref tests
* Add more tests for SafeHandle marshalling
* Add exclusion for broken CoreFX test
* Add support for tests via safari browser
* Run safari browser tests on CI for Mac lanes
* Update to fix syntax error using UNAME to `if [[ ${CI_TAGS} == *'osx-amd64'* ]];`
* Fix syntax error with `if`
In https://github.com/mono/mono/commit/fd424c5dd07b2dbbd4aafbf9165a42166d789438 we switched over to the `TextWriter.cs`/`StreamWriter.cs` implementation of corefx. One subtle difference is that an override for `WriteLine(string)` in `StreamWriter` was introduced:
https://github.com/mono/corefx/blob/8e3b279377d1f01d2d089f24548e33855bf6502e/src/Common/src/CoreLib/System/IO/StreamWriter.cs#L526-L531
Previously the definition in `TextWriter` was used, which would call the base case `Write(char[],int,int)`. The new override however won't call the base implementation at all, but directly uses the `Span`-variant.
This is a problem for our `CStreamWriter` implementation, since `WriteLine(string)` won't end up in the special handling for `Write(char[],int,int)`, which accounts for terminal cursor changes.
This is the real fix for https://github.com/mono/mono/issues/16701
This also reverts commit 68f5613422. ("[TermInfoDriver] update top/left value on Console.{CursorTop,CursorLeft} access (#16745)")
While it kind of masked the issue, it also posed a performance issue on some terminals (e.g. GNOME Terminal).
* Load VSTS telemetry helpers into build.sh script
* First cut adding some basic VSTS-compatible telemetry on failures
* Don't make `ci=true` the default, make it a build.sh flag
Otherwise the script will not replace the variable and we get confusing error messages like this:
```
[command]/bin/bash --noprofile --norc /home/builder/azdo/_work/_temp/ba0890e7-8c80-4245-b9dc-14253b0d399f.sh
/home/builder/azdo/_work/_temp/ba0890e7-8c80-4245-b9dc-14253b0d399f.sh: line 2: llvm: command not found
/home/builder/azdo/_work/_temp/ba0890e7-8c80-4245-b9dc-14253b0d399f.sh: line 2: [: =: unary operator expected
```
* This adds the ability to continue loading the application even though the .pdb files are not found.
When uploading an app built with mono-wasm the `.pdb` may not get committed so they will not exist when trying to load them.
- Add new boolean variable to MONO library support to control skipping these files on errors.
- `mono_wasm_ignore_pdb_load_errors` default is true
- Modify the assembly file fetching routine `mono_load_runtime_and_bcl` within our MONO module.
- Allows skipping the .pdb files if the `mono_wasm_ignore_pdb_load_errors` flag is true.
* [System.Net.Http] Clean up HttpMessageHandler setup
to avoid reflection and not to be recursive
Superseded #15051 and #15922
* [csproj] Update project files
* Remove unused mono_class_get_field_from_name_cached.
* Replace gcc-specific:
mono_array_class_get_cached
mono_array_new_cached
mono_array_new_cached_handle
with portable forms that are easy enough to use and general enough.
Before was "easier" because cache provided for you -- possibly multiple.
Before was more general because rank was a parameter -- and had to be a constant.
It was always 1.
* [sdks] properly shutdown runtime for Mono.Debugger.Soft test app
mini_jit_cleanup will cause mono_runtime_try_shutdown to be called before
mono_runtime_quit which will set the shutting down flags in the runtime.
* [test] Re-enable disabled tests
* Update parameters in MERP WerReportMetadata xml
To enable backend analysis, we need to update our parameters to match our back end event type, which is MonoAppCrash.
It doesn't make sense to me that the previous implementation constructed the XML here in Mono, but depended on the user (VSMac in this case) to add the "correct" event type. The parameters in the XML, must match exactly what is expected for the given EventType, and so we should ensure they are always in-sync by defining them here. Thus, I removed the usage of `eventType` in `mono_merp_enable` and hard coded the expected eventType.
* [merp] Don't pass eventType from managed
The eventType must me MONO_MERP_EVENT_TYPE_STR ("MonoAppCrash") - the backend
determines the format of the other fields based on the event type, so it
doesn't make sense to pass other values from managed since the runtime controls
the other fields.
For compatability Mono.Runtime.EnableMicrosoftTelemetry will still take a
string parameter (now called "unused" instead of "eventType_str") but it will
not pass it down to the internal call.
* Bump corlib version
* [merp] Revert paramerters in WerReportMetadata.xml
Still need event type to be `MonoAppCrash` but the parameters will be the same as before.
* Rewriting the ARM64 HWIntrinsic JIT infrastructure to share with and mirror the x86 infrastructure where possible.
* Lowercasing the hwintrinsicarm64 and hwintrinsiclistarm64 files.
* Applying formatting patch.
* Fixing up some names in the PAL and VM that were missed.
* Adding support for AdvSimd.Add
* Ensure impSpecialIntrinsic returns nullptr for unsupported base types.
* Rewording various method headers and simplifying some code.
* Fixing getEmitter to GetEmitter
* Adding support for the ld1 instruction
* Applying formatting patch
* Clarifying a todo comment and removing a stray newline
* Fixing the Arm64 impSpecialIntrinsic to not assert for helper intrinsics
* Fixing some intrinsic signatures that were incorrect
* Adding the initial template files for generating Arm HWIntrinsic tests
* Generating the initial batch of Arm HWIntrinsic tests
* Replace gtRegNum with GetRegNum()
* Fixing the test template alignment checks for Arm
* Regenerating the Arm HWIntrinsic tests
* Fixing the namespace checked for Arm intrinsics
* Changing Base to ArmBase and fixing some Arm hwintrinsic metadata
* Fixing the arm emitter and lowering to not assert for hwintrinsics
* Fixing the arm intrinsics to not set the number of vector elements for SIMDScalar intrinsics
* Updating the AdvSimd.Abs tests to use negative input values
* Regenerating the arm hwintrinsic tests
* Fixing the arm hwintrinsic codegen to use the element size for simd scalar operations.
* Fixing the arm scalar intrinsic tests to check for 0 on upper bits
* Regenerating the ARM intrinsic tests
* Fixing AdvSimd.AbsScalar and AdvSimd.AddScalar to be recursive
* Marking AdvSimd.Arm64 and ArmBase.Arm64 as implemented
* Ensure that AdvSimd.Arm64.Abs is marked as variable size
Signed-off-by: dotnet-bot <[email protected]>
* [interp] Replace STLOC to dead local with MINT_POP
* [interp] Optimize MINT_POP
It was only used for 0 and 1 values. The implementation for values larger than 1 was broken anyway.
* [interp] Remove unnecessary usage of MINT_POP1
When storing a static field from a CEE_STFLD instruction.
* [interp] Prevent optimizing away the stack, after a branch
We know the contents of the stack following a branch, so we could have optimized away some instructions preceding the branch. We shouldn't do this because the code we are branching to expects a certain stack size.
* [interp] Clear instructions which push unused values on stack
* [interp] Properly initialize stack when pushing local
* Incorrect constrained virtual call in method using gsharedvt for reference type.
For generic constrained virtual calls using reference type's, the
virtual call will be dispatched using instance vtable. When the same
virtual call is taking place in a gsharedvt method, mono_gsharedvt_constrained_call
gets called that will assist making the call, the problem is that it will
use the constrained class for reference types meaning that it will not call
the most derived implementation of the method. This difference in the behavior
compared to none gsharedvt versions of methods, gives inconsistent results.
One way this will reproduce is by using Dictionary<Type, EmptyStruct>. For
methods that will take both Type (reference type) and EmptyStruct (value type)
like Add, calling that through IDictionary (hiding details from compiler) will
use the gsharedvt version of the method. Internally that method will call
Type.GetHashCode (), and since Type really is a RuntimeType it overrides
GetHashCode. But since mono_gsharedvt_constrained_call will use the constrained
class instead of the instance class, the called method will be
Object.GetHashCode, that gives a different result. When later ContainsKey
is called using the same Type, it only takes a reference value, so not
using a gsharedvt version of the method, then the most derived version of
GetHashCode will be called, given a different hash, not finding item
in dictionary.
Fix is to make sure behavior in mono_gsharedvt_constrained_call match
behavior for regular constrained virtual calls when having a reference type.
This makes sure we always call the most derived version of the method.
Commit also adds a test for this specific scenario using a dictionary.
* Updated to a more low-level test.
Running these tests makes the application crash, probably at shutdown. Even if the tests are reported as passing, check if disabling them fixes the suite timeout on android osx sdks.
Remove varargs from g_assert and g_assert_not_reachable (save 200+ bytes per frame in wasm interp).
g_assertf unchanged.
I have a strong suspicion, this will save approximately 432 - sizeof (InterpFrame) bytes of stack
per function call in the WebAssembly interpreter.
It will not significantly benefit or hurt any other system.
Systems with disabled asserts will receive a small size improvement.
WebAssembly has no provision for varargs.
Emscripten emulates it.
It appears the emulation allocates room in the frame per outgoing varargs call.
No stack packing.
So each g_assert takes space.
Alternative would be to discourage or disable or remove asserts.
* [Mono.Posix] Add support for memfd_create() and file sealing
Add the linux syscall memfd_create() and add support for file sealing with
fcntl().
* Bump API snapshot submodule
* Fix check for FastAllocateString that used old name
* Fix linker scripts
* Update the icall name for FastAllocateString to match managed name
* Update size check in managed allocator
* One more 64-bit target fix
When doing memory copy dest is the destination address and src is the source address. If we are copying a single reference, we need to emit a write barrier and pass to the write barrier the value, not the pointer where the value is stored.
Both just call into NDirect::LoadLibraryFromPath, and so this simplifies the code by removing a superfluous QCall
Signed-off-by: dotnet-bot <[email protected]>
* [intepr] Add define for constant
* [interp] Pass separately pop_vt_sp argument
Cleans up the code a bit. There is no need to do fancy bit operations for such a slow opcode.
The tests are kinda bogus since they create a SafeWaitHandle from `new IntPtr(1)` which causes a crash during finalization when releasing that handle.
See https://github.com/mono/mono/issues/17224
* [Mono.Posix] Move Mono_Posix_{From,To}MremapFlags() to support/sys-mman.c
Since b522eab5ff Mono_Posix_FromMremapFlags()
and Mono_Posix_ToMremapFlags() contain manual changes for NetBSD. Move the
functions from support/map.c to support/sys-mman.c so that they won't be
overwritten when create-native-map is rerun.
* [Mono.Posix] Fix prototypes in support/stdio.c
In ed892ccf27 wrapper functions for several
stdio functions were added, but the prototypes in map.h were manually
written, not using create-native-map. This commit changes the prototypes so
that they match the output of create-native-map.
* [Mono.Posix] Undefine HAVE_STRUCT_SOCKADDR_IN6 in support/map.c on MSVC
In 22b6b95814 a manual change to support/map.c
was added to prevent Mono_Posix_FromSockaddrIn6() and
Mono_Posix_ToSockaddrIn6() from being built for windows even if
HAVE_STRUCT_SOCKADDR_IN6 is defined. Instead undefine it in a header file
to avoid manual changes to map.c.
With this commit map.c, map.h and NativeConvert.generated.cs contain no
manual changes anymore.
If we eliminate these instructions, it means we removed instructions that use the top of stack. Without them we might be able to optimize away that stack slot usage. If we retraverse the instruction stream, then we must handle movloc and stloc.np separately.
* Introduce new dladdr wrapper in glib, AIX reimpl, and convert usage
Provides a wrapper around dladdr that should be platform-neutral.
Also provided is a reimplementation for AIX, which should enable
that platform to get some previously dladdr-specific functions like
the crash reporter. It is somewhat flawed in that it only gets info
for symbols in .text, returns non-constant allocated strings, and
allocates heap memory for buffers.
Then convert usages (except a macOS specific one) of dladdr to the
new eglib function. It has a different signature, which should
simplify intent and reduce structiness. Also free memory on AIX due
to limitations of its reimplmenetation.
* Enable (and fix build of) crash reporter on AIX
So far crashes don't seem any different, but the code for it is
built.
* typo fix (guess this isn't compiled on aix)
* attempt to fix macOS and win32 builds
* Implement more of g_module_address on Win32
Implements the filename stuff. Untested; don't have Windows.
* Look for backtrace_symbols in an IBM compat library for i
Enables i to natively dump a stack trace. (AIX "works" too if you
copy the compat lib's code and hack it in - it probably needs to be
in EGlib.) Unfortunately, it's not perfect. The backchain from the
signal handler is empty on i, and AIX sometimes mangles the stack
frame in a way that severely confuses the backtrace code, causing
it to dereference invalid memory by interpreting instructions as a
pointer. (I have seen somewhat similar for the sigaltstack case,
where the native memory dump attempts to read something it should
not.) Perhaps mincore could be used, but that feels like a sloppy
workaround, especially in the "AIX making an invalid stack frame"
case.
* If the file isn't an archive, don't format its name like one
* Fix up search for backtrace_symbols to look in libexecinfo
FreeBSD ships it in base and Haiku has a package; likely others too.
* Win32 suffers in g_module_address as well
* That should habe been guarded with AIX due to limitations
Otherwise seems to free things that shouldn't be freed
* Casting for win32
* Fix up Win32 impl of module address
* Free HMODULE to lower reference count after using it
* Change dladdr based impl to always dup for impl consistency
Means freeing afterwards shouldn't be ifdefable.
* probably shouldn't strdup NULL
Likely why macOS has failures.
* Don't dup/return const strs, but copy to caller-provided buffers
...which can be on the stack. This makes it far less risky to use
in a crash reporter scenario, because malloc can be hosed then.
Also fix profiler up better to work with this new reality.
* Bump version to 6.9
* Add missing new linker source file
* [csproj] Update project files
* No monolinker on MCS mode, new linker version needs Roslyn
There is a bug in mono-service.cs file.
`setup.ApplicationBase = Environment.CurrentDirectory;`;
General `Environment.CurrentDirectory` does returns `Directory.GetCurrentDirectory()`.
And retuened value 'current path' without last character `/` but `AppDomain.CurrentDomain.BaseDirectory`;
It have a problem in my service application.
In my service application code,
```cs
using System;
using System.IO;
namespace BaseDirTest
{
internal class Program
{
public static void Main(string[] args)
{
var baseDir = AppDomain.CurrentDomain.BaseDirectory;
Console.WriteLine($"baseDir={baseDir}");
Console.WriteLine($"Path.GetDirectoryName(baseDir)={Path.GetDirectoryName(baseDir)}");
}
}
}
```
When I launch `mono app.exe`,
```bash
baseDir=/workspace/test/mono-owin-test/ConsoleApplication1/BaseDirTest/bin/Debug/
Path.GetDirectoryName(baseDir)=/workspace/test/mono-owin-test/ConsoleApplication1/BaseDirTest/bin/Debug
```
But when I launch `mono-service --no-daemon app.exe`,
```bash
eDir=/workspace/test/mono-owin-test/ConsoleApplication1/mono-service-umc/bin/Debug
Path.GetDirectoryName(baseDir)=/workspace/test/mono-owin-test/ConsoleApplication1/mono-service-umc/bin
```
Because my service application can not founds plugin directory and scans it.
* If there is a perform_wait_callback in the stack there will be another catch generated by the owner thread, so we don't need to throw, we can continue and find the next catch.
Fixes#17083
* Reverting unit test changed on commit 405d521.
* Fixing assert when calling mono_jit_info_get_method if it was a trampoline.
* [offfsets-tool] Embed a copy of the clang bindings, the version in PIP doesn't work with newer clang versions.
* [wasm] Bump emscripten version to 1.38.47.
* Optimize and extend System.Array intrinsic identification.
i.e. do the strcmp last.
Add GetRawArrayData.
* Use [Intrinsic] attribute instead of comment.
* [mixed] Add interp entry wrappers for devirtualized calls as well.
* [aot] Generate code for string:memcpy/memset/bzero even in profile mode, they are called by the generated code.
* [aot] Treat string:memcpy as always AOTed in mono_aot_can_enter_interp () as well.
* [aot] Always aot string ctors as well, the JIT doesn't generate interp entry code for them.
* [wasm] Update print-table.py.
Followup work for https://github.com/mono/mono/pull/17090
In order to get managed method info for unmanaged stacktraces, we call
mini_jit_info_table_find_ext which calls decode_exception_debug_info which may
allocate if it's not in async context.
Do the switch in mono_threads_summarize_execute so that non-supervising threads
all switch when they run the sigterm_signal_handler. mono_threads_summarize
already does it for the supervisor thread.
Fixes https://github.com/mono/mono/issues/17180
* Fix stackalloc reuse bug in Environment.UserDomainName
According to the comment, this code is never expected to be used (so it should either be deleted or the comment fixed), but in the meantime, if it were to be executed, things could go badly due to potentially passing the same buffer into LookupAccountNameW for two different arguments.
* Fix existing ValueStringBuilder usage to dispose the builder
Signed-off-by: dotnet-bot <[email protected]>
* Make relevant types static (mostly Interop)
* Fix a few stray semicolons
* Remove unnecessary locals
Some can be removed entirely, some can be replaced by discards.
* Remove unnecessary usings
* Move Unix-specific helper method to TimeZoneInfo.Unix.cs
* Remove duplicated code
* Remove duplicative checks
* Remove [ThreadStatic] initialization
These are all the default values and wouldn't be necessary for any static, but inline initialization for [ThreadStatic]s is particularly unuseful (and in non-default cases problematic) because the fields are only set to these values on the initializing thread.
* Fix methods whose return value is never used
* Use string.IsNullOrEmpty
* Remove unnecessary field initialization
All ctors overwrite these values.
* Address PR feedback
Signed-off-by: dotnet-bot <[email protected]>
* [aprofutil] Add skip regexes to simplify expression of removal matching
* [aprofutil] arguments to skip and take by count for automatic profile testing
* [interp] Refactor tracking of stack/local values
Previously we had just an InterpInst* inside StackContentInfo, which was representing the instruction that pushed a certain local/value on the stack. This makes many things awkward, since an instruction is logically different from a value, that a local or a stack slot have. If we clear an instruction, it doesn't necessarily mean that the value that the instruction produced can't be stored on stack or in a local.
This commit creates a new structure StackValue, which holds the value.
* [interp] Generalize contents of StackValue
StackValue contains an opcode and some data to enable reconstruction of the value. For example instead of doing a LDLOC for a local, we can see if the local has a known value and use it instead (this could be a LDLOC from another local, whose value was propagated, or in the future a LDC). This will make more sense when we also start to track constant values.
Also decouple MOVLOC instructions from the cprop pass. They serve no purpose there. They are useful though when we do deadce, since we currently don't know how to kill instructions that change the stack.
* [interp] Handle dup opcode during copy propagation
* [interp] Avoid losing track of stack values for some opcodes
For some opcodes, that access stack values below the top of the stack, we were assuming they pop everything and then push the stack back, in order to prevent optimizing away instructions that pushed some of these values, since the original instruction expects those values to reside on the stack. We handle these instruction separately and keep track of the values of the stack, so we can further propagate the stack values, even though we currently can't optimize away those instructions.
* [interp] Propagate values for ctor arguments
* [interp] MINT_CASTCLASS no longer clobbers top of stack
* [mkbundle] Fix mono_aot_register_module declaration (#17139)
This change reflects the declaration introduced in jit.h in #15132.
* [mkbundle] Remove spurious function declaration (#17139)
The comment is clearly outdated after the introduction of #15132.
* [merp] Don't overrun buffer in copy_summary_string_safe
MonoFrameSummary:str_destr is an array of MONO_MAX_SUMMARY_NAME_LEN bytes, not
MONO_MAX_SUMMARY_NAME_LEN + 1 bytes.
Fixes Coverity CID 1454563
* [merp] Use g_strlcpy for copy_summary_string_safe
Fixes Coverity CID 1454563
We would sometimes write to MonoSummaryFrame:str_descr which is
MONO_MAX_SUMMARY_NAME_LEN bytes long at index MONO_MAX_SUMMARY_NAME_LEN which
is one past the end of the array.
* nit: rename confusing parameter names
old names were confusing - we were copying from 'out' to 'in'. Now we copy to
'dest' from 'src'
After https://github.com/mono/mono/commit/9ff3b0d65ee4, in an aot image we can emit addresses either as bl offset (which uses 4 bytes) or as ldr pc, =<label>; <addr> (which uses 8 bytes). Before this commit we were dereferencing an instruction pointer, in get_call_table_entry, assuming 8 bytes per entry. This could overflow and crash if we used in fact only 4 bytes per entry. Fix this by including the entry size in the aot image.
Fixes random crashes on arm CI on full-aotmixed suite.
* Build MSVC only runtime using make file system.
Add a new option to only build MSVC version of mono runtime and native
tools, --enable-msvc-only. In the past, --enable-msvc build both
mingw as well as MSVC runtime, this commit adds an option to only build
MSVC version of runtime and native tools using make file system.
Commit updates all native make file making sure mingw/gcc builds are
not done if --enable-msvc-only has been used. It also makes sure we
build and use MSVC based tools as part of build and tests.
Result will be a build without any mingw/gcc artifacts, but where all
existing make files still works with the MSVC build artifacts.
This commits is also preparing to switch the .NETCore build over to use
MSVC build runtime in order to get LLVM support, something that is
currently only supported on Windows MSVC build.
* Add link to mono-sgen.exe and clean windows binaries.
* Fix failures in mono/tests test-aot on Windows.
* Add fullaot-mixed tests on Windows x64.
* Run msbuild in parallel.
* Default to x64 mingw host on cygwin build.
```
configure.ac:6695: error: required file 'netcore/corerun/Makefile.in' not found
Makefile.am:24: error: required directory ./netcore/corerun does not exist
```
* [mini] Use clr memory model by default
Otherwise we can have potential crashes in the bcl on arm targets, since a lot of code that assumes this memory model is now shared with mono.
Keep the old clr-memory-model option alive for now, to avoid potential build problems, if building older mono with newer mono.
* [build] Remove clr-memory-model option
It is default now
* [man] Add entry for weak-memory-model
* [merp] Include any managed methods in the 'unmanaged_frames' portion of the output also
This can help correlate the two lists when we have mixed managed & unmanaged stacks in our crash output.
* Wehn symbol/function address is not found, still output the IaP
* Don't set native_offset to ip, that's not what it means
* [merp] Bump protocol version
* Minor formatting fix
* Remove paths from assembly image names
* Remove unused var
* Refactor filling in managed info for stack frame
* Revert "Remove paths from assembly image names"
This reverts commit defe86b471f37e12fa66a104747cac932943dca1.
* Use macOS version not Darwin version in MERP
Fixes#17004
* Update mono-merp.c
Ensure this is only for Mac
* Don't allocate in macos_version_string
Use a static buffer.
Also some formatting fixes.
`System/RemoteExecutorTests.cs` tests are excluded in the mobile test profiles. It makes sense to do the same for wasm.
Fixes https://github.com/mono/mono/issues/17038.
* allow ASCII equality ordinal fast path for en-* cultures
* dont use StartsWith in the initialization execution path
* Update src/System.Private.CoreLib/shared/System/Globalization/CompareInfo.Unix.cs
Co-Authored-By: Jan Kotas <[email protected]>
Signed-off-by: dotnet-bot <[email protected]>
* Moving the Arm64 intrinsic files into the Arm folder.
* Refactoring the ARM Hardware Intrinsics based on the new design.
* Adding support for AdvSimd.Add
* Adding LoadVector64 and LoadVector128 APIs to Arm.AdvSimd
* Marking the LoadVector64 and LoadVector128 methods as unsafe
* Removing the ARM64 HWIntrinsic tests
* Renaming Arm.Base to Arm.ArmBase, as per the design
* Fixing Base.cs to ArmBase.cs in the shared projitems
* Fixing the doc comments for the AdvSimd.LoadVector methods
* Marking various IsSupported methods as new, now that they inherit from ArmBase
* Fixing a malformed doc comment that was missed
* Marking AdvSimd.Arm64 as [Intrinsic] and new
Signed-off-by: dotnet-bot <[email protected]>
A valid path might be something like \\\\.\\pipe\\pipename (i.e. \\\\.\\ is a valid root). If we blindly strip all instances of `.\\` then we end up confusing our path cleaning algorithm. So permit a directory component of `.` in UNC path roots.
Closes: https://github.com/mono/mono/issues/16460
* [mini] Add memory barriers to more stores inside objects
We should now have membars for all stores of an object ref inside another object (for the stores done by the jit). Used by clr-memory-model debug option.
* [mini] Add memory barrier for storing objref in static fields
For clr-memory-model debug option.
In 6d2c77fb33 we changed the representation of
the runtimes that we will probe from a NULL-terminated array to a linked list.
Unfortunately we made a typo, and in the case where the caller of
mono_init_internal provided a runtime_version, we still picked
DEFAULT_RUNTIME_VERSION instead of the given runtime_version.
This is an issue for embedders like XA that use the "mobile" runtime - all
their assemblies are compiled with the "mobile" version number (2.0.5.0) but
Mono running with the default runtime configuration will remap to 4.0.0.0. As
a result, when there are references to 2.0.5.0 assemblies, the load requests
will be remapped to 4.0.0.0 which will never see the already loaded 2.0.5.0
assemblies, and we will fall back on the embedder's preload hook or filesystem
probing every single time. This is a performance fail.
Reverts mono/mono#16882
This broke the Mono Android SDKs build in master though for some reason it doesn't show up in the PR build:
```
[2019-09-26T03:19:55.366Z] Undefined symbols for architecture x86_64:
[2019-09-26T03:19:55.366Z] "_mono_tls_key_jit_tls", referenced from:
[2019-09-26T03:19:55.366Z] _mono_tls_get_jit_tls in libmain_a-main-sgen.o
[2019-09-26T03:19:55.366Z] "_mono_tls_key_lmf_addr", referenced from:
[2019-09-26T03:19:55.366Z] _mono_tls_get_lmf_addr in libmain_a-main-sgen.o
[2019-09-26T03:19:55.366Z] ld: symbol(s) not found for architecture x86_64
[2019-09-26T03:19:55.366Z] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[2019-09-26T03:19:55.366Z] gmake[6]: *** [Makefile:1634: mono-sgen] Error 1
[2019-09-26T03:19:55.366Z] gmake[6]: Leaving directory '/Users/builder/jenkins/workspace/archive-mono/master/android/debug/sdks/builds/android-host-Darwin-debug/mono/mini'
```.
Add loading the default Mono configuration file.
Add loading the default Mono configuration file in the examples of Mono Embedded.
Also include header in existing usage of `mono_config_parse`.
This fixes problems under Raspbian, when extending the sample with your own code.
The `teste.c` is still not compiling, because the `mono_set_allocator_vtable` function is not up to date. But I was not able to find the documentation for this function.
* Revert "[Mono.Debugger.Soft] Properly close connections"
This reverts commit 2da7707373.
This was previously reverted because it was causing issues and it still does. It is a hack fix. We signal the connection for closing and next we send the dispose command over the network. This is obviously racy.
* [Mono.Debugger.Soft] Make sure receiving thread always closes
When we want to close the connection, setting the close flag is not enough, because a thread can be already stuck in a blocking receive, without getting to check the flag. We fix this by additionaly breaking the connection, by using socket.Shutdown.
Fixes https://github.com/mono/mono/issues/7377
* Bump API snapshot submodule
* BeginConnect complete to early when not using callback.
The following commit, https://github.com/mono/mono/commit/068e8fe0424806753d7ab72a7b9bf0e54b58408b#diff-33b28a9dc0b8032650ed77213481a99f
changed the way we do DNS resolve in BeginConnect using host name. Instead
of doing a blocking DNS resolve, it switched to an async DNS resolve, followed
by an async connect. The returned IAsyncResult was just representing the
completion of the DNS resolve task and not the underlying connect. It
also turns out that part of doing EndConnect, we did some validation
of the used IAsyncResult making sure it was an instance of SocketAsyncResult,
meaning that if EndConnect was called on the returned IAsyncResult from
BeginConnect, EndConnect would throw and exception.
NOTE, this only happens if you use pattern like this:
var result = sock.BeginConnect (hostName, port, null, null);
result.AsyncWaitHandle.WaitOne (2000);
sock.EndConnect (result);
It did not happened if you used callbacks, since then EndConnect would
be called as part of callback and that IAsyncResult was of correct type,
or if you did a BeginConnect with an EndPoint or IPAddress[] since that
won't trigger the DNS resolve.
Fix is to make sure we hand out the SocketAsyncResult instance that will
be used in our internal connect calls from BeginConnect. We also make
sure, we chain the DNS resolve task together with a task doing the async
connect (using the same SocketAsyncResult instance). This will make sure
the IAsyncResult returned from BeginConnect is the same one as used in
internal connect call, so it will only complete when the connect call
completes.
* Adding test for BeginConnect using host name.
* Bump API snapshot submodule
When we detach from the debugger, we reset the state by starting a new debugger thread (why don't we just use the existing thread?). As per commit https://github.com/mono/mono/commit/540ef385faa230bc226c7a83bfabd0730520911e we should shut down the debugger thread when the connection drops. However, since that commit was acting as a Dispose command was sent instead, it would end up relentlessly spawning and closing new debugger threads up until the runtime is shut down. This commit makes sure we don't respawn once the connection hangs.
* [threading] embedded mono hangs
When embedded mono is executing a C++ code, it didn't start to execute a C# code, we don't need to suspend the thread to run GC.
Fixes#16192Fixes#14725
* Changing what was discussed with Aleksey during our 1on1
* Changing what was suggested by Aleksey
* Separating mono_init_version that is being used on tests from the embedded ones
* Remove unnecessary asserts
* Make several classes static
* Use is instead of as+null check
* Use T? instead of Nullable<T>
* more static classes
* Mark locals as const
* Merge declaration and initialization of some variables
* Remove unnecessary casts
* Remove unnecessary "unsafe"s
* Simplify several lambda expressions
* Remove redundant parentheses
* Remove redundant '== true'
* Remove redundant empty lines
* Simplify boolean comparison with '== false'
* Replace if-statement with return statement
* Use while for infinite loop
* Add static to all partial static class declarations
* Use ++/-- operator instead of assignment
* Use string.IsNullOrEmpty
* Use coalesce expression
* Simplify lazy initialization
* Use coalese expression
* Join string expressions
* Use regular string literal instead of verbatim string literal
* Optimize StringBuilder.Append calls
* Remove redundant assignment
* Remove unnecessary unsafe context
* Merge processor directives
* Use String.Equals instead of String.Compare
* Use Debug.Fail instead of Debug.Assert(false
* Remove Attribute suffix
* Use predefined type
* Use compound assignment
* Use while statement to create an infinite loop
* Remove redundant base ctor call
* Avoid using catch (Exception)
* Remove empty regions
* Span comparison to null
* Avoid unnecessary boxing of value type
* Expression is always equal to 'true'
* Remove unused method
* update coalesce assignment
* fix unsafe
* fix redundant parens
* Fix whitespace errors introduced
Signed-off-by: dotnet-bot <[email protected]>
Currently netcore-build doesn't need submodules (except LLVM) so a task somewhere in arcade/microsoft.build.tasks.git always complain if those are not cloned.
Set EnableSourceControlManagerQueries=false to ignore the warnings.
* Add RenamedEvent* to FSW sources from CoreFX
Fixes#16486 - This was only partially fixed until now
* [csproj] Update project files
* Add test files which test these code paths on corefx
* Remove old RenamedEvent* files
* Remove IsFastSort optimizations from String
- Fix bugs in the Span-based globalization fast paths. Note that some of these bug fixes are going to affect performance of the globalization fast paths.
- Use Span-based globalization fast paths for strings
- Avoid static array allocation for HighCharTable
Fixes#26758
Signed-off-by: dotnet-bot <[email protected]>
Addresses an issue with jumping into DST for some time zones when the incorrect date-time offset is returned for date-time in UTC (which comes from DateTime.Now). The fix is to just check if the incoming date-time is in UTC.
Also added a set of tests for some time zones to verify jumping into DST in general.
Fixes https://github.com/mono/mono/issues/16395
* Creating a new version of MOD_KIND_EXCEPTION_ONLY to support VsWin features, discussed with Joaquin Jares.
Because we don't have this functionality of get every other exception that is not specified, VsWin was getting every exception and filtering later. But this causes a slowness during the debugger because we stop all thread on each exception that we get, even if they are caught and we don't want to stop.
* Fixing other unit test because now we have 2 nested classes.
Fixing indentation.
* Creating a flag in the MOD_KIND_EXCEPTION_ONLY protocol event and not creating a new protocol event.
* Changing what was suggested by Zoltan.
* Coding style
* Bump API snapshot submodule
The check was done incorrectly, the include files need to be separated by newlines otherwise we would get a false negative result.
config.log contained this:
```
conftest.c:279:23: warning: extra tokens at end of #include directive [-Wextra-tokens]
#include <sys/types.h>, #include <sys/stat.h>
^
//
```
This means that when doing File.GetCreationTime() we'd fall back to returning the last modified time.
It regressed when we switched to System.IO.File to the CoreFX implementation i.e. System.Native in https://github.com/mono/mono/commit/8f5cef936491e8b20888bbf18d426482c890637c.
Fixes https://github.com/mono/mono/issues/16974
Restores previous ExecutionContext Capture behavior where we were copying a new SynchronizationContext as opposed to a reference to the existing one.
The old behavior caused SynchronizationContextAwaitTaskContinuations to not post to a SynchronizationContext.
Fixes https://github.com/mono/mono/issues/16759
Reverts a fix for https://github.com/mono/mono/issues/12421
* Include Mono.WebBrowser.dll in mkbundle bundles (Closes: #7454)
Because System.Windows.Forms.dll includes an assemblyref on
Mono.WebBrowser.dll, bundles need to be able to include it
in order for WinForms to work (even if they don't actually
use a browser component)
Compare:
```
$ mkbundle hellowin.exe -o hellowin --cross mono-6.0.0-ubuntu-18.04-x64 --i18n all
From: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64
ERROR: Unable to load assembly `Mono.WebBrowser' referenced by `/home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/System.Windows.Forms.dll'
```
to
```
$ mkbundle hellowin.exe -o hellowin --cross mono-6.0.0-ubuntu-18.04-x64 --i18n all
From: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64
Using runtime: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/bin/mono
Assembly: /tmp/hellowin.exe
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/System.Windows.Forms.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/mscorlib.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/System.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/Mono.Security.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/System.Configuration.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/System.Xml.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/System.Security.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/System.Core.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/System.Numerics.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/System.Drawing.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/System.Runtime.Serialization.Formatters.Soap.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/Accessibility.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/Mono.WebBrowser.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/Mono.Posix.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/System.Data.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/System.Transactions.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/System.EnterpriseServices.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/I18N.CJK.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/I18N.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/I18N.MidEast.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/I18N.Other.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/I18N.Rare.dll
Assembly: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/lib/mono/4.5/I18N.West.dll
systemconfig: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/etc/mono/config
machineconfig: /home/directhex/.mono/targets/mono-6.0.0-ubuntu-18.04-x64/etc/mono/4.5/machine.config
Generated hellowin
```
For the test code:
```
using System;
using System.Drawing;
using System.Windows.Forms;
public class HelloWorld : Form
{
static public void Main ()
{
Application.Run (new HelloWorld ());
}
public HelloWorld ()
{
Button b = new Button ();
b.Text = "Click Me!";
b.Click += new EventHandler (Button_Click);
Controls.Add (b);
}
private void Button_Click (object sender, EventArgs e)
{
MessageBox.Show ("Button Clicked!");
}
}
```
* Also add Novell.Directory.Ldap (consumed by System.DirectoryServices)
* Doing the same fix from Android to IOS.
* On mini-exceptions.c check if there is no ji we can continue and generate the exception without checking wrapper_type.
Fixes#16824
The same functions are referenced by JIT and runtime.
The JIT uses cannot be inlined. The runtime can.
Since I could not get anything else to build and the change is simple and mechanical, now two sets of functions are provided, inline and extern. Extern just calls inline.
This PR appears to change all the uses, but it is only the JIT uses. The runtime ones just work and keep the old names.
We should also consider building desktop with LTO/LTCG, which would do all this automatically, smarter, more generally. A quick experiment shows it grows the runtime size, which is why I say desktop.
This includes resolving a somewhat deep problem involving
a void* that is usually to a int/float, but can be a MonoObject** or at least MonoString**.
An additional MonoStringHandleOut parameter is pass around to address this.
Perhaps it should be MonoObjectHandleOut for more generality.
[interp] avoid exception checkpoint when in thread is in GC Safe state
Usually the interpreter operates in GC Unsafe state. There is an exception however, and that is when it executes a `managed-to-native` wrapper in cooperative (or hybrid) suspend.
The wrapper does essentially:
1. enter GC Safe state via `mono_threads_enter_gc_safe_region_unbalanced`
2. call native function
3. exit GC state via `mono_threads_exit_gc_safe_region_unbalanced`
Usually upon return of a native function call, the interpreter would check for thread interruption and, if applicable, throw an exception. That, however, would mess with the GC state as the interpreter operates in GC Safe state at this moment.
Note that ignoring thread interruption at that point shouldn't be a problem, because after 3. the `managed-to-native` wrapper will check for thread interruption anyway.
Contributes to https://github.com/mono/mono/issues/16819
This is required by the newer arcade builds.
We can simplify our scripts since we no longer need the special publishwitharcade.proj.
Added copyright and license to the .nuspecs since the new arcade validation now
verifies this against a set of Microsoft policies.
We also need to make the .nupkg pre-release by appending the -preview suffix as stable versions are not permitted in non-stable feeds.
* [System] Make FileSystemWatcher backend non-static
The FileSystemWatcher `watcher` field is the backend IFileWatcher that's
supposed to be used for the actual operations.
Each backend has a `bool GetInstance (out watcher)` method that returns a
singleton object, so each new instance of FileSystemWatcher gets the same
IFileWatcher instance. (They will get different `watcher_handle` instances
which are used by some backends to uniquely identify this FileSystemWatcher).
However when the first FileSystemWatcher instance is `Dispose`d, it will set
`watcher = null` which will prevent the remaining instances from calling
watcher?.StopDispatching (watcher_handle);
watcher?.Dispose (watcher_handle);
which means that the backend won't properly cleanup resources for any other FSW
instances that have other `watcher_handle` values.
Addresses https://github.com/mono/mono/issues/16709
* [Coop] InterlockedExchange (object and T), InterlockedCompareExchange (object and T).
- Usually intrinsified.
- Always?
- Avoid coop handles by manually always using ref to object.
- For efficiency on input, and efficiency wrt MonoError.
- For correctness on output (due to aliasing in the wrappers).
- To probably avoid assertion failure in runtime around icall marshaling of generics.
- Unclear on location.
* Balance parens in prints, so they are balanced in the code.
* Reduce local arrays from 16 to auto-sized 1.
* Update and reformat System.Threading.Interlocked signature recognition.
* Rename the generic again to "_T" (or "Generic"?) on the theory
that the aot-runtime.c signature check is too strict/incorrect,
but that if we loosen it, it is not clearly specific to the generic.
* Revise corlib version again.
* Bump API snapshot submodule
ApplicationTrustEnumerator used to call itself. The following snippet crashed with SO:
using System.Security.Policy;
public class Program {
public static void Main (string[] args)
{
ApplicationTrustCollection col = ApplicationSecurityManager.UserApplicationTrusts;
col.GetEnumerator ();
}
}
hybrid suspend won't get disabled when using --enable-cooperative-suspend
triggering configure error:
Hybrid suspend and Cooperative suspend cannot be both enabled.
Fix explicit set hybrid suspend default behavior to no if cooperative
suspend has been configured.
- Use __builtin_bswapxx for s390x rather than inline assembler
- s390x ABI specifies that %f8-%f15 are protected between calls so avoid using or save/restore as required
- Save the "protected" FP registers in the context structure
[mini] Add missing membars when initializing rgctx entries
Whenever we are publishing changes to the rgctx arrays, we are racing with rgctx_lazy_fetch_trampoline, so we need to make sure any pointers we set there must have their contents initialized.
We sometimes saw the following build error in Mono SDKs builds on Jenkins:
```
[2019-09-16T01:03:30.709Z] CSC [xammac] nunit-lite-console.exe
[2019-09-16T01:03:30.709Z] error CS0009: Metadata file '/Users/builder/jenkins/workspace/archive-mono/2019-08/mac/release/mcs/class/lib/xammac/nunitlite.dll' could not be opened -- PE image doesn't contain managed metadata.
```
Taking a closer look we found out that nunit-lite was trying to be built twice for the same profile which caused a race where the file was corrupted.
The reason for this is that the corlib Makefile defines two test assemblies: the normal PROFILE_corlib_test.dll and BinarySerializationOverVersionsTest.dll and
integrating the BinarySerializationOverVersionsTest.dll via the `test-vts` target incorrectly overwrote the `test` target instead of using `test-local`.
This started as an effort to reduce the size of System.Net.NameResolution.dll when publishing a trimmed app. It's not that big to begin with, but it's carrying around a copy of all of the IAsyncResult helper types, because the Get*Async methods are currently wrappers for the Begin/End* methods.
This PR inverts that, wrapping the Begin/End* methods instead around the Get*Async methods, using the same TaskToApm helper we use in other places in corefx for the same purpose. This makes the Get*Async methods faster and lighterweight, but it does increase the number/amount of allocation in the Begin/End* APIs. Since these are considered legacy, I normally would consider that a good trade, however we still use these Begin/End methods in a few places in System.Net.Sockets, and I didn't want to regress those use cases.
So, this also then trims some additional fat, which helps the Get*Async cases even further, and gets the Begin/End* to be even better than before the change. This includes not allocating an IPHostEntry when we're just going to unwrap it and return its addresses, computing the exact IPAddress[] size we need rather than using a List<> to grow it and ToArray to create the actual array, avoiding creating the HostName if we don't need it, and avoiding an unnecessary SafeHandle allocation.
As part of this, I also noticed that we had some bugs in how some of our interop structures on Windows were defined. In particular, fields that in the native types were size_t were defined as int rather than IntPtr in the managed code. It appears we were saved by padding, but I fixed it regardless.
And as long as I was changing pretty much everything else, where I was touching code I also cleaned up some legacy style stuff.
Signed-off-by: dotnet-bot <[email protected]>
[arm64_32] make "Debug Mode" work on Watch series 4 with --interpreter
Main objective for reviewers: This PR shouldn't change anything for `arm64`.
Context: "Debug Mode" on the Apple Watch allows execution of regular machine code and thus is pretty similar to FullAOT on iPhone, i.e. it doesn't require bitcode, but _still_ doesn't allow `signal(3)` so cooperative suspend is required.
Apple Watch Series 4 and onward use an ARM64 chip, but with a different ABI, also known as `arm64_32`. This PR changes the AOT compiler and related trampolines so that the AOT compiler can generate all necessary code to run the interpreter on this target.
Changes:
--------------------------------------
[arm64_32] set register size to 8 in cross compiler too
-----------------------------------------
[machine] update `target_mgreg_t` definition
`SIZEOF_REGISTER` is usually the same as `TARGET_SIZEOF_VOID_P`, except when `MONO_ARCH_ILP32 is defined.
`target_mgreg_t` should represent the width of the hardware register, that is, `SIZEOF_REGISTER`.
---------------------------------------------
[arm64_32] fix AOT image layout
---------------------------------------------
[arm64_32] make trampolines bitwidth aware
* replace pointer loads/stores with bitwidth-dependent macro
* reflect `specific` trampolines so that only two instructions are used for ILP32, since the related pair in the data page only needs 2 * 32bits too
* replace some `sizeof (target_mgreg_t)` with `TARGET_SIZEOF_VOID_P` (former is hardware register size, latter is pointer size)
---------------------------------------------
These regression tests are _not_ passing: https://github.com/mono/mono/issues/16864 Also some of monotouch-tests are crashing, see https://github.com/mono/mono/issues/16819
Here is a screenshot of a debug session in VSMac:
<img width="1321" alt="Screenshot 2019-09-16 at 19 13 22" src="https://user-images.githubusercontent.com/75403/64981326-1dfbc000-d8bc-11e9-9d16-48036f36b638.png">
Contributes to https://github.com/mono/mono/issues/10641
Treat [In, Out], [In] and unspecified as input arguments. Important change from
current behavior is to allow parameter without directional attributes.
Use case example is _MethodInfo.Invoke() method called from native client.
- Factor out reptition into already existing macros.
- Remove the default for computed goto which is dead.
Computed goto has no notion of default. It is just
an unchecked array access.
Extracted from https://github.com/mono/mono/pull/16721.
* [interp] Pass rank instead to LDELEMA
It feels more intuitive and uses less computations.
* [interp] Avoid unnecessary type check
Loading element address of array requires type checks only if the elements of the array are references.
* [interp] Avoid using MINT_CALLRUN for Get intrinsic
It is very slow. Use ldelema/ldobj pair instead.
* [interp] Optimize MINT_LDELEMA
* [interp] Rename ldelema_fast to ldelema1
ldelema_fast was handling arrays with a single dimension. Rename it to better suggest this.
* [interp] Avoid using MINT_CALLRUN for Set intrinsic
* [interp] Remove some duplicated and confusing code
* [interp] Fix stack type of MINT_NEWARR result
When creating a new culture, we’ll have the equality CultureInfo.DateTimeInfo.Calendar == CultureInfo.calendar be true. After cloning such culture, this equality would not be true. The fix here is to ensure if the equality is true before cloning then should be true after cloning.
Signed-off-by: dotnet-bot <[email protected]>
* [runtime] Fix configure support for netcore+out of tree builds. Add wasm support for generating netcore/config.make.
* [runtime] Add bundle support for the netcore assembly loader.
* [netcore] Add missing linker exclusion.
* [wasm] Add netcore builds, enabled by defining ENABLE_WASM_NETCORE in Make.config.
The targets are 'package-wasm-runtime-netcore' and 'package-wasm-bcl-netcore'.
The binaries are copied to out/wasm-runtime-netcore-<CONFIG> and out/wasm-bcl/netcore.
* [wasm] Add netcore support to the build system and packager.
* Fix the build.
* Fix the dynamic build.
* Fix infrequent hangs in test-runner.
test-runner has been plagued with very infrequent hangs causing long
timeouts on CI. Turns out that there is a race in AsyncStreamReader
used by Process class for handling stdout/stderr when closing down
process. Since AsyncStreamReader::Dispose didn't make sure no pending
async read requests were still in flight before closing the stream
and underlying handle, it led to a race condition deadlocking the
complete process, hanging test-runner. A similar race has also been
observed but instead of causing a deadlock, it could also manifest as an
System.ObjectDisposedException when doing EndRead while another thread
is disposing the underlying stream. Hitting that race didn't deadlock
the process but failed to complete invoke of test-runner.
Fix is to better protect the async callback and the thread doing the
dispose call. In order to make sure we don't close underlying handle
while still having async reads in flight, fix also checks async result
for completion and if not completed when trying to dispose AsyncStreamReader
it will try to cancel outstanding pending IO and wait for completion
before closing the stream.
Since the issue has only been seen on Windows, the fix will try
to cancel pending IO and wait for completion before closing stream
on Windows. On other platforms, old behavior will be preserved, meaning
that the implementation will still be vunarable to race between pending
reads and close of stream, but since problem has not been observed on
other platforms and since there is no good way of cancel outstanding
blocking reads, old behavior is kept.
At some point in future we should look into replacing the implementation
of AsyncStreamReader and use cancelation tokens, but since we don't have
all corefx support around cancelation in Mono BCL, that currently won't
solve the issue, meaning that we need to bring in more classes. Since the
problem also occur in test-runner using the build BCL profile, even more
needs to be added to that profile in order to get similar support. But due
to the infrequency of the problem and that it has only been observed on
Windows, the isolated fix seems more reasonable.
* Build error fix.
* Review feedback.
* Fix type cast not working on linux builds.
* Adjust icall naming in icall-def.h.
* [netcore] Change an ArrayList to a List<T>.
* [netcore] Call the generic version of Array.IndexOf () in the ICollection wrappers. Update exclusions file.
Since each function has its own module (in JIT mode) it makes sense to dump the whole module for MONO_VERBOSE_METHOD instead of just LLVM::Function.
It adds metadata, attributes and global variables (so it will be possible to copy-paste it to godbolt)
Example
static int Test(int x)
{
return x / 10;
}
Diff for Unoptimized IR: https://www.diffchecker.com/NrF413Ts
Diff for Optimized IR: https://www.diffchecker.com/jbEkeFFS
So now we can see global variables and metadata for each function (and can easily paste them to godbolt.org)
NOTE: optimized IR for this case contains "dead" variables (dump_module allowed us to see such), we probably need some Module-wide optimizations to strip dead code such as -globaldce
NOTE2: why do we emit exceptions in the first place for this case at all?
This is a legacy of before the profiler was used for the trace
output; it would apparently get the raw stack pointer and try to
dereference things by recalculating the offset as needed (no for
little, yes for big). However, because the profiler returns the
actual fixed-up pointer, this recalculation isn't needed on BE,
but instead grabs garbage a bit ahead on the stack.
To fix, use what was the little endian case unconditionally.
Example before:
[1: 20.70598 14] ENTER: System.Globalization.CultureInfo:.ctor (int,bool,bool)(this:700000000408fb0[System.Globalization.CultureInfo platform.exe], 271824864, -32, -32, )
Example after:
[1: 1.93377 14] ENTER: System.Globalization.CultureInfo:.ctor (int,bool,bool)(this:700000000408fb0[System.Globalization.CultureInfo platform.exe], 127, 0, 1)
[aot] Do not put quotes around wrapped path
Should fix: https://github.com/xamarin/xamarin-android/issues/3619
As it results in double quoting, which vanishes the effect and breaks
AOT for XA on Windows.
The actual error:
[aot-compiler stdout] Stripping the binary: ""C:\Program Files (x86)\Microsoft Visual Studio\2019\Stable\MSBuild\Xamarin\Android\ndk\arm-linux-androideabi-"strip" --strip-symbol=\$a --strip-symbol=\$d obj\Release\90\aot\armeabi-v7a\libaot-Xamarin.Android.Arch.Core.Common.dll.so.tmp
[aot-compiler stderr] '""C:\Program' is not recognized as an internal or external command,
[aot-compiler stderr] operable program or batch file.
[aot-compiler stderr] AOT of image C:\Users\peter\source\repos\App9\App9\App9.Android\obj\Release\90\android\assets\Xamarin.Android.Support.CoordinaterLayout.dll failed.
* [interp] Add flag for locals that have their address taken
The previous handling of LDLOCA was broken because if the address was taken before the instructions that would be optimized we would miss any potential changes to the local value. Right now we just skip optimizing locals that have their address taken. This is achieved simply by not pushing LDLOC on the evaluation stack, for those locals.
* [interp] Add separate counters for optimized instructions
To provide more insight.
* [interp] Propagate locals
Whenever we generate a movloc we remember what local was copied. When loading a local we check if it's currently storing the value of another local, in which case we load the original local instead.
* [interp] Kill instructions that write to dead locals
We track the liveness of a local by counting how many times the local is loaded using ldloc. When such instructions are optimized, the ldloc counter is updated accordingly.
* [interp] Don't optimize code if under debugger
* [interp] Replace frame_objref with volatile stores to non-volatile locals.
Non-volatiles subject to volatile read/write still get stack-packed.
Volatiles do not.
This will possibly conserve stack, unless MINT_NEWOBJ_FAST is critical path.
It looks like it is -- enabling this for Linux/gcc/amd64 grows
frame from 0x98 to 0xA8.
In either case, it is more efficient as the reads do not have to be volatile.
The value can be on the stack and in registers. The stack value will pin it.
* PR: Comments.
* PR: Rearrange comment for correctness, same length.
S.R.CS.Unsafe is used in number of places in Vector<T> already. This change modifies more places to use it to make the code more compact.
Updated Vector.tt template to match while I was on it
Signed-off-by: dotnet-bot <[email protected]>
* improve logging for EventSource.WriteEvent
* Fix IndexOutOfRangeException in SerializeEventArgs when incorrect arguments got passed
* simplify arg-check; remove nullable-todo
* switch from Debugger.Log to ReportOutOfBandMessage
* Remove unused flush-Paramater from ReportOutOfBandMessage
* fix parameter type nullable-check for reference-types
* fix parameter type nullable-check for nullable-types
Signed-off-by: dotnet-bot <[email protected]>
* nuspec for llvm
* Add llvm to matrix
* fix scripts/ci/pipeline-netcore-runtime.yml
* fix scripts/ci/pipeline-netcore-runtime.yml
* fix scripts/ci/pipeline-netcore-runtime.yml
* run tests with llvm
* add macOS lane
* disable llvm tests for now
* [interp] Fix buffer overreads and overwrites found by valgrind.
* Attempt to deal with inlining correctly.
* PR: Dial back IR changes. Only IL relevant.
* PR: Dial back more -- only needed changes to .NET IL manipulation, not interpreter IR manipulation.
* PR: Remove one more line.
Eventually this could contribute to stack savings. On its own, nothing.
The compiler apparently likes to create temporaries, like ip and ip - 1.
Which then have to survive functions calls, on the stack, if nonvolatile registers are exhausted.
This combats that and in a larger PR helped.
-p PORT allows easier retrieval of AOT profile from the application
running with aot profiler, using the socket connection on local PORT
-f instructs the tool to try setup adb port forwarding to/from Android
device or emulator
Example usage, retrieve the AOT profile from Android:
> mono aprofutil.exe -s -v -f -p 9998 -o my.aprof
Calling 'adb forward tcp:9998 tcp:9998'...
Reading from '127.0.0.1:9998'...
Read total 94903 bytes...
Summary:
Modules: 6
Types: 262
Methods: 1,162
Going to write the profile to 'my.aprof'
* Fix Running .NET Core Under Winndows App Compat Shim
.NET Core uses Windows features called sort handles for perf reason to speed up the collation operations (e.g. string comparisons). When enabling Windows app compat shim (e.g. Windows 7 compatibility mode), the calls uses sort handles will fail which cause all collation operations to fail.
The fix here is to detect if the sort handles work before using it to ensure successful run.
* Address the feedback
* More feedback addressing
Signed-off-by: dotnet-bot <[email protected]>
* [wasm] Add missing aot-profile/runtime.js.
* [aot] Avoid writing out a zero AOTID in deterministic mode.
* [wasm] Add --aot-profile= option to packager.
* Modify configuration flag `ENABLE_WASM_DYNAMIC_RUMTIME` to `ENABLE_WASM_DYNAMIC_RUNTIME`
* Modify configuration flag `ENABLE_WASM_DYNAMIC_RUMTIME` to `ENABLE_WASM_DYNAMIC_RUNTIME`
* Modify configuration flag `ENABLE_WASM_DYNAMIC_RUMTIME` to `ENABLE_WASM_DYNAMIC_RUNTIME`
* [wasm] stop excluding test_0_large_nullable_invoke on wasm
* [wasm] remove wasm exclusion from test_0_simple_double_casts
* Add category MultiThreaded to more of the concurrent collection tests
* Add more MultiThreaded annotations to HttpListener2Test
* Add category MultiThreaded to HttpWebRequestTest
* [wasm] flag more tests that are taking down the runtime
* [wasm] force sockets to throw PNSE in the ctor for now
* [wasm] enable corlib interpreter tests
* [wasm] Increase timeout for corlib tests
* try to fix wasm-cross-win-release-configure on macos
* [wasm] Fix several typos
* add a comment about an error in test class name
* Remove the comment about test class name because it could be passed on xunit command line
Also removes dependency on System.Range and RuntimeHelpers.GetSubArray in a simple console app such that they can be trimmed away.
Signed-off-by: dotnet-bot <[email protected]>
These are not currently supported, but marking them as simd helps llvm eliminate dead variables with these types, since
XZERO is easier to eliminate than VZERO.
* [cominterop] Add a helper to create default marshal spec for ccw arguments.
* [cominterop] Default to SAFEARRAY(VARIANT) as CCW argument for object[].
* [cominterop] Fix build with --enable-cxx.
[interp] Embrace that ip is const guint16* and remove casts to that type.
or to gint16*. Or is there a reason for this style?
Maybe could change type but still want to cast for the deref?
Before this commit, the only information associated with a local was just the offset at which it resides and instructions had this offset embedded from the start. This makes it awkward to have data structures indexed on the local, or have additional information per local, which we might care at some point (for example if it is multi basic block local, if the address of the local was taken etc). In addition to this, if we will want to remove some instructions that make some locals dead, it means that we will have to compact the whole locals space and update all the offsets referenced by all instructions. We solve all these problems by resolving (and allocating) the local offset at the latest time, while emitting the instruction in the compacted byte stream. At this point dead locals will remain dead, with no additional work needed to handle them.
For now, IL locals of the current method that we are compiling are immortal. We can address that later if needed.
Keeping these reflection enabled pulls in quite a bit of junk (generic dictionaries, standalone method bodies, bookkeeping) that adds up to 1.5% of the size of Hello World...
Signed-off-by: dotnet-bot <[email protected]>
The implementation reads the current value of the static cache field and then later overwrites that field with the originally read value. If ClearCachedData was called in the interim to clear the cached data, this will end up effectively undoing part of that clearing, as it'll end up restoring the previous cache. The fix is to write back the new reference only when we need to, which we could do when we detect it's null.
There's a secondary race condition this fixes as well. When a name and an altname are used with CultureInfo.GetCurrentCulture(string, string), the implementation was publishig the newly created instance into the dictionary under the lock, but then after the lock was released, it was setting that TextInfo to be read-only. That provides a window where another thread could see it as non-read-only and mutate it. The fix is to ensure it's marked as read-only fully before it's published.
As I was doing this, it struck me that the implementation was overly complicated, trying to merge three different code paths for three different callers, presumably to share code, but most of the code ended up not being shared anyway, which just made the code harder to follow for little gain. So, I split it back out into the three calling functions and removed the helper.
I also changed the locking mechanism. It had been using a single shared lock to protect all state, but the purpose of the lock is really just to synchronize access to an individual dictionary, so we can just lock on the relevant dictionary.
Signed-off-by: dotnet-bot <[email protected]>
* Remove stale SuppressMessage attributes (dotnet/coreclr#26501)
Signed-off-by: dotnet-bot <[email protected]>
* Use null coalescing assignment operator in more places
There's currently no auto-fix for this, so the fixes were done manually.
Signed-off-by: dotnet-bot <[email protected]>
* Fix IDE0026 (use expression-bodied members for indexers)
Signed-off-by: dotnet-bot <[email protected]>
* [jit][llvm] Track variable nullness separately from array length ranges/index ranges in abcrem.
"Nullness" is tracked via a separate field that is stored adjacent
variable/array value ranges; values may be "maybe-null" or "not-null";
the intersection of maybe-null and not-null yields not-null, the union of
maybe-null and not-null yields maybe-null. The existing graph traversal logic
is reused as much as possible, which makes the implementation of this
null value approximation slightly more complicated than it would be
otherwise.
Fixes https://github.com/mono/mono/issues/16310, which was caused by
the use of non-empty array length ranges as a way to encode non-null
values.
This also allows null check elision for zero-sized arrays.
* Fix C++ compatibility. Fix a typo in a comment.
* Add symmetric nullness relations.
* Make ldlen imply that the source register is not-null, similar to CHECK_THIS or any other null check.
Callers of mono_reflection_create_custom_attr_data_args_noalloc were leaking some of the returned information. Accessed attributes are FixedBufferAttribute and UnmanagedFunctionPointerAttribute.
* [interp] Reduce unnecessary uses of frame->ex
* [interp] Remove ex from InterpFrame
We save stack space and move the exception where it belongs, in ThreadContext. It was confusing what frame->ex really meant, it was probably not used / initialized properly. We move it now to ThreadContext where it represents the current exception being thrown during EH (when we have a resume state set).
* Disable `subdir-objects` mode in Automake
This forces creation of subdirectories' files (e.g. .deps/*.Plo) in the
parent directory listing the source file. This works around a situation
where two different files specify files in a different parent directory
(i.e. ../../support/adler32.c in mono/metadata/ and adler32.c in
support/) both emit files into the same place (support/.deps), causing
`make distclean` to try and delete support/.deps from two different
places, breaking distclean.
This unfortunately adds a pile of Automake warnings, during autogen.
The "correct" fix is to stop specifying zlib as a pile of flat .c files,
and instead put it in its own subdirectory, conditionally including
its .la files as required.
Partially fixes https://github.com/mono/mono/issues/16605
* Ship netcore/Makefile with an empty distclean rule
We need a netcore/ directory because we write to it during configure,
and we need a netcore/Makefile with a distclean rule, so top-level
recursive distclean doesn't fail. So specify both here.
Partially fixes https://github.com/mono/mono/issues/16605
* [netcore] Fix the range checks for Vector.CopyTo().
* [netcore] Fix Vector.get_Item () for u1/u2, the llvm type is a vector of i1/i2, so we need to zero extend.
GCHandle is mutable, and this type does call Free on the handle, but with it marked as readonly, the mutations performed by Free will be done on a copy rather than on the original.
Signed-off-by: dotnet-bot <[email protected]>
* [llvm] Add functions to create weighted branches.
* [llvm] Use weighted branches in GC_SAFE_POINT, some llvm passes doesn't seem to recognize llvm.expect so the LLVM JIT generates the slow inline.
* Refactor BinaryReader.ReadChars using Span (dotnet/coreclr#26325)
Avoids unsafe code and makes the code simpler
Signed-off-by: dotnet-bot <[email protected]>
* Remove unnecessary parens from `return (true);` and `return (false);` (#26488)
Just a search and replace.
Signed-off-by: dotnet-bot <[email protected]>
* Avoid some unnecessary initialization in DateTimeParse (#26487)
Signed-off-by: dotnet-bot <[email protected]>
* Update analyzer versions (dotnet/corefx#40778)
In particular to pick up StyleCop fixes related to C# 8 and nullability.
Signed-off-by: dotnet-bot <[email protected]>
1. When comparing strings, check pointer equality.
Faster when they match, slower when they do not.
2. Provide string lowercasing into a provided buffer, which can equal
the input, to avoid extra malloc/free.
3. define G_STRING_CONSTANT_AND_LENGTH(x) (x), G_N_ELEMENTS (x) - 1
e.g. strncmp (foo, G_STRING_CONSTANT_AND_LENGTH ("version"))
mono_handle_native_crash() function can actually return if the native crash has triggered or has been trigerred by more than one signal. So it is possible to reach the point of the assert
This is so that complex consumers such as Visual Studio for Mac can forego attempting to enumerate all loaded libraries, register them one at a time and potentially keep the list updated
* [Coop] ves_icall_InternalInvoke.
(Part taken from ves_icall_InternalExecute https://github.com/mono/mono/pull/16622.)
* error_init_reuse.
* Remove stars from types.
* Fixing single step inside Exception on Android...
The method is null because on ss_create_init_args the IL is -1 when calling method Mono_UnhandledException_internal what I think it's expected, because of that I ignore the single step on android if there is no method. (debugger-engine.c)
After that the sequence point cannot be found because it's calling a method of class DynamicMethodNameCounter what I think it's expected, because of that I remove the assert on android. (debugger-agent.c)
Fixes#14772
* Changing comment to make it clear...
* [interp] Add stack information for each instruction
For each instruction PopN indicates how many values from the top of the stack are used by the instruction. PushN signals how many values are pushed back. These are also used to prevent values from the stack being optimized out, since they might still be used by an instruction. VarPop and VarPush mean that the number is not constant, so we need to inspect the data fields of the instruction (typically for an imethod or csignature) to figure out the stack usage.
* [interp] Convert ldloc/stloc pairs to movloc
The movloc instruction operates directly on locals. This is faster due to avoiding dispatch and stack indirection. More important is that it makes it easy to do copy propagation of locals and it has no stack usage, which means that it could even be killed if the destination local is no longer referenced (as well as STLOC_NP). In the future we could reuse this mechanism of tracking the value of a stack slot to do constant propagation and kill even more instructions (we might need to have _IMM versions of opcodes for this to work).
* [interp] Enable disabling of interp optimization
* [interp] Add time tracking stat for cprop optimizations
* [interp] Move stloc.np transformations to the cprop pass
It makes more sense to do such transformations here and we also don't want transformations in the generate phase prevent us from detecting alternative transformations when running the full pass.
* [interp] Add counter for instructions that were optimized away
* [interp] Make it explicit that we are dealing with IR code
It can be confusing in verbose output.
* Remove MAX_PATH usage in w32process
* Fixes
* Shrink buffer temporarily
* More fixes
* Reset buffer size to 260
* Fix length check and add notes
* Actually free things
* Add tracing and zero len at start
* Typo
* Fix another leak
* Simplify logic
It turns out it's not enough to set global fast math parameters, it's also required to mark some instructions as "fast" (see https://llvm.org/docs/LangRef.html#fast-math-flags) like, for instance, clang does, see https://godbolt.org/z/U8TFST
E.g. all optimizations inside SimplifyLibCalls pass (it's a subpass of InstCombine) need it.
Remove ASP.NET sample (we currently have to download apsnet runtime everytime)
instead we can do:
dotnet new webapp
and do make patch-app APP_PATH=/path/to/myasp (works for any kind of apps/templates)
* [jit] Relax assembly checking for 64 bit targets to allow running mixed-mode MSVC code.
Fixes#37913
* STACK_PTR|I8 should be the same as I8|STACK_PTR tuple
* fix i4 to ptr conv on 64bit
* [interp] Remove some some false is_bb_start markings
Having fewer basic blocks makes potential optimizations more effective.
* [interp] Persist variables in TransformData
Thate are not used by inlined code because we don't inline code that has multiple basic blocks or clauses.
* [interp] Enable emitting of MINT_NOP instruction
This instruction will be optimized away when compacting the instruction stream.
* [interp] Clear instructions insead of removing them
Makes everything easier.
* [interp] Fix some instructions size inconsistencies
* [interp] Add more is_bb_start markings
* [interp] Add nop instead of extending bb
We should always have an IR instruction associated with an IL offset, especially when that instruction is a bb_start since we will need to branch to it and resolve the IR instruction from the il_offset.
* [interp] Simplify resolving in offset
We should always have an in_offset associated with the il_offset we are branching to.
* [interp] Add correct il_offset for all instructions
Except for special prolog instructions that will have -1 as the offset. We don't make much use of il_offset for non bb_start instructions, but they might be useful for debugging.
* [interp] Fix il_offset of some conv opcodes
[runtime] Make eglib tests run on CI
Update mono/eglib SUBDIRS to build tests after eglib is built.
Add a check-local automake rule.
Add CI steps to run the eglib tests.
* Cleanup x86_patch and amd64_patch.
amd64_patch has two incorrect looking probably unused cases.
g_assert(0) and fix them.
call and jmp indirect (one case)
move reg RIP relative
x86_patch is large-ish inline macro.
Presumably for sharing with amd64, not inlining.
Restructure as an inline function, called once.
Try to make the code a little clearer also, with same functionality and efficiency
(modulo the optimized perf of "if i == 4" vs. "if i")
i.e. speak of instruction_size and offset_size, not pos and boolean size.
Add to x86_patch the ability to patch jmp/call indirect,
as amd64_patch has, but which was incorrect.
This would seem useful for a later change (using "thunks"
to patch nearby data instead of patching aligned instructions,
indirect call/jmp vs. direct).
amd64_patch largely delegates to x86_patch.
One case asserts and delegates.
Move the assert to the x86 side, where an optimizing
compiler should know to remove it for x86 anyway.
Change some assert to g_assert.
Remove some unnecessary casts.
Fix an assert (https://github.com/mono/mono/pull/16471).
* Change g_assert back to assert except where making larger changes
and less expansion.
[mini] publish global patches after JitInfo has been added
Fixes https://github.com/mono/mono/issues/14080
Consider the following example:
```csharp
static void CommonCallTarget () { }
static void TailA () {
tailcall CommonCallTarget ();
}
static void TailB () {
tailcall CommonCallTarget ();
}
```
Since `TailA` and `TailB` are tailcalling into `CommonCallTarget`, the resolution at patch-time is a bit tricky, that is, since it's a jump-like instruction the patching machinery won't know where it was called from. That's why we maintain a global hashtable `jump_target_hash` where each jump-site is signed up to be patched. At patch-time we know the target method (in the example `CommonCallTarget`), but since we don't know where we are coming from, we will just apply all patches for that target.
This works since ages, so why did it crash on arm64 sometimes?
When the patching happens, we check if the displacement between jump-site and target fits into it (24bit). If not, which happens not very often, we have to allocate a _thunk_:
https://github.com/mono/mono/blob/36296ce291f8a7b19de3eccb7a32c7e4ed9df8f2/mono/mini/mini-arm64.c#L928-L942
So instead of jumping to the target directly, we'll branch to the thunk. This is a little trampoline that loads the full address of the target and then finally branches to it. This one will live close-by the jump-site, because during compilation we will reserve specifically for that scenario some space after the generated code. For this, however, we need the JitInfo of the jump-site. And that's where the origin of the race is. Let's say:
* Thread A compiles `TailA`, and then jumps into it. Thus one patch point is in the `jump_target_hash`.
* Now Thread B compiles `TailB`, registers the patch point but has _not_ yet registered its JitInfo.
* Then Thread A continues, does the tailcall into `CommonCallTarget`, enters the patching machinery, which sees two patches. Now assume when applying the patch for `TailB` the displacement is too large, thus it tries to allocate a thunk but can't find the relevant JitInfo for it that it needs to emit the thunk. So it crashes as reported in https://github.com/mono/mono/issues/14080
As far as I can tell this only affects ARM64, ARM and PPC.
<!--
Thank you for your Pull Request!
If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.
Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
Revert "[android] add hardware specific workaround for Nexus9 in armv7 mode"
This reverts commit ee90fc601e (also see https://github.com/mono/mono/pull/4878 ).
The device was released November 2014. I think it's fair to assume it isn't widely used anymore.
Add F_OFD_GETLK, F_OFD_SETLK and F_OFD_SETLKW to FcntlCommand. These
commmands are similar to F_GETLK, F_SETLK and F_SETLKW but operate on a
per-open-file-description lock instead of a per-process lock and avoid the
problem that the locks are released when close(dup(fd)) is called. See
https://lwn.net/Articles/586904/ for more information.
This commit also reruns create-native-map but keeps manual changes from
ed892ccf27,
b522eab5ff and
22b6b95814.
In [create-native-map.diff.txt](https://github.com/mono/mono/files/3557077/create-native-map.diff.txt) you can see the difference between the commited `map.[ch]` and the one `create-native-map.exe` wants to create:
- Manually inserted changes for NetBSD (`MAYMOVE` is turned into a negated `FIXED`)
- `Mono_Posix_ToSockaddrIn6()` and friends get skipped for `HOST_WIN32` (not sure why, when `sockaddr_in6` exists then `Mono_Posix_ToSockaddrIn6()` should work)
- At the bottom of `map.h` some functions are reordered and the parameters change (`const char*` vs. `char*`)
Running create-native-map.exe also moved some O_NOATIME-related stuff (from 8b9033e4d2) to the correct position and added it to Mono_Posix_ToOpenFlags(), which I kept in the commit.
[configure] remove autodection of llvm-config in $PATH
Instead `./autogen.sh --with-llvm=<path>` should be used if a build from `external/llvm` is not preferred.
The old behavior was confusing when a `llvm-config` is on `$PATH`, which can be the case when you have LLVM packages installed on a Linux distribution. It picked that up when `./autogen.sh --enable-llvm` was used.
/cc @brianrob
* [interp] Compress the interpreter opcode names in the usual way, by changing
from an array of pointers to an array of 16 bit offsets into one large "string".
* PR: Make mono_interp_opname a function.
* [coop] Convert System_Runtime_Remoting_Messaging_AsyncResult_Invoke, etc.
* Remove mono_load_remote_field_checked from this PR.
* Pin ac->msg earlier (should not matter).
* Add missing barrier.
* Pin slightly earlier -- still should not matter.
Cleanup trampoline size checks.
- named `int` everywhere
- `assert` everywhere
- assert `<=` everywhere instead of `<`
- `const` almost everywhere
Names not consistent, following existing code (`size`, `buf_len`, `kMaxCode`.)
Only touching x86/amd64, granted.
Could be better -- make them two pass and avoid the presizing.
* Use the right FileSystemWatcher sources
The corefx code for FileSystemEventArgs has some changes to support
constructing one with a null filename.
Fixes#16486
* Remove the mono sources for the newly replaced files
* [csproj] Update project files
Read only memory is preferred, for efficiency and security.
Even if it requires relocation first.
If the runtime is loaded in more than one process, physical pages can be shared (at least on Windows, where the kernel does the relocation).
If there is memory corruption, writes to here will sigsegv/accessviolate.
The older code also copied the pointers. For lifetime purposes that could be useful, but generally is not. i.e. they live with the code they point to.
Writable function pointers are also particularly targets for attackers.
There's been tons of defenses put around them through the years.
Read only ones are not vulnerable -- unless the attacker escalates and calls mprotect first.
When there is a JIT, arguably there is just tons of attack surface.
But there is also AOT.
Structs of function pointers are usually read only in the wider world.
Resolves https://github.com/mono/mono/issues/16122
Since we put in the corefx version of GZipStream, it is expected that
our version of DeflateStream actually implements Write+ReadAsyncMemory.
This change does that by just calling the plain WriteAsync & ReadAsync
methods until we decide (or not) to pull in the corefx DeflateStream.
[mini] do not re-AOT whole BCL for fullaotcheck targets
And enable `llvmfullaotcheck` target on CI.
Fixes https://github.com/mono/mono/issues/15999
On my armv7/linux machine with a `--with-runtime-preset=fullaot_llvm` configured build, before this PR:
```console
$ time make -C mono/mini llvmfullaotcheck -j4
[...]
real 9m42.362s
user 23m2.000s
sys 0m18.480s
```
After:
```console
$ time make -C mono/mini llvmfullaotcheck -j4
[...]
real 3m1.984s
user 4m51.648s
sys 0m8.248s
```
* [merp] Initialize hang_watchdog_path earlier; be lax if it's missing
Initialize hang_watchdog_path earlier - not just when
ves_icall_Mono_Runtime_EnableCrashReportingLog is called. That function is
only expected to be called by apps that explicitly want progress reports from
MERP when it's collecting a crash report. But we want the mono-hang-watchdog
to execute for all mono crashes (when crash reporting isn't ifdef'd out).
Also if we try to exec mono-hang-watchdog and fail for some reason, print a
nice message and then exit. We used to call g_assert_not_reached which would
kick off another MERP of the _forked child process_ which would then get
confused because it really can't run in the forked process at all.
On Unix, TransitionTimes are not used, so they are left empty. When deserializing an empty TransitionTime, it is throwing an exception because those are not normally valid. Fix deserialization to not validate empty TransitionTimes.
Fix dotnet/corefx 40578
Signed-off-by: dotnet-bot <[email protected]>
* Remove dead Boehm code.
Unity looked similarly dead.
The key points making it dead were:
create_allocator:
g_assert_not_reached() covering everything but local variables
mono_gc_get_managed_allocator:
always returning NULL, killing a bunch of code
after it
mono_gc_is_critical_method:
looking at data that was never filled in
This should have no impact, not even on Boehm.
Boehm should continue working just the same.
It is nice because it is the few/only uses of CEE_MONO_TLS.
- It _presumably_ means nothing on 32bit ARM and 32bit MIPS (was there mono/mips64?).
- Leaving only PowerPC32 and PowerPC64 (in this vicinity).
- It presumably means nothing on PowerPC32.
- Leaving PowerPC64 as the only user in this vicinity -- is it needed?
- Notice this is varyingly absent on x86, arm64, amd64, s390x.
Subject of another PR maybe.
Perhaps this was to enable the debugger to be 32bit against a 64bit target
on a biarch system, so it could do a cross-process manipulation of these pages?
That makes some sense on Windows at least.
(32bit debugger cannot debug 64bit target as of Vista, but that is using the Win32
"hard" debugger API. Mono could do otherwise).
There remains amd64 mono-codeman.c define ARCH_MAP_FLAGS MONO_MMAP_32BIT left alone.
LLVM eagerly optimizes constants such as NaN in a way that does not align with .NET behaviour. In the future we can change it so that we only do opcode emulation when LLVM is used.
Fixes https://github.com/mono/mono/issues/16411
* Fix Abbreviated Genitive Month Names Parsing
In 3.0 we have fixed the formatting to use the abbreviated genitive month names when having "d" format specifier followed by "MMM". This fix is good as original formatting specs required but we needed to support the parsing when we have such genitive names.
* Addressing the feedback
Signed-off-by: dotnet-bot <[email protected]>
While working on stack reduction, I believe I found that
the compiler could not tell how THROW_EX and/or NULL_CHECK terminate.
That is, essentially, the success paths preserve volatile registers.
They do not have to be spilled/filled.
This tweak should make it clearer to the compiler, optimized common paths, and not slow down uncommon paths.
This also cleans it up a little and reduces macro expansion, and then possibly should allow for reinlining what is now used only once.
Also add some const so it can be casted away less.
Believed to save 32 bytes of stack with Linux/amd64/clang, nothing for gcc.
And a nice cleanup.
Several SGEN_LOG entries logged usec based on result returend from TV_ELAPSED.
On SGEN's implementation of TV_ELAPSED, the result is not scaled to usec
but returned as 100ns ticks. This was not handled correctly by SGEN_LOG,
but other measures, like profile counters and SGEN binary protocol handles
it correctly.
Fix will adjust the SGEN_LOG calls currently presenting usec to correctly
scale the result. Fix also adds one additional logging measuring total
amount of time spend scanning thread data.
- Chunks do not need flags, only codemanagers do.
- Sort by size to minimize padding for alignment.
- Booleans only need one bit.
- Chunk is not spelled chunck.
- Suggest foo accessors be named foo() and set_foo(), not get_foo() and set_foo().
i.e. the more common "get" is implied.
- Allow free(0) w/o initialization.
User may have extra expectations for the privatly owned array pools.
For example there could be an expectation that array never contains negative numbers (since user never puts them there). Uninitialized allocations can break such expectations.
Signed-off-by: dotnet-bot <[email protected]>
* Separate async method builder types into their own files
* Minor cleanup of AsyncTaskMethodBuilder types
* Split AsyncValueTaskMethodBuilder types into their own files
Signed-off-by: dotnet-bot <[email protected]>
The poll+select i/o selector backend can't handle file descriptor ids greater
than FD_SETSIZE. This can happen if too many files are open and we want to
wait on it.
Previously, mono would fail in the i/o selector thread by which point it was
too late to do anything.
With this change we will fail eagerly on the thread that calls IOSelector.Add
by throwing a NotSupportedException.
Addresses https://github.com/mono/mono/issues/15931
https://github.com/mono/mono/pull/16408 temporary fixed a tramp issue on
x86 (also exist on amd64). This commit fixes the underlying issue and re-enable
the use of noreturn outside of netcore.
The problem hit by the use of OP_NOT_REACHED on x86/amd64 is due to a specific
case when the address to patch happens to fall at the start of a different
managed method. Since the use of OP_NOT_REACHED can end a method
with the call instruction on x86/amd64 in combination with how patch location
(using the return address from stack) is resolved, the implementation in
mono_arch_patch_callsite didn't take this case into account, reading incorrect
patch data, triggering assert oh x86. So, based on timing we could end up with
the following code:
025715B3 call 02570D98
025715B8 push ebp
since the patch target is 025715B8, but also the start of a completely different
method, method_start == origin_code. The fix is to detect this case on x86/amd64
(done on each arch since the way origin_code is detected is arch specific)
and then use a method_start of NULL, that is already a supported scenario.
However, I'm not enabling the rule permanently, as it disagrees with VS IDE0055 about the spacing around semicolons at the end of empty while and for loops.
Because this also impacts `for (;;)` loops, I also searched and replaced those with `while (true)`, to standardize on that across the codebase.
Signed-off-by: dotnet-bot <[email protected]>
As of XCode 11 beta6 the MacOSX SDK defines the MAP_32BIT symbol:
```diff
--- /Applications/Xcode11-beta5.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/sys/mman.h 2019-07-25 17:43:49.000000000 -0400
+++ /Applications/Xcode11-beta6.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/sys/mman.h 2019-08-06 21:03:07.000000000 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2019 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@@ -145,6 +145,10 @@
#define MAP_RESILIENT_CODESIGN 0x2000 /* no code-signing failures */
#define MAP_RESILIENT_MEDIA 0x4000 /* no backing-store failures */
+#if !defined(CONFIG_EMBEDDED)
+#define MAP_32BIT 0x8000 /* Return virtual addresses <4G only: Requires entitlement */
+#endif /* !defined(CONFIG_EMBEDDED) */
+
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
/*
```
This causes the mono_valloc() function to try to use the MAP_32BIT flag for mmap().
However as mentioned in the comment for the symbol in mman.h it seems to require a special entitlement
which isn't available/documented anywhere yet.
This in turn causes the mmap call to fail presumably because we're missing that entitlement.
Instead we now skip setting this flag on Apple platforms to make mmap() behave like it did before.
[android] remove text relocations in AOT/arm32
Remove support for "big assemblies" for AOT on Android running on ARM 32bit. This will remove relocations in `.text` which are not allowed in the upcoming Android Q release anymore.
_If_ a customer should run into this problem, the suggested workarounds are:
* Switch to ARM64, or
* Do not use AOT compilation.
Fixes https://github.com/mono/mono/issues/16369
Contributes to https://github.com/mono/mono/issues/16172.
Seen to reduce frame from 0xB8 to 0xA8 on Linux/amd64/gcc against master.
Possibly similar elsewhere.
(Possibly 8 added to a rounded 8.)
Add const, add braces, they might help compiler and/or programmer.
Without being entirely scientific about it, this case seems
to be one that uses more than typical locals and therefore
be on a sort of critical path to reduce frame size.
I have a change that reduces frame to 0x78 bytes (albeit
not yet working) and to achieve that, in this case I refetched
the locals after function calls.
This achieves similar but perhaps more elegantly.
If we rest at larger frame size then this case might not be
on the critical path.
https://github.com/mono/mono/issues/16172
* Skip one syscall per thread in garbage collection.
Specifically do not query for guard pages.
There are better ways:
1. Visual C++ specific, __try / __except, get the guard page exception,
put back the guard page. This is a little slower (exception + two syscalls),
but exceedinly rare. __try itself is cheap on x86, free on the rest.
This was also not allowed on UWP. It will be. And is VirtualProtectFromApp.
2. Record the TEB and get from it the maximum commited page and just use MAX, trivial.
The comments are also not completely clear as to what is going on here, but they were close.
Augment them.
These registers can be encountered in the unwind info for functions with a cold
cconv, like xmm0 on amd64. Since they are caller saved, they don't have to
be restored during EH.
- Move source support files for custom building the wasm runtimes to a new directory called `wasm/support`
- Modified `packager.exe` to build from this new subdir.
- Updated the README.md to document the change.
Using the CoreCLR version of this line fixed the problem and my investigations
also revealed why.
The `SafePipeHandle` contains a reference to both the Socket as well as the
`SafeSocketHandle`, taking ownership of them. If there are no additional
references to either of them, so that both are collected in the same GC pass,
their finalizer may be invoked in any order.
If the Socket gets finalized first, it's `SafeSocketHandle` will have a `_mstate`
of 8 (two references) at the beginning of `DangerousReleaseInternal()` - which
will set it to 6 (one reference plus disposed flag).
Then when the `SafePipeHandle` gets collected, it will call `DangerousRelease ()`
on it's `SafeSocketHandle`. As mentioned above, it's `_mstate` will be 6.
Now we own the handle, so we'll decrease it's reference count by one and set the
`Closed` flag - the new `_mstate` should thus be 3.
However, using
new_state = (old_state & RefCount_Mask) - RefCount_One;
would set it to 1 - thus effectively clearing the `Disposed' flag. And since it's
reference count is now also zero, the next finalize pass will then throw.
The CoreCLR version of this class uses
new_state = old_state - RefCount_One;
which fixes this.
Lots of various spacing issues. I say "mostly" because I explicitly undid some changes that added to rather than reduced inconsistency, e.g. region indents. We can revisit that later.
Signed-off-by: dotnet-bot <[email protected]>
This is just running the rule and auto-fixing everything. I undid changes that converted e.g. `while (...);` to `while (...) { }`.
Signed-off-by: dotnet-bot <[email protected]>
The "mostly" here is that I undid changes where it was forcing formatting around a `: this` or `: base` call for a ctor, in particular where it was moving one up from the next line to be at the end of the current line.
Signed-off-by: dotnet-bot <[email protected]>
* Avoid race condition in DiagnosticCounter
If while a DiagnosticCounter instance is being created the timer fires to process counters, the timer may end up evaluating a DiagnosticCounter whose constructor or derived types' constructor hasn't finished configuring the instance's state yet.
* Remove unnecessary #if
Signed-off-by: dotnet-bot <[email protected]>
* [corlib] Improve file:// url handling in AppDomainSetup.
WiX 3 installer toolkit uses file:/// prefix when setting ApplicationBase for newly created domain.
Currently this leads to invalid path exception:
file:///C:\... -> /C:\... -> full path expansion with current workdir on different drive -> Y:\C:\...
Later it fails check for multiple ':' -> NotSupportedException ("The given path's format is not supported.").
This patch uses logic already present in AppDomain::Load().
* [Test] Add a test for file:/// application base.
* [Test] Fix test failure on Windows.
* [corlib] Simplify file: protocol check for AppDomainSetup.
The intention of calling `g_file_test (file, G_FILE_TEST_EXISTS)` where file is
the name of a shared library we want to open is to speed up probing for
non-existent libraries.
See https://github.com/mono/mono/pull/12074
The problem is that if file is just a simple "libdl.so" then `dlopen (file)`
doesn't just look for it in the current working directory, it will probe some
other paths too. (For example on desktop linux you'd also look in all the
directories in LD_LIBRARY_PATH). So the g_file_test() call is not a robust way
to avoid calling dlopen if the filename is relative.
But it actually broke more things: https://github.com/xamarin/xamarin-android/issues/3388
When probing for "libdl.so" on Android mono_lookup_pinvoke_call will first try
prepending some paths that it knows about and we end up calling
`dlopen ("/system/lib/libdl.so")` which will fail because Bionic has security
restrictions on what code can dlopen something from /system/lib with an
absolute path. Eventually mono_lookup_pinvoke_call will go back to trying the
bare "libdl.so" which hits `g_file_test` and returns NULL.
The new code only does the file test if we pass it an absolute path, which
gives Bionic's dlopen a chance to deal with relative paths however it needs to.
This should conserve stack. I didn't verify it.
child_frame being address-taken, compiler would struggle to remove it.
So we have the same value in two places.
https://github.com/mono/mono/issues/16172
It seems the Configuration set inside of the System.Private.CoreLib.csproj is just completely ignored, making it default to "Debug".
Maybe because we're using Microsoft.NET.Sdk ?
These aren't a perfect match, but better than falling into the `default` case
where Mono asserts and crashes.
Addresses part of https://github.com/mono/mono/issues/16024
* [netcore] Consolidate running tests between AzDO pipeline and Makefile
There was some unnecessary duplication between the two that we can remove.
* Add timeout to test execution
Jenkins builds are failing due to missing gettext; also realized that graphics unit tests will fail without some additional packages that will not be pulled in automatically.
Added:
`gettext-runtime gettext-tools cairo libdrm mesa-dri mesa-libs`
* Pass -fvisibility=hidden to profiler modules.
This appears to not break the profilers:
```
directhex@breakfast:/tmp$ nm -g /tmp/ponyponyponypony/lib/libmono-profiler-log.so | grep close_socket_fd
directhex@breakfast:/tmp$
directhex@breakfast:/tmp$ /tmp/ponyponyponypony/bin/mono --profile=log:report bottle.exe
99 bottles of beer on the wall, 99 bottles of beer.
Take one down and pass it around, 99 bottles of beer on the wall.
[..]
No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, 99 bottles of beer on the wall.
Mono log profiler data
Profiler version: 3.0
Data version: 17
Arguments: log:report
Architecture: x86-64
Operating system: linux
Mean timer overhead: 86 nanoseconds
Program startup: Mon Aug 19 14:18:30 2019
Program ID: 17715
Server listening on: 41539
JIT summary
Compiled methods: 753
Generated code size: 228046
JIT helpers: 0
JIT helpers code size: 0
GC summary
GC resizes: 0
Max heap size: 0
Object moves: 0
Metadata summary
Loaded images: 3
Loaded assemblies: 3
Exception summary
Throws: 0
Executed finally clauses: 3
Thread summary
Thread: 0x7fcd968c9700, name: "Finalizer"
Thread: 0x7fcd966c8700, name: "Profiler Sampler"
Thread: 0x7fcd9b036780, name: "Main"
Thread: 0x7fcd964c7700, name: "Profiler Helper"
Thread: 0x7fcd954c5700, name: "Profiler Dumper"
Thread: 0x7fcd95cc6700, name: "Profiler Writer"
Domain summary
Domain: (nil), friendly name: "bottle.exe"
Context summary
Context: (nil), domain: (nil)
Counters:
Mono System:
User Time : 70.000ms
System Time : 0.000ms
Total Time : 140.000ms
Working Set : 22032384
Private Bytes : 63455232
Virtual Bytes : 449630208
Page Faults : 3004
CPU Load Average - 1min : 1.870000
CPU Load Average - 5min : 2.670000
CPU Load Average - 15min : 2.900000
Mono JIT:
Methods from AOT : 536
Methods JITted using mono JIT : 154
Methods JITted using LLVM : 0
```
* Add missing annotations and includes
Without being entirely scientific about it, this case seems
to be one that uses more than typical locals and therefore
be on a sort of critical path to reduce frame size.
I have a change that reduces frame to 0x78 bytes (albeit
not yet working) and to achieve that, in this case I refetched
the locals after function calls.
This achieves similar but perhaps more elegantly.
If we rest at larger frame size then this case might not be on the critical path.
https://github.com/mono/mono/issues/16172.
* Many updates to make it better
Too much to list by many measures. This makes sure appropriate kernel modules, file systems, build packages, supplemental packages, and directories are installed or created as appropriate. This also addresses a known failure condition in System.Security-xunit due to a missing directory resulting in ownership problems.
* Make corrections for Azure
I don't have an Azure to test with, so I missed that the script is calling with `-e` and that Azure uses a non-`GENERIC` kernel with procfs baked in (likely required for Azure drivers.)
Part of #16172 though not necessarily any gain from this change, at this time.
We might want to expose ifdef and inline mono_thread_internal_current also or instead.
debug-mono-ppdb.c ppdb_compressed_size may be used uninitialized
ppdb_size may be used uninitialized
image.c iinfo set but not used
icall.c klass set but not used
* [netcore] Use Release configuration for CI builds
Fixes https://github.com/mono/mono/issues/16308
* [ci] Ensure the artifacts/logs/Release folder exists
Some arcade steps need the path to exist and we only create artifacts/logs/Debug right now,
because that folder is created by eng/common/tools.sh used by init-tools.sh defaulting to Debug.
For purposes of stack savings, only MINT_NEWOBJ_VT_FAST w/o the "ST"
needed to be outlined, and inlining also the ST form increased
its stack use, w/o savings elsewhere.
That is, the recursive cases should generally not be outlined.
We were outlining two. We still outline one.
This is partially undoing my recent change, where I outlined both of these, but only one was justified.
We'll download it from GitHub instead of storing it in Jenkins admin config.
Trial run with FreeBSD for moving all the other provisioning scripts to the repo too.
Immediately after calling this we're going to loop around and call it again at the beginning of the while loop.
Signed-off-by: dotnet-bot <[email protected]>
* Put finally data back in locals instead of frame to save 16 bytes of stack.
Partial undo of f8fd60b5c0.
* Add comments explaining goto main_loop vs. MINT_IN_DISPATCH.
- Convert setting thread name to be coop-compatible.
- For constant thread names, just retain the constant, not a copy.
This includes producing and using constant unicode thread names on Windows.
- Make setting a thread name often non-fatal, except where mandated by public API.
- From earlier PR: mono_free (mono-publib.c) would no longer be referenced and therefore
no longer exported. That broke profilers and maybe other externals.
Choices:
1 Use it instead of g_free randomly sometimes.
2 Call it randomly sometimes.
3 include it in external-only.c or object.c
4 Mark it external only (breaks profiler).
5 Use a .def file or Unix equivalent.
5 is best, 2 is done here, the advantages/disadvantages
among most choices are subtle. 3 is probably better than 2
but is slightly bigger change, to put off -- you'd stop
compiling mono-publib.c and move it to include/extra_redist.
The advantage of not-.def file is perhaps that it is exposed
by the compiler, so maybe easy to port and work with.
People are more comfortable with obscure C extensions than
any linker options, and there are multiple linkers to contend
with. Arguably there are fewer compilers.
There is an incompatibility here.
If Mono hands off an InternalError and it is accessed
like an ExternalError, like memset(sizeof()), bad.
Hopefully nobody does that.
There is also compatability -- embedders can continue to embed MonoError
in their own data. Its size and hopefully alignment is unchanged.
* [interp] Make sure we allocate stack for MINT_LD_DELEGATE_INVOKE_IMPL
This opcode is pushing a function pointer from the delegate, so it needs to have stack reserved.
* [interp] Fix overflow of stack space
* Fix IDE0066 across corefx
"Fix all", but then manual tweaking to accommodate places the rule doesn't work quite right.
* Address PR feedback
Signed-off-by: dotnet-bot <[email protected]>
Differences from the old versions:
- Only Vector<T> from corelib is supported.
- Only LLVM is supported.
- It uses more general opcodes like XBINOP instead of having one opcode
for every op+type combination which is not useful for LLVM.
- Convert setting thread name to be coop-compatible.
- For constant thread names, just retain the constant, not a copy.
This includes producing and using constant unicode thread names on Windows.
- Make setting a thread name often non-fatal, except where mandated by public API.
- From earlier PR: mono_free (mono-publib.c) would no longer be referenced and therefore
no longer exported. That broke profilers and maybe other externals.
Choices:
1 Use it instead of g_free randomly sometimes.
2 Call it randomly sometimes.
3 include it in external-only.c or object.c
4 Mark it external only (breaks profiler).
5 Use a .def file or Unix equivalent.
5 is best, 2 is done here, the advantages/disadvantages
among most choices are subtle. 3 is probably better than 2
but is slightly bigger change, to put off -- you'd stop
compiling mono-publib.c and move it to include/extra_redist.
The advantage of not-.def file is perhaps that it is exposed
by the compiler, so maybe easy to port and work with.
People are more comfortable with obscure C extensions than
any linker options, and there are multiple linkers to contend
with. Arguably there are fewer compilers.
* Use netcore_load_reference in mono_assembly_request_byname
* Add ALC static Resolve event code from CoreCLR
* Wire up the AssemblyResolve event
* Enable newly passing test
* Set requesting assembly in InternalLoad
* Remove infinite recursion
* Only call netcore_load_reference from mono_assembly_request_byname
* Remove test completely
* [interp] Fix more MonoError reuse (mono_object_new_checked).
* Inline mono_interp_new/mono_object_new_checked now that we are in outlined mono_interp_newobj.
Fixes https://github.com/mono/mono/issues/16032
When we switched to corefx File.Copy on unix, the behavior changed where it opened a source and destination stream in order to pass the safe handles to Interop.Sys.CopyFile. This exposed a flaw in our sharing validation rules in MonoIO.Open, which threw an exception in this scenario:
new FileStream("source.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite, 2048, FileOptions.DeleteOnClose);
new FileStream("source.txt", FileMode.Open, FileAccess.Read, FileShare.Read, 2048, FileOptions.None);
Simplified the FileShare check down to:
1. If the caller specifies FileShare.None, then it's an exclusive lock and no
sharing is allowed.
2. If the caller specifies some other FileShare option, then FileShare.None
cannot be specified.
Alternative to https://github.com/mono/mono/pull/16197.
If you are going outline, you sometimes might as well take it all with you
instead of bouncing back and forth for a partial inlining.
1002a4de2b added Authenticode cert support on non-WatchOS. The tests,
however, were not non-WatchOS-only. Fix this, so Watch doesn't try to
run Authenticode tests.
* [jit] Disable inlining for ThrowHelper methods for non-netcore as well. Add an OP_NOT_REACHED after calls to these methods to let LLVM know they don't return.
* [llvm] Use the cold calling convention instead of the preserveall one, it has the same effect and its better supported.
* [llvm] Call the aot init function using the cold cconv.
* [llvm] Make the condition in the poll function unlikely.
* [llvm] Add a wrapper around the GC poll icall so it can be called with a cold calling convention.
* Move the noreturn check before the code which is shared with calli.
* Fix several non-visible characters in test files
* Replace Unicode surrogate pairs with escaped hex values
* Fix non-ASCII characters in most C# files
Signed-off-by: dotnet-bot <[email protected]>
Windows can still have its Unicode thread names, since we have UTF16 initially, just don't retain it.
This does penalize ves_icall_System_Threading_Thread_GetName_internal (non-netcore only),
which has to convert back to UTF16 each time.
But seems like a net win overall.
There is also a little prep work here for constant thread names and some temporary measures as multiple changes head toward the same code.
Rename `mono_thread_set_name_internal` to `mono_thread_set_name`.
Close possible race conditions.
Extracted from https://github.com/mono/mono/pull/15859.
In this variation, the exception handling and resume are split between the main function and the helper function, and no address-taken occurs on ip/sp/vt_sp.
The order is a little tangled but convincing.
The helper function returns MonoException* or checks context->has_resume_state and then returns, and then the caller does the checks again.
Based on past analysis this will conserve stack, but that was not double checked here.
i.e. due to `&valuetype_this`, though it is conditional and the code could be split up into inline and outline.
Maintain a counter and only set if the counter has changed.
This cannot be fully thread safe, so is not.
Any thread can set any other thread name at any time.
You could be atomic to do better, and loop to do even better,
but the thread name could still be changed again right after the loop exists.
The previous code was also not reliable in this way, since again the name
could be changed right away.
#16248
* Fix linking of OS-provided zlib
This is a reduced version of https://github.com/mono/mono/pull/16091
without the Z_PREFIX stuff
* Get rid of HAVE_ZLIB, be explicit about HAVE_SYS_ZLIB vs HAVE_STATIC_ZLIB
* Proposed fixes from Alex
* [metadata] Create strongly typed versions of mono_assembly_request_prepare
Addresses the family of issues similar to Coverity #1443346.
This came up as part of the Coverity review, and Coverity notices that this is
writting beyond the end of the structure. While this is correct, this requires
that the idiom be properly followed - that is, that the structure being passed
is of the given size.
Replaced instead with a method that eliminates the room for error with methods
that will initialize the whole structure, and the actual size computation is
done inside the method with the proper type sizes.
While I used methods, I feel that this should use macros.
LLVM lowering passes vt as reference to managed methods. On platforms where
the value type ABI is passing an address to the value type, either in register
or on stack (Windows x64) we must make sure we always use a temporary of
the value type or we will be breaking the value type semantics.
In JIT lowering of OP_OUTARG_VT we always make sure we use a temporary
in cases where argument storage is set to ArgValuetypeAddrInIReg/ArgValuetypeAddrOnStack.
On LLVM lowering this was currently not the case, but it still worked in many scenarios.
This was because IL load of arguments before doing a call did a
local copy and then we pass that byref. However, there are cases where this
copy could get optimized away and when that happens, we will change the
local value type in the caller’s frame, breaking the value type semantics.
Added test case in winx64structs hits such a scenario that will generate IL
breaking the value type semantics before the fix:
...
notail call monocc void @winx64_vector3Struct_Add_winx64_vector3Struct_winx64_vector3Struct
(i64 %49, %winx64_vector3Struct* %3, %winx64_vector3Struct* %16)
...
notail call monocc void @winx64_vector3Struct_Add_winx64_vector3Struct_winx64_vector3Struct
(i64 %64, %winx64_vector3Struct* %3, %winx64_vector3Struct* %15)
...
The two add calls will use the same reference (to a local value type in caller frame)
on both calls, this will break the value type semantics since they should both
be temporaries, like second argument is.
After the fix, the same code will be lowered into:
...
notail call monocc void @winx64_vector3Struct_Add_winx64_vector3Struct_winx64_vector3Struct
(i64 %55, %winx64_vector3Struct* %19, %winx64_vector3Struct* %18)
...
notail call monocc void @winx64_vector3Struct_Add_winx64_vector3Struct_winx64_vector3Struct
(i64 %72, %winx64_vector3Struct* %16, %winx64_vector3Struct* %15)
...
Each argument gets its own temporary that, according to the ABI, gets passed
by address down to function.
There will be situations where we could end up with two temporaries, one from
the load and one from the lowering of OP_LLVM_OUTARG_VT (same as we get on JIT),
this will however be detected by LLVM optimization pass, removing one of the copies.
LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
I used the auto-fix and then undid changes in areas where the fields were potentially mutated in native, e.g. I undid many of the changes in reflection. We can revisit those individually later.
Signed-off-by: dotnet-bot <[email protected]>
* [runtime] Initialize thread suspend policy at startup, inline getter
On some benchmarks we saw mono_threads_suspend_policy() using a lot of CPU
time.
Rather than doing an init-on-first-use, initialize the policy once upfront when
the JIT it starting up and make the getter method static inline.
* move mono_threads_suspend_policy_init into mono_thread_info_init
* [mini] Initialize suspend policy for `mono --version`
Need to initialize the suspend policy before printing its name. Otherwise the
suspend policy is unset since no other runtime initialization is done for `--version`.
- The eng/Versions.props was already imported by the arcade targets causing a double-import warning:
> warning MSB4011: "/Users/alexander/dev/mono/eng/Versions.props" cannot be imported again. It was already imported at "/Users/alexander/.nuget/packages/microsoft.dotnet.arcade.sdk/1.0.0-beta.19379.1/tools/DefaultVersions.props (17,3)". This is most likely a build authoring error. This subsequent import will be ignored.
- Remove BaseAddress and TRACE from the project file, this was done upstream at https://github.com/dotnet/coreclr/commit/bc430cdd2010bf7790854a60380d00c506c346a6
- Remove unecessary DebugSymbols/DebugType settings, we already set them in the global PropertyGroup
The locally unknown function, despite being small/fast, forces saving values in stack and nonvolatile registers
around calling it.
Both nonvolatile registers and stack are at a premium here, whereas usually stack is cheap.
The macro is just a read from offset 0 and checking for zero.
Prompted by mono/msbuild#126:
This includes:
- merge mono-2019-06
- SDK update to track dotnet release/3.0.100-preview8
- Roslyn updated to 3.3.0-beta2-19381-14
https://bugzilla.xamarin.com/show_bug.cgi?id=14976
Credit goes to datnhanlz for noting that removing XChangeProperty(DisplayHandle, hwnd.whole_window, _XEMBED_INFO, _XEMBED_INFO, 32, PropertyMode.Replace, atoms, 2); would also fix the bug.
Note that the type of Atom is actually unsigned long (see usr/include/X11/X.h), however the code used a C# int for the atoms. As such the code worked without a problem on 32 bit linux, but broke on 64 bit linux.
I switched to using IntPtr instead to make the code also work on 64-bit.
The issue was made visible with .NET Core WinForms. Some controls draw text with DrawTextEx to intermediate Graphics based on Bitmap, that later it's moved back to main Graphics with DrawImage. This results in a lost of transparency component along the way, making antialiased glyph bitmaps draw and B/W. Corruption is visible with gray antialiasing, but is more severe in subpixel modes.
I verified that same happens with gdiplus on Windows, code from CoreFX works correctly.
When given a null application name, CreateProcess already
searches the path and appends .exe in some cases. .NET's
Process class behaves in the same way (see
https://github.com/mono/mono/pull/16089#issuecomment-519984244).
The duplicated logic is unnecessary and broken in several ways.
Failures are ignored and the command line arguments are
executed. Relative paths are expected not to end in "exe".
Many corner cases work differently from .NET and CreateProcess.
This change makes it impossible for process_complete_path to fail,
so I removed the gboolean return and pulled out the output
parameter. Its caller wasn't handling the return value correctly
anyway.
This will allow the interpreter to use System.Reflection.Emit.
Note: There is a small size increase (about 50kb) for an application
built in release mode with the LLVM backend (even if the interpreter
is now used).
* Make mono_assembly_request_prepare take an ALC
* Typo
* Fix pedump
* Use default ALC
* Make v1 preload hook external-only
* Convert pedump and monodis
* fixup: use default ALC in netcore preload hook
trusted platform assemblies should be loaded into the default ALC
* [merp] Use a separate program as the hang supervisor.
Fixes https://github.com/mono/mono/issues/15646
macOS does not like signals being sent from the forked supervisor process, possibly towards anywhere but definitely when sent to the parent process. The following message is currently spewed after the supervisor process attempting to send a SIGSEGV to a hanged Mono process:
"The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec()."
We follow that direction and introduce a new binary that, when available in the mono executable's binary directory, is used to abort the parent process for us.
The explicit implementations of IList.Add/Insert/Set methods catch
InvalidCastException for casting input argument to type T to throw
an ArgumentException. The issue here is they put the core collection
modification operation in the try block, which could be overridden
by sub-classes and produce an InvalidCastException from user logic,
even the argument passed to IList.Add/Insert/Set is valid.
To fix the issue, we just need to move the collection modification
outside the try block, and leave the casting in try block only. In
this way, we'll get an ArgumentException when the argument type is
invalid, but propagate the InvalidCastException thrown from user
code as it should be.
dotnet/corefx#39919
Signed-off-by: dotnet-bot <[email protected]>
Mechanical/automated change. The only manual changes were a) removing the two rules from the CodeAnalysis.ruleset file, b) removing spaces from one line of a .targets file that is used to generate a .cs file, and c) reverting the changes in a few test files where the naive replacement happened in the middle of a verbatim string where the whitespace actually mattered.
Signed-off-by: dotnet-bot <[email protected]>
* make few methods used by DateTime.UtcNow inlinable to minimize the leap second performance regression impact, related to #25728
* apply suggested micro-optimizations
Signed-off-by: dotnet-bot <[email protected]>
https://github.com/mono/mono/issues/16010
The current behavior for GetConstructorCandidates when the name is null, "",
or "*" is to return the set of constructors for the type. For "", .NET Core and
.NET Framework return 0 elements. This PR adds a check for "" to match that
behavior.
[sdb][interp] Use the interpreter's resume state to compute the IL offset in compute_frame_info.
This recovers the relevant bits of the "resume state" from the interpreter and uses that to recalculate the `il_offset` for the top frame.
Fixes https://github.com/mono/mono/issues/15687.
[llvm] Explicitly check for errors when calling LegacyIRCompileLayer::addModule.
LLVM built with LLVM_ENABLE_ASSERTIONS=On will crash if errors are not
explicitly consumed.
In the same way it is done in System.Buffer.MemoryCopy (void*, void*, ulong, ulong).
Correct what appears to be a typo in System.MemoryCopy with "long, long" size arguments.
Consequently, copy is not done byte per byte for the last int.MaxValue bytes when MemoryCopy is called with long argument (most common case). This should provide noticeable performance increase.
* [aotprof-tool] Initial import
Imported https://github.com/radekdoulik/aotprofile-tool and updated it
to use Mono.Profiler.Log
* [aotprof-tool] Added man page
* [aotprof-tool] Use the shortened name in README.md
* [trace] Use specific integer types for return value traces.
* [trace] Improve argument list formatting for ENTER lines.
Return value changes are especially visible for bools, where currently 4 bytes integers are printed.
[runtime] Fix an autoconf warning.
<!--
Thank you for your Pull Request!
If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.
Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
* Remove some unused locals
Trying out various analyzers, including one to flag unused locals. There are more than this, but this is a first batch. Some of these are just clean-up. Others are saving unnecessary cost. At least one appears to be a real functional bug.
* Address PR feedback
Signed-off-by: dotnet-bot <[email protected]>
* Updating Math.Round and MathF.Round to be IEEE compliant so that the intrinsic and managed form are deterministic.
* Fixing the Math.Round and MathF.Round handling for values greater than 0.5 and less than 1.0
* Applying formatting patch.
Signed-off-by: dotnet-bot <[email protected]>
* Allow for interface implementations in EventSource.WriteEventVarArgs
* Also account null ref types and nullable types
* fix error in comment and simplify first part of boolean logic
* Update src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs
Co-Authored-By: Noah Falk <[email protected]>
Signed-off-by: dotnet-bot <[email protected]>
The meat of this PR is what the title suggests, and with this commit all the basic ALC functionality should be working properly. Probably worth checking if this makes any new tests pass.
Additionally, this PR includes a second commit that switches over the search hook to use loaded_assemblies from the ALCs. This may break some existing tests due to remaining unimplemented ALC behavior, notably the native loading mechanism needed for Openssl in some of the cryptography tests. My inclination is to include the commit regardless and just disable the failing tests so that any future ALC work can watch for regressions in the loader, but I would appreciate input from steveisok on how important those tests are. I've not disabled anything yet in order to see exactly what new failures are introduced.
Cleaning up the `SocketAsyncEventArgs` class and preparing it for it's eventual
adaption from CoreFX.
There are a few instance fields and property accessors with `internal` visibility,
which the CoreFX version does not have. Replaced these with accessor methods.
The `PolicyRestricted` property and it's related `SocketAsyncEventArgs (bool)`
constructor is not used anywhere and the CoreFX version has a constructor with the
same signature, but different semantics.
In the CoreFX version, `Complete ()` does not call `DoComplete (this)` - renamed it
into `Complete_internal ()` to avoid any ambiguities and help the transitioning.
* Bump api-doc-tools to latest master
Disable building mdoc.exe in mcs mode since it no longer builds because of new C# features.
* Fix mcs build by disabling more mdoc invocations
* Bump monodroid_tools to compile against v4.7 reference assemblies
mdoc needs ValueTuple which is not in v4.6.
* [csproj] Update project files
* Update templates
- Add PropertyGroups for Debug and Release to set the DebugSymbols and DebugType by default.
* Allow the selection of the WebAssembly runtime version Debug | Release
- Decouple the reliance on `_DebugSymbolsProduced` to decide which runtime version to publish.
- Add support for <MonoWasmRuntime>Debug | Release</MonoWasmRuntime>
- Add validation target of the property to Mono.WebAssembly.Build.targets.
* Indentation
DIST_SUBDIRS=$(build_with_msvc) m4 mk po $(libgc_dir) llvm mono ikvm-native support data runtime scripts man samples tools $(build_without_msvc) docs acceptance-tests netcore
DIST_SUBDIRS=$(build_with_msvc) m4 mk po $(libgc_dir) llvm mono ikvm-native support data runtime scripts man samples tools $(build_without_msvc) docs acceptance-tests netcore netcore/corerun
AC_MSG_RESULT(zlib not found, using embedded zlib)
have_sys_zlib=no
zlib_msg="bundled zlib"
fi
;;
esac
@@ -719,13 +734,19 @@ esac
AC_ARG_WITH(static-zlib, [ --with-static-zlib=PATH use the specified static zlib instead of -lz],[STATIC_ZLIB_PATH=$with_static_zlib],[STATIC_ZLIB_PATH=])
if test "x$STATIC_ZLIB_PATH" != "x"; then
have_static_zlib=yes
have_sys_zlib=no
zlib_msg="static zlib from $STATIC_ZLIB_PATH"
AC_SUBST(STATIC_ZLIB_PATH)
fi
AM_CONDITIONAL(HAVE_STATIC_ZLIB, test x$have_static_zlib = xyes)
AM_CONDITIONAL(HAVE_ZLIB, test x$have_zlib = xyes)
AC_DEFINE(HAVE_ZLIB,1,[Have system zlib])
AM_CONDITIONAL(HAVE_SYS_ZLIB, test x$have_sys_zlib = xyes)
for feature in `echo "$enable_minimal" | sed -e "s/,/ /g"`; do
eval "mono_feature_disable_$feature='yes'"
@@ -1937,6 +1961,16 @@ if test "x$mono_feature_disable_gac" = "xyes"; then
AC_MSG_NOTICE([Disabled GAC support])
fi
if test "x$mono_feature_disable_dllmap" = "xyes"; then
AC_DEFINE(DISABLE_DLLMAP,1,[Disables use of DllMaps in MonoVM])
AC_MSG_NOTICE([Disabled DllMap in the loader.])
fi
if test "x$mono_feature_disable_threads" = "xyes"; then
AC_DEFINE(DISABLE_THREADS, 1, [Disable Threads])
AC_MSG_NOTICE([Disabled threading support])
fi
AC_ARG_ENABLE(executables, [ --disable-executables disable the build of the runtime executables], enable_executables=$enableval, enable_executables=yes)
AM_CONDITIONAL(DISABLE_EXECUTABLES, test x$enable_executables = xno)
@@ -2001,14 +2035,14 @@ if test "x$support_boehm" = "xyes"; then
AM_CONDITIONAL(ENABLE_EXPERIMENT_TIERED, test x$mono_experiment_test_enable_tiered = xyes)
dnl **********************
dnl *** checked builds ***
dnl **********************
@@ -5993,6 +6022,15 @@ AC_DEFINE(MONO_INSIDE_RUNTIME,1, [Disable banned functions from being used by th
mono_build_root=`pwd`
AC_SUBST(mono_build_root)
AC_ARG_ENABLE(msvc_only,[ --enable-msvc-only Build only with Visual Studio (msvc) (defaults to no). Disable gcc build.], enable_msvc_only=$enableval, enable_msvc_only=no)
if test x$host_win32 = xno; then
if test x$enable_msvc_only = xyes; then
echo "Error, --enable-msvc-only only supported for Windows builds."
exit 1
fi
fi
AM_CONDITIONAL(ENABLE_MSVC_ONLY, test x$enable_msvc_only = xyes)
AC_ARG_ENABLE(msvc,[ --enable-msvc Build with Visual Studio (msvc) (defaults to no)], enable_msvc=$enableval, enable_msvc=no)
if test x$host_win32 = xno; then
if test x$enable_msvc = xyes; then
@@ -6000,13 +6038,12 @@ if test x$host_win32 = xno; then
exit 1
fi
fi
if test x$enable_msvc_only = xyes; then
enable_msvc=yes
fi
AM_CONDITIONAL(ENABLE_MSVC, test x$enable_msvc = xyes)
if test "x$enable_msvc" = "xyes"; then
if test "x$support_boehm" = "xyes"; then
echo "Error, Boehm GC is not supported when using --enable-msvc."
[string]$GuardianPackageName,# Required: the name of guardian CLI package (not needed if GuardianCliLocation is specified)
[string]$NugetPackageDirectory,# Required: directory where NuGet packages are installed (not needed if GuardianCliLocation is specified)
[string]$GuardianCliLocation,# Optional: Direct location of Guardian CLI executable if GuardianPackageName & NugetPackageDirectory are not specified
[string]$Repository=$env:BUILD_REPOSITORY_NAME,# Required: the name of the repository (e.g. dotnet/arcade)
[string]$BranchName=$env:BUILD_SOURCEBRANCH,# Optional: name of branch or version of gdn settings; defaults to master
[string]$SourceDirectory=$env:BUILD_SOURCESDIRECTORY,# Required: the directory where source files are located
[string]$ArtifactsDirectory=(Join-Path$env:BUILD_SOURCESDIRECTORY("artifacts")),# Required: the directory where build artifacts are located
[string]$AzureDevOpsAccessToken,# Required: access token for dnceng; should be provided via KeyVault
[string[]]$SourceToolsList,# Optional: list of SDL tools to run on source code
[string[]]$ArtifactToolsList,# Optional: list of SDL tools to run on built artifacts
[bool]$TsaPublish=$False,# Optional: true will publish results to TSA; only set to true after onboarding to TSA; TSA is the automated framework used to upload test results as bugs.
[string]$TsaBranchName=$env:BUILD_SOURCEBRANCH,# Optional: required for TSA publish; defaults to $(Build.SourceBranchName); TSA is the automated framework used to upload test results as bugs.
[string]$TsaRepositoryName=$env:BUILD_REPOSITORY_NAME,# Optional: TSA repository name; will be generated automatically if not submitted; TSA is the automated framework used to upload test results as bugs.
[string]$BuildNumber=$env:BUILD_BUILDNUMBER,# Optional: required for TSA publish; defaults to $(Build.BuildNumber)
[bool]$UpdateBaseline=$False,# Optional: if true, will update the baseline in the repository; should only be run after fixing any issues which need to be fixed
[bool]$TsaOnboard=$False,# Optional: if true, will onboard the repository to TSA; should only be run once; TSA is the automated framework used to upload test results as bugs.
[string]$TsaInstanceUrl,# Optional: only needed if TsaOnboard or TsaPublish is true; the instance-url registered with TSA; TSA is the automated framework used to upload test results as bugs.
[string]$TsaCodebaseName,# Optional: only needed if TsaOnboard or TsaPublish is true; the name of the codebase registered with TSA; TSA is the automated framework used to upload test results as bugs.
[string]$TsaProjectName,# Optional: only needed if TsaOnboard or TsaPublish is true; the name of the project registered with TSA; TSA is the automated framework used to upload test results as bugs.
[string]$TsaNotificationEmail,# Optional: only needed if TsaOnboard is true; the email(s) which will receive notifications of TSA bug filings (e.g. [email protected]); TSA is the automated framework used to upload test results as bugs.
[string]$TsaCodebaseAdmin,# Optional: only needed if TsaOnboard is true; the aliases which are admins of the TSA codebase (e.g. DOMAIN\alias); TSA is the automated framework used to upload test results as bugs.
[string]$TsaBugAreaPath,# Optional: only needed if TsaOnboard is true; the area path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs.
[string]$TsaIterationPath,# Optional: only needed if TsaOnboard is true; the iteration path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs.
[string]$GuardianLoggerLevel="Standard",# Optional: the logger level for the Guardian CLI; options are Trace, Verbose, Standard, Warning, and Error
[string[]]$CrScanAdditionalRunConfigParams,# Optional: Additional Params to custom build a CredScan run config in the format @("xyz:abc","sdf:1")
[string[]]$PoliCheckAdditionalRunConfigParams# Optional: Additional Params to custom build a Policheck run config in the format @("xyz:abc","sdf:1")
[string]$GuardianPackageName,# Required: the name of guardian CLI package (not needed if GuardianCliLocation is specified)
[string]$NugetPackageDirectory,# Required: directory where NuGet packages are installed (not needed if GuardianCliLocation is specified)
[string]$GuardianCliLocation,# Optional: Direct location of Guardian CLI executable if GuardianPackageName & NugetPackageDirectory are not specified
[string]$Repository=$env:BUILD_REPOSITORY_NAME,# Required: the name of the repository (e.g. dotnet/arcade)
[string]$BranchName=$env:BUILD_SOURCEBRANCH,# Optional: name of branch or version of gdn settings; defaults to master
[string]$SourceDirectory=$env:BUILD_SOURCESDIRECTORY,# Required: the directory where source files are located
[string]$ArtifactsDirectory=(Join-Path$env:BUILD_ARTIFACTSTAGINGDIRECTORY("artifacts")),# Required: the directory where build artifacts are located
[string]$AzureDevOpsAccessToken,# Required: access token for dnceng; should be provided via KeyVault
[string[]]$SourceToolsList,# Optional: list of SDL tools to run on source code
[string[]]$ArtifactToolsList,# Optional: list of SDL tools to run on built artifacts
[bool]$TsaPublish=$False,# Optional: true will publish results to TSA; only set to true after onboarding to TSA; TSA is the automated framework used to upload test results as bugs.
[string]$TsaBranchName=$env:BUILD_SOURCEBRANCH,# Optional: required for TSA publish; defaults to $(Build.SourceBranchName); TSA is the automated framework used to upload test results as bugs.
[string]$TsaRepositoryName=$env:BUILD_REPOSITORY_NAME,# Optional: TSA repository name; will be generated automatically if not submitted; TSA is the automated framework used to upload test results as bugs.
[string]$BuildNumber=$env:BUILD_BUILDNUMBER,# Optional: required for TSA publish; defaults to $(Build.BuildNumber)
[bool]$UpdateBaseline=$False,# Optional: if true, will update the baseline in the repository; should only be run after fixing any issues which need to be fixed
[bool]$TsaOnboard=$False,# Optional: if true, will onboard the repository to TSA; should only be run once; TSA is the automated framework used to upload test results as bugs.
[string]$TsaInstanceUrl,# Optional: only needed if TsaOnboard or TsaPublish is true; the instance-url registered with TSA; TSA is the automated framework used to upload test results as bugs.
[string]$TsaCodebaseName,# Optional: only needed if TsaOnboard or TsaPublish is true; the name of the codebase registered with TSA; TSA is the automated framework used to upload test results as bugs.
[string]$TsaProjectName,# Optional: only needed if TsaOnboard or TsaPublish is true; the name of the project registered with TSA; TSA is the automated framework used to upload test results as bugs.
[string]$TsaNotificationEmail,# Optional: only needed if TsaOnboard is true; the email(s) which will receive notifications of TSA bug filings (e.g. [email protected]); TSA is the automated framework used to upload test results as bugs.
[string]$TsaCodebaseAdmin,# Optional: only needed if TsaOnboard is true; the aliases which are admins of the TSA codebase (e.g. DOMAIN\alias); TSA is the automated framework used to upload test results as bugs.
[string]$TsaBugAreaPath,# Optional: only needed if TsaOnboard is true; the area path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs.
[string]$TsaIterationPath,# Optional: only needed if TsaOnboard is true; the iteration path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs.
[string]$GuardianLoggerLevel="Standard",# Optional: the logger level for the Guardian CLI; options are Trace, Verbose, Standard, Warning, and Error
[string[]]$CrScanAdditionalRunConfigParams,# Optional: Additional Params to custom build a CredScan run config in the format @("xyz:abc","sdf:1")
[string[]]$PoliCheckAdditionalRunConfigParams# Optional: Additional Params to custom build a Policheck run config in the format @("xyz:abc","sdf:1")
EnableXUnitReporter:false# optional -- true enables XUnit result reporting to Mission Control
WaitForWorkItemCompletion:true# optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget."
IsExternal:false# [DEPRECATED] -- doesn't do anything, jobs are external if HelixAccessToken is empty and Creator is set
HelixBaseUri:'https://helix.dot.net/'# optional -- sets the Helix API base URI (allows targeting int)
Creator:''# optional -- if the build is external, use this to specify who is sending the job
DisplayNamePrefix:'Run Tests'# optional -- rename the beginning of the displayName of the steps in AzDO
condition:succeeded() # optional -- condition for step to execute; defaults to succeeded()
Write-PipelineTelemetryError-Category"InitializeToolset"-Message"Failed to install dotnet runtime '$runtime' from custom location '$runtimeSourceFeed'."
}
}
}
}
@@ -278,6 +312,7 @@ function InitializeXCopyMSBuild([string]$packageVersion, [bool]$install) {
Loaded 100 of 2407 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.