* Update TPN with Mono entry
* Update THIRD-PARTY-NOTICES.TXT
Add additional notice for Mono
* Update THIRD-PARTY-NOTICES.TXT
Update the Novell MIT-specific license
* Update THIRD-PARTY-NOTICES.TXT
Group various patterns of Mono license together
* Improve fatal err msg
* Match SO format
* a
* Remove dead define
* More adjustments to ex msg
* And PAL
* Remove special case for SOE
* Remove excess Debug.Assert newline
* Remove excess newline
* typo
* New format
* Remove DebugProvider redundancy
* Adjustments
* Remove preceding newline
* Make other SOE and OOM consistent
* Tidy up assertion msg
* Fix missing newline after inner exception divider
* CR when no inner exception
* ToString never CR terminated
* disable corefx tests temporarily
Signed-off-by: dotnet-bot <[email protected]>
* [arm64] Set a llvm target layout. Assert in llvm if the target layout is not set, the defaults used by 'opt' are not correct.
* Add a llvm target layout for amd64.
Flush() behaves like Flush(false) and writes out any buffered data but doesn't P/Invoke to FlushFileBuffers/FSync to flush the OS buffers.
But whereas FlushAsync() is supposed to just be an async equivalent of Flush(), it's actually behaving like Flush(true). This makes FlushAsync() inconsistent and much more expensive. (This is separate from FlushAsync not actually being async, which is an impactful problem to be solved separately.)
This changes FlushAsync to behave like Flush()/Flush(false) rather than Flush(true). If someone wants the FlushFileBuffers/FSync behavior, they can call Flush(true).
Signed-off-by: dotnet-bot <[email protected]>
* Add support for marshalling DateTime and DateTimeOffset
* Add type checking to Runtime.GetDateValue
- Update to use clr ToUnixTimeMillisecons and FromUnixTimeMilliseonds to replace manual calculations.
- Moved magic numbers to managed side to address comments left by Katelyn and Jay.
If this was not possible due to them being called during runtime initialization, a short comment was left noting the specific reason why.
Fixes#14377
This includes a couple other random fixes I noticed on the way, most notably replacing SEE_MASK_FLAG_DDEWAIT with SEE_MASK_FLAG_NOASYNC as the former is deprecated.
When passing a delegate to native code, we pass the delegate_trampoline which can be used to invoke the delegate from native code and we store this mapping (delegate_trampoline->delegate) in a hashtable so we can get a delegate for the delegate_trampoline, when marshalling the opposite way. If we are trying to marshal a ftnptr (for managed code) to a delegate and we don't find this mapping we can crash. This could happen if the finalization for some other delegate that uses the same ftnptr removes this entry from the table. We solve this by never freeing these entries. The first delegate-ftnptr pair will always be alive. This is easier, faster and potentially uses less memory than tracking in the hashtable every pair. There should be a small and limited set of methods marshalled to native.
Fixes https://github.com/mono/mono/issues/13231
* Add a warning to the gensources Makefile so it's not confusing when it fails to compile in non-build profiles
* Add CI test script that verifies the compiler server functions
* Fix bugs
* Add compiler server tag to jenkins script
* Add +x
* Rename compiler server test tag
The test case CopyFileWithData_MemberData with input of size 1024 * 1024 * 10
causes the Xamarin.Android.Bcl_Tests to crash for some reason. Temporarily
exclude this entire set of tests from running.
Also disable System.IO.Tests.FileInfo_CopyTo_str because it derives from the
above test class.
* [corlib]: Move sre dependency into their own method in `System.RuntimeType`.
Move call to `TypeBuilderInstantiation.MakeGenericType` into a new
`System.RuntimeType.MakeTypeBuilderInstantiation` method to allow the
linker to remove it.
Requires linker PR https://github.com/mono/linker/pull/590.
* Bump linker.
* Bump cecil as well.
* Fix the build.
* Really fix the build.
* Bump API snapshot submodule
* [csproj] Update project files
when the allocation does not fit, i.e. when it is >= MONO_MEMPOOL_PREFER_INDIVIDUAL_ALLOCATION_SIZE.
Or at least make the code clearer and smaller.
"fixes" https://github.com/mono/mono/issues/14669.
It's a private helper that's always directly awaited. No need to allocate a task each time it's called and data is synchronously available.
Signed-off-by: dotnet-bot <[email protected]>
* Just use `new T[]` when elements are not pointer-free
* reduce zeroing out when not necessary.
* use AllocateUninitializedArray in ArrayPool
Signed-off-by: dotnet-bot <[email protected]>
We didn't set all the categories that the products used in our profiles.
Now that the products can consume the exclude categories from mono we
need to unify the values.
Removed ValueAdd since it's not used anymore and combined MacNotWorking
into NotOnMac.
It makes sense to pass --interp (--interp=-inline) while having another execution mode previously set up (like --full-aot-interp).
Cleanup code a little bit by killing mono_enable_interp which doesn't do much.
* Fix enabling the compiler server using autogen, and force it off if mcs is being used
* autogen updates
* Formatting fixes
* Fix vbcs getting turned on if unspecified even if mcs was selected
* Dynamically evaluate ENABLE_COMPILER_SERVER each time we compile instead of evaluating it once at some arbitrary point during makefile evaluation
* More detailed comment based on testing
* Handle the /shared option in genproj so it doesn't fail
* Raise basic profile check requirement to 6.2 and hopefully assert that named pipes work
* Default compiler server to off for now.
During XI integration we noticed that just using the verbatim commandline
-exclude or -notrait is not ideal since XI uses the nunit/xunit APIs to
pass that information and not the command line parser.
Instead we now write the exclude categories/traits as a newline-separated file.
[interp] Share more wrappers for different interp in signatures
The passed arguments are already considered to be gpointer in interp_entry and the real value is obtained using stackval_from_data. For types that are passed by value in a register the wrappers will be identical and we can share them.
This commit reduces the size used by interp_in wrappers (in fullaot-interp) by half. These wrappers still take a fair amount of size, which comes mainly from signatures including value types, which aren't shared.
We used to use the static MXE toolchain, but after switching to Homebrew, we
have to explicitly pass flags to build binaries that don't depend on the
MinGW32 GCC support libraries (libstdc++-6.dll, libwinpthread-1.dll and others)
when building the LLVM and Mono binaries.
The simplest approach is just to pass CMAKE_EXE_LINKER_FLAGS=-static to cmake
and LDFLAGS=-all-static to libtool. The rest of the changes are just to make
it easier to do that by adding a configure flag and updating the SDKs
infrastructure.
We will also need an LLVM bump to actually build a new llvm archive with the
new build flags; until then, building Mono will provision an old build of LLVM
with the old build flags that still depends on libstdc++-6.dll.
---
An alternative approach instead of passing -all-static and -static would be to
probe for the assorted -static-libXYZ flags to GCC at configure time. (For the
LLVM build we would need to hardcode them as that build doesn't go through
autoconf). Right now Mono doesn't have any other DLL dependencies (other than
the core windows DLLs), so -all-static works just as well and is simpler.
Otherwise the Xcode linker tries to guess the version from the path,
and since we use Xcode101.app it'd use sdk=101 as the version which is wrong.
By explicitly specifying e.g. `$(XCODE_DIR)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk`
as the sysroot it correctly guesses sdk=12.1 instead.
See also https://github.com/xamarin/xamarin-macios/commit/834c0a9fd7062c0c25011721fd7d524b8a60b41e
Reduce stack size used by interpreter frame on Windows MSVC.
Interpreter frame was 1248 bytes in size under Windows MSVC. This was almost double the size of other platforms ~670 bytes. After investigating different constructs in interpreter switch statement in interp_exec_method_full, it turns out that local declared errors couldn't be reused over different case statements and added ~100 bytes each. Switching local declared errors to shared one, reduce the stack size down to ~670 bytes under Windows MSVC.
ifdef __cplusplus
define g_static_assert(x) static_assert (x, "")
else
define g_static_assert(x) g_assert (x)
endif
It is, granted, C++11, not C++98, and some C variations.
I myself am bumping for ODBC fixes. This includes a change to SslProtocols to include the Tls13 entry required by the CoreFX changes. (It doesn't wire it up to anything, including BTLS.)
* Fix CollectionTest.UnusableSyncLockTest test
The test checked whether the SyncRoot is of type object, but the corefx implementation switched to returning `this`.
* Bump API snapshot submodule
SemaphoreSlim.Dispose nulls out its lock object, and that's then used as an indication in other methods whether they should throw ObjectDisposedException. But nulling out an object used for synchronization in other methods is a bad practice, and while SemaphoreSlim.Dispose is not thread-safe to be used concurrently with other usage of the instance, it's still confusing when such usage leads to NullReferenceExceptions due to trying to lock on a null lock object. This change just changes the lock to be readonly, always set, and then whether the instance has been disposed is just a value set on that object (such that it's no larger than it used to be).
Signed-off-by: dotnet-bot <[email protected]>
* [System.Net.NetworkInformation] Fork FreeBSD from MacOs
They are related, but not identical. In particular, MacOS AF_INET6 is wrong
on FreeBSD and breaks IPv6 networking on FreeBSD. Establish an inheritence
relationship with overrides for now; it's possible more differences will be
needed in the future.
This change is released under the MIT license.
* [csproj] Update project files
* [jit] Also allow System.Runtime.CompilerServices.Unsafe intrinsics from the System.Runtime.CompilerServices assembly, not just corlib.
* [jit] Fix Unsafe.RefIsAddressLessThan()/RefIsAddressGreaterThan().
Relevant issue: #14376
There are potentially more functions this can apply to, but this covers the ones listed in the issue and an extra one I found in the process.
Functions were either broken off into an external-only and internal version, or such a pair already existed and the internal version was moved from the source file to a separate `-internals` header, similarly to in 3c74df5667.
This gets slightly complicated with `mono_domain_set` and `mono_domain_set_internal`, both of which are currently public (thanks to 4beada2892) and have different signatures. Additionally, the latter does not actually include the gc-unsafe transition despite being public.
I've opted to introduce `mono_domain_set_fast` as the 'internal' version of `mono_domain_set`, to add the proper gc-unsafe transition to `mono_domain_set_internal`, and then to migrate internal usage to `mono_domain_set_internal_with_options`. As part of that I've marked `mono_domain_set_internal` as external only, which is unfortunate naming-wise but I believe the best option here without introducing API breakage.
[llvm] Use CoreCLR GC interop configuration
Since they're identical right now, we can use the coreclr configuration
to make our IR more easily analyzed by tools built around LLVM.
```
class CoreCLRGC : public GCStrategy {
public:
CoreCLRGC() {
UseStatepoints = true;
// These options are all gc.root specific, we specify them so that the
// gc.root lowering code doesn't run.
InitRoots = false;
NeededSafePoints = 0;
UsesMetadata = false;
CustomRoots = false;
}
Optional<bool> isGCManagedPointer(const Type *Ty) const override {
// Method is only valid on pointer typed values.
const PointerType *PT = cast<PointerType>(Ty);
// We pick addrspace(1) as our GC managed heap.
return (1 == PT->getAddressSpace());
}
};
/// A GCStrategy for the Mono Runtime.
class MonoGC : public GCStrategy {
public:
MonoGC() {
UseStatepoints = true;
// These options are all gc.root specific, we specify them so that the
// gc.root lowering code doesn't run.
InitRoots = false;
NeededSafePoints = 0;
UsesMetadata = false;
CustomRoots = false;
}
};
```
Source: https://github.com/mono/llvm/blob/64c0343537016c153894dc60316bd7b316b812c8/lib/CodeGen/BuiltinGCs.cpp#L105-L137
On the stage of the initialization of the SqliteMembershipProvider the existed code always produced an error "Failed to map path '/'" in case if the ASP.NET application is placed not at the root path. Detailed step by step description of the problem is provided in the issue description.
The bug was that was implemented the call of the function with wrong parameters list. So the fix was in changing the function call. The same function call is also used in SqlMembershipProvider.cs.
Fixes#14234
[merp] Don't leak g_getenv return value
Coverity said:
```
CID 1445100: Resource leaks (RESOURCE_LEAK)
Failing to save or free storage allocated by "monoeg_g_getenv("MONO_CRASH_NOFILE")" leaks it.
```
First set of fixes to get the following tests working under interpreter
on Windows x64:
* mono/mini richeck
* mono/mini mixedcheck
* mono/mini fullaotmixedcheck
* mono/tests winx64structs.exe
Fixes are primarily related to Windows x64 ABI support in interpreter. Fixes
also makes sure our interpreter trampolines get unwind info making it possible
to debug through the trampolines on Windows x64.
Several fixes related to value types was needed, also fixed support for return
value types not fitting into registers, current implementation didn't return
passed in value type address in return register as mandated by both
System V and Win x64 ABI's.
Identified and fixed memory leak on every pinvoke from interpreter that needs stack.
Since Windows x64 ABI always use 32 bytes of stack allocated by caller, the
memory leak was hit on every pinvoke call.
It was using an unescaped makefile variable in the template, i.e. ended up empty which meant the build just took the host version as the min version.
Fixed the variable and also moved it to CFLAGS/CXXFLAGS instead of CPPFLAGS to be consistent with ios.mk
* Throw ObjectDisposedException instead of crashing when Cairo.Context.handle == IntPtr.Zero
We are seeing instances where VS for Mac is crashing with a SIGSEGV when
calling into certain Cairo.Context functions. Looking at the code, it's clear
that it's possible to have Context.handle == IntPtr.Zero after disposing the
object.
From research, it looks like passing a nullptr to raw cairo functions can
result in a SIGSEGV:
https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/93807
This change adds check to see if Conext.handle == IntPtr.Zero in Context
painting, font, and path methods. This will turn uncatchable SIGSEGVs
into ObjectDisposedException.
* Update Context.cs
* Ensure SetTarget results in a valid handle
* [llvm] Remove unused default_mono_llvm_unhandled_exception.
It references mono_gchandle_get_target_internal which is not marked MONO_LLVM_INTERNAL
so attempts to run it will fail.
This is caught by linking wit -z now (https://github.com/mono/mono/pull/14562).
* [loaded LLVM] mono_debug_get_seq_points and mono_class_enum_basetype_internak MONO_LLVM_INTERNAL
* Mark mono_debug_method_lookup_location MONO_LLVM_INTERNAL.
Found by linking with -z now (https://github.com/mono/mono/pull/14562)
which we should probably do for this and other reasons.
* #include mono-compiler.h for MONO_LLVM_INTERNAL.
* [loaded LLVM] Mark mini_is_gsharedvt_variable_signature as MONO_LLVM_INTERNAL.
Found by https://github.com/mono/mono/pull/14562.
* Mark mono_print_ins MONO_LLVM_INTERNAL.
* mono_rgctx_info_type_to_str MONO_LLVM_INTERNAL
* [loaded LLVM] mono_compile_create_var MONO_LLVM_INTERNAL
* ifdef around use of MONO_LLVM_INTERNAL and hope
* remove include mono-compiler.h from public header to internal header
* MONO_API_NO_EXTERN_C mono_debug_method_lookup_location() instead of mono_debug_method_lookup_location() MONO_LLVM_INTERNAL to workaround possible lack of MONO_LLVM_INTERNAL.
Rework use of marshalling for RuntimeTypeHandle, RuntimeModule, RuntimeAssembly, and IRuntimeMethodInfo as used by QCalls
- Remove special QCall only used marshallers for RuntimeAssembly, RuntimeModule and IRuntimeMethodInfo
- Following the pattern of ObjectHandleOnStack, implement QCall handle types for RuntimeAssembly/Module/TypeHandle. Use these in all QCalls that once passed the types directly.
- For uses of IRuntimeMethodInfo, follow the existing RuntimeMethodHandleInternal pattern
Also perform some replacement of bool marshalling with use of Interop.BOOL, and a few cases of using pointers instead of byref arguments.
Fix delivers a relatively small win on startup, and small throughput gains around reflection as IL stubs are no longer necessary for many functions in reflection that once needed them.
Reduces methods jitted on powershell startup from 422 to 399, (About 5%) but performance win is only about 5ms on ~400ms as the methods removed are simple.
Signed-off-by: dotnet-bot <[email protected]>
* [System.Core] Ensure monotouch[_runtime] API are identical
Ensure the API surface for `System.Core.dll` is identical between the
`monotouch` and `monotouch_runtime` (used for REPL and the interpreter).
This ensure code compiled against one will be fine when building against
the other (e.g. avoiding linker errors).
Removed methods:
```csharp
public void CompileToMethod (System.Reflection.Emit.MethodBuilder method);
public void CompileToMethod (System.Reflection.Emit.MethodBuilder method, System.Runtime.CompilerServices.DebugInfoGenerator debugInfoGenerator);
```
Removed methods:
```csharp
[Obsolete ("do not use this method")]
public static IRuntimeVariables MergeRuntimeVariables (IRuntimeVariables first, IRuntimeVariables second, int[] indexes);
[Obsolete ("do not use this method")]
public static System.Linq.Expressions.Expression Quote (System.Linq.Expressions.Expression expression, object hoistedLocals, object[] locals);
```
* [csproj] Update project files
* Bump API snapshot submodule
[interp] set correct stack type on op_Implicit/op_Explicit intrinsics for native types
Needs some additional conversions which happen to be included by accident previously.
This fixes those warnings on amd64:
```
Test run:
image=/Users/lewurm/work/mono-dim-call/mono/mini/builtin-types.exe
BuiltinTests.test_0_nuint_fieldload: Store local stack type mismatch 0 1
BuiltinTests.test_0_much_casting: Store local stack type mismatch 0 1
Results: total tests: 84, all pass
Elapsed time: 0.026546 secs (0.026546, 0.000000)
```
and those warnings on armv7:
```
Test run: image=/mono/mono/mini/builtin-types.exe
BuiltinTests.test_0_nint_inc: 0011 arith type mismatch add.i4 0 1
BuiltinTests.test_0_nint_dec: 0011 arith type mismatch sub.i4 0 1
BuiltinTests.test_0_nint_implicit_decimal: 0034 arith type mismatch
add.i4 0 1
BuiltinTests.test_0_nuint_inc: 0011 arith type mismatch add.i4 0 1
BuiltinTests.test_0_nuint_dec: 0011 arith type mismatch sub.i4 0 1
BuiltinTests.test_0_nuint_implicit_decimal: 0034 arith type mismatch
add.i4 0 1
Results: total tests: 84, all pass
Elapsed time: 0.039214 secs (0.039214, 0.000000)
```
[Android] Fix runtime loading of DSOs for 64-bit processes
Context: https://github.com/xamarin/xamarin-android/issues/2780
On Android the executable for the application is going to be
`/system/bin/app_process{32,64}` depending on the application's architecture.
However, libraries for the different architectures live in different
subdirectories of `/system`: `lib` for 32-bit apps and `lib64` for 64-bit ones.
Thus appending `/lib` below will fail to load the DSO for a 64-bit app, even if
it exists there, because it will have a different architecture. The quickest fix
is to use `lib64` explicitly for 64-bit Android apps.
<!--
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
-->
Backport of #13281.
/cc @lambdageek @grendello
Use example.com and example.org instead.
Fixes https://github.com/mono/mono/issues/14585
Note that not all of the things I replaced make an actual network request but I thought it'd be nice to be consistent.
* Plug leak of CustomAttribute initializer name
All the CustomAttribute initializer names (fields, property) except the last were leaked. Ensure all names are freed.
Fixes#14543
* Apply suggestions from code review
Co-Authored-By: Martin Baulig <[email protected]>
* [driver] add --version-number
Useful for third parties consuming the version number of mono.
* s/--version-number/--version=number/g
* add man page entry
* Implement AppDomain.MonitoringTotalAllocatedMemorySize
* Change precise:true back to precise:false in GetTotalAllocatedBytes
Signed-off-by: dotnet-bot <[email protected]>
* Modified format logic so that braces are not allowed in custom format specifiers.
* Disabled failing test temporarily and fixed code style issue.
PR needed to pass test: https://github.com/dotnet/corefx/pull/35820
* Slight changes to logic to better align the diff.
* Fixed counting error.
* Fix nullable
* Move exclusion near related test
* Add skip to new issue file
* Delete CoreFX.issues.json
Signed-off-by: dotnet-bot <[email protected]>
This affects the case where SemaphoreSlim.WaitAsync is invoked, the operation completes asynchronously because there's no count available in the semaphore, and where a timeout and/or a cancellation token is passed to WaitAsync. In that case, we need to wait for the underlying wait task to complete, for cancellation to be requested, or for the timeout to elapse.
There's currently one code path that handles this. This change improves that slightly by avoiding a defensive array copy. However, we can do much better when we get a cancelable token but no timeout, in which case we can avoid operations like Task.Delay, can register with the original cancellation token rather than a new one (which means we avoid forcing a new CancellationTokenSource's lazily-allocated partitions into existence), etc.
Signed-off-by: dotnet-bot <[email protected]>
The most important point of the "temporary" aspect, esp. given
the complete conversion, is renaming MONO_PATCH_INFO_JIT_ICALL to MONO_PATCH_INFO_JIT_ICALL_ID.
Any accidental or merged MONO_PATCH_INFO_JIT_ICALL will fail to compile.
* Copy icall-def.h to icall-def-core.h.
* Manually preprocess icall-def.h vs. icall-def-core.h.
The only common part in this construction is the JIT icalls at the end.
There much overlap, now duplicated.
* Remove JIT icalls fro icall-def-core.h.
* Merge icall-def-core.h with master.
* Merge icall-def.h with master.
* Rename icall-def-core.h to icall-def-netcore.h.
* Remove more unused icalls
Fixes#24663 by calling `Write(ReadOnlySpan<char>)` instead of `Write(object)` with a boxed `Memory<char>`.
Signed-off-by: dotnet-bot <[email protected]>
Currently if calling GetSystemTimeZones, will return a list which in include Utc object created from the enumeration. But when calling FindSystemTimeZoneById("UTC") will return the cached Utc object which is different than the one returned from the enumeration. This in general could be not a problem but it is better to ensure returned the same object from both APIs. The reason is in our internal code, we use some reference equality for the perf reason. Ensure the usage of Utc object will make it more reliable.
Signed-off-by: dotnet-bot <[email protected]>
We encountered some cultures have a time patterns with single quotes which we should handle keeping the parts between quotes as fixed text inside the pattern and not treat it as any of the time specifiers
Signed-off-by: dotnet-bot <[email protected]>
Build / profile changes:
------------------------
* `build/profiles/testing_aot_common.make`: define `DISABLE_REMOTING = yes` and
`NO_MULTIPLE_APPDOMAINS = yes`.
* `mcs/class/corlib/Makefile`: check `DISABLE_REMOTING` when setting
`REFERENCE_SOURCES_FLAGS` (and don't define `FEATURE_REMOTING`, `MONO_COM`
and `FEATURE_COMINTEROP`).
* added new `testing_aot_common_corlib.dll.exclude.sources`. Several types in
the `System.Runtime.Remoting.Messaging` namespace are used by the runtime in
non-remoting scenarios, so those need to be preserved.
For all other remoting namespaces, we only need a few stripped down stub versions
of the some of the types; those have been added to a new `legacy` directory, so
we can wildcard-exclude all the files here.
* added new `testing_aot_common_corlib.dll.sources`; this currently only contains
`legacy/*.cs` to list above mentioned stub versions.
* added new `testing_aot_common_corlib_test.dll.exclude.sources` as a common test
excludes file.
API Changes (conditional to `DISABLE_REMOTING`):
------------------------------------------------
* `mcs/class/corlib/legacy/`: add stub-versions for some of the remoting-related
classes that are used by the runtime (so we can't completely remove those types):
- `System.MarshalByRefObject`.
- `System.Runtime.Remoting.IRemotingTypeInfo`.
- `System.Runtime.Remoting.ObjectHandle`.
- `System.Runtime.Remoting.RemotingServices`.
- `System.Runtime.Remoting.Activation.ActivationServices`.
- `System.Runtime.Remoting.Contexts.Context`.
- `System.Runtime.Remoting.Messaging.ILogicalThreadAffinative`.
- `System.Runtime.Remoting.Messaging.LogicalCallContext`.
- `System.Runtime.Remoting.Proxies.TransparentProxy`.
- `System.Runtime.Remoting.Proxies.RealProxy`.
some of these have fields that need to be preserved; these are marked with
appropriate `#region` pragmas.
All changes below are conditional to `DISABLE_REMOTING`.
* `System.Runtime.Remoting.Messaging.AsyncResult`: this class is used by some of
the async code, so we can't completely remove it. However, we can remove the
`MonoMethodMessage call_message` field when `DISABLE_REMOTING`.
* `System.Runtime.Remoting.Messaging.MonoMethodMessage`: this class is also used
by some runtime code and thus needs to be preserved. However, when `DISABLE_REMOTING`
is defined, then we make some changes to it:
- remove all iterfaces (`IMethodCallMessage`, `IMethodReturnMessage`, and `IInternalMessage`).
- `Properties` throws `PlatformNotSupportedException`.
* `System.Runtime.InteropServices.Marshal`: disable some COM-related code.
* `System.Threading.Thread`: remove `CurrentContext` property.
* `System.Threading.ExecutionContext`: adjust conditional logic; don't define
`FEATURE_REMOTING` if `DISABLE_REMOTING`.
* `System.Activator`: add `DISABLE_REMOTING` to the existing
`#if FEATURE_REMOTING || MOBILE_LEGACY` conditional in this class.
* `System.AppDomain`: since we only have one domain, `DefaultDomain` will always
return the root domain; comment out the call to `RemotingServices.GetDomainProxy`
as well as some internal methods.
* `System.__ComObject`: stub out on `DISABLE_REMOTING` as well as `!FULL_AOT_RUNTIME`.
* `System.Runtime.Serialization.Formatters.Binary.BinaryFormatter`: adjust `IFormatter`
versus `IRemotingFormatter` interface logic to use the former when `DISABLE_REMOTING`.
* `System.Runtime.Serialization.Formatters.Binary.BinaryObjectReader`: adjust existing
`#if FEATURE_REMOTING || MOBILE_LEGACY` conditional to add `DISABLE_REMOTING` to it.
* `System.Diagnostics.CorrelationManager`: comment out some `CallContext.LogicalGetData()`
and `CallContext.LogicalSetData`.
* `System.Diagnostics.TraceEventCache`: likewise.
Test changes:
-------------
* `mono/tests/Makefile.am`: conditionally disable some remoting tests.
* `corlib/Test/System.Runtime.Serialization/SerializationTest.cs`: conditionally
disable all tests requiring remoting.
* `corlib/Test/System/ActivatorTest.cs`: same; trying to preserve as much as possible
in this test.
* added some `DISABLE_REMOTING` and `DISABLE_SECURITY` conditionals to some of the tests.
Fix leak in mono_parse_options
When MONO_ENV_OPTIONS is null, we would leak the array and buffer
<!--
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
-->
* [runtime] Fix mono_icall_get_wrapper_full () to always compile the wrapper even if a trampoline was created previously.
* [jit] Add a mini_patch_llvm_jit_callees () function to patch callsite variables for LLVM JIT.
* [llvm] Patch LLVM JIT callees in trampolines as well. Patching after a method is compiled is not enough, since new callsites can be created after a method has been compiled.
* [llvm] Cleanup calls from JITted code. Compile referenced jit icall wrappers immediately, since the calls will not be patched.
* Add a missing MONO_LLVM_INTERNAL.
* [arm] one more attempt to fix slotsize issue on llvmonly
Regression of https://github.com/mono/mono/pull/12992 & https://github.com/mono/mono/pull/14362
In the end, the actual fix boils down to:
```patch
--- a/mono/mini/mini-arm.c
+++ b/mono/mini/mini-arm.c
@@ -2374,7 +2374,7 @@ mono_arch_get_llvm_call_info (MonoCompile *cfg, MonoMethodSignature *sig)
lainfo->nslots = ALIGN_TO (ainfo->struct_size, 8) / 8;
lainfo->esize = 8;
} else {
- lainfo->nslots = ainfo->struct_size / sizeof (target_mgreg_t);
+ lainfo->nslots = ALIGN_TO (ainfo->struct_size, sizeof (target_mgreg_t)) / sizeof (target_mgreg_t);
lainfo->esize = 4;
}
break;
```
Tested on `xamarin-macios/arm64_32-v3` branch:
* mscorlib
* mini
* dont link
* monotouch tests
* and a modified version of https://github.com/mono/mono/issues/8486#issuecomment-414365860 (added larger structs too)
with each device, Watch Series 3 (`armv7k`) and Watch Series 4 (`arm64_32`).
I hope that is the last iteration on this.
* remove arm64_32_abi
* Reduce JIT icall hash use.
* PR: Rename mono_jit_icall_info_at to mono_find_jit_icall_info.
* Use enum instead of int, and update comment to reality (the assert is arguably leniently off by one.)
* Cast integer to enum for C++.
* More int vs. enum, and use two variables, and const.
* Undo a little fishing for CI failure.
* [netcore] Use bash explicitly for Arcade things
* [netcore] Work around https://github.com/dotnet/cli/issues/10014
* [netcore] Try forcing powershell Arcade on Windows
* [netcore] Switch build properties from /p: to -p: due to MSYS2/dotnet bug
* [netcore] Switch from nuget pack to dotnet pack
* [netcore] Add Windows x64 build
* [monodroid] Introduce 'win32 host' BCL build
* [sdks] Add _bcl_$(1)_BUILD_FLAGS variable to BclTemplate build step
Allows Android SDK on Windows to pass PROFILE_PLATFORM=win32
* [sdks] Pass _bcl_$(1)_BUILD_FLAGS when building the tests, too
* Copy test source exclusion files from the general monodroid profile
Apparently we don't fall back to the general exclusion sources for tests if the platorm-specific exclusion file does not exist.
* Also add win32 copies of the nunit exclude files:
files=$(find . -name "monodroid*_test*exclude.sources")
for file in $files
do
name=$(basename $file)
pushd $(dirname $file)
cp $name win32_$name
git add win32_$name
popd
done
* [csproj] Update project files
* [netcore] Exclude unused native locale icalls
* Fix builds with mono_feature_disable_sockets, currently not enabled by configure script
* [netcore] Don't compile in System.IO icall in netcore profile
* Make genmdesc output better typed and more readable -- almost hand-maintainable
but no clear route to actually hand-maintainable.
* Replace != with < and undo debug code.
* Changing EnableDefaultCompileItems=false to EnableDefaultItems=false
* Taking the VS auto-fixes for the solution and corelib csproj
* Removing the duplicated T4 file includes in the main csproj
* Regenerating the included T4 templates
* Fixing S.P.Corelib to properly list available platforms/configurations
* Add a comment on the T4 template service
Signed-off-by: dotnet-bot <[email protected]>
- Assembly.ToString() won't return null
- Several attributes have the intent that their arguments are non-nullable, even though they don't check and throw; the annotations should match the intent in such cases.
Signed-off-by: dotnet-bot <[email protected]>
Since commit d8af775, c++ compiler is required to compile.
This patch checks if the c++ compiler is available as soon as possible
and returns an error in case it is not found.
Fixes: https://github.com/mono/mono/issues/14195
Signed-off-by: Angelo Compagnucci <[email protected]>
Modify the sdks/builds/ infrastructure to support compiling the Android SDK on Windows.
The initial goal of this commit is to build only the monodroid BCL on Windows. Compilation of the host and cross-compiler mono binaries is future work.
There's one kind of hacky bit in here. Had to make sure that scripts/ci/run-jenkins.sh does _not_ set MONO_EXECUTABLE. Normally windows builds use the msvc in-tree compiled mono binary to build the BCL. In the case of the SDKs, we don't build that msvc binary, and we just use the usual (cygwin) mono to build the BCL.
* [sdks] allow building on cygwin
* [sdks] Start adding stub templates to llvm.mk
* [sdks] provision-android stubs for win32
* [sdks] Pass cygwin host triple to calls to configure on win32
* [sdks] Add runtime stub templates
* [sdks] Add android stub templates for win32
This is enough to get configure-android to work on cygwin x86_64
* [sdks] On win32, the HostMxe build is the host buildwe want the x86_64-w64-mingw32 toolchain, not the cygwin toolchain
* [sdks] For android on cygwin depend on the mingw64-{x86_64,i686}-zlib
* [sdks] Add android SDK build artifacts to .gitignore
* [sdks] Add AndroidCrossMXETemplate stub to android.mk for Windows builds
* [sdks] Fixup comments in android.mk
* [sdks] use UNAME=Windows for Cygwin and WSL
Don't assume Cygwin is the build platform for Windows Android SDK builds.
Keep using UNAME for coarse platform descriptions.
Switch to HOST_ARCH_MINGW32 instead of CYGWIN_BUILD_MACHINE for variable holding
the machine part of the host triplet for Windows.
* [sdks] Dummy provision-mxe target for windows
* [ci] Don't provision-android on Windows
It doesn't work yet.
* [sdks] temporarily turn off android-host-mxe-Win64-release
Needs mingw64-x86_64-zlib on all the CI builds bots.
* FIXME: hack - don't set MONO_EXECUTABLE to the msvc mono for Android SDK build
* [sdks] drop LLVMProvisionTemplateStub
[arm64] set MONO_ARCH_HAVE_UNWIND_BACKTRACE for watch4
Fixes a couple of mscorlib test failures, failing with
> Stack walks are not supported on this platform
* Revert "[System] Add FSEvent FileSystemWatcher to 'monotouch' BCL profile"
This reverts commit 46fc5352f3dfe0027e684a0f61e71130fccd559f.
While iOS FileSystemWatcher works, we now find that it is using unofficially-available symbols and cannot publish apps using those.
Fixes https://github.com/mono/mono/issues/14290
* [csproj] Update project files
* Enable nullable at the project level
* Remove `#nullable enable` from individual files
Removes `#nullable enable` from almost all .cs files in System.Private.CoreLib. I left it only in the ~30 files (out of ~1480 that had it) that are mirrored to corefx, that are built into projects by corefx that don't yet set NullableContextOptions at the project level, and that use nullable annotations; otherwise, they'd break the corefx build.
Signed-off-by: dotnet-bot <[email protected]>
* Enable MSVC builds of Mono w/ ENABLE_NETCORE
* Fix non-netcore build
* Move the ENABLE_NETCORE definition to config.h where it belongs
* Replace .def with linker #pragmas
* TARGET_WIN32 -> HOST_WIN32 && HOST_X86
* Pick up MONO_ENABLE_NETCORE from cygconfig.h
* Make `./configure --with-core=only` MSVC builds working
* Include netcore sources unconditionally, move the condition into the .c file
* Fix MSVC C++ netcore build on Win32
* [corlib] Change the RuntimeModule.GetGuid and RuntimeAssembly.GetAotId icalls to return a byte array instead of a string, so it doesn't have to be parsed by the Guid ctor. Also allocate the arrays in the c# code and pass them to the icalls.
* Do not allocate handles in ReleaseMutex.
Take advantage of thread/internal_thread maturity/pinning.
There are arguments for and against this.
It is arguably better to use handles everywhere.
But it is dubious to require an allocation to release a lock.
Releasing a lock should be infallible.
And surviving low memory shouldn't be a lost cause, imho..
This diff could also be viewed as an opportunistic cycle/size optimization
and be placed under ifdef -- ifdef THREAD_ALWAYS_PINNED orsuch.
This is an alternative to https://github.com/mono/mono/pull/14397.
* PR: Move comments.
Several fixes to the log profiler in order to work on Windows.
* Add new dynamic library project to build log profiler on Windows MSVC.
* Fix dependecy between log profiler and Mono.
* Rewrite command pipe logic on Windows since it's not supported to select
on both sockets and pipes.
* Several additional socket fixes needed for log profiler to work on Windows.
The less mechical parts:
- spell out monoeg_g_free
- register_dyn_icall not used, remove
- register_icall_no_wrapper only used once, spell it out instead
This is nice cosmetically on its own and will help remove JIT icall hashing.
* Introduce enum and static data for JIT icalls, that are currently hashed
by string and address and use dynamic allocation.
These will be used shortly.
* PR: Move MONO_JIT_ICALLS content from class-internals.h to jit-icall-reg.h.
Not clear what is the best name but moving along.
[gitignore] Add crash dump files, .dylib.dSYM directories, and test-path
Wasn't sure where in the file to best put the .dylib.dSYM stuff, so suggestions are welcome
* Mechanism strings to register_dyn_icall in mini-runtime.c.
That is both, generate them kinda, and make them available for some later manipulation.
* Mechanize strings for JIT icall registration in mini-runtime.c.
Generate them slightly and make them amenable to crude preprocessor transforms later.
* Try to improve github diff presentation.
The constructor for mono_error_set_argument lacks a `const char *msg_format`
so clearly we shouldn't be applying formatting from an entirely
unrelated parameter.
This was flagged by `-Werror=format-security`
During GC we allocate a gray queue protected by a mutex, sgen_gray_object_queue_init.
This mutex is never destroyed when clearing up the object containing it,
sgen_gray_object_queue_dispose, so it will leak. Overtime this could cause
OOM on some systems depending on how memory related to system primitives are
handled and partitioned.
* Make mono_fmod extern "C and not static, to simplify later
removal of JIT icall hashing. Making it more consistent with other icalls.
Costing maybe one instruction in some slow paths.
* Move mono_fmod from mini-runtime.c to jit-icalls.c.
* Fix declaratoin of mono_fmod.
Convert managed product binary to use SDK project system.
- Uses Arcade for versions strings
- Overrides Arcade defined output paths - should change in the future
Signed-off-by: dotnet-bot <[email protected]>
* [WinForms] If DataGridViewCheckBoxCell not in threeState mode
EditingCellFormattedValue must return true or false, instead of
value of CheckState type
* [WinForms] DataGrid: fix type check in EditingCellFormattedValue setter.
When set bool value to EditingCellFormattedValue there will be exception.
Type equality must be done through IsAssignableFrom not direct
* [WinForms] DataGrid: Add test for EditingCellFormattedValue getter and setter.
* match the parameter
* Removed special handling.
Removed special handling of TypedReference and RuntimeArgumentHandle
* Remove the whole special casing block
* Revert part of last commit
Restored the check for IsByRefLikeAttribute
* Corrected the function name
I accidentally left these MICROSOFT_BCL_ASYNCINTERFACES_PACKAGE references in as part of some recent churn. This compilation constant isn't set anywhere.
And the CORERT ifdef is no longer needed now that we've consolidated the code to shared.
Signed-off-by: dotnet-bot <[email protected]>
* Add ManualResetValueTaskSourceCore / AsyncIterateMethodBuilder to Microsoft.Bcl.AsyncInterfaces
These two types needed modifications to target .NET Standard 2.0 and are the necessary pieces to enable the compiler to compile async iterators.
- Copied ManualResetValueTaskSourceCore.cs from coreclr and tweaked it. I opted to do this rather than ifdef because the changes are not localized and I didn't want to significantly perturb the primary implementation.
- Added a few ifdefs to the shared AsyncIteratorMethodBuilder. It already had ifdefs, so I just added to it.
- Added a test project, and included the existing ManualResetValueTaskSourceCore tests. I had to disable two of the tests because of some of the optimization differences.
- Augmented those tests to validate that the compiler is able to successfully generate iterators and await foreach them.
* Address PR feedback
Signed-off-by: dotnet-bot <[email protected]>
* Implement GC.RegisterMemoryLoadChangeNotification
This allows users to register a callback to be called whenever the
memory load is between a low and high thresholds. The idea is to allow
them to tweak their memory usage based on the available memory.
It is only internal for now because we are not confident on the shape of
the API and if it's the best we can provide users. This needs to go
through a few iterations with first party users like ASP.NET or corefx.
WIP for https://github.com/dotnet/coreclr/issues/18619
* fixup! Implement GC.RegisterMemoryLoadChangeNotification
* fixup! Implement GC.RegisterMemoryLoadChangeNotification
* fixup! Implement GC.RegisterMemoryLoadChangeNotification
Signed-off-by: dotnet-bot <[email protected]>
* Added overloads to Path.Join
* Refactor Path.Join and Path.Combine to use ValueStringBuilder
* Use proper defined const for empty string
* Fix Windows-specific const
Signed-off-by: dotnet-bot <[email protected]>
We decided after all to put these on a different type, TaskAsyncEnumerableExtensions. This commit adds the new type. We can delete the methods in the old location once corefx consumes an updated build and switches over to using the new ones.
Signed-off-by: dotnet-bot <[email protected]>
The previous attempt ( https://github.com/mono/mono/pull/14078 ) only fixed it for ABIs where the stack pointer alignment is 8 bytes. ABIs, such as watchOS, require 16 byte alignment.
* [llvm] Widen vector equality (OP_PCMPEQx)
Fixes https://github.com/mono/mono/issues/14261
Fixes https://github.com/mono/mono/issues/14143
This was causing an issue when trying to inline
System.Numerics.Vectors.Vector`1<byte>:Equals into System.Span.IndexOf
from System.Memory.dll as provided by nuget. I believe that it is
comparing the result of a SIMD operation on two SIMD registers there with a
SIMD register full of zero bytes.
When we produce the Equals call (no inline), we spill the SIMD <4 x i32>
vector to the stack in the caller, and we then later load it
with the widened type used here <16 x i8>.
When we inline, we end up making the args into XMOV opcodes,
and then doing the "pcmpeqb" mini opcode with the return values
from those operations. This becomes a register to register no-op
copy, and the original <4 x i32> gets compared against the <16 x i8>
type:
```
%116 = icmp eq <16 x i8> zeroinitializer, <4 x i32> %115
```
This does not go the way we want it to. It reliably leads to IndexOf
breaking and only finding the desired byte in the portion not processed
by the SIMD code (in the last few elements of the array).
This fix checks if the input dimensions differ, and does a conversion.
This produces the following IR:
```
%114 = bitcast <4 x i32> %99 to <16 x i8>
%115 = icmp eq <16 x i8> %114, %113
%116 = sext <16 x i1> %115 to <16 x i8>
%117 = icmp eq <16 x i8> zeroinitializer, %116
```
* [llvm] Widen vector greater-than
Here we do the same trick used in the above fix, but for the parallel greater-than operation.
Technologies like SharpDX uses a minimal set of COM support from runtime
and System.Runtime.InteropServices.Marshal:
AddRef
Release
QueryInterface
All these are low level wrappers around methods in IUknown interface and
doesn't need any of the additional runtime COM support enabled to work.
Technologies like CoreRT includes these methods in their full AOT
profile, meaning that SharpDX can run on CoreRT on Windows platforms. Mono's
WinAOT profile and runtime currently don't, making it impossible to use
SharpDX.
This PR adds the needed methods into WinAOT profile and also make
sure corresponding icalls always gets included on Windows build Mono runtime.
I'm taking the LibraryNameVariation helper from System.Runtime.Loader for the ride as well because it's a general purpose probing logic that is useful in a managed implementation of NativeLibrary.
Signed-off-by: dotnet-bot <[email protected]>
Applies changes to `Array.IndexOf()` and `Array.LastIndexOf()` similar
to the changes made in #20855, so that types other than `byte` and
`char` can use use the fast vectorized path.
Also allows 32-bit and 64-bit types for which
`RuntimeHelpers.IsBitwiseEquatable<T>()` returns `true` to use the
faster implementation of `IndexOf` and `LastIndexOf` from
`MemoryExtensions`.
Signed-off-by: dotnet-bot <[email protected]>
* Workaround memset alignment sensitivity
memset is up to 2x slower on misaligned block on some types of hardware. The problem is uneven performance of "rep stosb"
used to implement the memset in some cases. The exact matrix on when it is slower and by how much is very complex.
This change workarounds the issue by aligning the memory block before it is passed to memset and filling in the potential misaligned
part manually. This workaround will regress performance by a few percent (<10%) in some cases, but we will gain up to 2x improvement
in other cases.
Fixes#24300
Signed-off-by: dotnet-bot <[email protected]>
* Increasing precision properly and leaving the rounding of to casting operator
* disabling corefx tests in coreclr and addressing feedback
* correcting test project name
* Fix json
Signed-off-by: dotnet-bot <[email protected]>
The --pinvoke-libs=x argument to packager.exe can be used to generate pinvoke linking tables.
'x' is a list of library names used in DllImport declarations, i.e. --pinvoke-libs=libtest is used
to link with [DllImport ("libtest")].
* Fix Satellite Assembly loading
When loading satellite assemblies, we should probe next to the parent
assembly and load into the same AssemblyLoadContext as the parent
assembly.
Disable fallback probing for satellite assemblies.
Add AssemblyLoadContext.Resolving handler to probe for satellite
assemblies next to parent
Fixes#20979
* Call ResolveSatelliteAssembly from native
Only call ResolveSatelliteAssembly from native when
resolving a satellite assembly
* PR Feedback
Minimize string creation
Remove unnecessary if null checks
Eliminate corner cases by only allowing one case insensitive matching directory.
* ResolveSatelliteAssembly should ...
ResolveSatelliteAssembly should always be called on the ALC which loaded parentAssembly
Simplify code.
Add Debug.Assert
* Remove case insensitive culture search
* PR Feedback
* Fix parentAssembly logic
* Fixes from initial testing
* Add probe for lower case culture name
* PR feedback
Signed-off-by: dotnet-bot <[email protected]>
Don't use popcount intrinsic.
Alternative but not exactly contradictory to https://github.com/mono/mono/pull/14248.
Note that this is a single inlinable instruction on x86,
if you assume at least SSE4 from circa 2007, which I am avoiding here.
* [interp] Optimize enum.HasFlag for csc pattern
Avoid boxing and slow call. Makes it 100x faster.
* [interp] Optimize enum.HasFlag for mcs pattern
* [interp] Transform ldc.i4 + conv.i8 into ldc.i8
Simplifies code, making enum.HasFlag optimization work for long enums.
* Refactor WebAssembly.Core object instantiation.
- Move the supported Core object identification into javascript.
- Runtime the core object type is now passed into the Runtime from javascript binding support instead of being housed in managed code.
* Address review comments.
* Fix indentation
* Implement suggestion by Katelyn Gadd to use Symbol instead of a Map or WeakMap.
- This removes the previous mono_wasm_core_map used for type mapping.
- Attach a special named symbol for `wasm type` to the prototype property for the Core objects that we have bound.
- The Managed Type is stored in the symbol property that will be passed to the managed side.
* [interp] Optimize special static field access
3x faster. For value types 10x.
* [interp] Remove duplicated code
* [interp] Further optimize thread static field access
Provides an additional 50% perf gain.
This field is used by the internal hash table to link nodes and it can be changed during hash table insertion of other imethods. Copying this field back was leading to random hangs in hash table lookup.
* [runtime] Add a python version of the offsets tool.
This version only depends on python and libclang. It currently only
works on osx.
* [runtime] Add a dummy structure needed by the python version of the offsets tool.
* [offsets-tool-py] Change some argument names for compatibility.
* [wasm] Use the python offsets tool on osx, the c# version is 32 bit, and the 64 bit version doesn't work.
* [wasm] Fix the ordering of mono libraries on the link line.
- The routine specifically will escape path separators when needed for instance on windows instead of using the simplified `.Replace ("\\", "\\\\")` as previously implemented.
- The routine will also add quoting when necessary.
The version number in version.h only shows e.g. "6.3.0", and we
want full version numbers ideally, to match what our Mac pkg files
show. This logic calculates that version number.
* Revert "[Tailcall] [arm] [jit] Fix moving tailcall parameters. (#12701)"
This reverts commit 257efc6374.
* When moving parameters for tailcall, and having pushed ip,
and adjusting the offset to account for that, split the adjustment
between sp and frame pointer, as frame pointer may or may not be sp.
This fixes https://github.com/mono/mono/issues/11489.
* Restore Roslyn compilers from NuGet to allow up-to-date version to be used
* Move the Roslyn version to makefile, ensure that it is updated before building System.Private.CoreLib
* Pass the whole path to Roslyn props file instead of just Roslyn version to dotnet build
* Make the Roslyn restore compatible with .NET Core 2.2 SDK
Under hybrid suspend a thread can be cooperative suspended but still
checked for a platform critical region under wow64. Since thread is
not preemptive suspended we can't reliably call GetThreadContext and
doing so could also (even correctly) return a context flagged as critical
triggering an assert in stw for cooperative suspended threads.
We were inadvertently running the roslyn tests against the system mono in CI.
Instead we now install mono to a custom prefix, prepend that to PATH and run
the roslyn tests against the correct mono we just built.
* [netcore] Convert netcore/Makefile.am to a normal makefile, get the configure variables from config.make.
* [netcore] Convert mcs/class/System.Private.CoreLib/Makefile.am to a normal makefile.
We need to emit a real call here. On arm/android we would emit this now:
```asm
ldr pc, =label
.ltorg # place address of `label` here.
```
which is a jump to `label`, not a call.
We need a different solution to make larger assemblies work, but for now
I revert it so the `2019-02` intergration is unblocked.
Partial revert of #14043
* Bump CoreFX version, include few more packages
* Add exclusions for System.Collections.NonGeneric.Tests
* Exclude tests that crash runtime
* Add more exclusions for known failures
* Exclude System.Utf8String.Experimental.Tests, it is CoreCLR specific
Exclude System.ComponentModel.Composition.Registration.Tests, the published version throws PNSE for all methods
Please enter the commit message for your changes. Lines starting
* Make a list of known non-passing tests and establish baseline for 'make xtestpass'
* Add exclusions
* Reenable System.Net.NameResolution.Functional.Tests
* Reenable System.Net.Sockets.Tests
* Reenable System.Diagnostics.Tracing.Tests
* Reenable System.Net.Http.Functional.Tests
* Reenable System.Net.HttpListener.Tests
* Reenable System.CodeDom.Tests
* Reenable System.Linq.Expressions.Tests
* Reenable System.Threading.ThreadPool.Tests
* Reenable System.Runtime.Tests
* Reenable System.Collections.Tests
* Reenable System.Threading.ThreadPool.Tests
* Reenable System.Memory.Tests
* Reenable System.Linq.Parallel.Tests
* Update exclusions for System.Diagnostics.Process.Tests
* Reenable System.Dynamic.Runtime.Tests
* Reenable System.Runtime.Numerics.Tests
* Sort excluded tests
* Reenable System.Reflection.Tests
* Reenable System.Reflection.Emit.Tests
* Reenable System.Linq.Parallel.Tests
* Reenable System.Diagnostics.TraceSource.Tests
* Reenable System.Threading.Tests
* Disable tests that trigger UI on macOS
* Update System.Runtime.Tests exclusion list
* Update line numbers
e.g. whenever underlying representation is nul terminated string.
MONO_PATCH_INFO_LDSTR_LIT
MONO_PATCH_INFO_OBJC_SELECTOR_REF
almost the same as
MONO_PATCH_INFO_JIT_ICALL
MONO_PATCH_INFO_JIT_ICALL_ADDR
MONO_PATCH_INFO_JIT_ICALL_ADDR_NOCALL
MONO_PATCH_INFO_LDSTR_LIT no longer allocate
and copy the string from the AOT image into image_pool.
g_str_equal check pointer equality first.
While obviously correct, not obviously faster,
as it adds cost when strings are unequal.
Uninline g_str_equal, seems cleaner, but perhaps less efficient.
Combine the switch-exit and default: paths,
as only one case other than default exited the switch.
Lift out other common subexpressions.
* Package the wasm and wasm Facades correctly.
* Move the build props and targets file to netstandard2.0 build directory.
* Place framework .props file properly for build
* Place runtime .props file properly for build
* A little cleanup and add escaping windows path separator.
- There are problems executing mononlinker.exe on windows if the windows path separators are not escaped.
* [image] Create MonoImageStorage to own the image raw data
Create a new data structure: MonoImageStorage.
It is an object that will have the responsibility for the raw data of a
MonoImage. It has a string key and a refcount that is used to share a
MonoImageStorage between multiple MonoImage objects.
The reason we need this is because the current MonoAssembly/MonoImage design is
broken for multiple domains and (more evidently) it will be broken when we add
AssemblyLoadContext support. The issue is that a MonoImage may be shared
between multiple domains (or ALCs), but it has a 'references' field which
points to a single other MonoAssembly.
This is a problem because the references of an image may be resolved
differently in different domains (or ALCs).
The eventual solution will be to stop sharing MonoImages based on path name (or
in the case of in-memory images based on a name made up from the address of the
byte blob).
However we still don't want to open the same data more than once (if we're on a
config where we don't have mmap, we malloc some memory and dump the data in
there - we don't want to do that multiple times for the same file).
So the solution is to create this MonoImageStorage object and make it possible
to share it based on path name, but don't give it any responsibilities except
for owning the memory. It doesn't know anything about metadata or assemblies
or any of that stuff - it just owns a chunk of memory and knows when and how to
free it.
This commit just adds the MonoImageStorage object and wires it up in MonoImage
loading. There should be no observable behavioral changes from this commit.
* [win32] call FreeLibrary from MonoImageStorage dtor, not mono_image_close_except_pools
If we're sharing a MonoImageStorage, only call FreeLibrary when the storage is
finally destroyed, not every time one of the images is closed.
* Update dependencies from https://github.com/dotnet/corefx build 20190419.5
- Microsoft.NETCore.Platforms - 3.0.0-preview5.19219.5
- Microsoft.Private.CoreFx.NETCoreApp - 4.6.0-preview5.19219.5
* Removing the Sse2.StoreLow(long/ulong*, ...) methods that have been replaced
* Moving the Sse2.StoreLow(long/ulong*, ...) tests to be Sse2.StoreScalar tests
* Fixing some existing usages of Sse2.StoreLow(long/ulong*, ...)
Signed-off-by: dotnet-bot <[email protected]>
* removing using systems and adding nullability for System.Diagnostics.SymbolStore
* annotating the class that implements the internal interface
* adding bang to fix failure
* correcting the byte array declarations
Signed-off-by: dotnet-bot <[email protected]>
* Nullable: shared\System (most of it)
And some other things it touches.
* Nullable: src\System (most of it)
* Address PR feedback
Signed-off-by: dotnet-bot <[email protected]>
* Nullable: System.IO
Everything exception StreamReader, StreamWriter, BinaryReader, BinaryWriter, which are waiting for some changes in master to propagate over to the feature branch.
* Address PR feedback
Signed-off-by: dotnet-bot <[email protected]>
* Nullable: System.Runtime.InteropServices.Marshal
* Fixing the nullable annotations for BindToMoniker and GetObjectForIUnknown
* Fixing the nullability of PtrToStringAuto(IntPtr, int)
Signed-off-by: dotnet-bot <[email protected]>
Ultimate goal is to significantly reduce or maybe completely
eliminate the hashing of JIT icalls.
It is not a small change.
This is a small digestable albeit tedious step toward that.
The "names" of opcode emulation icalls are needed for
token pasting and/or struct fields. They are needed without quotes.
This PR removes the quotes.
And then for now, just always restores them.
This is extracted from https://github.com/mono/mono/pull/14047
as a step toward making it easier to review.
* [loader] Dont't store through a null ptr
If 'status' is null, don't try to write to it.
Fixes https://github.com/mono/mono/issues/13941
* [metadata] Protect writes to MonoImageOpenStatus* in a few places.
When possible assert that `MonoImageOpenStatus *status` arguments to various
functions in the runtime aren't null. There are a few places (MONO_API) where
it's possible that callers are passing null. In that case, use a local
MonoImageOpenStatus, or check for null before doing assignments.
* Cut down on strlen calls.
But keep the shared memory format unchanged to match .NET. (i.e. don't
put string lengths in it).
* PR: MONO_ENTER_NO_SAFEPOINTS instead of gchandle.
Push/pop frames in loops and mind the return/goto/break/continue carefully, instead of using assignment.
*PR: Reduce gsize to adequate int, move multiple int declarations to same line.
* PR: Fix prototypes in disabled code.
* PR: Spell out `int` as `gint32`.
Use an uppercase guid to workaround Windows problem.
* A bit more true to the previous version.
* Reduce diff a little.
* if (is_ok()) around one line instead of goto around it.
* Restore some old code.
* Restore more verbosity, that used to have a point but no longer does.
* [aot] Add a depfile= argument which causes the AOT compiler to write out a gcc style dep file listing the dependencies between the output file and all referenced assemblies.
* Add a manpage entry.
* Update after comments.
When a static method is called the obj is not used, so it can be null and it doesn't need to be boxed.
Adding an assert in the method to prevent other crash in this method if a NULL is received.
[interp] Simplify cpobj.vt
[interp] Optimize stelem.vt/ldelem.vt
[interp] Avoid unnecessary write barrier for ldobj.vt
Write barriers are only required for stores in the major heap/los.
[interp] Simplify ldfld.vt/stfld.vt
* [interp] Remove redundant check
It can't be an enum if it is stored on the vtstack
* [interp] Optimize boxing
Makes boxing of primitives 4x faster and boxing of vt 3x faster.
* [interp] Remove unneccessary check in unbox
We do the same check as jit. Makes unboxing 10x faster.
* [interp] Extract some duplicate code for boxing
* [interp] Fix boxing of nullable with constrained calls
Before the box opcode optimization, it was handling nullable. When normally boxing a nullable we call the Box method, but this is awkward when doing a constrained call, so we just add a separate opcode. This is slightly slower than calling Box, but much faster than the old code using the generic mono_value_box_checked.
Now all custom attribute related tests pass in System.Runtime.Tests.
Also this PR fixes broken acceptance tests for regular mono introduced in https://github.com/mono/mono/pull/13809
* Move most of EventSource to shared CoreLib partition
* Reenable some code that can be shared with Microsoft.Diagnostics.Tracing.EventSource.Redist in CoreFX
* Remove unused functions
* Fix placement of #endregion
* Clean up P/Invoke prototypes
* Move remaining code from EventSource_CoreCLR to shared partition (guarded by !CORERT)
* Remove more unnecessary marshalling attributes
* Move remaining CoreRT/ProjectN code to shared partition
* Avoid using Windows errors on non-Windows platforms
Signed-off-by: dotnet-bot <[email protected]>
* [netcore] Add linker descriptor. This is just a copy of the mscorlib descriptor.
* [netcore] Update linker descriptor for netcore.
* Remove com/remoting related classes.
* Other smaller changes.
* [netcore] Allow loading corlib from MONO_PATH.
* Update System.Private.CoreLib.xml
[aot] change method table generation so that it works for larger assemblies on ARM
At the end of the AOT compilation, we dump a table containing all method
entrypoints using the toolchain linker to resolve the addresses. Previously
we used `bl` for that, however on larger assemblies the offset might
overflow the 24bit immediate (thus, the linker bailing out with
"Error: branch out of range"). Instead, using `ldr pc,=<label>` followed
by `.ltorg` emits the full 32bit address to a method. That takes 8 bytes
for each method instead of 4 bytes.
( I couldn't reopen https://github.com/mono/mono/pull/3486 anymore)
* Check for lower bounds on non-zero-based arrays
* Grab correct version of System.Reflection.Context
* Move Attribute type validation to fix checking for custom attributes using interface types
* Fix parameter checks
* [interp] Further optimize static vt field access
We don't require any write barrier checking since we always copy between interpreter vt_stack and static data. We can also include the vt size in the code stream. Makes it over 1.5x times faster.
* [interp] Fix static field access using ldfld/stfld
Static field access using the ldfld/stfld instructions was not updated when stsfld/ldsfld were optimized.
* [interp] Fix special static vtype field access
* Switch to msbuild nuget which is available for all platforms
* Remove check-env rule dependency
* Add missing reference to System.Composition.TypedParts
* Sort references by name
* Fix Windows builds of CLR hosting API
* Make System.Private.CoreLib compilable on Windows
* Remove accidental change
* Fix Unix build
* Update GlobalizationMode.cs
* Update GlobalizationMode.Unix.cs
* Move DateTime Windows implementation to shared CoreLib
* Make all the BOOL/struct marshalling explicit
* internal -> private
* Use unsafe code on all layers, remove unnecessary fixed blocks
Signed-off-by: dotnet-bot <[email protected]>
This compat quirk is increasingly more broken since the framework is generally not compatible with, and we have not heard anybody actually using it.
Changed Environment.HasShutdownStarted to unconditionally return false. It does not make sense for it to ever return true with shutdown finalization disabled.
Signed-off-by: dotnet-bot <[email protected]>
* Update dependencies from https://github.com/dotnet/corefx build 20190411.2
- Microsoft.NETCore.Platforms - 3.0.0-preview5.19211.2
- Microsoft.Private.CoreFx.NETCoreApp - 4.6.0-preview5.19211.2
* Update dependencies from https://github.com/dotnet/corefx build 20190411.22
- Microsoft.NETCore.Platforms - 3.0.0-preview5.19211.22
- Microsoft.Private.CoreFx.NETCoreApp - 4.6.0-preview5.19211.22
* Removing renamed HWIntrinsic APIs from S.P.Corelib
* Updating the hwintrinsiclistxarch to match the new intrinsic API names
* Updating the HWIntrinsic generated tests to use the new API names
Signed-off-by: dotnet-bot <[email protected]>
* Make GC.GetGCMemoryInfo public
This is to be used to allow users to optimize memory consumption based
on what's available to the GC and on the system.
This is based on https://github.com/dotnet/corefx/issues/34631
* Address reviews
- Pass GCMemoryInfo struct to native in place of many arguments
- Make GCMemoryInfo.HeapSize and GCMemoryInfo.Fragmentation long in place of IntPtr
* Address reviews
- Mark GCMemoryInfo readonly
* Rearrange fields and match managed/native names
* Fix compilation
* Use getter shorthand
* Address API Design Review
https://github.com/dotnet/corefx/issues/34631#issuecomment-481358549
* Fix comments
* Fix comments
* Do everything in managed
* Address review
- Remove unecessary [StructLayout.Sequential]
- Remove "_" prefix for parameters variables
Signed-off-by: dotnet-bot <[email protected]>
* Update Range.GetOffsetAndLength
Make it return offset and length tuple instead of the old Type Range.OffsetAndLength
* Fix the return Tuple fields names
Signed-off-by: dotnet-bot <[email protected]>
* Updating the Avx2.ConvertToVector256UInt APIs to return a signed type (matching the native signature and Sse41 APIs).
* Adding explicit overloads for `Sse41.ConvertToVector128Int*` and `Avx2.ConvertToVector256Int*` that take a pointer
* Updating the word ordering for the Compare/CompareScalar methods.
Signed-off-by: dotnet-bot <[email protected]>
* rename BaseCounter to DiagnosticCounter
* Change MetaData->Metadata
* Make EventSource and Name a property for counter classes
* Make the counter APIs public
* fix build errors
* Change float to double
* Few cleanups, fix test
* fix GetMetadataString
* PR feedback
* More PR feedback
Signed-off-by: dotnet-bot <[email protected]>
* [interp] Remove dead code
It doesn't make sense to dereference a value type
* [interp] Emit faster instructions for ldobj
* [interp] Emit faster instructions for stobj
* [interp] Simply ldobj vt
This makes it 10x faster
* [interp] Make ldind.r8 unaligned friendly
Assembly.LoadFromPartialName(string) should not throw FileNotFoundException, but
should rather return null.
ArgumentException should use nameof(partialName)
Fixes#19817
Signed-off-by: dotnet-bot <[email protected]>
Previously for `<`/`<=` it would throw if `v1` argument was null, but for `>`/`>=` would throw if the `v1` argument was null, albeit using `v1` in the exception parameter name. It's also not expected for comparisons like this to throw, in general.
Signed-off-by: dotnet-bot <[email protected]>
Symlinks on TVOS run into sandboxing restrictions. We've already disabled a similar test.
This test was added recently as part of 26e0b1deec.
(cherry picked from commit b85fdbdb10)
There are many minor arguments here.
Where this matters most -- iOS -- the pool is already dynamic.
Other platforms could use a dynamic pool or JIT (despite FullAOT).
Using JIT would defeat the test coverage.
Mitigates https://github.com/mono/mono/issues/13888.
If this feels too tenative, go bigger.
`make dist` stopped erroring in #13961 but didn't actually work, because
the relevant Makefile.am was not distributed, causing configure to fail
(because the Makefile.am was cited as an input, unconditionally).
We can't rely on the dist-recusrive from library.make or build.make because
this lib is in a weirdo format which doesn't comply with the requirements
of those helpers, so craft a simple handwritten replacement for our special
case
Cleaning exceptions during static constructor loading
Reset the stack_trace and trace_ips because the type initialization exception is reused.
Fixes#13714
* Use a custom prefix instead of trying to infer it, which doesn't work under bockbuild.
The following line is problematic in the scope of building the Mac SDK package (using bockbuild):
https://github.com/fsharp/fsharp/blob/ccfccbacfdb16b2ab143cf83f5ece20f738fd864/mono/config.make#L5
It's problematic because where `mono` lives in this case would be something like `/macsdk-staging-dir/bin/mono` which is not the actual prefix (prefix here being the final destination, `/Library/Frameworks/Mono.framework/...`) but a staging area that bockbuild uses (this is how we build on system prefixes without installing on CI)
For the F# build, bockbuild expects things to end up in `/fsharp-staging-dir/$(prefix)` (because that's what most `make install`s do when given `DESTDIR=/fsharp-staging-dir/`). If things end up in _any other_ directory in `/fsharp-staging-dir/` (like `/fsharp-staging-dir/macsdk-staging-dir` in our case) that would cause us to miss packaging those files (this has happened before, with packages that have broken or different use of `DESTDIR`). So there is an added write-protection for anywhere in `/fsharp-staging-dir` that *isn't* `/fsharp-staging-dir/$(prefix)` , because a write-protection error, while obtuse, is much preferable to missing the fact that some files are not packaged (as would have happened here)
So the fix is to stop trying to infer the prefix, and return to providing it explicitly to the build system (this used to be the case via the `configure` step)
* Also, if we are doing an override of the 'make' command, we need to take care of passing DESTDIR ourselves too
* Since now we perform 'make install' on the make step, make the 'install' step into a no-operation.
* Look for sn where mono is, not in the final destination (which again, may not be the same)
Currently we have two nullable API's that will have value in the public
embedding API (already requestsed by users), eliminating the needs to go
from native->managed and back to get nullable information about a type.
mono_class_is_nullable
mono_class_get_nullable_param
This PR moves them from class-internals.h into class.h and mark them
with MONO_API and when needed include GC UNSAFE/SAFE transition.
GitHub provides a way to download a .zip/.tar.gz of the repository content in their UI, however the archive doesn't contain git submodules.
The mono build then fails with confusing "missing file" errors.
Since GitHub doesn't let us disable the archive download we should at least add some logic to detect this broken case and bail out.
uses_handles parameter is a gboolean -> int32_t in Mono but was uint8_t
in WASM implementation. This triggered a problem when a uninitialized
gboolean was used and only parts of it got set and method still returns
an address, indicating success. This is a different behavior compared to
Mono's default implementation. Fix to this particular problem was to init
the gboolean variable before calling, but good to make sure the signatures are in
sync anyways.
icalls registered with mono_add_internal_call, mono_add_internal_call_with_flags
or mono_add_internal_call_internal ended up in two different hash tables
depending if they were "foreign" or not. This caused double lookups in
mono_lookup_internal_call_full. There are also use cases where it could be
interesting to keep additional flags related to the icall, that could be
used by codegen for various optimization.
This PR merge the two hash tables into one and add a flag describing icall
details. The flag could later be extended with additional behaviors going
forward if needed.
* Improve RuntimeHelpers.GetSubArray
This change does three things.
First, it fixes `GetSubArray` to work when the supplied array is actually a `U[]` where `U : T`. Currently this case ends up throwing an exception inside of span, which doesn't like working with arrays covariantly.
Second, it fixes argument validation so that we throw an ArgumentNullException if the input array is null rather than NullReferenceException.
Third, it improves the performance of `GetSubArray` for the 95% common case where either `T` is a value type or the type of the array matches the `T` type specified.
* Only use `Array.Empty<T>` when `typeof(T[]) == array.GetType()`
Signed-off-by: dotnet-bot <[email protected]>
* Match PtrToStringUTF8 to the other PtrToString* families.
* Make PtrToString*(IntPtr,int) exceptions consistent.
* Exclude out-of-date tests in CoreFX.
* Update exclusions to cover tests that are now throwing ArgumentOutOfRangeExceptions instead of ArgumentExceptions.
* Fix parameter order for exception.
* Pass value to exception.
Signed-off-by: dotnet-bot <[email protected]>
* Moving some JITDUMP calls into Compiler::lookupNamedIntrinsic
* Marking the IsSupported methods as Intrinsic for all HWIntrinsic ISAs
* Updating the hwintrinsic importation to more generally handle IsSupported and ThrowPNSE
* Applying formatting patch.
* Adding using System.Runtime.CompilerServices to the various x86 PlatformNotSupported HWIntrinsic files
Signed-off-by: dotnet-bot <[email protected]>
These types null out some fields on Dispose, and some of those fields are accessible directly via exposed properties, which means that nulling them out would either force us to annotate those properties as being nullable or would require us to lie about them being nullable. Nulling them out also makes it easier to accidentally null ref in the implementation, and prevents us from making the fields readonly.
It should be exceedingly rare that you dispose of one of these objects and then keep it alive while also being concerned about keeping alive the other helper objects the type uses. So this change just uses a separate flag to track disposal, and avoids nulling out the fields, which is not a common practice elsewhere in the framework.
This will be a visible change in that after Dispose, properties like StreamWriter.BaseStream/Encoding will now return the stream/encoding rather than null. In theory that could break someone if they were using those properties to determine whether the writer had been disposed, but that seems unlikely / similar fallout from most any bug fix, and objects generally aren't supposed to be touched after Dispose, anyway.
Signed-off-by: dotnet-bot <[email protected]>
[aot] use g_malloc () instead of malloc ()
Unbreaks jemalloc support as it hooks into `g_malloc ()` instead of replacing `malloc ()`.
```
%4 0x000055ee6af0d27b in sigabrt_signal_handler (_dummy=6, _info=0x7ffc7b0c4ff0, context=0x7ffc7b0c4ec0) at mini-posix.c:232
%5 <signal handler called>
%6 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
%7 0x00007f4ae0d73801 in __GI_abort () at abort.c:79
%8 0x000055ee6b2ab6ed in rtree_child_leaf_tryread (elm=0x55ee6b75b028 <je_extents_rtree+704104>, dependent=true) at src/rtree.c:205
%9 0x000055ee6b2ab95f in je_rtree_leaf_elm_lookup_hard (tsdn=0x7f4ae1f05738, rtree=0x55ee6b6af1c0 <je_extents_rtree>, rtree_ctx=0x7f4ae1f05758, key=94482510772944, dependent=true, init_missing=false) at src/rtree.c:292
%10 0x000055ee6b242f70 in rtree_leaf_elm_lookup (tsdn=0x7f4ae1f05738, rtree=0x55ee6b6af1c0 <je_extents_rtree>, rtree_ctx=0x7f4ae1f05758, key=94482510772944, dependent=true, init_missing=false) at include/jemalloc/internal/rtree.h:369
%11 0x000055ee6b242fb5 in rtree_read (tsdn=0x7f4ae1f05738, rtree=0x55ee6b6af1c0 <je_extents_rtree>, rtree_ctx=0x7f4ae1f05758, key=94482510772944, dependent=true) at include/jemalloc/internal/rtree.h:394
%12 0x000055ee6b2431ee in rtree_szind_slab_read (tsdn=0x7f4ae1f05738, rtree=0x55ee6b6af1c0 <je_extents_rtree>, rtree_ctx=0x7f4ae1f05758, key=94482510772944, dependent=true, r_szind=0x7ffc7b0c6000, r_slab=0x7ffc7b0c6004) at include/jemalloc/internal/rtree.h:446
%13 0x000055ee6b24d468 in ifree (tsd=0x7f4ae1f05738, ptr=0x55ee6c7dfad0, tcache=0x7f4ae1f058f0, slow_path=true) at src/jemalloc.c:2126
%14 0x000055ee6b24de06 in mono_jefree (ptr=0x55ee6c7dfad0) at src/jemalloc.c:2290
%15 0x000055ee6b2c6c68 in monoeg_g_free (ptr=0x55ee6c7dfad0) at gmem.c:83
%16 0x000055ee6adefafa in emit_method_code (acfg=0x7f4ae0986000, cfg=0x7f4ae0ad4e00) at aot-compiler.c:6243
%17 0x000055ee6adf9534 in emit_code (acfg=0x7f4ae0986000) at aot-compiler.c:9704
%18 0x000055ee6ae04a9d in emit_aot_image (acfg=0x7f4ae0986000) at aot-compiler.c:13535
%19 0x000055ee6ae03b7c in mono_compile_assembly (ass=0x7f4ae09a9300, opts=374434303, aot_options=0x7f4ae093c000 "bind-to-runtime-version,outfile=./../../class/lib/build-linux//Microsoft.CodeAnalysis.CSharp.dll.so", global_aot_state=0x7ffc7b0c6438) at aot-compiler.c:13357
```
* Nullable: remainder of globalization
* annotate windows specific files
* add TODO-NULLABLE next to TODO suggesting comments
* fixes after merging other globalization annotations, apply feedback
* fix windows
* address feedback
* fix windows
* fixes
* apply feedback
* remove workaround
* s_Invariant?, couple of Debug.Asserts
Signed-off-by: dotnet-bot <[email protected]>
* Nullable: NumberFormatInfo, CultureInfo
* fix build
* fix windows
* fix APPX issue
* another appx failure
* get rid of line split
* mark retVal as nullable
Signed-off-by: dotnet-bot <[email protected]>
We can now build `--with-core=only` on Linux or Mac with the same makefile, and have a functional `make nupkg` rule which attempts to produce a .nupkg of the runtime in the format consumed by core-setup.
* [corlib] Make NSLogWriter thread-safe.
* [corlib] Simplify newline checking in NSLogWriter.
Checking the StringBuilder buffer after writing to it instead of the input
string/char[] makes the code somewhat simpler.
* [corlib] Fix NSLogWriter.Write to take into account the index and count parameters.
CoreCLR allows reflection on methods with ByRef return types under certain conditions. The PR implementing it is https://github.com/dotnet/coreclr/pull/17639.
Mono already implemented most of it in the marshalling code but artificially blocked it in `ves_icall_InternalInvoke`. I changed the condition for the exception to match the condition in `emit_invoke_call` (marshal-ilgen.c). It's similar to the condition in CoreCLR, but it may not handle byref-like types correctly. It would have to fixed on both places if it turns out to be the case.
The remaining issue is that null references returned in ByRef are not checked and converted to correct exception. It should result in `NullReferenceException` with special message that doesn't get wrapped in `TargetInvocationException`. I put a TODO marker at a place where I think it should be handled, but it's a bit over my head to implement it.
/cc @vargaz
An icall declaration can now use the following attribute:
MonoDirectICallSymbolNameAttribute("MyNativeCFunction")
and if not already defined in icall-def.h and direct-icalls are used when
AOT compile the assembly, a direct call will use symbol defined in attribute
as the symbol for direct call. Using this attribute will also enable inlining
for the specific icall wrapper generating inlined direct icalls to external
defined native methods.
This feature is valuable when embedding the runtime and extend with icalls
added using mono_add_internal_call. By applying the above attribute, it is
possible to do AOT with direct-icalls and get static linked icalls without
the need to extend and rebuild cross compiler in the process.
* Add support for core SharedArrayBuffer.
- Add SharedArrayBuffer implementation
- Add SharedArrayBuffer constructors to TypedArray implemenations
* Add tests for SharedArrayBuffer.
- Refactored the test code to add specific test files for Core Bindings. This separates the tests into specific test regions.
- Moved bindings tests from the http tests to the core bindings tests.
* Cleanup debugging code.
It contained DllImports to some Windows APIs which causes issues on xamarin-macios which expects all pinvokes to exist.
Turns out we don't even need that file.
* Add JavaScript Core support for Function
* Fix compile
* Fix bindings tests
* Add Core Function tests
- TestFunctionSum
- Create a new Function with a body that returns the sum of two numbers
- call method `Call` on the sum Function
- TestFunctionApply
- Return the Math.min function from the Global Math space
- Call method `Apply` on the min Function to return the minimum value from an array.
* Use Core Function to determine streaming instead of calling InvokeJS which uses javascript Eval.
* Move nested array checking to managed code as per review comments.
- This removes the icall as per review suggestion.
* [wasm] Generate the pinvoke tables.
Put the default non-linked version of the table into version control, usable by the interpreter only build.
* Add a comment to the generated file.
Create a new data structure: MonoImageStorage.
It is an object that will have the responsibility for the raw data of a
MonoImage. It has a string key and a refcount that is used to share a
MonoImageStorage between multiple MonoImage objects.
The reason we need this is because the current MonoAssembly/MonoImage design is
broken for multiple domains and (more evidently) it will be broken when we add
AssemblyLoadContext support. The issue is that a MonoImage may be shared
between multiple domains (or ALCs), but it has a 'references' field which
points to a single other MonoAssembly.
This is a problem because the references of an image may be resolved
differently in different domains (or ALCs).
The eventual solution will be to stop sharing MonoImages based on path name (or
in the case of in-memory images based on a name made up from the address of the
byte blob).
However we still don't want to open the same data more than once (if we're on a
config where we don't have mmap, we malloc some memory and dump the data in
there - we don't want to do that multiple times for the same file).
So the solution is to create this MonoImageStorage object and make it possible
to share it based on path name, but don't give it any responsibilities except
for owning the memory. It doesn't know anything about metadata or assemblies
or any of that stuff - it just owns a chunk of memory and knows when and how to
free it.
This commit just adds the MonoImageStorage object and wires it up in MonoImage
loading. There should be no observable behavioral changes from this commit.
* [netcore] Implement RuntimeImports.RhBulkMoveWithWriteBarrier
* Add the actual write barrier to RhBulkMoveWithWriteBarrier
* Rename ves_icall_System_Runtime_RuntimeImports_Memmove_wbarrier to ves_icall_System_Runtime_RuntimeImports_RhBulkMoveWithWriteBarrier
Fixes 15 failures in System.Memory.Tests.
From: https://llvm.org/docs/LangRef.html
```
Furthermore, the semantics of the noalias attribute on return values are stronger than the semantics of the attribute when used on function arguments. On function return values, the noalias attribute indicates that the function acts like a system memory allocation function, returning a pointer to allocated storage disjoint from the storage for any other object accessible to the caller.
```
Think this probably helps LLVM reorder the method calls, telling it that allocating won't return a pointer to something else on the stack.
The aggregate modifiers container is owned by a MonoImageSet. The aggregate
modifiers may be shared by more than one MonoType that happen to need the same
modifiers. (Similar to how generic instantiations are shared)
When the image set is cleaned up the aggregate modifier cleanup will free the
types in the aggregate modifiers container (the call to
free_aggregate_modifiers in mono_metadata_clean_for_image).
With this extra call to free_aggregate_modifiers in mono_metadata_free_type may
cause the same memory to be freed twice.
Fixes https://github.com/mono/mono/issues/13775
* Add MONO_PATCH_INFO_LAZY_FETCH_ADDR and MONO_PATCH_INFO_TRAMP_ADDR.
These are int-based alternatives to MONO_PATCH_INFO_JIT_ICALL_ADDR + sprintf.
This clarifies work to remove the JIT icall hash tables that are used with:
MONO_PATCH_INFO_JIT_ICALL
MONO_PATCH_INFO_JIT_ICALL_ADDR
MONO_PATCH_INFO_JIT_ICALL_ADDR_NOCALL
making it easier to make those enum-based, indexing a fixed size dense array.
As a related side effect, that could be achieved otherwise,
this fixes apparent leaks.
And clarify MONO_PATCH_INFO_JIT_ICALL_ADDR_NOCALL slightly, by making
searches for it find one more hit.
That is, those three enums are mostly used with a fixed set of strings.
Except for as in this PR where they are used with indefinite strings.
The removal of the indefinite strings eases replacement of the fixed
set of strings with an enum.
* Bump MONO_AOT_FILE_VERSION.
* PR feedback: Remove unused code and historical commentary.
Also updated PR title with more verbose actual names of the new symbols:
`MONO_PATCH_INFO_TRAMPOLINE_FUNC_ADDR`
`MONO_PATCH_INFO_SPECIFIC_TRAMPOLINE_LAZY_FETCH_ADDR`
* Add missing break.
* [netcore] Fix Marshal test failures.
* [netcore] Add exclusions for System.Runtime.InteropServices.Tests.
* [netcore] Make an icall internal.
* Add more test exclusions.
* Address review comments.
1. it doesn't touch the managed runtime
2. it may be called (arguably it ought to be called only) before the runtime is
initialized (and in particular before the current thread is attached).
This method returns a function pointer that can be called with a calli instruction. On interpreter we use a pointer to InterpMethod while on jit we use the native code address. Normally, GetFunctionPointer should return the InterpMethod pointer if called from interp or the native code address if called from jit. Since we don't have any information about the execution engine of the caller, we solve this by intrinsifying all these calls, that happen in the interpreter.
Passing such function pointers between jitted and interp code is probably still unreliable.
Fixes https://github.com/mono/mono/issues/13654
This test https://github.com/dotnet/coreclr/blob/1649da12db73c8c07513c9168cb30ec70c310063/tests/src/Regressions/coreclr/20452/twopassvariance.il
On mono we were ordering the list of implemented interfaces and shouldn't do this as it's described on ECMA-335 Section II.12.2.1 and II.12.2.2.
The ordering was removed on ilasm and some changes were needed on metadata either because it's not ordered anymore.
There were two bugs, one on ilasm and other on class initialization on mono.
### ILAsm ###
If we get the .exe generated by .net Framework it doesn't execute on mono without modifications because we ordered the implemented interfaces list by id. And doing that the order defined on source code is ignored.
If we get the .exe generated by Mono it doesn't execute on .net Framework because on IlAsm we order the list and loose the order defined on source code.
The interfaces on metadata before these changes on IlAsm were like this:
```
1: Fooer1 implements class IFoo<class Derived>
2: Fooer1 implements class IFoo<class Base>
3: Fooer2 implements class IFoo<class Base>
4: Fooer2 implements class IFoo<class Derived>
5: Fooer3 implements class IFoo<object>
6: Fooer3 implements class IBar<class Derived>
7: Fooer3 implements class IBaz<class Base>
8: IBar implements class IFoo<!0>
9: IBaz implements class IFoo<!0>
10: Fooer4 implements IQux
11: Fooer4 implements class IBar<class Derived>
12: IQux implements class IFoo<class Base>
13: IQux implements class IFoo<class Derived>
14: Fooer5 implements IQux
15: Fooer5 implements class IBar<class Derived>
16: Fooer6 implements class IBar<class Base>
17: Fooer6 implements class IFoo<class Base>
18: Fooer7 implements class IFoo<class Base>
19: Fooer7 implements class IBar<class Base>
```
And After the changes they follow the definition order which is the same order of IlAsm for .net framework and .net core.
```
1: IBar implements class IFoo<!0>
2: IBaz implements class IFoo<!0>
3: IQux implements class IFoo<class Base>
4: IQux implements class IFoo<class Derived>
5: Fooer1 implements class IFoo<class Base>
6: Fooer1 implements class IFoo<class Derived>
7: Fooer2 implements class IFoo<class Derived>
8: Fooer2 implements class IFoo<class Base>
9: Fooer3 implements class IBaz<class Base>
10: Fooer3 implements class IBar<class Derived>
11: Fooer3 implements class IFoo<object>
12: Fooer4 implements IQux
13: Fooer4 implements class IBar<class Derived>
14: Fooer5 implements class IBar<class Derived>
15: Fooer5 implements IQux
16: Fooer6 implements class IFoo<class Base>
17: Fooer6 implements class IBar<class Base>
18: Fooer7 implements class IBar<class Base>
19: Fooer7 implements class IFoo<class Base>
```
### Mono vtable layout ###
Internally when Mono computes the interface table for each class, it would previously sort the interfaces by `MonoClass:interface_id` which is a unique id assigned (roughly) in load order. This was incorrect because the order of the interfaces determines the final vtable for the class. This PR changes the interface table computation so that the interfaces of a single class are ordered in declaration order, following ECMA.
One consequence is that we can no longer use binary search with the interface id as the key to find out if a class implements an interface. We have to do a linear scan. On the other hand, we expect that the number of interfaces implemented by a single class is small in practice.
This is how the Vtable for Fooer1 and Fooer2 looks like after the changes:
```
*** Vtable for class 'Fooer1' at "FINALLY" (size 6)
[O][000][INDEX 000] object:ToString () [0x7fd78681db20]
[O][001][INDEX 001] object:GetHashCode () [0x7fd78681daf8]
[O][002][INDEX 002] object:Finalize () [0x7fd78681dad0]
[O][003][INDEX 003] object:Equals (object) [0x7fd78681daa8]
[I][004][INDEX 000] IFoo:Gimme () [0x7fd786503800]
[I][005][INDEX 000] IFoo:Gimme () [0x7fd7865038c0]
Packed interface table for class Fooer1 has size 2
[000][UUID 078][SLOT 004][SIZE 001] interface IFoo[Base]
[001][UUID 079][SLOT 005][SIZE 001] interface IFoo[Derived]
```
and
```
*** Vtable for class 'Fooer2' at "FINALLY" (size 6)
[O][000][INDEX 000] object:ToString () [0x7fd78681db20]
[O][001][INDEX 001] object:GetHashCode () [0x7fd78681daf8]
[O][002][INDEX 002] object:Finalize () [0x7fd78681dad0]
[O][003][INDEX 003] object:Equals (object) [0x7fd78681daa8]
[I][004][INDEX 000] IFoo:Gimme () [0x7fd7865038c0]
[I][005][INDEX 000] IFoo:Gimme () [0x7fd786503800]
Packed interface table for class Fooer2 has size 2
[000][UUID 079][SLOT 004][SIZE 001] interface IFoo[Derived]
[001][UUID 078][SLOT 005][SIZE 001] interface IFoo[Base]
```
This is how the VTable for Fooer1 and Fooer2 looks like before the changes, as you can see Packed interface table are the same in Fooer1 and Fooer2, so the behavior of both classes was the same:
```
Vtable for class 'Fooer1' at "FINALLY" (size 6)
[O][000][INDEX 000] object:ToString () [0x7fcf3801d920]
[O][001][INDEX 001] object:GetHashCode () [0x7fcf3801d8f8]
[O][002][INDEX 002] object:Finalize () [0x7fcf3801d8d0]
[O][003][INDEX 003] object:Equals (object) [0x7fcf3801d8a8]
[I][004][INDEX 000] IFoo:Gimme () [0x7fcf37c29880]
[I][005][INDEX 000] IFoo:Gimme () [0x7fcf37c29940]
Packed interface table for class Fooer1 has size 2
[000][UUID 076][SLOT 004][SIZE 001] interface IFoo[Base]
[001][UUID 077][SLOT 005][SIZE 001] interface IFoo[Derived]
```
```
Vtable for class 'Fooer2' at "FINALLY" (size 6)
[O][000][INDEX 000] object:ToString () [0x7fcf3801d920]
[O][001][INDEX 001] object:GetHashCode () [0x7fcf3801d8f8]
[O][002][INDEX 002] object:Finalize () [0x7fcf3801d8d0]
[O][003][INDEX 003] object:Equals (object) [0x7fcf3801d8a8]
[I][004][INDEX 000] IFoo:Gimme () [0x7fcf37c29940]
[I][005][INDEX 000] IFoo:Gimme () [0x7fcf37c29880]
Packed interface table for class Fooer2 has size 2
[000][UUID 076][SLOT 005][SIZE 001] interface IFoo[Base]
[001][UUID 077][SLOT 004][SIZE 001] interface IFoo[Derived]
```
[llvm] Fix llvm JIT.
<!--
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 cpu counter
* Fix windows build
* Make the counter just return current CPU usage as %
* Add Unix
* Fix unix build
* Some cleanup
* rename
* fixing some build errors
* some cleanup
* remove unused using
* more cleanup
* newline
* Address PR feedback
* more pr feedback
* More feedback
Signed-off-by: dotnet-bot <[email protected]>
Match Mono's behavior by changing the Auto character set to mean UTF-8 on non-Windows platforms (new behavior) and UCS-2/UTF-16 on Windows (current behavior).
Fixes#23464Fixesdotnet/corefx#32442
Impact of breaking change: It is highly unlikely that anyone is actively using current behavior since it is inconsistent with Mono and doesn't match any native system APIs on non-Windows platforms (they're all UTF-8 based).
We will need to update our documentation to reflect this updated behavior.
Signed-off-by: dotnet-bot <[email protected]>
The OnProcessExit was iterating over the s_contextsToUnload and calling
Unload on each of the contexts. However the s_contextsToUnload is a
misnomer, it contains all the contexts, both collectible and
non-collectible ones. So we were calling Unload on non-collectible
contexts too there. That resulted in InvalidOperationException being
thrown from the OnProcessExit.
This change fixes that by calling unload only on ALCs whose
IsCollectible returns true. It also renames the s_contextsToUnload to
s_allContexts.
Close#22902
Signed-off-by: dotnet-bot <[email protected]>
We want to avoid calling stackval_to/from methods. Also include the field address in the instruction stream. This makes static vtype field access 10x faster.
Refactor the code a bit.
[gsharedvt] Fix sizeof opcode
We were setting the stack type by using another global local named ins.
This lead to missing methods in the aot image due to invalid IL. Fixes https://github.com/mono/mono/issues/13479.
Adds 5 quick checks, on prefix-tests tag:
* Build a basic file with mcs
* Build a basic file with Roslyn
* AOT an assembly
* LLVM AOT an assembly (loadedllvm)
* LLVM JIT an assembly (loadedllvm)
This should let us spot regressions affecting installed prefixes sooner
These console PInvokes are used in nearly every app. Omitting unnecessary SetLastError
will save us from generating marshalling stub for them.
Signed-off-by: dotnet-bot <[email protected]>
Also make cimag/creal macros for guaranteed inlining -- instead of passing structs by value.
And add spaces before parens to follow coding convention (which is designed
to ease low tech searches for entire words).
This was agreed to when the code was first ported to C++ but got dropped.
The compromise though was to put the defines relatively late to limit their impact.
In this case we relied on nunitlite to be compiled when the parent profile is compiled. That doesn't work however if we compile the child profile first (e.g. during a parallel make) since it'll
complain about missing nunitlite.dll.
We now compile nunitlite in the child profiles too even though we don't use it.
This is an alternative solution to what I tried in https://github.com/mono/mono/pull/5357 since I couldn't get it to work and this should be the easier fix.
It allows us to finally remove the `-i` (ignore errors) from the CI scripts and catch test assembly breakages in mobile profiles which we ignored before.
* fix test
* fix tests
* Fix ArgumentNullException empty ParamName
* System.Text.Tests.StringBuilderTests are fine
* fix BlockCopy test
* enable more tests
* Enable more tests
* address feedback
* [System] Clear MONO_CFG_DIR before starting mcs in CodeDOM CSharpCodeGenerator
This showed up in the xamarin-macios 2019-02 integration.
When you used Xslt with a custom C# script in a Xamarin.Mac Full application
we'd try to launch mcs via CodeDOM to compile the script.
This started failing in 2019-02 because System.Native (mono-native) wasn't found,
the reason is that XM sets MONO_CFG_DIR to point to the Contents/MonoBundle
in the app bundle where it packages the global config file with dllmaps.
However the started Mono wasn't able to find mono-native since the config
there uses a different name for the file.
To prevent that we now clear MONO_CFG_DIR so it uses the default value for the
mono process we're starting (note that setting it to String.Empty doesn't work)
* Make it specific to XM 4.5
* [netcore] Add error checking for assembly version parsing, pass the full 32 bit value to managed code.
* [netcore] Implement RuntimeType.StructLayoutAttribute.
* [runtime] Implement RuntimeFieldHandle.GetValueDirect (), convert SetValueDirect () to handles.
* [netcore] Implement Assembly.GetFiles ()/GetForwardedTypes ().
* [runtime] Handle 'ARM' as a valid architecture in assembly name parsing.
* [netcore] Implement ParameterInfo.MarshalAsAttribute, AssemblyName.EscapedCodeBase.
* [netcore] Add exclusions for System.Reflection.Tests.
* [netcore] Update test exclusions.
* [netcore] Fix CustomAttributeExtensions.
* [netcore] Add a list of passing test suites.
* [netcore] Add a missing argument check.
* Update Object.cs
* Fix a few deficiencies in mono_path_filename_in_basedir.
The main one is that strstr is too loose.
Add tests.
Make it case insensitive on Win32 and allow some denormal input.
Note that case sensitivity is a function of file system, not
operating system, but a lot of code gets it wrong, so here does too.
Add more data to asserts.
Account for test reality -- filename is not absolute.
The Win32 code paths can be tested on Unix and vice versa
w/o compromise. See https://github.com/mono/mono/pull/13707
* Reduce testing per PR feedback.
* Edit/add comments.
This is an attempt to clarify and hopefully doesn't backfire.
* Try to make tests clearer, and stop skipping some oops.
* PR: Restore case insensitivity testing on Windows. Tweak a little bit.
* Include the .c file instead of .h to fix some builds.
It turns out that homebrew now has a package for the MinGW gcc-based windows
cross compiler which is awesome as it allows us to skip building MXE and use the
latest version of the GCC suite pre-packaged for Mac. This commit removes almost
all traces of MXE (except for `mxe.mk` itself, because I don't know if any bot
or external tool, whatever, use targets in it) and adds the following brew
packages to SDK bot provisioning as well as to the `provision-mxe` target of
Mono SDKs:
* mingw-w64
* xamarin/xamarin-android-windeps/mingw-zlib
The latter package builds a Windows version of zlib using MinGW and it comes
from Xamarin's own homebrew tap at https://github.com/xamarin/homebrew-xamarin-android-windeps/blob/f4cc90845ff1953800d8d71035566a12d9b7aa24/mingw-zlib.rb
Additionally, this commit adds a new `configure` flag: `--with-static-zlib=PATH`
which allows one to specify the static zlib archive to use when linking Mono.
The static archive supersedes the otherwise indicated or detected zlib. This is
the recommended mode of operation for MinGW builds as it avoids problems with
`zlib.dll` versions on the target machine.
* The `SimpleCollator` class now implements a new internal interface `ISimpleCollator`.
In `CompareInfo`, we reference it by that interface everywhere except `GetCollator ()`,
so we can `#if`-def it out.
Later on, we will use the linker to do this dynamically with some sort of conditional,
but even then the interface is required to limit references to the `SimpleCollator` type
to one single method.
* Add `Mono.Globalization.Unicode/SimpleCollator.cs` to `wasm_corlib.dll.exclude.sources`.
* `corlib/Makefile`: remove collation resources on WASM.
* Added new `[Category ("ManagedCollator")]` to the relevant tests.
* Revert "[System.Net.Http] Move NSUrlSessionHandler from xamarin-macios to mono (#13229)"
This reverts commit 5bf74a9954.
* [System.Net.Http] Move Mac/iOS specific HttpMessageHandler's to Xamarin.*.dll
We decided to move these types into Xamarin products since they can't be
used without the underlying infrastructure anyway.
* Bump API snapshot submodule
* [csproj] Update project files
* Add missing roslyn assemblies to mcs package makefile
* Remove deploy step for dynamic interface methods prototype since current roslyn has DIM
Roslyn picked up some new dependencies that I failed to add to a Makefile containing a list of its dependencies. This may fix some scenarios (not covered by CI) that result in csc and/or msbuild not working.
Sometimes Google DNS is/was returning "dns.google" for reverse query of 8.8.8.8 and 8.8.4.4 instead of the expected "google-public-dns-a.google.com" and "google-public-dns-b.google.com". Since "dns.google" resolves to both 8.8.8.8 and 8.8.4.4 in random order the round-trip tests for IP -> hostname -> IP were failing when they got the other IP.
This changes the logic in the hostname -> IP check to check whether the expected IP is any one of the returned ones (ie. non necessarily the first one).
* Removing FeedTasksPackageVersion from dependencies.props
* The corresponding metadata was removed in https://github.com/dotnet/coreclr/pull/22884
* Updating BuildTools, CoreCLR to preview4-03828-01, preview4-27528-71, respectively
* Adding a ! in String.Searching.cs
Signed-off-by: dotnet-bot <[email protected]>
* Add test for IncrementingPollingCounter
* Fix a bug in Increment calculation in IncrementingPollingCounter
* Remove setting DisplayName property since that's a private property for now
* fix comment
* Remove unused variables
Signed-off-by: dotnet-bot <[email protected]>
The python script now also extracts downloaded zips and `make xtest-%` is now able to consume these artifacts.
E.g.
```
make xtest-System.Collections.Tests COREFX_ROOT=/prj/corefx-repo
```
We still need COREFX_ROOT because of two missing files:
`CoreFx.Private.TestUtilities.dll` and `xunit.console.deps.json`
maybe I should just add them to our repo?
Also this PR fixes `RemoteExecutorConsoleApp` problems for `make xtest-%`
* [profiler] Add duration=NUM parameter to AOT profiler
It instructs the AOT profiler to write the data after NUM seconds
measured from runtime initialization.
* [profilers] Added aot:duration=NUM parameter description
* Nullable: Int32
* remove restore and move nullable up front
* remove trailing \n after #nullable to make it easier to remove later
Signed-off-by: dotnet-bot <[email protected]>
* Initial implementatation of ALC enhancements
Add public constructor with name
Add Name property
Add Assemblies property
Add All property
Override ToString
Name Default and Assembly.Load(...) ALCs
Add AssemblyLoadContext30Extensions test
Signed-off-by: dotnet-bot <[email protected]>
* [interp] Extract the code pushing lmf in separate function
There is no reason to not optimize the code inside do_icall
* [interp] Remove dead code
Trace ips are filled in mono_handle_exception_internal
* In mono_threadpool_enqueue_work_item, if mono_runtime_invoke_checked fails,
still restore domain.
In mono_threadpool_enqueue_work_item, acknowledge with a comment but do not change
that mono_domain_set failing leads to returning success.
In mono_threadpool_enqueue_work_item, refactor for sharing code without loss
of efficiency or hopefully clarity.
* Keep this line duplicated:
`mono_runtime_invoke_checked (unsafe_queue_custom_work_item_method, NULL, args, error);`
Every caller was consistently forming the same name based on callinfo->name
and passing callinfo->func and callinfo->sig.
Pass callinfo instead and do the common work in mono_marshal_get_icall_wrapper.
This has the following side effects:
Do not form and free name when there is a cache hit. This seems like a nice optimization.
Allow name when there is a cache hit. This is unintended. We could assert if it is a problem.
It was set by xamarin-macios when they were still taking the raw .cs source files
but since we switched to prebuilt binaries we need to replace it with
some define we're actually setting in Mono.
Most cases can be replaced by just XAMMAC_4_5 since MOBILE is defined on the xammac profile.
When you use `Process.Start()` with `UseShellExecute=true` (which is the default on Mono/.NET Framework, but false on .NET Core) then we'd still try to first start the file directly, before falling back to trying the "open" handlers like xdg-open to launch the file.
Presumably we do this so that on mobile you can still start a process without needing to explicitly set `UseShellExecute=false`.
However we don't need to try the fallback on iOS/Android since the "open" handlers won't work there anyway.
This recently showed up on the Xamarin.iOS Mono 2019-02 integration where we started running the `System.Diagnostics.ProcessTest` suite and the `Start1_FileName_NotFound()` would fail at `#C6` because the native error code wasn't 2 (file not found) but 13 (invalid data). This is because it tried
to use `/usr/bin/open` which doesn't work of course so it got to the `mono_w32error_set_last (ERROR_INVALID_DATA)` on L2088.
We cannot presume more than just "linux" or "osx" in our RIDs, because
if we want to enable --host vs --build, we can't detect the OS from
the runtime environment.
This is an okay compromise for now.
* Cleaning up the P/Invoke signatures for QPF and QPC to avoid marshalling and pinning
* Responding to PR feedback.
* Dropping support for low resolution stopwatch
* Removing BestFitMapping=false
* Removing unneeded unsafe declarations
* Addressing more PR feedback
* Fixing the pal_time header file
* Fixing the Unix P/Invoke signatures for GetTimestamp and GetTimestampResolution to return ulong.
* Fixing GetTimestampResolution to scale the result for HAVE_CLOCK_MONOTONIC
Signed-off-by: dotnet-bot <[email protected]>
When we switched to using the corefx System.IO.File implementation we also switched to an implementation that uses the `copyfile()` standard library call on macOS/iOS to copy files. This should preserve file metadata such as timestamps.
However there's a small edge case: when using an older version of the iOS Simulator < 11.0 the `copyfile()` call doesn't copy sub-second timestamps, presumably because older iOS ran on HFS which doesn't support that.
When we run this simulator on modern macOS which uses APFS and thus supports sub-second timestamps the origin file used for the test _does_ have sub-second timestamps and the test would fail.
We now skip the test in such environments.
PS: why did this not fail with the old Mono implementation? We used to always call utimes() on the destination file after copying to copy metadata, which in turn would update the file in the simulator host.
It doesn't seem worth it to replicate that behavior for this small edge case.
* Reconfigure bump for PR test
* Actually bump submodule this time probably
* Bump submodule
* Revert "Bump submodule"
This reverts commit b47679be10d3c38d40673cf73e0dc48a300318bc.
* Bump submodule
* Modify csi-test.csx to manually reference netstandard 2.0, because this is required for some reason
* Checkpoint: Test modifying csi.rsp instead of csi-test
* Git
* Update submodule
* Update submodule compiler path
* Remove binaries-new submodule
* Update to latest roslyn-binaries revision and update path in configure.ac
* Instead of having one `AppDomain.DoTypeResolve(object)` that checks at runtime whether
the argument is a `string` or a `TypeBuilder`, use two strongly-typed methods
`DoTypeResolve(string)` and `DoTypeBuilderResolve(TypeBuilder)`.
* Add both to the `corlib/LinkerDescriptor/mscorlib.xml`.
* Adjust the code in `appdomain.c` accordingly.
* Bump corlib version.
This is part of a larger on-going project to improve the linker logic.
The rationale behind this is that the new `AppDomain.DoTypeResolve(string)`
that is being called from `mono_domain_try_type_resolve_name()` should not
reference `TypeBuilder`, to allow the linker to remove some of the
`System.Reflection.Emit` types.
* [intrinsics] sync implementation with IL code
Before the intrinsic implemented
```
ldarg.0
ldarg.1
sizeof !!T
mul
conv.i
add
ret
```
now it implements
```
ldarg.0
ldarg.1
sizeof !!T
conv.i
mul
add
ret
```
`conv.i` and `mul` have been swapped. Also see https://github.com/mono/mono/pull/13609
* fix op_sext_i4 usage
[amd64] use 32bit variant of lea_membase for 32bit operations
Consider
```
xor %r15, %r15 // %r15 = 0x0
dec %r15d // %r15 = 0xffff_ffff
lea 0x1(%r15), %rdx // %rdx = 0x1_0000_0000 but should be 0x0
```
instead `lea 0x1(%r15), %edx` should be generated.
Fixes#13452Fixes#13597
* Remove the parsing, hashing, locking, allocations associated with JIT icall signatures.
Make them statically allocated, single-instanced at compile time, and almost
statically initialized.
Fix C++ and x86.
More x86 fix.
Fix ARMv5.
Undo tedious work to be redone instead of merged from old.
Put all signatures back, prepare for automated conversion.
Replace all the register_icall strings with:
my @a = ("double double",
"long long long",
"long long int32",
"double double double",
"ulong float",
"ulong double",
"long float",
"double int32",
"float float float",
"long double",
"object ptr int int32",
"double ptr",
"int int int ptr ptr ptr",
"int obj ptr",
"int obj",
"int ptr int int ptr object",
"int32 double",
"int32 int32 int32",
"int32 int32 ptr",
"int32 obj",
"int32 object ptr ptr ptr",
"int32 object",
"int32 ptr ptr ptr ptr ptr int32",
"int32 ptr ptr",
"obj ptr int",
"obj ptr",
"object int object object",
"object int object",
"object int",
"object int32",
"object object ptr ptr",
"object object ptr",
"object object",
"object ptr int int int int",
"object ptr int int int",
"object ptr int int",
"object ptr int ptr",
"object ptr int",
"object ptr int32",
"object ptr ptr int32",
"object ptr ptr ptr ptr ptr",
"object ptr ptr",
"object ptr",
"object",
"ptr int",
"ptr obj",
"ptr object int ptr ptr",
"ptr object int32 int32",
"ptr object ptr ptr",
"ptr object ptr",
"ptr object",
"ptr ptr int ptr",
"ptr ptr int",
"ptr ptr int32",
"ptr ptr ptr ptr",
"ptr ptr ptr",
"ptr ptr",
"ptr",
"uint32 double",
"uint32 ptr int32",
"void double ptr",
"void int",
"void int32",
"void obj ptr",
"void object object ptr",
"void object object",
"void object ptr int32 int32",
"void object ptr int32",
"void object ptr",
"void object",
"void ptr int int object",
"void ptr int object",
"void ptr int ptr",
"void ptr int",
"void ptr int32",
"void ptr object int32",
"void ptr ptr int",
"void ptr ptr int32",
"void ptr ptr ptr",
"void ptr ptr",
"void ptr",
"void ptr object",
"void",
);
while (my $line = <>)
{
if ($line =~ /register|mono_create_icall_signature/ && $line =~ /"/)
{
for my $from (@a)
{
my $to = "mono_icall_sig_$from";
$to =~ s/ /_/g;
$to =~ s/"//g;
$to =~ s/"//g;
$to =~ s/"//g;
$line =~ s/\Q"$from"\E/$to/;
}
}
print($line);
}
Remove whitespace from end of line.
Convert the strings to smaller arrays, of chars now,
that are scaled offsets into MonoDefaults, or -1 for ptrref.
Use smaller encoding.
fix merge
cleanup
* Larger representation that handles alignment.
* Try to undo external changel.
* Fix AOT.
* Fix code search and comments
* Restore warning in this PR.
* More ARM signatures.
* Change representation from pointer to offset.
Use sizeof for the special case ptrref.
Comments. Perhaps too much.
asserts. Perhaps too much.
A little bit more verbose/readable but essentially the same thing otherwise.
Perhaps too verbose.
* The initializer all-but-must be pointer-sized.
Even if the values fit in much smaller.
Add comments.
On obscure systems size_t is smaller than a pointer so
gsize or uintptr_t is required. Use gsize.
* Spaces before parens.
* PR: Use enum instead of offsetof.
Use may_alias some.
mono builds with -fno-strict-aliasing, but we had recent
aliasing problem (the enum operators with older g++)
and this looks a little hazardous
We could also have a separate integer or array of byte or array of integer or perhaps string
to resolve the aliasing.
integer: 16 values, 8 max -- could just use an int instead of this array business,
but the representation would be full with no room for expansion.
We are not wasting any/much memory here -- maybe one word per the 200 signatures,
because of sloppyness around any_size_array.
Work a little on dealiasing.
Comment some aliases and make obj/object, int/ptr, bool/boolean share values.
* tweak: Compute all the values once and then directly index small local array.
* Adjust comments to new reality.
Add comments explaining aliasing.
* Add casts to attempt to abide by strict aliasing rules.
* Updated Argument Helper param from list->collection since the parameter name is collection
* Updated exception message to use an out of range exception that doesn't explicitly reference a list
* Simplified if statements that verify if the index is out of range
* Updated if logic to be simplified using (uint)
* Updated exception handling to throw ThrowHelper.ThrowArgumentOutOfRange_IndexException() when the ExceptionArgument was 'Index'
Signed-off-by: dotnet-bot <[email protected]>
* Unexpected System.MethodAccessException is thrown for a method call of a class that implements a protected interface inside another interface.
```
public interface I1
{
protected interface T1
{
void M1();
}
protected class T2
{}
protected struct T3
{}
protected enum T4
{
B
}
}
class Test1 : I1
{
static void Main()
{
I1.T1 a = new Test2();
a.M1();
System.Console.WriteLine(new I1.T2());
System.Console.WriteLine(new I1.T3());
System.Console.WriteLine(I1.T4.B);
}
class Test2 : I1.T1
{
public void M1()
{
System.Console.WriteLine("M1");
}
}
}
``
Fixing this case Test1 implements I1<int> but can access methods from I1<object>
public interface I1<X>
{
protected interface T1
{
void M1();
}
protected class T2
{}
protected struct T3
{}
protected enum T4
{
B
}
}
class Test1 : I1<int>
{
static void Main()
{
I1<object>.T1 a = new Test2();
a.M1();
System.Console.WriteLine(new I1<object>.T2());
System.Console.WriteLine(new I1<object>.T3());
System.Console.WriteLine(I1<object>.T4.B);
}
class Test2 : I1<object>.T1
{
public void M1()
{
System.Console.WriteLine("M1");
}
}
}
* [interp] Fix instruction length
* [interp] Don't generate directly into linear code stream
Allocate each instruction into the mempool and link them together. At the end of code generation and after all potential optimisation passes, we will compact this code into its final form.
* [interp] Add support for branch relocations
For each branch instruction, we store in its data field the il offset that we are branching to. During the final code generation, we resolve all backward branches and add relocs for forward branches. These relocs are then resolved after all instructions have been emitted in the final code stream.
* [interp] Extract vararg call code in separate instruction
It requires a different instruction size and is extremely rare code.
* [interp] Fix backwards branch with large offset
We were adding an unsigned instead of subtracting.
* [interp] Fix line numbers
For each il offset that generated interpreter instructions we store the native offset, during the compaction phase.
* [interp] Fix seq points
We have to defer SeqPoint data creation during the compact generation phase, because that's when we have native offset information. We add a flags field to the interpreter instruction to store any relevant information coming from the compilation phase.
* [interp] Make verbose logging a bit nicer
We no longer have the native offset during the first IL instruction interation. Maybe we should bring back logging for the IL -> IR mapping during the compaction phase.
* [interp] Remove some dead code
Helix wasn't running our runtime tests as expected, because the test runner expected newline-separated tests to run, and we were generating space-separated.
Following "be liberal in what you accept" philosophy, and to prevent this issue in the future, just deal with "whitespace separated" rather than "this specific whitespace and no other"
Backport of #12940.
- Disable other failing tests (they are tests that are newly added, not regressions)
- Look for mono_pal_init() directly in the System.Native library
- [configure] Have libmono-native depend on libmono(-sgen) for the Android build
If this is not done, Android is not able to resolve mono symbols that are used in mono-native (e.g. mono_add_internal_call_with_flags), and will refuse to load the library with 'cannot locate symbol' errors
[llvmonly] Add gsharedvt in wrappers to calls which could go to the interpreter.
Fixes https://github.com/mono/mono/issues/13463.
<!--
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
-->
* Enable MSVC objects on LLVM >= 6.00
* Always used PIC relocation-model on Windows x64 due to LLVM problem with
static triggering incorrect ADDR32 relocation entries in 64-bit objects.
* Add CodeView symbol format instead of DWARF for Windows x64.
* Fix LLVM outfile when doing static link to not end up in temp directory.
* Only add /DEFAULTLIB when using MSVC and not doing static compile. For
static compile the needed libraries must be added when objects get's linked
and since the needed libraries are c-runtime libraries, should be transparent
for most applications consuming the object files.
When logic moved from winsetup.bat into an msbuild task that changed the
console output of winsetup.bat causing problems for genconst to find
MONO_VERSION and MONO_CORLIB_VERSION. There was also a potential problem
where winsetup.bat couldn't find msbuild.exe if not included in PATH.
This fix makes sure winsetup.bat detect and setup a full msbuild environment
before running msbuild.exe. It also change genconsts to look at the generated
config.h for the correct values of MONO_VERSION and MONO_CORLIB_VERSION that
will be used by the runtime builds.
[ssa] avoid code motion to try-blocks
Consider
```
BB4: // successor BB5, BB9
[...]
br [B9]
BB5: // catch handler block for BB4
[...]
br BB9
BB9:
aotconst R90
gc_safe_point R90
[...]
```
Previously, our invariant code motion pass would move `aotconst R90` to the end of BB4. Unfortunately, BB4 contains instructions that can cause an exception and thus control flow is broken and continues to BB5. `aotconst R90` wouldn't be loaded correctly in this scenario.
When lowered to LLVM IR this is more obvious, and the verification pass of LLVM catches this.
Fixes https://github.com/mono/mono/issues/13460
* ```
interface I1<T>
{
sealed protected void M1()
{
System.Console.WriteLine("M1");
}
}
interface I3<T> : I1<T>
{}
interface I2<T> : I3<T>
{
static void Test(I2<int> x)
{
x.M1();
}
}
class A : I2<int>
{
static void Main()
{
I2<byte>.Test(new A());
}
}
```
When a interface implements another interface and they are generics, we don't need to check the datatypes of generics, we only need to check the inheritance.
Fixes 13467
* Adding test.
* Using the getter functions
* Initializing klass->interfaces/interfaces_count.
* Update mono/metadata/class.c
Co-Authored-By: thaystg <[email protected]>
* Fixing side effect on dim-simple.il
1. aot-compiler: don't leak `MonoCustomAttrInfo`
2. aot-runtime: don't leak sigs when decoding wrapper references. All of these cases we decode a sig (which uses malloc), and then call some method that immediately calls `mini_get_underlying_signature` which dups the sig, so the one from the decode isn't needed anymore.
* namespace Application
{
public interface I1 { void M1() { System.Console.WriteLine("Unexpected!!!"); }}
public interface I2 : I1 { void I1.M1() { System.Console.WriteLine("I2.I1.M1"); }}
public interface I3 : I1 { void I1.M1() { System.Console.WriteLine("I3.I1.M1"); }}
public interface I4 : I1 { void I1.M1() { System.Console.WriteLine("I4.I1.M1"); }}
class Test10 : I1, I2, I3, I4 { public void M1() { System.Console.WriteLine("Test10.M1"); } }
class MainClass {
public static void Main(string[] args)
{
I1 var = new Test10();
var.M1();
}
}
}
The interface method M1 is overridden at I1, at I2, at I3, at I4. The class Test10 overrides method M1 so regardless of having methods overriden in interface, the method of the class should be priority in this case. And then I remove the conflicts because there is not a conflict anymore.
[aot] force v7 on arm when using LLVM on iOS
In https://github.com/mono/mono/pull/11172 we added passing `-march=arm` to `llc`, so that newer LLVM would generate code correctly for the target arch. Unfortunately this seems to break older LLVM, that is still used for 32bit code on Xamarin.iOS. For iOS we need to force it to armv7, otherwise it will try to substitute certain locking primitives with builtins that aren't available as hardware instructions on armv5.
Before this change:
```console
$ nm ./obj/iPhone/Release/mtouch-cache/armv7/mscorlib.dll-llvm.o | grep sync_
U ___sync_fetch_and_add_4
U ___sync_lock_test_and_set_4
U ___sync_synchronize
U ___sync_val_compare_and_swap_4
00079e1c T _mscorlib_System_Runtime_CompilerServices_AsyncMethodBuilderCore_ThrowAsync_System_Exception_System_Threading_SynchronizationContext
00057f80 T _mscorlib_System_Threading_SemaphoreSlim_WaitAsync_int_System_Threading_CancellationToken
00058430 T _mscorlib_System_Threading_SemaphoreSlim_WaitUntilCountOrTimeoutAsync_System_Threading_SemaphoreSlim_TaskNode_int_System_Threading_CancellationToken
U _p_1214_plt_mscorlib_System_Threading_SemaphoreSlim_WaitAsync_int_System_Threading_CancellationToken_llvm
U _p_1217_plt_mscorlib_System_Threading_SemaphoreSlim_WaitUntilCountOrTimeoutAsync_System_Threading_SemaphoreSlim_TaskNode_int_System_Threading_CancellationToken_llvm
U _p_1735_plt_mscorlib_System_Runtime_CompilerServices_AsyncMethodBuilderCore_ThrowAsync_System_Exception_System_Threading_SynchronizationContext_llvm
U _p_1976_plt_mscorlib_System_Threading_SemaphoreSlim_WaitAsync_llvm
U _p_37_plt_mscorlib__jit_icall_ves_icall_thread_finish_async_abort_llvm
```
After this change:
```console
$ nm ./obj/iPhone/Release/mtouch-cache/armv7/mscorlib.dll-llvm.o | grep sync_
0007008c T _mscorlib_System_Runtime_CompilerServices_AsyncMethodBuilderCore_ThrowAsync_System_Exception_System_Threading_SynchronizationContext
00050654 T _mscorlib_System_Threading_SemaphoreSlim_WaitAsync_int_System_Threading_CancellationToken
00050ab4 T _mscorlib_System_Threading_SemaphoreSlim_WaitUntilCountOrTimeoutAsync_System_Threading_SemaphoreSlim_TaskNode_int_System_Threading_CancellationToken
U _p_1214_plt_mscorlib_System_Threading_SemaphoreSlim_WaitAsync_int_System_Threading_CancellationToken_llvm
U _p_1217_plt_mscorlib_System_Threading_SemaphoreSlim_WaitUntilCountOrTimeoutAsync_System_Threading_SemaphoreSlim_TaskNode_int_System_Threading_CancellationToken_llvm
U _p_1735_plt_mscorlib_System_Runtime_CompilerServices_AsyncMethodBuilderCore_ThrowAsync_System_Exception_System_Threading_SynchronizationContext_llvm
U _p_1976_plt_mscorlib_System_Threading_SemaphoreSlim_WaitAsync_llvm
U _p_37_plt_mscorlib__jit_icall_ves_icall_thread_finish_async_abort_llvm
```
Fixes https://github.com/mono/mono/issues/13478
* [runtime] Default llvm to self-init
Now the init code is behind llvm_plt_init. Setting
--aot=llvm-plt will bring back the legacy llvm+plt behavior
* [llvm] Mark managed methods no-inline by llvm
* [runtime] Clean up self-disabling machinery
* [llvm] Skip self-init on cctors
* [runtime] Always make ctors call their cctors
* [runtime] Improve mono_print_unwind_info, add cases
* [runtime] Fix too-early eager calling of cctors
We emitted all of the lazy checks and init around a specific static
method, but still were initializing it when we initialized methods
that access it. This made static cctors run before they were supposed
to.
The problem was that the call site here has method == NULL, because
we don't compute it. That's expected, as we don't compute the method
along this path.
This initial "&&" looks like it was supposed to avoid calling the method
on a null MonoMethod reference. This preserves that, while fixing the
control flow issues.
* [runtime] Associate init_method native code with MonoMethod
* [runtime] Future-proof against aot init wrapper subtype mixups
* [runtime] Fix goto in AOT-init change for c++
* [runtime] Move docs for llvm-disable-self-init into runtime
* [runtime] Fix bitcode, remove unneeded wrapper around init icall
* [llvm] Include global prefix in init name
* [comment] Describe debugging usage of llvm self-init disable flag
* [aot] Consolidate mangler string append lines
* [llvm] Make self-init documentation changes
* [llvm] Rename self-init funcs, mini_llvmonly_ to mini_llvm_
* [runtime] Enable inlining for methods without init
* [netcore] Avoid casting to generic parameters in gen-xunit-runner.
* [netcore] Make the build-/run- targets more generic, add support for more test suites.
* remove NIE from Exception
* [netcore] Convert gen-xunit-runner to use roslyn for code generation instead of codedom.
* [netcore] Add check target to run all test suites.
* Reduce number of classes in winaot mscorlib.
Winaot profile should be a Windows AOT friendly profile close to mobile
and consoles. At some point it was set to include the full net_4_x that
cause problems on none desktop platforms. This fix reduce the set to only
include classes similar to mobile and console profiles.
* Reverting changes to TimeZoneInfo test when reducing classes in corlib winaot.
* Move SafePasswordHandle to win32_build_corlib profile.
* Excluded some additional none Windows sources from win32_build/winaot profile.
Utf8String is an experimental type that is string-like (heap-allocated, immutable, variable-length, null-terminated) but whose inner representation is UTF-8, not UTF-16.
This is a skeleton implementation of the basic API shape. The ecosystem of APIs has not yet been built around it. All Utf8String-related code is currently surrounded by ifdefs to allow easy identification and removal from release branches.
Signed-off-by: dotnet-bot <[email protected]>
* '''
interface I1
{
sealed void M1()
{
System.Console.WriteLine(“M1”);
}
}
interface I2 : I1
{
static void Test<T>(T x) where T : I2
{
x.M1();
}
}
class A : I2
{
static void Main()
{
I2.Test(new A());
}
}
'''
When an interface implements a Sealed method, this method is not virtual, so it will not be available at vtable. But in the IL the call is a virtual call, but in this case we don't need to search at vtable.
Fixes#13466
* Change IL test.
Types like sbyte, ushort, and other 8-bit / 16-bit elemental types are now directed down the fast vectorized code paths that previously only byte and char were eligible for.
Signed-off-by: dotnet-bot <[email protected]>
* [Coop] Convert ves_icall_System_Globalization_CultureData_fill_number_data.
Tested by running this program:
```
class A
{
public static void Main()
{
System.Console.WriteLine(System.Globalization.CultureInfo.CurrentUICulture.CompareInfo);
System.Console.WriteLine(System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat.AMDesignator);
System.Console.WriteLine(System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat.DateSeparator);
System.Console.WriteLine(System.Globalization.CultureInfo.CurrentUICulture.DisplayName);
System.Console.WriteLine(System.Globalization.CultureInfo.CurrentUICulture.EnglishName);
System.Console.WriteLine(System.Globalization.CultureInfo.CurrentUICulture.IsNeutralCulture);
System.Console.WriteLine(System.Globalization.CultureInfo.CurrentUICulture.IsReadOnly);
System.Console.WriteLine(System.Globalization.CultureInfo.CurrentUICulture.LCID);
System.Console.WriteLine(System.Globalization.CultureInfo.CurrentUICulture.Name);
System.Console.WriteLine(System.Globalization.CultureInfo.CurrentUICulture.NativeName);
System.Console.WriteLine(System.Globalization.CultureInfo.CurrentUICulture.NumberFormat.CurrencySymbol);
System.Console.WriteLine(System.Globalization.CultureInfo.CurrentUICulture.NumberFormat.NumberDecimalDigits);
System.Console.WriteLine(System.Globalization.CultureInfo.CurrentUICulture.NumberFormat.NumberDecimalSeparator);
System.Console.WriteLine(System.Globalization.CultureInfo.CurrentUICulture.Parent);
System.Console.WriteLine(System.Globalization.CultureInfo.CurrentUICulture.TextInfo);
System.Console.WriteLine(System.Globalization.CultureInfo.CurrentUICulture.ThreeLetterISOLanguageName);
System.Console.WriteLine(System.Globalization.CultureInfo.CurrentUICulture.ThreeLetterWindowsLanguageName);
System.Console.WriteLine(System.Globalization.CultureInfo.CurrentUICulture.TwoLetterISOLanguageName);
}
}
```
which covers some but not all of the data.
* - Use gint32 instead of int when interfacing directly with managed code.
Indirectly would be passing the parameter off to additional native code; compiler
can often silently convert.
int will always be 32 bits.
- Expand tedious error-prone code instead of using preprocessor to automate.
- Add comments that the native and managed types must match.
- Rename the managed type to match the native type (not necessary,
but might as well have them grep perfectly coincidentally.).
- Sort the fields and some of their uses for easier reading.
It might be infinitesimally faster to line up the order
with the native structure, to synchronize access order (i.e. sequential access to all).
- Restore parameter name to number_index.
- Validate, with assert, number_index maximum not just minimum.
* Restore the group_sizes logic.
group_sizes is an array of up to two integers, -1 terminated.
* restore const
* Add comment explaining the ordered -- sorted alphabetically.
I was looking over the new Range methods on `Collection<T>` and it occurred to me that for all existing methods, parameter validation is done in the *public* methods before calling the *protected virtual* methods. This changes the new Range methods to do the same.
Signed-off-by: dotnet-bot <[email protected]>
* Only do clean/rebuild when an assembly changed.
* Add wrappers for different full AOT build configurations.
* Make scripts callable from different working directory.
Winaot profile should be a Windows AOT friendly profile close to mobile
and consoles. At some point it was set to include the full net_4_x that
cause problems on none desktop platforms. This fix reduce the set to only
include classes similar to mobile and console profiles.
This all stems from ECMA 335, 7.1.1:
> The CLI itself shall treat required and optional modifiers in the same
> manner. Two signatures that differ only by the addition of a custom
> modifier (required or optional) shall not be considered to match. Custom
> modifiers have no other effect on the operation of the VES.
This rule means that when comparing signatures, we have to treat two types that
differ only in their custom modifiers as distinct. In particular, we have to do
this when comparing signatures in order to fill in the vtable for a class. And
moreover, we have to concatenate custom modifiers when doing generic
instantiation. If a method in a generic type has signature `T modopt(IsConst)
Method()` and we instantiate T with `int32 modopt(IsLong)`, we are expected to
produce the signature `int32 modopt(IsConst) modopt(IsLong) Method()` (with the
custom modifiers on `int32` in that order).
So this PR implements the following operations:
1. custom modifier appending during `mono_metadata_type_dup_with_cmods`
2. custom modifier-respecting comparison in `do_mono_metadata_type_equal`
To do this, we actually have to introduce a second representation of custom
modifiers: in the normal representation, all the cmod type specs come from a
single image. Whereas now, due to inflation of signatures, we can have a mix
of modifiers from different images. So in the MonoAggregateModContainer
representation, we pair each typespec token with the image in which it is to be
resolved.
We keep the old representation (a single image to resolve the entire set of
typespec tokens) because it's natural when you're just reading from a single
image. Also this representation is part of the embedding API.
---
### But that's not all ###
It is possible for generic parameters of a generic class to appear in the
_custom modifiers_ of a type in a method signature. For example:
```
T modopt(Nullable`1<T>) Method ()
```
In this case, when we inflate this signature, we need to inflate not only the
return type, but also the modifiers on a return type.
That means our old aggregate representation (where each modifier is a pair of a
MonoImage and a typespec token) is inadequate: we can inflate a signature and
get a custom modifier that doesn't appear as a typespec in any table of any
existing image.
This is the same situation as generic instances: as a program runs, it creates
generic instances that are not part of the source code. So we solve it the
same way as with generic instances.
Our new `MonoAggregateModContainer` representation is a pointer into memory owned
by a MonoImageSet that contains an entire MonoType for each custom modifier.
The invariant is that the aggregate modifier container is allocated from a
mempool of a `MonoImageSet` that includes the images of all the modifiers.
In general, when inflating, we first create a provisional candidate
MonoAggregateModContainer on the stack and then look it up the image set that
should own it and then look for a "canonical" mod container in the
`MonoImageSet:aggergate_modifiers_cache`
---
Also had to bump the AOT image format, which now always reads back in using the aggregate representation.
---
This should address #10564, #10565, #12422, #10945 (again), #6936, and the parts of #11350 that **don't** deal with arrays.
---
TODO:
- [x] Add some representative test cases to this PR.
- [ ] Modify our acceptance tests to run the various disabled Roslyn tests.
Writing to MonoClass:interface_id must be done with the loader lock held.
Fixes assertion:
```
* Assertion at class-init.c:1830, condition `i == 0 || interfaces_full [i]->interface_id >= interfaces_full [i - 1]->interface_id' not met
```
Revert "[mini] Inline Selector.GetHandle for tvOS and watchOS assemblies as well. (#13246)"
This reverts commit c99fe4b462.
It doesn't work when LLVM is enabled for tvOS: https://github.com/xamarin/xamarin-macios/pull/5742#issuecomment-471007078, it causes multiple compilation errors like this:
Process exited with code 1, command:
/Applications/Xcode101.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Applications/Xcode101.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.1.sdk -Qunused-arguments -mtvos-version-min=12.1 -fembed-bitcode-marker -arch arm64 -c -o /private/var/folders/nh/n1y9qj2n40d7wpmx1mg9blg80000gn/T/mtouch.cache/arpl1vgs.js6/arm64/Xamarin.TVOS.dll-llvm.o -x assembler /private/var/folders/nh/n1y9qj2n40d7wpmx1mg9blg80000gn/T/mtouch.cache/arpl1vgs.js6/arm64/Xamarin.TVOS.dll-llvm.s
/private/var/folders/nh/n1y9qj2n40d7wpmx1mg9blg80000gn/T/mtouch.cache/arpl1vgs.js6/arm64/Xamarin.TVOS.dll-llvm.s:4665:14: error: invalid variant 'OBJC_SELECTOR_REFERENCES_.2@PAGE'
adrp x8, l_@OBJC_SELECTOR_REFERENCES_.2@PAGE
^
/private/var/folders/nh/n1y9qj2n40d7wpmx1mg9blg80000gn/T/mtouch.cache/arpl1vgs.js6/arm64/Xamarin.TVOS.dll-llvm.s:4673:18: error: invalid variant 'OBJC_SELECTOR_REFERENCES_.2@PAGEOFF'
ldr x1, [x8, l_@OBJC_SELECTOR_REFERENCES_.2@PAGEOFF]
<!--
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
-->
* Refactor EventCounter and add PollingCounter
* Add PollingCounter
* Add IncrementingEventCounter and IncrementingPollingCounter
* Add MetaData API to Counters
* Some more refactoring
* removing commented out code
* some more cleanup
* build fix and addressing some PR comments
* Addressing PR feedback
* use StringBuilder to generate metadata string
Signed-off-by: dotnet-bot <[email protected]>
* Move drawing types for XI/XM/wasm/orbis/unreal to System.Drawing.Common
For XI/XM they were in Xamarin.iOS.dll/OpenTK-1.0.dll before.
For wasm/orbis/unreal we remove System.Drawing.dll from the profiles and
add the types to System.Drawing.Common.dll instead to align with the other
mobile profiles (only "net_4_x" and "build" still have System.Drawing.dll).
* Bump API snapshot submodule
* [csproj] Update project files
Replacing this with a pattern that is easier to statically analyze. We use the GetType/GetMethod/CreateDelegate pattern in several places already.
Signed-off-by: dotnet-bot <[email protected]>
When the configure checks were ported from configure.cmake in corefx
a couple of mistakes happened:
- Using AC_TRY_COMPILE instead of AC_TRY_LINK:
CMake's check_c_source_compiles() function compiles *and* links while
AC_TRY_COMPILE only does the former. This hides potential linking issues
which should fail the configure check.
- Using CFLAGS="-Werror -W....":
This works in CMake but autoconf always appends the previously defined
CFLAGS and since we set e.g. `-Wno-undefined` some configure checks
would fail due to an unrelated warning being treated as an error.
We need to only promot specific warnings to errors instead.
While looking at this I also found that we were setting CFLAGS after
we already AC_SUBST() it, we need to do this very close to the end of configure.ac.
Moved some code into that last block.
Finally, Android has special cases for sendfile and arc4random_buf where
they're defined in the header but aren't actually there for certain API profiles.
For now we disable arc4random_buf on Android and add a special check for sendfile.
* Fix sendfile with 6 parameters being misdetected
We need to make sure to actually prevent the implicit prototype since
in this case sendfile with different set of parameters actually exists
so the linker wouldn't fail.
Also fixed a few other cases of wrong configure checks due to missing headers.
* Move GSS checks into the Mono.Native checks section
This allows us to have a 1:1 mapping of the checks from configure.cmake
* [debugger] Fixing two crashes while debugging an Android app.
-> Doing stepping into in VSM in some situation the frame saved in TLS is not synchronised with what is really been executed in the main thread. This makes the debugger-agent crashes because it tries to get variable info in some memory that is not available anymore.
-> To fix it I forced the update of stack when CMD_THREAD_GET_FRAME_INFO is called.
-> Doing step over in Visual Studio for Windows, if you have the threads debugger window enabled, VSW calls frame_commands for each thread that is showed, and if the thread is not really_suspended it tries to get variable info from a memory that is not available anymore because the thread is not suspended yet.
-> To fix it I don't send variable info of a frame if the thread is not really_suspended and doesn't have an async_state valid.
#Fixes 12843
This PR adds missing System.Drawing converters thus it completes NS2.1 support (as of today) for all profiles except macOS\IOS specific ones: monotouch, tv, watch, xammac, xammac_net_4_5.
* [runtime] Add a few new m_class inline functions.
* [netcore] Implement Array.IndexOf ().
* [netcore] Implement RuntimeHelpers.PrepareMethod ().
* Add error checks to RuntimeHelpers.GetUninitializedObject ().
* Fix some type attributes.
* Fix some TypedReference special cases.
Upstream must have rewritten, because the runtime checks were
replaced with the (not good for Mono) ifdefs.
Not throughly tested, but unbreaks build locally; waiting for CI
to come back with more results.
If it works, could someone get this upstream?
* DynamicRoleClaimProvider to help with legacy role management in web forms
* Added AppDomainManagerAssembly, AppDomainManagerType, and PartialTrustVisibleAssemblies
properties to AppDomainSetup. They don't do anything, but having them there
helps lessen the amount of change in refsrc System.Web.
This refactoring is limited to ASCIIEncoding at the moment, but it can easily be applied to UTF-8 / UTF-16 / UTF-32.
High-level changes:
- Fallback logic has been split from the fast-path, improving performance of GetBytes and similar routines.
- All of the plumbing of when to invoke the fallback logic and how to manage leftover data has been moved into the base class.
- Almost all of the logic except for the fast-path is now written in terms of verifiable code (Span and ReadOnlySpan).
- Minor bug fixes in EncoderNLS.Convert (see https://github.com/dotnet/coreclr/issues/23020).
Signed-off-by: dotnet-bot <[email protected]>
threads: set mutex PRIO_INHERIT in attribute
When running multiple threads on a linux-rt kernel, with different priorities, the lack of priority-inheritance
makes the kernel make wrong scheduling choices.
This commit changes the system-wide mutex initializers.
This change protects our system against unexpected latencies in higher priority threads.
<!--
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
-->
Currently Task has a stack depth check that avoids stack overflows on very deep stack continuation chains, but it only applies to Task.ContinueWith, not to other kinds of continuations. This changes that to have it apply to all.
As part of this, this also deletes the current StackGuard type used to achieve the check. The type was meant to avoid expensive calls to check where we are on the stack, but now that we're using TryEnsureSufficientExecutionStack, it's actually faster to just call that rather than access the current StackGuard from a ThreadLocal. This then also cleans up the call sites nicely, as they no longer need finally blocks to undo the increment performed on the StackGuard.
Signed-off-by: dotnet-bot <[email protected]>
* [netcore] Implement MethodBody using internal Runtime* classes. Use the mono version for ModuleHandle.
* [netcore] Reflection fixes.
* Address review comments.
* [netcore] Implement RuntimeHelpers:GetUninitializedObject ().
* [netcore] Implement the Type::GetMethod () overload which has a genericParameterCount parameter.
* [netcore] Implement Thread.OptimalMaxSpinWaitsPerSpinIteration.
* Revert a change to fix a test failure.
* [netcore] Implement Marshal:GetExceptionForHRInternal ().
* [netcore] Implement GC:GetSegmentSize ().
* [runtime] Allow pointer type members in typed references.
* Added new Range Manipulation APIs for Collection<T> which propogate up to ObservableCollection<T>. AddRange, InsertRange, RemoveRange and Replace Range
Signed-off-by: dotnet-bot <[email protected]>
* Updated index out of range exception check to be a single comparison
Signed-off-by: dotnet-bot <[email protected]>
* Updated foreach to use T instead of var
Signed-off-by: dotnet-bot <[email protected]>
* Adding braces on for loop
Signed-off-by: dotnet-bot <[email protected]>
* Added ReplaceItemsRange API and updated ReplaceRange to invoke the protected method
Signed-off-by: dotnet-bot <[email protected]>
* Remove ternary operator from invocation as it is the same as inputing items.Count
Signed-off-by: dotnet-bot <[email protected]>
* Updated RemoveItemsRange to prevent int.MaxValue overflow errors
Signed-off-by: dotnet-bot <[email protected]>
* Updated RemoveItemsRange to properly remove each item and not just the index items
Signed-off-by: dotnet-bot <[email protected]>
* Added ArgumentOutOfRangeException exception in RemoveRange if the count is less than 0
Signed-off-by: dotnet-bot <[email protected]>
* Updated RemoveRange invocation of RemoveAt to use index instead of i, because the array changes with each iteration of the for loop and will cause side-effects which may include index out of range exceptions. This needs to be index because as the array shrinks the index is always at the correct position.
Signed-off-by: dotnet-bot <[email protected]>
* Updated RemoveAt->RemoveItem. This change removes redundent validation checks that happen using the RemoveAt API. RemoveItem gives us direct access to invoke the command
Signed-off-by: dotnet-bot <[email protected]>
* Updated InsertItemsRange to simplify the expression and added performance improvements. If the underlying `items` is using List<T> we should use it's InsertRange method since it is optimized, othersie we use InsertItem
Signed-off-by: dotnet-bot <[email protected]>
* Added new RemoveRange validation check to see if the resulting range (index + count) > items.Count and if it is true throw ArgumentException
Signed-off-by: dotnet-bot <[email protected]>
* Removed (Int64) cast statements from RemoveItemsRange when checking for overflow errors
Signed-off-by: dotnet-bot <[email protected]>
* InsertItemsRange API now checks if the underlying items.IsReadOnly first then collection == null
Signed-off-by: dotnet-bot <[email protected]>
* Simplified the RemoveItem logic since we have more robust validation
Signed-off-by: dotnet-bot <[email protected]>
* Optimized RemoveItemsRange to call the list.RemoveRange if the items is of type List<T>
Signed-off-by: dotnet-bot <[email protected]>
Several of the corefx interop sources uses the Unicode names of Win32 symbols.
Our current probing implementation on Windows will test the given name last
when nomangle is not provided (default). On Windows that will be a large number
of probes due to old stdcall name mangling rules. Fix makes sure we first test
the symbol against its charset and the given symbol, before trying the stdcall
name mangling rules. Will reduce the probing a lot on Windows for corefx Win32
interop classes.
* [corlib] Remove Interop.MountPoints.cs from .sources
We no longer need it since https://github.com/mono/mono/pull/13125 and having
it included makes xamarin-macios still complain about the missing symbol.
* [csproj] Update project files
Warning (at least on Windows) due to unamed struct:
C4201, nonstandard extension used : nameless struct/union
Since the header can be consumed by embedders this warning should be
disabled.
* Use platform specific implementation of GetCurrentProcessId
directly in shared location instead of relying on runtime export
* Move GetCurrentProcessId to Interop class
* Update ES_BUILD_STANDALONE build
Signed-off-by: dotnet-bot <[email protected]>
* Created SR and Strings helpers as refsrc resources are
missing / incomplete
* Moved existing tests into the Test folder
* Moved old DBLinq code into tools/sqlmetal as there are no other
alternatives.
* Fixing the float/double parsing logic to handle exponents that are too large/small
* Fixing the debug assert to use >= and <=
* Fixing the max exponents to be +1 to match what scale uses.
Signed-off-by: dotnet-bot <[email protected]>
* Clean up some string.Format usage
Mainly changes some string.Format usage to be SR.Format when working with resource strings. Also cleans up a few asserts that were using string.Format.
* Address PR feedback and clean up src
* Address more feedback
* Update src/System.Private.CoreLib/shared/System/Type.Enum.cs
Thanks.
Co-Authored-By: stephentoub <[email protected]>
Signed-off-by: dotnet-bot <[email protected]>
* Fix ValueStringBuilder.EnsureCapacity to call Grow correctly (#35746)
Call to EnsureCapacity may result in invalid buffer size being
allocated.
* Update ValueStringBuilder.Grow to prevent misuse (#35746)
Updated name of the argument to make it clearer on the call-site also
added summary co clearly state the behavior of Grow.
Signed-off-by: dotnet-bot <[email protected]>
* Update dependencies from https://github.com/dotnet/core-setup build 20190301.13
This change updates the following dependencies
- Microsoft.NETCore.App - 3.0.0-preview4-27501-13
- Microsoft.NETCore.DotNetHost - 3.0.0-preview4-27501-13
- Microsoft.NETCore.DotNetHostPolicy - 3.0.0-preview4-27501-13
* Remove workaround for System.Runtime.CompilerServices.Unsafe
* Update dependencies from https://github.com/dotnet/core-setup build 20190302.8
This change updates the following dependencies
- Microsoft.NETCore.App - 3.0.0-preview4-27502-8
- Microsoft.NETCore.DotNetHost - 3.0.0-preview4-27502-8
- Microsoft.NETCore.DotNetHostPolicy - 3.0.0-preview4-27502-8
* Update dependencies from https://github.com/dotnet/core-setup build 20190303.9
This change updates the following dependencies
- Microsoft.NETCore.App - 3.0.0-preview4-27503-9
- Microsoft.NETCore.DotNetHost - 3.0.0-preview4-27503-9
- Microsoft.NETCore.DotNetHostPolicy - 3.0.0-preview4-27503-9
* Update dependencies from https://github.com/dotnet/core-setup build 20190304.10
This change updates the following dependencies
- Microsoft.NETCore.App - 3.0.0-preview4-27504-10
- Microsoft.NETCore.DotNetHost - 3.0.0-preview4-27504-10
- Microsoft.NETCore.DotNetHostPolicy - 3.0.0-preview4-27504-10
* Don't include EventRegistrationToken on Unix
This type was accidentally duplicated between CoreLib and contracts.
Suppress that for now since we're detecting the duplication in the shared framework.
Make a fix in the shared items to restore the condition on this type.
Signed-off-by: dotnet-bot <[email protected]>
* The default `HttpClient` constructor now calls a static method `CreateDefaultHandler()`;
we provide a platform-specific implementation of it.
* Replaced `HeaderUtils` with `PlatformHelper` and removed the `LEGACY_HTTPCLIENT` conditional.
* Added a new `socketshandler.sources` file to keep the sources in one place.
* Use a reflection check in the tests instead of the `LEGACY_HTTPCLIENT` conditional.
* This allows us to also get rid of the `SOCKETSHTTPHANDLER` define.
* [safepoint] Use LLVM pass to insert safepoint
This is to avoid safepoints to stop optimizations from happening.
* [safepoint] Use LLVM pass to insert safepoint
This is to avoid safepoints to stop optimizations from happening.
* fix error: emit_gc_safepoint_poll does not return anything
* Revert partial 4150f06f8621f2f2918e3bd747bf80a0f0f8c9c6
* Fix build
* [runtime] Add mono_threads_state_poll to preinited icalls
* [runtime] Adding back in safepoint icall skip code
* Revert mini.c to 100f422
* [runtime] Add missing deref to safepoint poll
* [runtime] Make safepoint functions have WeakODR linkage
They can be used with native line endings.
We now have a shared folder with the dotnet repos and they have CRLF normalization enabled.
This difference leads to conflicts while applying changes from the dotnet repos to mono.
Concurrent request completions could cause following exception:
```
FATAL UNHANDLED EXCEPTION: System.ArgumentOutOfRangeException:
Index was out of range. Must be non-negative and less than
the size of the collection.
Parameter name: index
at System.Collections.Generic.List`1[T].RemoveAt (System.Int32 index) [0x00009] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
at System.Collections.Generic.List`1[T].Remove (T item) [0x0000c] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
at System.ServiceModel.Channels.HttpRequestChannel+HttpChannelRequestAsyncResult.Cleanup () [0x00011] in <28c4695205ef47378f5370502b066592>:0
at System.ServiceModel.Channels.HttpRequestChannel+HttpChannelRequestAsyncResult.set_IsCompleted (System.Boolean value) [0x00034] in <28c4695205ef47378f5370502b066592>:0
at System.ServiceModel.Channels.HttpRequestChannel+HttpChannelRequestAsyncResult.Complete (System.Exception ex) [0x0001a] in <28c4695205ef47378f5370502b066592>:0
at System.ServiceModel.Channels.HttpRequestChannel+<>c__DisplayClass7_1.<BeginProcessRequest>b__0 (System.IAsyncResult r) [0x000bd] in <28c4695205ef47378f5370502b066592>:0
This stack was captured after some changes in AwaitTaskContinuation.RunOrScheduleAction.
Unfortunately the current implementation of AwaitTaskContinuation.RunOrScheduleAction re-throws the above
exception with a wrong stack:
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction (System.Action action, System.Boolean allowInlining, System.Threading.Tasks.Task& currentTask) [0x00023] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
at System.Threading.Tasks.Task.FinishContinuations () [0x00052] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
at System.Threading.Tasks.Task.FinishStageThree () [0x0003c] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
at System.Threading.Tasks.Task.FinishStageTwo () [0x000a1] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
at System.Threading.Tasks.Task.Finish (System.Boolean bUserDelegateExecuted) [0x00003] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
at System.Threading.Tasks.Task.TrySetException (System.Object exceptionObject) [0x00023] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].SetException (System.Exception exception) [0x00029] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
at System.Net.HttpWebRequest+<RunWithTimeoutWorker>d__241`1[T].MoveNext () [0x000e0] in <3e9b3e26c4694baab3f689687ad40612>:0
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext (System.Object stateMachine) [0x00000] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00024] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction (System.Action action, System.Boolean allowInlining, System.Threading.Tasks.Task& currentTask) [0x00023] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
at System.Threading.Tasks.Task.FinishContinuations () [0x00052] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
at System.Threading.Tasks.Task.FinishStageThree () [0x0003c] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
at System.Threading.Tasks.Task`1[TResult].TrySetResult (TResult result) [0x0004f] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].SetResult (TResult result) [0x0003d] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
at System.Net.ServicePointScheduler+<WaitAsync>d__45.MoveNext () [0x000f7] in <3e9b3e26c4694baab3f689687ad40612>:0
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext (System.Object stateMachine) [0x00000] in <4a8a0
```
On an Android Xamarin installation this causes an app crash. Since no user code is active the exception cannot be caught.
- The purpose of this is to be able to respond to CI incidents faster for instance specific engine versions when JavaScript engines do not update/install correctly.
- This will install from a forked version of the jsvu repo: https://github.com/GoogleChromeLabs/jsvu
- Forked version rests here: https://github.com/kjpou1/jsvu/tree/mono-wasm
- The forked version removes the Node >= 10.0 dependency but brings in the newest 1.4.0 version modifications.
- This should be temporary until we get another solution i.e. a managed version of the engine updater.
* Ensure that the module cctor is run before the entry point is executed
We need to ensure that any module cctor for the 'main' image
is run *before* we invoke the entry point
This is required in order for tools like Costura
(https://github.com/Fody/Costura) to work properly. These tools inject
a module initializer which sets up event handlers (e.g. AssemblyResolve),
which allows the main method to run properly
For more information about module constructors,
see https://blogs.msdn.microsoft.com/junfeng/2005/11/19/module-initializer-a-k-a-module-constructor/
* Fix module-cctor-entrypoint.il
* [interp] avoid multiple transformations
* [interp] remove delegate hack for method_ptr=imethod case
it isn't needed anymore
* [interp] ensure initialized fields of a class retrieved from wrapper data
* [fullaot mixed] add test for specific mixed mode scenario
* [interp] remove assertion, it does not take into account multiple threads transforming the same method
* [interp] avoid non-lazy compilation of delegate if interpreter is involved
* [fullaot-mixed] disable on i386
* [interp] propagate errors on delegate init
* fix c++ build
* [tests] improve return codes
* error only for dynamic methods
* [fullaot-mixed] disable test on coop
* Fix System.Math regressions brought on by PowerPC JIT optimizations
* While frin[.] does do rounding, the semantics are slightly
different enough from the BCL that it subtly breaks, as
seen by some tests. Ceil/Floor/Trunc are fine, however.
Perhaps the sysmath.c version can be translated to asma.
* Fix typo where signed long comparison for isel was using
an unsigned comparison.
Add a test for this in the JIT regression check.
* Link against (not fd.o) libbsd for System.Native on AIX
The way we link the library by default will allow some unresolved
symbols. These will get resolved to the runtime when loaded by it.
However, flock isn't in AIX libc, and the native library needs it.
This doesn't seem to be a problem on AIX, but on i libbsd doesn't
seem to be in the dependency chain, so it errors out when you use
it. The workaround is to link libbsd (not the freedesktop.org one)
into the library. According to dump, it seems it has its own copy
of ioctl and fnctl, but they seem benign according to objdump and
don't seem to affect System and corlib tests I've ran to check it.
* [runtime] Add unmanaged fast-path for mono_class_is_assignable_from
Our managed code has a fast path for this that checks if the two types
are the same. The unmanaged calls here always falls back on the slow path.
This leads to a latency that is pretty observable during
array_set_value_impl calls.
* [runtime] Make faster already-pinned nullable init path
* [runtime] Expose non-handle-allocating object_handle_isinst_mbyref
* [runtime] Use MONO_ENTER_NO_SAFEPOINTS for array_set_value_impl
* [interp] Remove some duplicated code
* [interp] Optimize type checking for interfaces
Mainly to avoiding handles for common scenarios. Makes type checking for common interfaces 10x faster.
* [interp] Optimize type checking for common classes
Mainly to avoiding handles for common scenarios. Makes type checking for common classes 10x faster.
This reverts commit b740313aa5.
We actually want to only run one build per product on a node,
e.g. so that android-debug and android-release can't run on
the same node and stomp on each other's toolchain.
* [System.Net.Http] Move NSUrlSessionHandler from xamarin-macios to mono
This allows us to remove the need for a special custom System.Net.Http.dll
build in the xamarin-macios repository.
Part of #11397
* Bump API snapshot submodule
* [csproj] Update project files
* Removing the InsertVector128 and ExtractVector128 overloads that take an address from S.P.Corelib
* Removing the ExtractStore and InsertLoad tests.
* Fixing the PacketTracer test to use the appropriate Extract/InsertVector128 overloads
* Removing the JIT support for the Extract/InsertVector128 overloads that take an address.
Signed-off-by: dotnet-bot <[email protected]>
* [monodroid] Use CoreFX to fill in reference stubs for System.Drawing types that are currently 'forked' from Mono into Mono.Android.dll
The list of localy implemented System.Drawing types: https://github.com/xamarin/xamarin-android/blob/e0da1f152de84c4cc39983f2fda775ec98c08250/src/Mono.Android/Mono.Android.csproj#L311-L325
* [netstandard] Update for Mono.Android change
* Bump reference assemblies to include Mono.Android update
* Use System.Drawing.Common to find moved types in monodroid case for netstandard facade
* Bump API snapshot submodule
* [csproj] Update project files
a IDispatch class interface. this is being done
to ensure WinForms consumers can interact with
COM based controls.
Signed-off-by: dotnet-bot <[email protected]>
Continuations created while the debugger is attached or certain EventSource events are enabled end up getting wrapped in an extra ContinuationWrapper object that carries some additional information. DumpAsync currently isn't unwrapping these but should. This just teaches it to look for a known field name so that it can "see through" these wrappers while following async "stacks".
Signed-off-by: dotnet-bot <[email protected]>
- Thread.ExecutionContext needs to return ExecutionContext.Capture() to public callers.
- Fix restoring of culture to be inside of the ExecutionContext callback where applicable
Signed-off-by: dotnet-bot <[email protected]>
* Move Thread to shared CoreLib
* Remove all local variables from Thread in shared code
* Remove duplicate checks
* Port back CoreRT changes needed for shared code
* Fix missing culture initialization in ThreadStart()
* Adjust for shared WaitHandle
Signed-off-by: dotnet-bot <[email protected]>
* Cancel sync IO on Windows when aborting thread.
Using CancelIO/CancelIOEx or CancelSynchronousIo on a thread that is moving
into a suspended state can cause these calls to hang (they shouldn’t but
have been observed to be the case). Fix does the cancel of sync IO after
the aborted thread has been resumed, but before releasing suspend locks
making sure thread won't be suspend again until after cancel IO call has
completed.
* Add tests aborting blocking socket and file IO on Windows.
* Fixed the Attach() test which required a free port to attach.
* Added test for incorrect events behavior when VM is started with suspend
* Bump API snapshot submodule
* [ppc] Optimize floating point performance in the JIT sqrt/sqrtf/abs
* [ppc] Integer Min/Max inlining wiht POWER5 isel instruction
Compresses a function call down to two instruction, for both signed
and unsigned, long and int. Needs to check for POWE5 though, and I
don't know the effects of this on ppc32. FP version using fsel is
also desirable, but not in the scope of this commit.
* [ppc] Check for POWER5 compatible CPU before using isel
* [ppc] Don't use long min/max inlining for ppc32
Other 64-bit operations are marked for ppc64 only.
* [ppc] also ifdef that out for ppc32 too
* [ppc] Rounding function optimizations
* [corlib]: Use `Guid.NewGuid()` implementation from CoreFx.
The corefx implementation of `Guid.NewGuid()` uses the internal
`Interop.GetRandomBytes(byte*, int)`, which uses `RNGCryptoServiceProvider`
directly without using `CryptoConfig`.
* [csproj] Update project files
* Rename Guid.MonoTouch.cs -> CommonCrypto/Guid.cs.
* Initial support for Fuchsia
Compile like this:
if you have Zircon installed, with the prebuilts on "../zircon", use this to compile:
CC="`pwd`/../zircon/prebuilt/downloads/clang/bin/clang-9 -nostdlib -O2 -g -fdebug-prefix-map=/cvs/fuchsia/zircon=. -finline -fno-common -ffunction-sections -fdata-sections -no-canonical-prefixes -march=x86-64 -mcx16 --target=x86_64-fuchsia -fPIC -D_ALL_SOURCE=1 -DENABLE_DRIVER_TRACING=1 -fasynchronous-unwind-tables -fno-omit-frame-pointer -std=c11 -I`pwd`/../zircon/build-x64-clang/sysroot/include/ -I`pwd`/../zircon/system/public" LDFLAGS="-L`pwd`/../zircon/build-x64-clang/sysroot/lib/ -L`pwd`/../zircon/build-x64-clang/sysroot/debug" ./configure --host=x86_64-google-fuchsia
* Use HOST_FUCHSIA rather than TARGET_FUCHSIA
We can get the the OS name similar to the architecture from the value that is used by the runtime for DllMaps.
Cached the values into static fields so we only need to do the runtime icall once.
Added all the existing OS names recognized by DllMap to RuntimeInformation.
This also allows us to mark some corlib/System tests that hang the runtime on AIX as non-working.
* Make BitOps public
* Update name to BitOperations
* Change namespace to System.Numerics
* Fix file name
* Alphabetical
Signed-off-by: dotnet-bot <[email protected]>
Current output from console-output test is just Error and Out (indicating)
the different console output streams. When seen in log files the error output
string can be misleading. Fix makes it clearer that the output is originating
from a test and not an “error”.
* Add new internal `CryptoConvert.TryImportCapiPrivateKeyBlob()` method that's using `RSAManaged` directly to make it more linker-friendly.
* Also add new internal `CryptoConvert.TryImportCapiPublicKeyBlob()`.
* Use it in `AssemblyName.IsPublicKeyValid`.
* [runtime] Inflate overridden methods properly during vtable construction when using default interface methods.
* [jit] Handle default interface methods in constrained calls, they need to box if the constrained type is a valuetype which doesn't override the default method.
* [runtime] Update Default Interface Methods tests from coreclr.
* [jit] Fix interp support.
* [nuget-hash-extractor] Make the order for denied lists deterministic and
.. stable. We were not sorting the list of assemblies with the same
version, causing irrelevant changes in updates.
* Update denied assembly list to fix order
.. to be deterministic. Generated with the updated
nuget-hash-extractor.cs .
* [nuget-hash-extractor] Make the order of assemblies deterministic
The .nupkgs were being processed in arbitrary order, causing unncessary
diffs when updating them which required manual work to check and fix
them.
It's very common for an assembly to have only one module, in which case we can avoid unnecessary allocations and copies in Assembly.GetTypes() and Assembly.DefinedTypes.
Signed-off-by: dotnet-bot <[email protected]>
* [ci] Add new mode of execution for nunit tests on Android
This makes it possible to run the `nunit-lite-console.exe` on the host, while the tests still run on the device. This makes it transparent wherever the tests are running, giving us a seamless integration with the existing infrastructure based around nunit.
* [android] Fix System.Net.Http test suite
* [android] Fix System.ServiceModel.Web test suite
* [android] Fix Mono.Security test suite
* fixup! [ci] Add new mode of execution for nunit tests on Android
* [ci] Disable failing tests
* [csproj] Update project files
Compile like this:
if you have Zircon installed, with the prebuilts on "../zircon", use this to compile:
CC="`pwd`/../zircon/prebuilt/downloads/clang/bin/clang-9 -nostdlib -O2 -g -fdebug-prefix-map=/cvs/fuchsia/zircon=. -finline -fno-common -ffunction-sections -fdata-sections -no-canonical-prefixes -march=x86-64 -mcx16 --target=x86_64-fuchsia -fPIC -D_ALL_SOURCE=1 -DENABLE_DRIVER_TRACING=1 -fasynchronous-unwind-tables -fno-omit-frame-pointer -std=c11 -I`pwd`/../zircon/build-x64-clang/sysroot/include/ -I`pwd`/../zircon/system/public" LDFLAGS="-L`pwd`/../zircon/build-x64-clang/sysroot/lib/ -L`pwd`/../zircon/build-x64-clang/sysroot/debug" ./configure --host=x86_64-google-fuchsia
* [interp] Move special case initialisation of frame->ip
* [interp] Properly init locals
When we have locals that need to be initialized.
* [interp] Load the entire enum value
When calling calling method on constrained type for enums with long storage.
* [interp] Avoid clearing the stack with each call
Reducing overhead for each call, this can give an overall performance improvement of 5%.
* Consider unknown GB18030 characters as invalid to enforce use of replacement character instead of throwing SystemException.
* Return negative result for unknown character instead of throwing SystemException in GB18030Source.FromUCS
* Add new internal `CryptoConvert.TryImportCapiPrivateKeyBlob()`
method that's using `RSAManaged` directly to make it more
linker-friendly.
* Use it in `AssemblyName.IsPublicKeyValid`.
* [wasm] Add browser test suite.
- Runs a series of tests against the HttpClientHandler and blob tests.
* Setup custom browser launcher to pass `--no-sandbox` to work on CI
* Remove auto client config that caused async errors on tests.
[aot] abort lookup early when a method isn't available in AOT image
Mixed mode depends on that. Usually, compile_method of mini takes care
to request only existing methods from the AOT image, but in some cases,
e.g. from a trampoline, AOT runtime is quiered directly.
Contributes to https://github.com/xamarin/xamarin-macios/issues/5618
* https://github.com/mono/mono/issues/11643 mkbundle problem - Illegal byte sequence
The size of the mapping is the maximum file offset to map.
See https://docs.microsoft.com/en-us/windows/desktop/Memory/creating-a-file-mapping-object.
When I tried it, I got a different error.
If in the debugger you simulate this fix, it gets further.
Here is a small program to exercise and see the behavior:
```
// include <windows.h>
// include <stdio.h>
// include <stdlib.h>
//
// int main()
// {
// // Create a 128K file.
//
// HANDLE file = CreateFile("1", GENERIC_READ | GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0);
// printf("createfile %p %d\n", file, GetLastError());
//
// HANDLE map = CreateFileMapping(file, 0, PAGE_READWRITE, 0, 1 << 17, 0);
// printf("createmap %p %d\n", map, GetLastError());
//
// CloseHandle(map);
// CloseHandle(file);
// system("dir");
//
// // Attempt to map the second 64K of the 128K file, with a 64K mapping.
//
// file = CreateFile("1", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
// printf("createfile %p %d\n", file, GetLastError());
//
// map = CreateFileMapping(file, 0, PAGE_READWRITE, 0, 1 << 16, 0);
// printf("createmap %p %d\n", map, GetLastError());
//
// // This fails.
//
// PVOID view = MapViewOfFile(map, FILE_MAP_WRITE, 0, 1 << 16, 1 << 16);
// printf("view %p %d\n", view, GetLastError());
//
// CloseHandle(map);
//
// // Use a 128K mapping instead. It works.
//
// map = CreateFileMapping(file, 0, PAGE_READWRITE, 0, 1 << 17, 0);
// printf("createmap %p %d\n", map, GetLastError());
//
// view = MapViewOfFile(map, FILE_MAP_WRITE, 0, 1 << 16, 1 << 16);
// printf("view %p %d\n", view, GetLastError());
// }
```
Here is debugging mono and simulating the fix in the debugger (I did not build or test
the fix):
```
\bin\amd64\cdb C:\Users\jaykrell\Downloads\output\output.exe
0:000> bm kernel*!*createfilemap*
0:000> g
Breakpoint 2 hit
KERNELBASE!CreateFileMappingW:
00007ffd`0a449de0 4883ec48 sub rsp,48h
0:000> dv
hFile = 0x00000000`00000200
lpFileMappingAttributes = 0x00000000`00000000
flProtect = 2
dwMaximumSizeHigh = 0
dwMaximumSizeLow = 0x477000
lpName = 0x00000000`00000000 ""
0:000> bm kern*!*mapviewoffile*
0:000> g
Breakpoint 38 hit
KERNEL32!MapViewOfFileStub:
00007ffd`0b09bfa0 48ff2591c10500 jmp qword ptr [KERNEL32!_imp_MapViewOfFile (00007ffd`0b0f8138)] ds:00007ffd`0b0f8138={KERNELBASE!MapViewOfFile (00007ffd`0a465ad0)}
0:000> dv
hFileMappingObject = 0x00000000`00000204
dwDesiredAccess = 4
dwFileOffsetHigh = 0
dwFileOffsetLow = 0x30000
dwNumberOfBytesToMap = 0x477000
0:000> gu
0:000> r rax
rax=0000000000000000
0:000> !gle
LastErrorValue: (Win32) 0x5 (5) - Access is denied.
LastStatusValue: (NTSTATUS) 0xc000001f - {Invalid Mapping} An attempt was made to create a view for a section which is bigger than the section.
0:000> .restart
0:000> bm kernel*!*createfilemap*
0:000> g
0:000> dv
hFile = 0x00000000`00000220
lpFileMappingAttributes = 0x00000000`00000000
flProtect = 2
dwMaximumSizeHigh = 0
dwMaximumSizeLow = 0x477000
lpName = 0x00000000`00000000 ""
0:000> ?? dwMaximumSizeLow += 0x30000
unsigned long 0x4a7000
0:000> bc *
0:000> g
Corlib not in sync with this runtime: The runtime did not find the mscorlib.dll it expected. Expected interface version CA4932AE-2294-4ECD-B863-BF98FDD84F33 but found 0CC970F6-6F25-4218-9427-3E4C3DC8DE33. Check that your runtime and class libraries are matching.
Loaded from: mscorlib.dll
Download a newer corlib or a newer runtime at http://www.mono-project.com/download.
```
* Restore useful part of comment.
* Restore dead code.
* Add to comment the other possibility that is being countered.
* Additional explanation.
* Fix multiple issues with --response file option on Windows.
* If file is UTF8 encoded and include BOM mark, implementation failed to
detect and remove BOM mark causing errors. Fix check for BOM mark and if
found, remove it before passed to parsing. NOTE, current implementation
only supports UTF8 (and ASCII) content in response file and won't detect
or handle any other codepages.
* Since the content in --response file should mimic what should have been
passed on command line, we should apply same parsing rules on Windows as done
by the shell when running the arguments on the command line. Current
implementation uses its own parsing that is not the same as used by the Windows
shell, meaning that arguments can't be identical in response file compared to
what's passed on command line. This commit fix parsing of the command
line in the response file so its first parsed by the shell before added
to internal argc, argv parameters (similar as done when passed to main function).
* Add support to handle new lines in response file on Windows.
[aot] Resolve profile against compiled assembly
When trying to use AOT profile in XA for assembly AOT compilation, the
methods from the profile were not compiled.
Context: https://github.com/xamarin/xamarin-android/issues/2504
The problem was, the profile data were not resolved, as there was no
assembly loaded in the domain.
With this fix, the compiled assembly is used to resolve the profile as
well.
* [wasm] Update to emscripten 1.38.28.
The emscripten patch is no longer needed.
* [wasm] Disable optimizations in SHA1Transform (), the normal version seems to cause stack overflows in binaryen's asm2wasm tool.
* Make System.Runtime.CompilerServices.Unsafe inbox
Fix a couple places where we wanted to use it from other inbox assemblies but couldn't.
Unsafe remains as a package and newer versions of Unsafe will replace the inbox Version,
permitting us to add API over time.
* Update Rune tests to use TryEncodeToUtf8Bytes directly
* Add temporary suppression to package tests
Signed-off-by: dotnet-bot <[email protected]>
* Change Environment.Version to return product version
- Contributes to https://github.com/dotnet/corefx/issues/31099
- Use AssemblyInformationalVersion attribute as fallback
* Add sanity test for Environment.Version
* Disable CodeDom tests
* Fix test assembly name
Signed-off-by: dotnet-bot <[email protected]>
- Previous test with 100 micro second timeout would fail on iOS device when running **all the socket tests** about 3 times out of 5.
- With a 1 millisecond timeout, it didn't fail the 10 times I tried locally, hopefully this is enough to fix the flakiness.
- Fixes#8360: [System.Net.Sockets] flakey failures of SocketTest.TestSelect1 on Darwin systems
(https://github.com/mono/mono/issues/8360)
- Also partial fix for maccore issue https://github.com/xamarin/maccore/issues/1069
```
@/external/bockbuild/builds/fsharp-fsharp-6624925/src/scripts/fssrgen.fsx(334,28): error FS0041: A unique overload for method 'GetFileNameWithoutExtension' could not be determined based on type information prior to this program point.
A type annotation may be needed. Candidates: System.IO.Path.GetFileNameWithoutExtension(path: System.ReadOnlySpan<char>) : System.ReadOnlySpan<char>, System.IO.Path.GetFileNameWithoutExtension(path: string) : string
[@/external/bockbuild/builds/fsharp-fsharp-6624925/src/fsharp/FSharp.Build-proto/FSharp.Build-proto.fsproj]
```
We need the recently introduced "unbox arbitrary" trampolines in one more
scenario: non-mscorlib AOT code calls a method from mscorlib with
interpreter. Before we just relied on the amodule not being available,
but mscorlib amodule is always present due to wrappers, trampolines,
etc.
* [wasm] [debugger] Add test suite.
* [wasm] [debugger] Add test suite.
* [wasm] [debugger] Add test suite.
* Changing what Larry suggested and removing some -debug that is not used.
* Adding the DebuggingTestSuite.
* indentation
* Update run-jenkins.sh
We need the recently introduced "unbox arbitrary" trampolines in one more
scenario: non-mscorlib AOT code calls a method from mscorlib with
interpreter. Before we just relied on the amodule not being available,
but mscorlib amodule is always present due to wrappers, trampolines,
etc.
It's possible to pass any string as an argument to DriveInfo ctor (e.g. `new DriveInfo(Path.GetTempPath())`). Mono throws ArgumentException if there is no exactly the same drive name in the list of available drives.
I tried to handle this case by extracting any valid drive name from the array of available drives sorted by path in descending order.
Fixes https://github.com/mono/mono/issues/12157
* Add server-side Server-Name-Indication (SNI) support (both AppleTls and BTLS).
* Support the new `SslServerAuthenticationOptions.ServerCertificateSelectionCallback`.
* Server certificate selection is now compatible with CoreFx behavior; first
checking the new `ServerCertSelectionDelegate` then `LocalCertSelectionCallback`
and finally using an explicitly provided certificate.
* Misc exception checks and fixes to make behavior consistent with CoreFx;
any exception thrown by reading / writing the underlying stream will now be
propagated verbatim (and not wrapped in an `AuthenticationException`);
exceptions thrown by the handshake / TLS stack itself will still be wrapped.
* Added `System.Net.Security` xUnit tests from CoreFx.
* Misc test cleanups; moved certificate test files from `System.Net.Http` into
`System` and embed them in the test assembly as resources, adjusting
`test-helpers/Configuration.Certificates.cs` accordingly.
* Removing various S.R.I.Vector instance method APIs, since they should now be exposed as extension methods
* Updating the JIT to recognize the S.R.I.Vector extension methods.
* Updating various S.R.I.Vector test templates
* Regenerating the S.R.I tests that are created from a template.
* Fixing the numArgs for Base_Vector256_GetLower
* Fixing the handling for `Base_VectorXXX_As` to normalize the struct type.
* Adding the Base_Vector128_As intrinsics back for arm64
Signed-off-by: dotnet-bot <[email protected]>
[loader] Fix off by 1 (netstandard is a framework facade)
Before 5e0d39a8a1, there used to be a handwritten binary search that traveersed `framework_assemblies` to determine if a given assembly was a framework assembly or not. The binary search used `last = G_N_ELEMENTS (framework_assemblies) - 1` as the initial condition, but it used an inclusive `first <= last` as the loop count.
After we switched to a hashtable, we used the same final value initialize `assembly_remapping_table`.
We didn't notice because `mscorlib` used to be the last assembly in the table and `mscorlib` already has a ton of special handling in the loader. But `netstandard` is not special. So we added it to the table, but it still doesn't get special handling.
This should fix instances where code references netstandard 2.0.0.0, but we give it netstandard 2.1.0.0
https://github.com/mono/mono/blob/f8094319132d2d40f37e8cac6058e783b5648260/mono/metadata/assembly.c#L345
* Fix for runtime mcs-compileall test on Windows x64 full AOT.
Test picked up full AOT:ed libraries as well as managed libraries failing
the test. Full AOT:ed shared libraries on Windows has .dll.dll prefix and
full AOT:ed executables on Windows has .exe.dll prefix.
Fix makes sure to filter out any files ending with dll.dll or exe.dll.
* Fix build errors in System.Web.Services test under winaot profile.
* Fix errors in System.Core test under winaot profile.
* Fix build error in linker tests on Windows under winaot profile.
Build fails since profile build mscorlib is used as well as default
triggering build error. Fix is to build linker tests using -nostdlib flag.
Should not be part of the package and cause issues on Windows 32-bit
cygwin build since it's not using makefile generated by autotools. When
make install is run it will build jay one more time, but picking up
cygwin default gcc compiler instead of the one used in configure step, mingw.
That cause link errors since the object files are not rebuild, only relinked
with different linker, causing errors.
Apple's make doesn't support the --output-sync option and Homebrew's make is installed as gmake.
Also fixed a few places in the repo where we directly invoked make instead of $(MAKE).
* Fix race condition in ManualResetValueTaskSourceCore
ManualResetValueTaskSourceCore.GetStatus is used from ValueTaskAwaiter.IsCompleted. If GetStatus returns Success too early, then IsCompleted will also return true too early, which will result in GetResult being called too early. This doesn't happen today when an MRVTSC is used sequentially. But if an instance is pooled by the object its stored on getting put back into a pool as part of a call to the wrapper's GetResult, then we can end up in the following situation:
- Thread 1 starts an await on an instance containing an MRVTSC. It calls IsCompleted.
- Thread 2 starts to complete that instance, getting as far as calling SignalCompletion and setting _completed to true but not yet setting _continuation.
- Thread 1 sees _completed == true and returns true from IsCompleted. It calls GetResult, and the wrapper extracts the result from the instance, resets it, and puts it back into the pool.
- Thread 3 takes the object out of the pool and starts using it.
- Thread 2 continues SignalCompletion on that instance, and sets _continuation to the sentinel.
- Now Thread 3's instance's _continuation is the sentinel when it should be null. If it calls SignalCompletion, it'll erroneously find that _continuation is not null and will queue _continuation/_continuationState for execution, resulting in the sentinel getting executed. If it calls OnCompleted, it'll find that the _continuation is not null, and will queue the supplied continuation/state to execute immediately even though the operation may not yet actually be done.
The fix is simply to check not just _completed but also _continuation. The operation is considered pending if either _completed is false, meaning SignalCompletion has not yet been called, or if _continuation is still null, meaning it's neither been set to the supplied delegate nor to the sentinel. We can't just rely on _completed for the above outlined reasons, and we can't just rely on _continuation because it can be non-null if OnCompleted was called to hook up a callback (if we only cared about the await pattern, then we could just check _continuation and wouldn't need _completed, but we also need to support non-await access).
* Address PR feedback
Signed-off-by: dotnet-bot <[email protected]>
The `mono_profiler_printf` already adds `\n` char, so we don't need to
add them in most cases.
Before the fix the output of aot profiler with verbose enabled looked
like:
02-19 10:50:02.877 22795 22815 I mono-prof: System.OutOfMemoryException:.ctor (string) 2
02-19 10:50:02.877 22795 22815 I mono-prof:
02-19 10:50:02.877 22795 22815 I mono-prof: System.SystemException:.ctor (string) 4
02-19 10:50:02.877 22795 22815 I mono-prof:
02-19 10:50:02.877 22795 22815 I mono-prof: System.Exception:.ctor (string) 6
02-19 10:50:02.877 22795 22815 I mono-prof:
02-19 10:50:02.877 22795 22815 I mono-prof: System.Exception:.cctor () 7
02-19 10:50:02.877 22795 22815 I mono-prof:
...
The `usage ()`'s output should now look similar to other profilers
usage output.
SemaphoreSlim.Release shouldn't invoke arbitrary continuations as part of its invocation, so when it dequeues a task waiter and goes to complete it, rather than just calling TrySetResult, it queues the task to the thread pool to have TrySetResult invoked there. Now that we have RunContinuationsAsynchronously, though, we can just use that functionality instead. This has two main benefits:
1. We avoid queueing a work item entirely if there are no continuations from the task. This might happen, for example, if the semaphore is released so quickly after waiting on it that the WaitAsync caller hasn't yet hooked up a continuation, in which case the await on the WaitAsync task will just see IsCompleted as true and continue running.
2. We avoid queueing a work item when the task represents a synchronous Wait, which happens if there's already a pending WaitAsync when Wait goes to block. The main benefit here is avoiding potential thread pool starvation, if threads in the pool are blocked in such Waits, and previously another thread pool thread would have been needed to run the queued work item to complete the synchronous Wait.
Signed-off-by: dotnet-bot <[email protected]>
* [interp] Extract some duplicated code
* [interp] Kill stinarg opcodes
Before we were reallocating the arguments in the current frame and had a stinarg opcode for copying each argument there. Access the arguments directly from the parent frame, to reduce call overhead. This can give up to 5-10% general speedup.
The leading `.` in the script invocation causes the tests to fail on multiple platforms by causing the required argument to not be passed correctly resulting in bad output. Removal of the leading `.` ensures correct operation on all platforms.
Correct access permissions for run-msbuild.sh. Adding "user execute" seems to fix the following build error. With this change I'm able to build on windows in Cygwin. without, I see the below error:
```
$ make -j4
(CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /cygdrive/c/mono/mono/missing autoheader)
rm -f stamp-h1
touch config.h.in
cd . && /bin/sh ./config.status config.h
config.status: creating config.h
config.status: config.h is unchanged
Git submodules updated successfully
make all-recursive
make[1]: Entering directory '/cygdrive/c/mono/mono'
Making all in msvc
make[2]: Entering directory '/cygdrive/c/mono/mono/msvc'
Building Mono runtime using Visual Studio.
../msvc/run-msbuild.sh "build" "i686"
**/bin/sh: ../msvc/run-msbuild.sh: Permission denied**
make[2]: *** [Makefile:614: all-local] Error 126
make[2]: Leaving directory '/cygdrive/c/mono/mono/msvc'
make[1]: *** [Makefile:583: all-recursive] Error 1
make[1]: Leaving directory '/cygdrive/c/mono/mono'
make: *** [Makefile:513: all] Error 2
```
* [netcore] Switch to Debugger class from corlib.
* [netcore] Implement exception stack trace support.
* Address review comments.
* [netcore] Create a netcore specific version of Exception based on the refsource version.
* [interp] Fix unaligned access crashes on arm
strd instruction fails if the memory address is not word aligned.
Fixes corlib-xunit suite on arm.
* [interp] Fix warning
This makes us consistent with corefx; see also
https://github.com/dotnet/corefx/pull/35306.
Using `X509Certificate` has become a problem because the
`HttpClientHandler.ServerCertificateCustomValidationCallback`
callback takes an `X509Certificate2` parameter.
* [tests] Add the BitcodeNotSupported category to tests exercising non-bitcode-compatible API.
We have APIs that use exception filter clauses, and we don't support that when
compiling to bitcode.
So mark any tests exercising such API accordingly, so that we can skip those
tests when running tests on targets that use bitcode (watchOS).
* [tests] Use BitcodeNotSupported on applying profiles
consider
```csharp
struct S3
{
public ushort X;
public ushort Y;
public ushort Z;
}
```
this would be 3 * 2 = 6 bytes. Structs, however, are passed around as i32
arrays in LLVM IR between functions. Those, if such a struct is passed, are
split to int32 depending on the struct's size. The previous calulation was
wrongly reserving one such i32 slot instead of two for `S3` above.
Additionally increase slot size to i64 so that it aligns with a
slightly different ABI on arm64_32.
* [crash] Add more detailed reporting for exceptions
This bumps the crash reporting file format to version 0.0.3.
* [crash] Fix exception stack walker to consider captured_traces
Previously we were missing these frames from the captured_traces fields
of MonoException and MonoStackTrace.
* Move SafeHandle to managed code and shared
This moves the implementation of SafeHandle from native code in the runtime to managed. I used corert's implementation as a base, and reviewed it again against the existing native implementation, making a few tweaks to better match the existing semantics.
This should be a valid move because of the reduced goals around CERs, thread aborts, etc.
However, there are places in the runtime that access SafeHandle functionality via its native counterpart, so I kept the relevant pieces of the native code intact. Most code will continue to use the managed APIs, but the runtime can continue calling into the native versions when needed.
* Address PR feedback
* Address PR feedback
Signed-off-by: dotnet-bot <[email protected]>
- Conditional include of bindings depending on if --nobindings is specified.
- Packager: AOT ninja build modifications.
- Add corebindings build dependency
- Add bindings_support.j build dependency
- Remove dependency to add Bindings initialisation to build and mono_config.js
- Modify runtime.js and runtime-tests.js to remove the bindings initialisation code.
* Index and Range updates
* Address @mikedn feedback
* Address Feedback
* more feedback
* Use Deconstruct in Range.GetOffsetAndLength
* Rename GetArrayRange to GetSubArray
* Temporary disable the old Corefx Range tests
* Return back the TimeSpan test disabling
* Fix Range jit test
* Exclude the jit test
* revert the changes in the jit Range test
* Address Suggested Feedback
Signed-off-by: dotnet-bot <[email protected]>
* Move GCHandle to shared
* Cache the handle in a local to make it easier for JIT to generate good code
* Rename m_handle to _handle to match the coding conventions
* Delete isPinned argument for GCHandleInternalCompareExchange
* Add fast path to GCHandle.Alloc/Free FCalls
* Disable outdated test
Signed-off-by: dotnet-bot <[email protected]>
* Renaming RuntimeEventSource to NativeRuntimeEventSource
* missed a couple of comments and XPlatEventLogger
* rename DotNETRuntimeEventSource.cs to NativeRuntimeEventSource.cs
* use condition= instead of ifdef
* removing ifdef from NativeRuntimeEventSource.cs
* Fix case for 'eventing' directory in csproj
* Fix unix builds
* This should fix unix build...
Signed-off-by: dotnet-bot <[email protected]>
* Moving several of the Vector128<T> instance methods to be extension methods.
* Moving several of the Vector256<T> instance methods to be extension methods.
* Moving several of the Vector64<T> instance methods to be extension methods.
Signed-off-by: dotnet-bot <[email protected]>
* [debugger] Reverting part of this commit https://github.com/mono/mono/pull/12114, removing this part the test ShouldCorrectlyStepOverOnExitFromArgsAfterStepInMethodParameter continues working and solve the regressions of 12881.
Inserted a new test that reproduces the regression.
Fixes#12881
Remove the hack that injected an extra line with the source
location now that we reference local sources when we can and
fix the Match logic so that it corrects for the difference
between pdbs and chrome breakpoints
Unknown schemes (dotnet:) are not well supported by all the
tools that support the chrome DevTools protocol so if the
file exists locally use a file: url rather than a dotnet:
url to reference it.
* add new rounding modes to MidpointRounding.cs
new modes added to enum
implemented ToZero for double in Math.cs
* ToZero implementation
* implement double and float rounding modes
* updating rounding implementation
now round inline with DecCalc internal round implementation
* small bug fix
also replace var to make things obvious
* update implementation - floor/ceil
code review feedback
* review feedback
add comments, update MathF with floor/ceil
* code review feedback
- fix comments
- replace ifelse with switch
- remove RoundingMode enum from DecCalc
* exclude outdated corefx test
Signed-off-by: dotnet-bot <[email protected]>
* Add new String overloads
* Remove some overloads with non-primitive types
* Remove IndexOf overloads with more than 1 argument
* Remove Trim() from TrimTranslator because CanonicalFunctionDefaultTranslator already supports it.
* Trim/TrimStart/TrimEnd: remove Char parameter overloads; add condition to support parameterless overloads.
* Remove unsupported Char overloads of Contains, IndexOf, StartWith and EndWith methods
* Move all icalls to RuntimeModule.
* Make all icalls static and receive the module as an IntPtr.
* Remove some duplicate code between the RuntimeModule and ModuleBuilder classes.
* Make Module partial to allow additional changed for Mono
Signed-off-by: dotnet-bot <[email protected]>
* Move ConditionalWeakTable to shared (dotnet/coreclr#22531)
Leaves DependentHandle as being the runtime PAL
Signed-off-by: dotnet-bot <[email protected]>
Much of the tooling around DevTools expects
actions under /json to return useful data
this adds adds some simple logic to proxy those
so that you can point tooling directly at the
proxied port and get responses you expect
* Move Volatile to shared
This largely takes corert's implementation, which uses Unsafe.As and volatile fields.
We could investigate also removing the JIT's replacements subsequently.
* Add [Intrinsic] attributes
Signed-off-by: dotnet-bot <[email protected]>
* [marshal] Add emit_exception_for_error callback
* [runtime] MonoError-ize mono_lookup_pinvoke_call_internal
Two complications:
1. Marshalling needs to turn a MonoError into MethodBuilder instructions to
emit an exception.
2. The public API uses two string to signal an error. So we have to use
a custom status struct to return the error code.
* [loader] Factor out library path transformations
* [marshal] Copy error msg in mono_mb_emit_exception_for_error
Add new mono_mb_stdrup to make a copy of a given string into the memory that
will live with the MethodBuilder's method.
* [interp] Callvirt of an icall should call the wrapper.
See pinvoke2.cs test_0_missing_virtual_pinvoke_method ()
You can have an icall override a virtual method:
public class T2 : T {
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public override extern object MyClone ();
}
When the interpret saw this, it was setting up a child frame with the frame
method being the MonoMethod of the icall itself, not the wrapper. But it was
executing the wrapper. As a result if the wrapper body had a LDSTR in it, we
would hit the assertion in the MINT_LDSTR_TOKEN case where
frame->imethod->method->wrapper_type == MONO_WRAPPER_NONE is not allowed.
With this change the frame method is now the wrapper which has a correct
wrapper type.
* [loader] remove pinvoke_probe_transform_path do{}while(0) construct
take the line damage; make the code easier to understand.
mono_string_utf16_to_builder_copy incorrectly uses MONO_HANDLE_SETRAW to
update the chunkLength field with a string length. Since MONO_HANDLE_SETRAW
assumes the argument is a MonoObject reference this could lead to a dereference
and since the value is a string length, that dereference will lead to a crash.
The problem happens in mono_gc_wbarrier_set_arrayref_internal where vtable
is retrieved from value. The crash happens randomly since it is depending
on the object being moved out of the nursery + sgen_binary_protocol_wbarrier
not being eliminated.
Fix is to use MONO_HANDLE_SETVAL since the value is not a reference so no need
to trigger a write barrier.
Current codegen incorrectly read back last error when doing p/invoke for
full AOT. This caused many failed corlib tests ~600. It also
turns out that the test for set/get last error related to p/invoke that we
have in pinvoke2.exe, is not run for the full AOT profile, due to other tests
depending on none full AOT features. In order to make sure we run the test
and not regress, test has been moved into its own runtime tests, running as
part of full AOT testing.
When using the previous test, some memory unsafety was
observed. It's rather unrecoverable memory unsafety, as
it corrupts heap memory used by the sequence points, registered MERP
paths, jit info internals, and output string.
Crashes seen here: https://github.com/mono/mono/pull/12387 reproduce
with less than 100 iterations of this malloc test run as the stress
test.
```
(MonoJitInfoTable) $2 = {
domain = 0x5050505050505050
num_chunks = 1347440720
num_valid = 1347440720
chunks = {}
}
```
with
```
(lldb) p/x 1347440720
(int) $0 = 0x50505050
```
And sometimes the mono crash
```
(lldb) p *it
(SeqPointIterator) $3 = {
seq_point = (il_offset = 0, native_offset = 0, flags = 0, next_offset = 0, next_len = 0)
ptr = 0x5050505050505050 <no value available>
begin = 0x5050505050505050 <no value available>
end = 0x5050505050505064 <no value available>
has_debug_data = 0
}
```
===
These do not reproduce when doing a double free of legally allocated
memory.
I think that the crash reporting tests aren't the place to check if the
OS allows for wild heap corruption when doing these things. I don't
think it's currently in scope for the runtime to do crash reporting
after it's internal metadata tables have been corrupted. They're the
source of truth for symbolication. We don't have many options to
validate and reparse them, unless we want to make this all very
heavyweight.
* Move Array's SZGenericArrayEnumerator to shared partition
* Remove legacy comment
* Move all array enumerators to a new file
Signed-off-by: dotnet-bot <[email protected]>
On armv7 our calling convention happens to be the same as the platform
one. However, when using a armv7 cross compiler to generate bitcode that
targets a different platform (e.g. arm64_32) the calling convention can
be different (e.g. on arm64_32, a return buffer must be passed via r8).
Thus, mark it properly for LLVM so it can generate correct code.
Fixes this app startup issue
```
dyld: Library not loaded: /Users/lewurm/work/mono-watch4-ios-sdk/sdks/out/ios-target64-release/lib/libmono-native-unified.0.dylib
Referenced from: /var/containers/Bundle/Application/9697C8F3-811C-4BF3-B1BC-1E6385673984/PublicStaging.app/test-Mono.Runtime.Tests
Reason: image not found
Process 2269 exited with status = 0 (0x00000000) Terminated due to signal 6
```
* [interp] Avoid using MINT_CKNULL
Unnecessary overhead for this tiny instruction.
* [interp] Do null check for this before inlining
Otherwise we miss it.
* [interp] Add method to seq_points table after we finish registering it
When adding a breakpoint (mono_de_set_breakpoint) we search in this table for seq_point information for the method. If we find the information we expect that the method is already compiled and has the metadata initialized when actually adding the breakpoint (set_bp_in_method). We were crashing if the jinfo field of the interp method was not yet initialized.
Fixes https://github.com/xamarin/xamarin-macios/issues/5381
* [interp] Move profiler callback when we are actually done
Just in case.
* [corlib] Move the implementations of virtual methods from Assembly to RuntimeAssembly to ease netcore integration.
* [corlib] Move more code to RuntimeAssembly.
* [corlib] Move fields from Assembly to RuntimeAssembly/AssemblyBuilder.cs. Reduce the amount of fields visible to runtime code.
* Update serialization tests.
* Fix the MOBILE build.
* Bump API snapshot submodule
On armv7 our calling convention happens to be the same as the platform
one. However, when using a armv7 cross compiler to generate bitcode that
targets a different platform (e.g. arm64_32) the calling convention can
be different (e.g. on arm64_32, a return buffer must be passed via r8).
Thus, mark it properly for LLVM so it can generate correct code.
Normally strings are encoded as length-then-utf8 in ECMA-335. But a null
String is encoded as just the byte 0xFF.
When we make a CustomAttributeBuilder for a MarshalAsAttribute and attach it to
some parameter we first encode the CAB as a byte blob and then decode it in
CAB.get_umarshal into a UnmanagedMarshal attribute. But the decoding didn't
account for the possibility of null strings.
Fixes https://github.com/mono/mono/issues/12747
* Index and Range updates
* Address @mikedn feedback
* Address Feedback
* more feedback
* Use Deconstruct in Range.GetOffsetAndLength
* Rename GetArrayRange to GetSubArray
* Temporary disable the old Corefx Range tests
* Return back the TimeSpan test disabling
* Fix Range jit test
* Exclude the jit test
* revert the changes in the jit Range test
* Address Suggested Feedback
Signed-off-by: dotnet-bot <[email protected]>
This fixes a regression introduced by https://github.com/mono/mono/commit/5187b0bdaaff56936d697b0753dad51e7498991d
The AOT compiler wasn't aware of the icalls since they are guarded by `ENABLE_MONOTOUCH`. Passing `--enable-monotouch` to configure of the AOT compiler enables that define, so it can properly resolve those icalls. However, to avoid `zlib` dependency for the cross compilers, we stub
them out.
The 2018-10 lane seemed to be failing some tests because the merp-json-valid.exe test left behind the crash log file. I fixed that in this PR, but also move the tests into their separate folders so they can run at the same time safely.
* Fixing Utf8Formatter.Float to support all the same format specifiers as the utf16 formatter.
* Disabling some outdated CoreFX tests.
* Fixing TryFormatFloatingPoint to special-case format.IsDefault
Signed-off-by: dotnet-bot <[email protected]>
* [runtime] Mark mono_lookup_pinvoke_call external only
Runtime should use mono_lookup_pinvoke_call_internal
* [loader] Factor out helper functions from mono_lookup_pinvoke_call
Separate the logic for probing for a dynamic library module from the logic for
looking for a symbol inside the module.
* [loader] Factor out relative directory probing in pinvoke lookup
* An attribute with a content that was a string null was creating two items in result json and it was throwing an exception in client side because it is expected a name and a value and not a name and two values.
The managed linker removes the type embedded inside mscorlib and we don't want to whitelist it in linker xml since then it'd be kept for everyone.
Instead move the type to the test assembly and remove the reflection-based tests.
We were only doing the -mmacosx-min-version replacement magic on
CFLAGS and LDFLAGS for mono-native-compat and -unified,
but we need to do the same for CPPFLAGS/CXXFLAGS too.
Fixes an issue where the libraries were targeting the wrong minimum OSX
version when built from xamarin-macios since they pass the minimum version
in CPPFLAGS instead of CFLAGS for OSX.
* [metadata] Decouple dynamic method signature from its delegate invoke wrapper
The invoke wrapper should not be referencing the signature because it will be freed once with the dynamic method. The wrapper can outlive the dynamic method, it is cached based on the signature.
Fixes crash on old IronJS benchmark with interpreter (which uses a lot of delegate wrappers, compared to jit)
* [interp] Add debug method for printing transformed code
Resolves https://github.com/mono/mono/issues/11431
I put the native impl to Mono.Native, but probably it should be in a separate lib (`libmono-native.0.dylib` before: **81kb**, after: **898kb**) if Linker is not able to trim it if it's not used.
Compiles and works on Windows (however, we don't build Mono.Native for Windows, but we can borrow `clrcompression.dll` from .net core) and macOS but requires changes in mono/corefx,
I disabled xunit tests as those need 50mb of test data.
PS: Brotli could be fully managed 😢https://github.com/dotnet/corefxlab/issues/1673
C# ports:
- https://github.com/master131/BrotliSharpLib
A quick benchmark (Compressing a 5mb file with max compression level=11)
Mono JIT: 25sec
Mono LLVM-AOT: 7.8sec
.NET Core 2.2: 6.8sec
.NET Core 3.0: 5.8sec
.NET Core's BrotliStream (with native lib): 3.5sec
- https://github.com/google/brotli/tree/master/csharp - official C# port. Based on Java sources, slow, outdated (2 years ago).
Due to current order, process togglerefs and then take current threads
stack could cause a problem where toogleref references might be left
in registers after native code process the list and those reference
would then be put into current thread context, incorrectly pinning the
toggleref, preventing it from being GC:ed. The problem was observed on
Windows (in debug build) running sgen-toggleref.exe runtime test since
the native compile of sgen_process_togglerefs used a register when
walking the list of togglerefs that was then not re-used until the
current threads stack was taken, causing incorrect pinning. This problem
could in theory happen on any platform depending on how sgen_process_togglerefs
would been compiled and what register will be used.
Fix is to take current threads context before walking the togglerefs to make
sure we are not getting managed references into registers as part of managing
the toggleref list in native code.
Combination of Windows x64 ABI and the lack of not checking for fault handlers
in OP_START_HANDLER cause a hard to track stack corruption when combined with
tail calls. Fix is to make sure we also handle fault regions in handlers to
handle cases like the one exposed by catchfault_tail.exe test.
When running tests on CI the runtime is configured from autogen.sh script.
When running fullaot there are a couple of features not supported so they are
disabled. The problem is that the MSVC Windows builds have its own winconfig.h
template, losing all the disabled features from configures config.h.
This commit adds support to detect the disable defines from configures config.h
if one exists. Since the complexity of this step increases the work previously
done in winsetup.bat has been moved into a msbuild target that is used from
both within VS build as well as winsetup.bat (there are a couple of other builds
using that bat file, so won't remove it).
The winconfig.h template we had is quite outdated compared to what’s generated
by configure. This commit also updates the winconfig.h to closer match what generated
for corresponding mingw build but keep all the Windows specific configurations
included in current version.
* [runtime] Switch to GC Unsafe in mono_property_get_value
It's external only, so it should switch from GC Safe to GC Unsafe when called.
Addresses crash in https://github.com/mono/mono/issues/12724
* [runtime] Make mono_image_loaded external only
Also mono_image_loaded_full
Runtime should use mono_image_loaded_internal
* [runtime] Make mono_get_exception_argument_null external only
Without this patch, Mono crashes while writing AOT profiling data at
shutdown (when instructed to do so via --profile=aot:output=out.aotprof)
if any of the sampled methods belong to a dynamic image, which doesn't
have a GUID.
This happens with e.g. the DynamicProxyGenAssembly2 image:
> DynamicProxyGenAssembly2 is a temporary assembly built by mocking
> systems that use CastleProxy like Moq or NSubsitute. It is generated
> when the mock is needed and disposed of after the tests are finished.
(cf. https://stackoverflow.com/a/17179923)
* Remove code that was already moved from System.Private.CoreLib.Native to System.Native.
* Move Interop files for System.Native to shared Interop directory.
* Add FeaturePortableThreadPool conditions to csproj files.
Signed-off-by: dotnet-bot <[email protected]>
LoadFile lost assembly load-context. If the logger assembly has any dependencies placed in same folder logger can't load it. Main.cs using LoadFrom to load assembly but assembly already loaded in the cache after GetLoggerTypeName.
When awaiting a task, there's a race between seeing whether the task has completed (in which case we just continue running synchronously), finding the task hasn't completed (in which case we hook up a continuation), and then by the time we try to hook up the continuation finding the task has already completed. In that final case, we don't want to just execute the callback synchronously, as we risk a stack dive, so we queue it. That queueing currently entails two allocations in the common case: one for the work item object, and one for the Action delegate we force into existence for the state machine box's MoveNext method (in the common case it's now never allocated because you only await Tasks and ValueTasks known to the runtime, which bypasses its creation). We can instead just queue the box itself, and avoid both allocations.
Signed-off-by: dotnet-bot <[email protected]>
It used to be that the CS0420 warning ("a reference to a volatile field will not be treated as volatile") would fire when a volatile was used with an Interlocked.* operation. That warning was unnecessary, as Interlocked.* would itself provide the relevant barriers, and these functions were special cased in Roslyn a long time ago. But there are still lots of places where pragmas disabling the warning have stuck around. I'm deleting them all.
Signed-off-by: dotnet-bot <[email protected]>
The solution from https://github.com/mono/mono/pull/12725 doesn't fully work
since e.g. gacutil seems to verify the strong name.
Instead follow what we do for other keys where we don't have the private key:
add them to the machine.config pubTokenMapping list.
* Updating Number.Formatting to always compute a round-trippable number by default.
* Adding a third-party notice entry for the Grisu3 reference implementation
* Fixing up the Grisu3 algorithm to better match the reference implementation (including comments, etc)
* Porting the Grisu3 implementation that generates the shortest roundtrippable sequence.
* Updating the Dragon4 algorithm to support printing the shortest roundtrippable string.
* Fixing the double/float formatters to ignore precision specifiers for 'R'
* Fixing the double/float formatters to handle +0.0 and -0.0
* Fix the casing of `point` in THIRD-PARTY-NOTICES
Co-Authored-By: tannergooding <[email protected]>
* Fixing the double/float formatting code to consider a precision specifier of 0 to be the same as default.
* Fixing the double/float formatter so that nMaxDigits is set appropriately.
* Changing the double/float formatting logic to account for the format when determining the correct precision to request.
* Updating the double/float formatter to take the format specifier into account when determining the number of digits to request.
* Fixing the double/float formatting code to continue handling zero correctly.
* Disabling some outdated CoreFX tests.
* Responding to various feedback from the PR
Signed-off-by: dotnet-bot <[email protected]>
* [bcl] Fix assembly identity of nunit/nunitlite
The new strong name key added in https://github.com/mono/mono/commit/acaa73b7026897f7e83a101a9bc331476b5ed169
changed the assembly identity which we can't do for shipping libraries.
Given that the old .snk is invalid (see https://github.com/dotnet/roslyn/issues/32502),
we just sign with the extracted public key and /publicsign.
For MCS_MODE builds we instead use the mono.snk since mcs doesn't support /publicsign
and we don't really care about having the correct identity there.
* [csproj] Update project files
Add support for building Windows x64 fullaot version of winaot profile
that can be run on CI. Initial changes also add execution of mini regression
tests on CI. More tests will be added going forward and when having full
pass rate.
Add support for building Windows x64 fullaot+llvm version of winaot profile
that can be run on CI. Initial changes also add execution of mini regression
tests on CI. More tests will be added going forward and when having full
pass rate.
In order to get deterministic build results and working build on CI, we need
to setup a correct build environment for the MSVC builds. Since MSVC build is
currently run from cygwin, there are environment problems, both general
but also in our CI environment, since we add cygwin bin folder to system path
(needed by Jenkins plugin). When running more complex cmake builds like
BTLS and LLVM, this will cause problems picking up incorrect tools,
failing builds on CI.
Another problem is the AOT compilation using MSVC toolchain. In the
past CI used some "hard coded paths" to make sure clang.exe and link.exe was found.
This is not optimal and won't work when including LLVM as part of full AOT since
link.exe will need access to more of the full build environment setup by VS
development environments (like platform libraries).
In order to get a better build environment on CI this commit includes and enhance
a couple of build scripts used to run msbuild.exe and mono-sgen.exe (as AOT compiler)
in a VS development environment, isolate that build process from cygwin environment.
The build scripts will locate installed VS tooling, VS2015 build tools or VS dev env,
VS2017 build tools or VS dev env and use corresponding development environment
scripts as part of running msbuild.exe and mono-sgen.exe in AOT mode.
In order to make sure mono-sgen.exe as AOT compiler is run through these scripts
an additional environment variable MONO_EXECUTABLE_WRAPPER is introduced and used
in mono-wrapper when set. Without this indirection there will be problems on CI
tests since the environment is using MONO_EXECUTABLE and pass that into for example
test driver that run child processes of mono-sgen.exe, meaning that we can't
use scripts for MONO_EXECUTABLE, but splitting the MONO_EXECUTABLE to represent
mono runtime and have a MONO_EXECUTABLE_WRAPPER that could be a launch script
solves this issue.
This commit also includes several smaller fixes made to the generic
fullaot build infrastructure.
Fix additional msbuild arguments.
Add Mono.SIMD assembly to winaot profile.
Run msbuild.exe as part of .bat file.
`CSharpCodeGenerator` runs a compiler while redirecting its standard error and
standard output streams for further reporting. However, in doing that it fails
to read the standard output data completely and also fails to properly wait for
the standard error output to complete. Depending on environment it may lead to
the process using `CSharpCodeGenerator` hanging while the process has already
exited but there still is data to be read from standard output and standard
error.
This commit changes the code to an implementation of reading standard error and output
that makes sure all the data is read before the process is closed.
The hope is that it may fix some of the timeouts/hangs we see on the
Xamarin.Android build bots as a portion of them hangs in test that use the
code generator.
* When moving parameters for tailcall, first copy the parameters using ARMREG_IP and after that get destination in ARMREG_IP, then it's not necessary the PUSH and POP to SP nor the saved_ip_offset.
Fixes#11489
* Removing unused variable.
Testing how much hate this is going to bring me.
These annotations let ProjectN deal with the fact that we now have two
definitions of System.Environment in the system. This is needed as long
as Project N is stuck on 2.1-level version of the framework.
Signed-off-by: dotnet-bot <[email protected]>
The former does extra work that the latter doesn't do, and they're equivalent when we know it contains a value, such as immediately after a HasValue check.
Signed-off-by: dotnet-bot <[email protected]>
Fixes dynamic-method-churn.exe timeouts, which was hanging on arm because the finalizer thread was hanging from taking too long to clear these hashtable entries.
* [runtime] Improve mono_print_ji ().
* [llvmonly] Add a few more preinited got slots. Avoid emitting TLS_TRAMP preinited got slots in llvmonly mode.
* [aot] Simplify the mangled name of icall wrappers.
* [llvmonly] Make direct calls to icalls/icall wrappers in llvmonly+static mode.
* [aot] Disable some dedup logging which is always 0.
* Fix an strstr call.
This requires merging/adapting the implementation with EnvironmentAugments (which goes away completely), the shared files, what corert has, etc.
Signed-off-by: dotnet-bot <[email protected]>
Fix leak if mono_assembly_setrootdir is called multiple times.
Fix leak if mono_assembly_setrootdir is called multiple times by freeing the
previously stored value.
<!--
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
-->
Fix leak if mono_set_config_dir is called multiple times.
Fix leak if mono_set_config_dir is called multiple times by freeing the
previously stored value.
<!--
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
-->
When we unified the implementations of these across all of our runtimes, we lost all size optimizations people have been doing on the Project N side over the past six years.
This restores a bit of the loss. For one sample app with lots of async usage, this removes 2.1 MB of generic instantiations.
There is more we can do, but I can't spend time on that right now. These two things jumped out on me when I was looking at it back in December and were an easy fix I wanted to do for a while.
Signed-off-by: dotnet-bot <[email protected]>
* [gshared] Make mono_method_lookup_or_register_info () static, its only used in mini-generic-shared.c. Simplify callers.
* [aot] Optimize the encoding/decoding of MonoJumpInfoRgctxEntry.
Previously, all entries were associated with a method, but thats only needed for entries which have
is_mrgctx set, the rest can be associated with a class. Also, emit the encoding of methods/classes
only once, then refer to the them using a blob offset.
* [aot] Optimize the encoding of generic contexts by emitting every ginst only once.
* [aot] Add a MONO_AOT_METHOD_FLAG_HAS_PATCHES flag to avoid having to write the number of patches if its 0.
* [aot] Add a preinited got slot for MONO_PATCH_INFO_GC_SAFE_POINT_FLAG, fix the equality test.
* [wasm] Fix crash with delegates.
Internally the javascript bridge support uses `System.Delegate` and `System.Delegate.DynamicInvoke` to support delegate callbacks. The linker, when executed over the assemblies, does not know about this code coverage and will strip out `System.Delegate.DynamicInvoke`.
To fix this:
- Add reference to `System.Delegate.DynamicInvoke` to the `WebAssembly.Bindings` linker xml file so the linker knows not to strip the code.
- Add detailed error messages in case something else goes wrong so the crash is not so cryptic.
* [wasm] WebSocket support initial commit.
- Connect to socket
- Basic Send and Receive support for Text and Binary - Needs work.
- Close socket.
* Add nuget packaging for build tools sdk
* Add Not Implemented Exceptions to the ClientWebSocketOptions implementation.
- The browser websocket specification does not provide for referencing the underlying http parameters.
- KeepAliveInterval - The browser websocket implementation implements the PING/PONG implementation and does not provide a mechanism via the websocket API.
* Remove validattion for keepalive as it is not implemented.
* a couple more Not Implemented Exceptions for WebSocketOptions
* Change to PlatformNotSupportedException.
* ProjectReference instead of assembly.
* Add websockets assembly to sdk build
* Add WebAssembly.Net.Websockets to packager.
- Treat as core for AOT linker. This should be linked out but the linker but will appear in the loaded assembly list.
- Make sure it is imported as part of the non AOT build.
* Cleanup code.
* Add WebAssembly.Net.WebSockets assemblies to package
Not yet enabled for mobile, build and basic profiles.
Doesn't require ICU dependency, also I created a small PR for dotnet/coreclr to improve TimeZoneInfo.DisplayName on unix: https://github.com/dotnet/coreclr/pull/20728
Part of #7737
<!--
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
-->
## Problem
`LinkLabels` ignore the text alignment for rendering the "hitbox" and the text color (= the `LinkArea`), and the focus rectangle. Also every text behind the end of this LinkArea/focus rectangle region is not painted at all.
This becomes visible if `AutoSize = false` and the `Size` is bigger than the text would need,
and if the text alignment is anything different than `TopLeft`.
## Cause
I think this is because the `piece.regions` are only translated regarding the padding, but neglecting the text alignment.
## Solution
Calculate the offset due to alignment and add it to the translation in `LinkLabel.CreateLinkPieces ()`
Fixes#12402
## One more problem:
~Right now, a very tiny bit at the end of the label is still cut off (see my zipped and attached comparison pictures). Maybe `GetBounds ()` returns a value little bit smaller than it should be.
Can someone help?~
Also, maybe I took the wrong approach to this issue, but I don't know the inner mechanisms of mono.
So feel free to either advise me to change something, or change it yourself(s) :)
* [cxx] Set CCLD and CXXLD for final linking
Essentialy bypass automake's automatic linker selection based on _SOURCES file
extensions.
The issue:
1. Right now we need to use the C linker unless we're linking with LLVM which
needs C++.
2. Later when we start using C++ in Mono we will still want the C linker,
because we will use a subset of C++ that doesn't depend on the C++ runtime
library (because we don't want to break embedders that don't expect us to
use C++).
So in either case which linker we use is a decision that we want to make
independent of what the file extensions look like.
So we set MONO_CXXLD in configure. If LLVM is enabled, we use $CXX, otherwise
$CC.
Then in mono/mini/Makefile.am.in we set CCLD and CXXLD to MONO_CXXLD. So
whatever automake decides we're going to use the linker that we want.
This partly reverts 988f4a2147 which tried
another approach (which turned out not to work).
This should also address https://github.com/mono/mono/issues/12060
Closes https://github.com/mono/mono/issues/12435
* [cxx] Fix link errors if both --enable-llvm and --enable-cxx are on
BinaryReader.ReadInt32() has nice optimization which was missing from the ReadUInt32() version. Now both implementations are aligned.
ReadUInt32 and all the 64 bits types are now 30% to 50% faster than original implementation.
Signed-off-by: dotnet-bot <[email protected]>
* Remove defunct netstandard code from ValueTask
* Remove several uses of VoidTaskResult
Currently TrySetResult/Canceled/Exception live on `Task<T>`. There's no reason `TrySetCanceled` and `TrySetException` need to live there, as they only access state from the base `Task`, and so can be moved down. `TrySetResult` needs the `TResult`, however in a variety of cases `Task<T>` is used with a `VoidTaskResult`, and for such cases we can just have a parameterless `TrySetResult()` on the base class as well, which can be used any time there is no `TResult` or when `default(TResult)` is the desired result. This lets us switch several cases where we were using `Task<VoidTaskResult>` to just be `Task`, which saves 8 bytes on the task instance on 64-bit. It also avoids an Interlocked.Exchange as part of the TrySetResult call.
This primarily affects Task.Delay and the non-generic variants of Task.WhenAll, ValueTask.AsTask(), Task.FromCanceled, and Task.FromException.
Signed-off-by: dotnet-bot <[email protected]>
* Move Timer to shared CoreLib partition.
* Move SignalNoCallbacksRunning back to shared code, add static EventWaitHandle.Set.
* Remove AppDomain references from shared Timer code, reshuffle some code out of SetTimer in non-shared code.
* Change m_ prefix to match code style.
Signed-off-by: dotnet-bot <[email protected]>
* Move more Marshal methods to shared partition (dotnet/coreclr#22205)
* Move more Marshal methods to shared partition
* Implement ThrowExceptionForHR in managed
Signed-off-by: dotnet-bot <[email protected]>
* Remove local copy
The intended behaviour on specifying a delay of zero is that the CancellationTokenSource is cancelled immediately - before this change, it would depend on the scheduling of the timer callback which could lead to seeing a non-cancelled token. Now, it marks itself as cancelled immediately, without invoking any callbacks (as this method is called only from within the constructor of the object, before any callbacks could have been registered.
Signed-off-by: dotnet-bot <[email protected]>
This PR still needs additional cleanup work to be ready to merge but it's getting close enough to be worth running tests and getting code review. The purpose of this PR is to make various bug fixes and infrastructure changes so that it is trivial to use the roslyn compiler server on a clean checkout.
Summary of the changes:
* configure.ac generates some additional variables in config.make that are used to configure the compiler server mode in make. You can then use the compiler server by passing ```ENABLE_COMPILER_SERVER=1``` to make or flipping the switch in config.make.
* config.make has two variables pointing to the compiler server version of roslyn. This lets you use a local build/checkout of roslyn but only when the compiler server is enabled. Once we update in-tree roslyn these vars can default to that. (The in-tree version of csc is not compatible with the compiler server.) The vars are named ```SERVER_CSC_LOCATION``` and ```VBCS_LOCATION```.
* config.make also has a variable that sets the name of the roslyn compiler server pipe. If you're trying to build multiple checkouts in parallel, or build in multiple user accounts, you'll need to use separate pipenames. You'll be able to set this from the command line once I tweak the config file with ```COMPILER_SERVER_PIPENAME=xxx```.
* basic_profile_check attempts to start the compiler server before any builds happen. I put it there because that was the only way I found to get it to always run before mcs builds. I spent a few hours trying to add a separate build target for this, and then gave up because makefiles. (I'd love to get suggestions on a better way to do this) Because it's nontrivial to track compiler server instances across builds, I just spawn a new one every time - this works fine because the compiler server has logic to detect an existing instance.
* I completely rewrote our implementation of Timer and its scheduler, because the existing one was burning an entire core at all times in the compiler server, mostly calling SortedList methods. The new implementation is probably not release-ready, but I focused on keeping it easy to audit and understand because attempts to preserve the existing logic kept breaking. Ideally we can just pull in corefx's timers here, but it looked non-trivial to do that.
* ReaderWriterLockSlim was checking Environment.ProcessorCount every time it was used, which in most configurations will result in a syscall to getpid() and another syscall to check our affinity. This was bottlenecking the compiler server really bad. I changed this to match most other threading code and use PlatformHelper.ProcessorCount instead.
* Our nunit.snk was corrupt (not sure how this happened) so I replaced it with the current nunit.snk from mainline nunit. Thanks to @jaredpar and other roslyn folks for troubleshooting this - it was causing problems for our msbuild infrastructure as well and I never figured that out.
Some work remains before the compiler server is good enough to use by default, which I will probably document here (or in tree? on a wiki?)
This fixes NullReferenceException that was thrown if:
-
HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ProxyEnable was set to true (1)
-
HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ProxyServer was set to null
Fixes#10030
* Fixing the decimal formatting so that -0 prints as 0
* Fixing the decimal parser to consider digits still in the buffer as part of the zero/non-zero tail check
Signed-off-by: dotnet-bot <[email protected]>
* [wasm] Fix AOT test build error message 'Unable to compile method'.
* Remove `--aot-interp` command line option
* Remove a few more options
* add --linker option
* Speedup SpanHelpers.IndexOf(byte)
* 128 * 2 alignment
* Move TrailingZeroCountFallback to common SpanHelpers
So it can be used by other types than byte
* Speedup SpanHelpers.IndexOfAny(byte, ...)
* Indent for support flags
* More helpers, constency in local names/formatting, feedback
* Skip bounds check in software fallback
Signed-off-by: dotnet-bot <[email protected]>
* Move common ThreadPool code to shared CoreLib partition.
* Move numWorkingThreads counting out of shared code.
* Rename ThreadPoolGlobals.vmTpInitialized to threadPoolInitialized.
Remove exception handling from ThreadPoolWorkQueue.Dispatch.
Remove obsolete code from ThreadPoolWorkQueue.Dispatch.
Rename ThreadPool.EnsureVMInitialized to ThreadPool.EnsureInitialized.
Signed-off-by: dotnet-bot <[email protected]>
- Add `verbose` CL flag to control `--verbose` mode sent to `monolinker` during link phase.
```
--verbose (set verbose option on link)
type: bool default: false
```
The handler receive an `Open` and the a `Close` event but never a
`DataAvailable` event.
So it _hangs_ if only a `200` status is received (since the headers
are not considered _data_) received from the web server.
This is because some initialization only occurs inside
`HandleHasBytesAvailableEvent` which is now called, on `Close`,
to ensure the initialization is done before completing the request.
This, along with a cancellation check, makes the test case from
https://github.com/xamarin/xamarin-macios/issues/5190 work properly
with this handler.
Fixes https://github.com/xamarin/xamarin-macios/issues/5289
The values of the enum for the TcpState are different in Unix systems
than in .NET, so a function was added to convert between the two.
Signed-off-by: Bijan Tabatabai <[email protected]>
Different instantiations of generic virtual methods occupy the same slot in the vtable. We probe them using a single linked list, by the same logic of jit's imt trampolines.
We allocate a new interp vtable array that we store inside the type's vtable. This array has the same logic as the jit vtable array and it stores InterpMethod pointers. We embed the virtual method slot in the interp instruction stream.
Partly revert a change in https://github.com/mono/mono/pull/12478
CoreCLR treats `Assembly.Load (new AssemblyName ("System.Private.CoreLib.dll"))`
the same as `Assembly.Load (new AssemblyName ("System.Private.CoreLib"))` (and
.NET Framework behaves likewise with "mscorlib.dll").
* [runtime] Make infrastructure for merp tests
* [runtime] Fix dumping when crash happens without sigctx
* [runtime] Disable crashy (886/1000 runs) stacktrace walker
* [crash] Remove usage of allocating build/os info functions
* [crash] Remove often-crashing g_free on native crash path
* [crash] Add crash_reporter checked build
We add a checked build mode that asserts when mono mallocs inside of
the crash reporter. It makes risky allocations into assertions. It's
useful for automated testing because the double-abort often represents
itself as an indefinite hang. If it happens before the thread dumping
supervisor process is started, or after it ends, the crash reporter
hangs.
* [crash] Remove reliance on nested SIGABRT/double-fault (broken on OSX)
* [crash] Fix top-level handling of double faults/assertions
* [runtime] Make fatal unwinding errors return into handled error paths
* [crash] Change dumper logging for better info
* [runtime] Fix handling of segfault on sgen thread
Threads without domains that get segfaults will end up in
this handler. It's not safe to call this function with a NULL domain.
See crash below:
```
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x10eff40f8)
* frame #0: 0x000000010e1510d9 mono-sgen`mono_threads_summarize_execute(ctx=0x0000000000000000, out=0x0000001000000000, hashes=0x0000100000100000, silent=4096, mem="", provided_size=2199023296512) at threads.c:6414
frame #1: 0x000000010e152092 mono-sgen`mono_threads_summarize(ctx=0x000000010effda00, out=0x000000010effdba0, hashes=0x000000010effdb90, silent=0, signal_handler_controller=1, mem=0x0000000000000000, provided_size=0) at threads.c:6508
frame #2: 0x000000010df7c69f mono-sgen`dump_native_stacktrace(signal="SIGSEGV", ctx=0x000000010effef48) at mini-posix.c:1026
frame #3: 0x000000010df7c37f mono-sgen`mono_dump_native_crash_info(signal="SIGSEGV", ctx=0x000000010effef48, info=0x000000010effeee0) at mini-posix.c:1147
frame #4: 0x000000010de720a9 mono-sgen`mono_handle_native_crash(signal="SIGSEGV", ctx=0x000000010effef48, info=0x000000010effeee0) at mini-exceptions.c:3227
frame #5: 0x000000010dd6ac0d mono-sgen`mono_sigsegv_signal_handler_debug(_dummy=11, _info=0x000000010effeee0, context=0x000000010effef48, debug_fault_addr=0xffffffffffffffff) at mini-runtime.c:3574
frame #6: 0x000000010dd6a8d3 mono-sgen`mono_sigsegv_signal_handler(_dummy=11, _info=0x000000010effeee0, context=0x000000010effef48) at mini-runtime.c:3612
frame #7: 0x00007fff73dbdf5a libsystem_platform.dylib`_sigtramp + 26
frame #8: 0x0000000110bb81c1
frame #9: 0x000000011085ffe1
frame #10: 0x000000010dd6d4f3 mono-sgen`mono_jit_runtime_invoke(method=0x00007faae4f01fe8, obj=0x0000000000000000, params=0x00007ffee1eaa180, exc=0x00007ffee1ea9f08, error=0x00007ffee1eaa250) at mini-runtime.c:3215
frame #11: 0x000000010e11509d mono-sgen`do_runtime_invoke(method=0x00007faae4f01fe8, obj=0x0000000000000000, params=0x00007ffee1eaa180, exc=0x0000000000000000, error=0x00007ffee1eaa250) at object.c:2977
frame #12: 0x000000010e10d961 mono-sgen`mono_runtime_invoke_checked(method=0x00007faae4f01fe8, obj=0x0000000000000000, params=0x00007ffee1eaa180, error=0x00007ffee1eaa250) at object.c:3145
frame #13: 0x000000010e11aa58 mono-sgen`do_exec_main_checked(method=0x00007faae4f01fe8, args=0x000000010f0003e8, error=0x00007ffee1eaa250) at object.c:5042
frame #14: 0x000000010e118803 mono-sgen`mono_runtime_exec_main_checked(method=0x00007faae4f01fe8, args=0x000000010f0003e8, error=0x00007ffee1eaa250) at object.c:5138
frame #15: 0x000000010e118856 mono-sgen`mono_runtime_run_main_checked(method=0x00007faae4f01fe8, argc=2, argv=0x00007ffee1eaa760, error=0x00007ffee1eaa250) at object.c:4599
frame #16: 0x000000010de1db2f mono-sgen`mono_jit_exec_internal(domain=0x00007faae4f00860, assembly=0x00007faae4c02ab0, argc=2, argv=0x00007ffee1eaa760) at driver.c:1298
frame #17: 0x000000010de1d95d mono-sgen`mono_jit_exec(domain=0x00007faae4f00860, assembly=0x00007faae4c02ab0, argc=2, argv=0x00007ffee1eaa760) at driver.c:1257
frame #18: 0x000000010de2257f mono-sgen`main_thread_handler(user_data=0x00007ffee1eaa6a0) at driver.c:1375
frame #19: 0x000000010de20852 mono-sgen`mono_main(argc=3, argv=0x00007ffee1eaa758) at driver.c:2551
frame #20: 0x000000010dd56d7e mono-sgen`mono_main_with_options(argc=3, argv=0x00007ffee1eaa758) at main.c:50
frame #21: 0x000000010dd5638d mono-sgen`main(argc=3, argv=0x00007ffee1eaa758) at main.c:406
frame #22: 0x00007fff73aaf015 libdyld.dylib`start + 1
frame #23: 0x00007fff73aaf015 libdyld.dylib`start + 1
thread #2, name = 'SGen worker'
frame #0: 0x000000010e2afd77 mono-sgen`mono_get_hazardous_pointer(pp=0x0000000000000178, hp=0x000000010ef87618, hazard_index=0) at hazard-pointer.c:208
frame #1: 0x000000010e0b28e1 mono-sgen`mono_jit_info_table_find_internal(domain=0x0000000000000000, addr=0x00007fff73bffa16, try_aot=1, allow_trampolines=1) at jit-info.c:304
frame #2: 0x000000010dd6aa5f mono-sgen`mono_sigsegv_signal_handler_debug(_dummy=11, _info=0x000070000fb81c58, context=0x000070000fb81cc0, debug_fault_addr=0x000000010e28fb20) at mini-runtime.c:3540
frame #3: 0x000000010dd6a8d3 mono-sgen`mono_sigsegv_signal_handler(_dummy=11, _info=0x000070000fb81c58, context=0x000070000fb81cc0) at mini-runtime.c:3612
frame #4: 0x00007fff73dbdf5a libsystem_platform.dylib`_sigtramp + 26
frame #5: 0x00007fff73bffa17 libsystem_kernel.dylib`__psynch_cvwait + 11
frame #6: 0x00007fff73dc8589 libsystem_pthread.dylib`_pthread_cond_wait + 732
frame #7: 0x000000010e28d76d mono-sgen`mono_os_cond_wait(cond=0x000000010e44c9d8, mutex=0x000000010e44c998) at mono-os-mutex.h:168
frame #8: 0x000000010e28df4f mono-sgen`get_work(worker_index=0, work_context=0x000070000fb81ee0, do_idle=0x000070000fb81ed4, job=0x000070000fb81ec8) at sgen-thread-pool.c:165
frame #9: 0x000000010e28d2cb mono-sgen`thread_func(data=0x0000000000000000) at sgen-thread-pool.c:196
frame #10: 0x00007fff73dc7661 libsystem_pthread.dylib`_pthread_body + 340
frame #11: 0x00007fff73dc750d libsystem_pthread.dylib`_pthread_start + 377
frame #12: 0x00007fff73dc6bf9 libsystem_pthread.dylib`thread_start + 13
thread #3, name = 'Finalizer'
frame #0: 0x00007fff73bf6246 libsystem_kernel.dylib`semaphore_wait_trap + 10
frame #1: 0x000000010e1d9c0a mono-sgen`mono_os_sem_wait(sem=0x000000010e43e400, flags=MONO_SEM_FLAGS_ALERTABLE) at mono-os-semaphore.h:84
frame #2: 0x000000010e1d832d mono-sgen`mono_coop_sem_wait(sem=0x000000010e43e400, flags=MONO_SEM_FLAGS_ALERTABLE) at mono-coop-semaphore.h:41
frame #3: 0x000000010e1da787 mono-sgen`finalizer_thread(unused=0x0000000000000000) at gc.c:920
frame #4: 0x000000010e152919 mono-sgen`start_wrapper_internal(start_info=0x0000000000000000, stack_ptr=0x000070000fd85000) at threads.c:1178
frame #5: 0x000000010e1525b6 mono-sgen`start_wrapper(data=0x00007faae4f31bd0) at threads.c:1238
frame #6: 0x00007fff73dc7661 libsystem_pthread.dylib`_pthread_body + 340
frame #7: 0x00007fff73dc750d libsystem_pthread.dylib`_pthread_start + 377
frame #8: 0x00007fff73dc6bf9 libsystem_pthread.dylib`thread_start + 13
thread #4
frame #0: 0x00007fff73c0028a libsystem_kernel.dylib`__workq_kernreturn + 10
frame #1: 0x00007fff73dc7009 libsystem_pthread.dylib`_pthread_wqthread + 1035
frame #2: 0x00007fff73dc6be9 libsystem_pthread.dylib`start_wqthread + 13
(lldb)
```
* [crash] Add signal-safe mmap/file "allocator"
* [crash] Remove use of static memory from dumper
* [runtime] Reduce print buffer size for lockless printer.
Each frame that prints ends up increased by the size of buff.
In practice, clang often fails to deduplicate some of these buffers,
leading to 30k-big stackframes.
It was noticed by a series of hard-to-diagnose segfaults on stacks that
looked otherwise fine during the crash reporting stress test.
This change fixes this, making stacks a 1/10th of the size. It doesn't
seem to break the crash reporter messages anywhere (may need to shrink
other "max name length" fields), and it's not mission-critical anywhere
else.
* [crash] Use async-safe file memory for dumper internals
* [crash] Add memory barriers around merp configuration
* [crash] Use signal-safe printers on all native crash paths
* [crash] Move gdb/lldb lookup to startup
* [runtime] Move MOSTLY_ASYNC_SAFE_FPRINTF to eglib
* [runtime] Fix all callsites of MOSTLY_ASYNC_SAFE_PRINTF
* [runtime] Fix all callsites of MOSTLY_ASYNC_SAFE_FPRINTF
* [crash] Switch to signal-safe exit function
* [crash] Make dumper enum in managed
* [runtime] Add more information to managed frame
* [crash] Make async_safe printers inlined
* [runtime] Move basic pe_file functionality into proclib
* [crash] Fix handling of thread attributes
* Move MemoryFailPoint to shared CoreLib partition.
* Split MemoryFailPoint into Unix and Windows versions.
* Replace MemoryFailPoint.GetMemorySettings FCall with GC.GetSegmentSize to make sharing with CoreRT easier.
Signed-off-by: dotnet-bot <[email protected]>
- Add new experimental command line option
- --link-mode=None|SdkOnly|Full Set the link type used for AOT. (EXPERIMENTAL)
- `None` no linking.
- `SdkOnly` only link the Core libraries.
- `Full` link Core and User assemblies. **(default)**
- Add the Facades directory to the resolve paths.
- Treat netstandard, WebAssembly.Bindings and WebAssembly.Net.Http as core libraries. `monolinker.exe` does not see `netstandard` as a core library.
- The problem stems from void methods returning a corrupted MonoObject when the method that is invoked is marked as `void`.
- Internally the cwrap'd invoke method is defined as returning a `number` which internally will return the result from `mono_wasm_invoke_method` of the driver. In the case of `void` methods this may contain invalid address reference causing a memory access crash if referenced.
* Avoid intermediate strings in some StringBuilder formatting
Several appends to string builders are first creating strings and then appending those strings, and they're not using the existing Append(primitive) overloads because they want to customize the format string or provider as part of appending the value. This fixes a few of those cases, using another internal AppendSpanFormattable overload on StringBuilder.
* Address PR feedback
Signed-off-by: dotnet-bot <[email protected]>
* The version of the server and client should be bumped to call the elapsed_time.
* Removing extra {
* Calling correctly.
* This should be checked in ThreadMirror.ElapsedTime instead using vm.CheckProtocolVersion (), so calling the public method will fail.
Enable SHA256, SHA384 and SHA512 hash algorithms to be used for
Authenticode signatures. This enables producing digital signatures that
are trustworthy using the `mono` tooling.
Fixes#7517
* [llvmonly] Fix dynamic delegate creation in mixed mode.
* [llvmonly] Fix support for virtual calls in mixed mode. Handle calls which end up being not virtual, and add wrappers
for virtual call signatures too.
* [llvmonly] Disable calling aot-ed synchronized methods from the interpreter, it hits an assert in mono_jit_compile_method_jit_only ().
* [wasm] Add a 'wasm-tuner' helper tool which is ran during the app build process.
Currently it only supports one option: --gen-icall-table which generates a linked
icall table based on a linked mscorlib.dll.
* [wasm] Add support for linking out unused icalls in interpreter and aot+interp mode using a new --link-icalls option.
This involves the following steps:
- mono --print-icall-table > icall-table.json
- tuner.exe --gen-icall-table icall-table.json linker-out/mscorlib.dll > icall-table.h
- link icall-table.h into the final executable.
The downside is that this requires compiling a new mono.wasm even in interpreter mode.
* Update README.
* Fix thisdir.
* [csproj] Update project files
* Use ReadOnlySpan.ToArray in places
* Use List.ToArray
* Don't take .Length in to local and use as loop condition
Signed-off-by: dotnet-bot <[email protected]>
* [configure] --with-core should disable remoting, sre.save and appdomains
* [class-init] with ENABLE_NETCORE System.Array has some constant fields
* [object] for NETCORE don't handle appdomain unload exception specially
Since it doesn't exist in System.Private.CoreLib.dll (it's no netstandard.dll)
1. Add classes that the runtime depends on:
* System.Reflection.RuntimeAssembly and System.Reflection.MonoAssembly
* System.Mono.MonoDomain and System.Mono.MonoDomainSetup
2. Add fields to some classes so they match what `object-internals.h` expect on the native side.
3. Make a non-`abstract` `System.RuntimeType` stub.
`System.Type` and `System.RuntimeType` need to have fields that match `object-internals.h` and also the runtime wants to create instances of this type and things go wrong if it's abstract.
On android, the dlopen call will take around 1ms per AOT module we try to load. By not using dlopen with the existence check, we rely on a much slower dlopen check that happens later. I think they support dlopen of non-resolved names.
This might break a few things if we don't use the full path to dlopen. If it does, we should probably add existence checks at the caller, but this will be an optimization that works everywhere.
Rather than having Environment partially live in corefx and call into an EnvironmentAugments type in CoreLib that in turn calls into an Environment type in CoreLib, we're just moving Environment to live in CoreLib.
To start that, this PR moves Environment and its dependencies from their current locations into the shared CoreLib. Those changes will mirror over to coreclr. After that, I'll fix it up to work in CoreLib. And once those changes are built and available back to corefx, I'll update System.Runtime.Extensions to just use the functionality from CoreLib and delete remaining unnecessary code from corefx.
Signed-off-by: dotnet-bot <[email protected]>
I took the liberty of marking the types containing the hardware intrinsics as [Intrinsic] to avoid doing a name check on everything in the system module. It feels like we should take advantage of this attribute in CoreCLR too.
This doesn't actually enable the support because RyuJIT unconditionally disables HW intrinsics for prejit (both CoreRT and CPAOT are considered prejit). We might want to do something about this on the RyuJIT side to address that (for CPAOT, to be able to pregenerate best code possible ahead of time, assuming a fixed ISA; and for CoreRT without JIT, where the concerns about AVX-SSE penalty don't apply). See conversation in dotnet/coreclr#21603
Signed-off-by: dotnet-bot <[email protected]>
Use the MONO_ASSEMBLY_CORLIB_NAME define instead of hardcoding "mscorlib"
everywhere. If building for netcore, the define is set to
"System.Private.CoreLib" instead.
In some circumstances, a string comparison against assembly->aname.name is used to
check if something is in corelib. In cases like that, instead use
`mono_is_corlib_image (assembly->image)` instead. (This introduces a
dependency on mono_defaults.corlib being correctly initialized, so it's
inappropriate for code that runs very early during startup. Which I checked as
best I could.)
This should fix every use of literal "mscorlib" in the runtime.
This does _not_ fix every use of literal "mscorlib.dll" in the runtime, partly
because some of those uses are in the Framework-specific codepaths in the
loader and it doesn't necessarily make sense to perturb them.
Some unnecessary Span to ReadOnlySpan casts.
Some places where new Span(...).Slice(...) can be replaced with AsSpan(...).
Etc.
Signed-off-by: dotnet-bot <[email protected]>
* Avoid allocations in Utf8Formatter.TryFormat(float/double, ...)
Currently every call to Utf8Formatter.TryFormat for a float or a double allocates two strings, one for the format string and one for the resulting number. This avoids those in the common case where we can use float/double.TryFormat and format directly into a stack buffer. Also removes some unsafe code; the performance of StandardFormat.ToString isn't currently worth the extra nanoseconds gained by using unsafe code.
* Delete assert
There's a test that uses unsafe code to cause this to fail and validate that no exception is thrown.
Signed-off-by: dotnet-bot <[email protected]>
* [llvmonly] Move all runtime support code to a new llvmonly-runtime.c file.
* [llvmonly] Make mini_init_delegate () work in mixed mode, it needs to initialize both the interp and the llvmonly related data.
* [llvmonly] Implement EH support in mixed mode.
On interp->native transitions, add a try-catch. On native->interp transitions, rethrow the exception using a c++ throw.
* [llvmonly] Unify function naming, name all llvmonly runtime functions mini_llvmonly_.
* Fix a build failure.
* Fix windows build.
* Fix an aot failure.
* Fix the EH changes.
Internally the javascript bridge support uses `System.Delegate` and `System.Delegate.DynamicInvoke` to support delegate callbacks. The linker, when executed over the assemblies, does not know about this code coverage and will strip out `System.Delegate.DynamicInvoke`.
To fix this:
- Add reference to `System.Delegate.DynamicInvoke` to the `WebAssembly.Bindings` linker xml file so the linker knows not to strip the code.
- Add detailed error messages in case something else goes wrong so the crash is not so cryptic.
After .NET 4.5 .NET Framework has changed the System.ComponentModel.Composition ReflectionModelServices.IsExportFactoryImportDefinition to not throw.
Updating this to match the .NET Framework behavior.
The latest Android NDK releases no longer ship with per-platform C headers.
Instead they ship with a set of unified headers and require the presence of the
`__ANDROID_API__` macro in order to select the target platform.
The AOT offset dumper doesn't support this new layout and this commit changes
that by adding support for the unified headers (without removing support for the
older NDKs) thus fixing the following error when trying to dump the offsets with
newer NDK:
Processing triple: aarch64-v8a-linux-android
Error parsing '[...]/mono/mono/metadata/metadata-cross-helpers.c'
[...]/mono/mono/metadata/metadata-cross-helpers.c(5,10): fatal: 'stdio.h' file not found
Error parsing '[...]/mono/mono/mini/mini-cross-helpers.c'
[...]/mono/mono/mini/mini-cross-helpers.c(7,10): fatal: 'stdio.h' file not found
- Add linker xml descriptor to WebAssembly.Bindings and WebAssembly.Net.Http
- The XML linker descriptor will keep the full assembly for these assemblies during link.
- Fix Link Assemblies command line.
- Miscellaneous fixes for how the assemblies are linked whether they are framework or facades.
- Add the Facades directory to the resolve paths.
* [wasm] Add support for v8 style options to the packager, i.e. --option/--no-option.
Add a --linker option to turn on linking in interpreter mode.
* [wasm] Add a print-table.py helper script to print out the function table of a wasm module.
* [runtime] Add a --print-icall-table option to dump the icall table as json. Usable for linking the icall table.
* [runtime] Pass the method to the icall table lookup function.
* [arm] Set the LLVM data layout, without it, opt seems to make incorrect optimizations.
Fixes https://github.com/mono/mono/issues/12307.
* [x86] Set the LLVM data layout.
* [Debugger] Debugger failure when a method is called in watches and any field of the Class has the type of the field different of the value of the field because the assign was done in an unsafe way like this:
Now the datatypes check in the fields are only executed when it's not inside an invoke method.
_pinnable = Unsafe.As<Pinnable<T>>(array);
A unit test that reproduces the issue was created either.
Fixes#12374
Reverts a29ad08d00 (#9914)
The basic problem we want to solve is the following:
1. All access to InternalThread:state must be protected by the
InternalThread:synch_cs mutex
2. We must destroy the mutex when we are done with the thread.
3. We don't know which happens later - detaching the machine thread or
finalizing its InternalThread managed object.
The solution is to replace InternalThread:synch_cs by InternalThread:longlived
which is a refcounted struct that holds the synch_cs. The refcount starts out
at 2 when the thread is attached to the runtime and when we create the managed
InternalThread object that represents it.
Both detaching and finalizing the managed object will decrement the refounct,
and whichever one happens last will be responsible for destroying the mutex.
This addresses https://github.com/mono/mono/issues/11956 which was a race
condition due to the previous attempt to fix this lifetime problem. The
previous attempt incorrectly used CAS in mono_thread_detach_internal while
continuing to use locking of synch_cs elsewhere. In particular
mono_thread_suspend_all_other_threads could race with
mono_thread_detach_internal: it expects to take the thread lock and test
thread->state and use the thread->suspended event, while detaching deletes
thread->suspended without taking a lock.
As a result we had a concurrency bug: in suspend_all_other_threads it's
possible to see both the old (non-Stopped) value of thread->state and the
new (NULL) value of thread->suspended. Which leads to crashes.
---
Background - why we don't know if detaching or finalization happens first.
1. InternalThread normally outlives the machine thread. This can happen because
when one thread starts another it can hold a reference to the fresh thread's
Thread object which holds a reference to the InternalThread. So after the
machine thread is done, the older thread can query the state of the younger
Thread object. This is the normal situation.
2. During shutdown we can have the opposite situation: the InternalThread
objects are finalized first (this happens during root domain finalization), but
the machine threads are still running, and they may still return to
start_wrapper_internal and call detach_internal. So in this case we have an
InternalThread whose finalizer ran first and detach will run second.
* [Debugger] Debugger crashes when inside a class, there is an internal struct, with a field that is an enumerator.
files.myBucket.GetEnumerator().get_Current().Key
Fixes#10735
* [Debugger] Debugger crashes when there is a generic struct with a field that is an enumerator.
Example: files.get_Current().Key
A unit test that reproduces this crash was added too.
Fixes#10735
* Removing the extra space.
* [wasm] Add support for llvmonly+interp mixed mode.
* Add new --aot-interp and --aot-assemblies= options to packager.exe.
The former enables mixed mode, the latter specifies the list of assemblies which will be AOTed.
* Set the proper AOT_MODE and link in interp libraries in the driver when mixed mode is enabled.
* [llvmonly] Add beginnings of support for llvmonly+interp mixed mode. Treat cross assembly calls as possible places where execution can transition to the interpreter.
* [llvmonly] Add mixed mode tests.
* [llvmonly] Return NULL from mono_jit_compile_method_with_opt () if a method is not found in mixed mode, the caller needs to handle it.
* Implement interp entry support for delegate invokes.
* Implement interp entry for virtual calls.
* Implement interp entry in virtual delegate calls.
* Implement interp entry for virtual generic calls.
* Add runtime invoke test.
* [llvmonly] Add a mini_llvmonly_load_method () helper function to reduce the amount of duplicated code.
* [llvmonly] Add a mini_llvmonly_load_method_delegate () helper function.
* Fix the checked build.
* [runtime] Add a 'cleanup' --enable-minimal option to disable the shutdown cleanup code on platforms which don't need it. Enable it on wasm.
* [wasm] Disable mdb support in the device runtime.
* [runtime] Disable appdomain creation/unload icalls if DISABLE_APPDOMAINS is set.
Several recently added virtuals to TextWriter were missing overrides on SyncTextWriter.
We were missing overrides of the synchronous `Write(ReadOnlySpan<char>)` and `WriteLine(ReadOnlySpan<char>)` overloads. The impact here is primarily performance, though it'll still be an observable change in corner-case scenarios: rather than using the base implementation which would copy the span to an array and then invoke the properly overridden array-based Write{Line} methods, it'll now just delegate to the wrapped span methods. So it calls the correct overload now on the wrapped instance, and saves some cost in the process.
We were also missing overrides for the async `WriteLineAsync()`, `WriteAsync(ReadOnlyMemory<char>, CancellationToken)`, WriteLineAsync(ReadOnlyMemory<char>, CancellationToken)` overloads. Fixing these doesn't change the overload that's invoked on the wrapped writer, but it does cause the calls to become synchronous rather than queue a task that in turn calls the synchronized overload. Whether the new behavior is better is arguable, but it keeps it consistent with every other XxAsync method on SyncTextWriter, which in my opinion is more important... if we wanted to alter the behavior for all of the XxAsync methods, we should do it for all of them.
Also, in the StringBuilder-based overrides, we were ignoring cancellation. And in the recently added DisposeAsync, we should follow-suit with the rest of the async APIs and make it synchronous.
Signed-off-by: dotnet-bot <[email protected]>
We might need to adjust the ip in the same fashion when normally resuming to catch handler.
In the example from the testcase, we have these transitions : ... -> interp_frame -> jit -> eh1 -> interp_frame -> eh2. When eh1 unwinds to call the finally clause from interp_frame it also pops all other lmf entries until there. This means that eh2 thinks it was called directly from the interp_frame (as it would happen with the jit), but in this case there are still the jit frames in the middle. Eh2 doesn't know how to resume over the jit frames, it will just set the resume state to the interp_frame and eh1 will do the resuming over the jitted frames, after run_finally returns gracefully. If the exception were to be handled by frames parent to interp_frame and there are also pushed contexts on the lmf stack, then eh2 could both unwind and resume directly there, skipping eh1 and the jitted frames altogether.
* Cleanup Framework Bindings and HttpMessageHandler code.
- move to framework folder to match package structure. Simplifies packager code finding the framework libraries.
- create solution and project files
- split up the `bindings.cs`, now removed, into multiple files and reformat code
- Clean up xml documentation
- generate xml file documentation on build.
- modify make file to build the solution and modify tests to use framework output.
- modify `packager` to use the correct directory structure.
- modify `sdk` build targets.
- modify `package` target to package the correct assemblies along with source projects and solution.
Tested:
- JavaScript shell tests which run in jenkens
- Browser Tests
- AOT build and tests
* Modify projects to be netstandard instead of framework.
- use dotnet instead of msbuild which is not available.
- Modify test builds
* Fix Sdk.props to point to correct Bindings library path
* Fix build dependencies
* Fix AOT build - duplicate assembly key
* Fix package target
This is the first step to moving OperationStatus from corefx into coreclr. It'll be used by the transcoding APIs which live in System.Private.CoreLib.
Signed-off-by: dotnet-bot <[email protected]>
[interp] use interp_lmf wrapper for interp2native on platforms with wonky sigcontext
On some platforms (e.g. AppleTV) SigContext is available, but isn't as
precise as we would like to have it. For example, it doesn't save
callee-saved registers and thus aren't restored properly.
Unfortunately, this also means we can't use the fastpath for
interp2native, so we disable it on those platforms.
Needs backport to: 2018-08, 2018-10, 2018-12
* Changing the test behavior as discussed with Ludovic, because we already have knowledge about the unreliability of the crash reporter and the test is not about it.
So if in 10 times at least one of them works for now it's good.
Fixes#11385
* Removing extra message.
* Removing the crash log file after the test is finished.
It was never documented and it is not as useful now with a matured hybrid
suspend.
If MONO_ENABLE_BLOCKING_TRANSITION set, and mono is otherwise configured to use
preemptive suspend, the thread state machinery would perform RUNNING->BLOCKING
transitions (ie: MONO_ENTER_GC_SAFE and friends would be more than no-ops), but
still preemptively suspend every thread. This was useful for testing the
thread transitions separately from the coop suspend details.
* [llvmonly] Avoid generating/loading trampolines in llvmonly+interp mode.
Add a new execution mode MONO_AOT_MODE_LLVMONLY_INTERP and make --llvmonly-interp use that. INTERP_LLVMONLY defaults to the interpreter, while LLVMONLY_INTERP defaults to aot.
* [llvmonly] Save whenever a method has a gsharedvt variable signature into the aot image and use that instead of looking up its MonoJitInfo, which is a perf problem since its done for all methods.
* Add a case to append_mangled_wrapper_subtype ().
* [llvmonly] Move initialization of delegate->method_ptr to mini_init_delegate (), pass a handle to the callback.
* [llvmonly] Allow --regression to work in mixed mode.
* [llvmonly] Set param names for gsharedvt in/out wrappers.
* [llvmonly] Use the dedup mangler for setting method names for gsharedvt in/out wrappers, shorten the names a bit.
* Revert "[llvmonly] Allow --regression to work in mixed mode."
This reverts commit d7838c1ce7dc0e3d7bfc3c7f01214224f561db90.
* Fix c++-isms.
- Fix different errors when building via the nuget instead of locally.
- The nuget generated had a different structure so fixed the output generation to work for both local build as well as nuget build.
- Fix problem with the monolinker.exe not being located correctly.
- Move the monolinker.exe to tools directory within nuget.
* Moves common COM type to shared corelib partition
* Moves GetHRForException to PInvokeMarshal
* Add temporary CORECLR ifdef to ArrayWithOffset
* Apply cleanup from CoreCLR
Signed-off-by: dotnet-bot <[email protected]>
We hit the following issue when the upstream repo receives a new commit:
```
16:11:49 error: Your local changes to the following files would be overwritten by merge:
16:11:49 binaryen-tags.txt
16:11:49 emscripten-tags.txt
16:11:49 upstream/lkgr.json
```
To workaround we now clean the emsdk repo before pulling.
Several of the name changes fixes MSVC warnings where local variables
hides global variables using the same name.
Number of adjustments not building on platforms not defining HAVE_CLASSIC_WINAPI_SUPPORT.
Fix a couple of build projects not setting dependencies on build-init.vcxproj.
This could cause races in build order if projects depend on build initialization.
Added support to force external builds to use msbuild even if ninja is present.
The problem was in this line:
ss_nested_with_two_args(ss_nested_arg (), ss_nested_arg ());
The first step_into works correctly entering in the ss_nested_arg method, but the second one doesn't work.
The problem was because this flag MONO_SEQ_POINT_FLAG_NONEMPTY_STACK was set, so the debugger don't consider that it was a possible break.
The solution of the issue was create another flag to identify nested calls and ignore the MONO_SEQ_POINT_FLAG_NONEMPTY_STACK.
2 new tests were added to test other nested calls.
#Fixes 7326
* [wasm] Add stubs for a few functions needs by System.Native.
* [wasm] Enable Mono.Native.
* Enable Mono.Native in the mono build.
* Link libmono-native.a into the interpreter/aot builds.
* Add a dlopen fallback to driver.c to allow the runtime to look up the pinvoke declarations.
* [wasm] Enable direct pinvokes for AOT, disable the dl fallback in AOT mode, its not needed since the generate code links directly to the Mono.Native symbols.
* [wasm] Disable more corlib tests for wasm.
* [wasm] Enable running corlib tests on CI.
* [wasm] Pass -D_WASM_ to the Mono.Native build.
* Fix line numbers in stack frame tests.
* Revert "[wasm] Enable direct pinvokes for AOT, disable the dl fallback in AOT mode, its not needed since the generate code links directly to the Mono.Native symbols."
This reverts commit 2d2ba5261c6fa0b6c1c110d53f18c4248c11cdff.
Direct pinvokes need more support since it needs to link against objc-libs, btls, etc.
* [csproj] Update project files
* [mini] Use C++ linker iff building C++ that needs the C++ runtime
(This has nothing to do with --enable-cxx. This is about our LLVM .cpp files).
Explicitly set the linker for libmini. The issue is that the automatic
linker selection (See
https://www.gnu.org/software/automake/manual/html_node/How-the-Linker-is-Chosen.html)
looks at all the _SOURCES for a target, even those that are only
conditionally added, even if the condition is false. So because we sometimes
build mini-llvm-cpp.cpp we always get the c++ linker. But that's not what we
want.
The goal is:
- if there's any C++ code included into mono (either the shared lib or a
program) that needs the C++ runtime library, ensure that we link using the C++
linker. This was already true, we just need to make sure it stays true.
- if mono is built in such a way that it has no C++ code in it (that needs the
C++ runtime library), ensure that we link with the C linker and without
including the C++ runtime library.
This will address issues like https://github.com/mono/mono/issues/12060
We do this in two steps:
1. We split out all the c++ source code to libmini-cxx.la and include that into
libmini.la.
That's enough to force C++ linking if libmini-cxx.la has any code in it. If
there's no C++ code (right now that means there's no --enable-llvm or
--enable-llvm-runtime), we don't add libmini-cxx.la and all the C source in
libmini links in the normal manner.
2. We have a hack where we sometimes include libmono.a (the static library)
into the mono executable. In that case, we could forget about the C++
linker (which leads to build failures because llvm uses all the C++ runtime
library stuff that we forgot to link in).
So we use the "nodist_EXTRA_..._SOURCES=dummy.cpp` hack to make it look like
the mono executable has C++ source, which in turn forces the use of the C++
linker.
The conditional logic here has to match exactly what we do for deciding
whether to add libmini-cxx.la into libmini.la. If we do, then force the use
the C++ linker here.
It may seem like another option is to use something like
`mono_boehm_LINK=$(CXXLINK)` to set a target-specific linker. But this is
bad, actually, because in that case we will drop the `..._LDFLAGS` and other
linker flags unless we're very diligent to include all of them. The
`nodist_EXTRA_..._SOURCES` hack is more resilient because automake will
ensure that all the flags are kept.
* [llvm,wasm] Don't add -lstdc++ in llvm_config.mk
Leave it to the linker.
This is needed when building wasm cross compilers for windows which pass
-static-libstdc++ to configure. As a result we would get duplicate symbols by
linking against a static libstdc++.a and also the export stubs of libstdc++.dll
In mini, link monow using the C++ linker same as with mono by using the nodist_EXTRA_..._SOURCES
trick.
In wasm, pass -static-libstdc++ to CXXFLAGS, not LDFLAGS. c++ linking picks up
CXXFLAGS anyway, and -static-libstdc++ has no effect on the C linker and it
doesn't affect explicit -lstdc++ flags anyway.
* [Coop] Convert System.Threading.Semaphore.
Potential handles are avoided through fixed, but error path converting utf16 to utf8 is introduced.
* [Coop] Cleanup System.Threading.Mutex. Replace gchandle pinning with C# fixed.
* Remove two commented out lines that are not likely to materialize.
* [Coop] Cleanup System.Threading.NativeEventCalls. Replace gchandle with C# fixed.
* Don't assume ves_icall_System_Threading_Semaphore_ReleaseSemaphore_internal output is to stack.
[exceptions] Always process self aborts even if we have one pending
For example, in the following code, the abort that ends the thread should be the one thrown from the finally block instead of the try block :
```csharp
try {
Thread.CurrentThread.Abort ();
} finally {
Thread.CurrentThread.Abort ();
Console.WriteLine ("Why are you still here ?");
}
```
Apparently, on old versions of Autoconf, a AC_TRY_COMPILE block with an
empty action-if-true block, like:
```
if test x$fpabi = xauto; then
AC_TRY_COMPILE([], [
#ifdef __riscv_float_abi_double
#error "double"
#endif
], [
], [
fpabi=double
])
fi
```
emits invalid shell code, like:
```
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
else
```
`else` immediately after `then` is not valid.
This construct is fine on newer versions, where `then :` is used, which
does not count as invalid.
Even though we're not building for CentOS 6 RISC-V, the invalid shell
causes the configure script to fail entirely, e.g. https://jenkins.mono-project.com/view/Releases/job/ng-release-generate-rpm-packages/963/execution/node/142/log/
Add a useless action-if-true which won't affect the program flow, but
means we aren't emitting `then else` on old Autoconf.
Xamarin.Android is looking to switch to using the latest Android NDK, r18.
However, there are a few build issues in Mono and BTLS which need to be
addressed before that happens.
* BTLS fails to build some ARM assembly sources with NDK r18's clang.
https://github.com/mono/boringssl/pull/12 fixes this issue
* BTLS uses obsolete Android cmake toolchain file.
Add a configure option to set alternative toolchain file.
* NDK r18 minimu supported API level is 16.
This commit makes the API level configurable and sets the minimum platform
to API 16
* NDK r18 makes changes to declaration of `mmap` which break Mono build.
Detect NDK version in `mono-compiler.h` and act accordingly (do not
redeclare `mmap`)
* NDK r18 doesn't have `cpp` and SDKs build assumes it's present.
Detect whether `cpp` is present and, if not, use `compiler -E` instead.
* NDK r18 uses unified headers exclusively and requires __ANDROID_API__ to be
set in order to present the correct set of native APIs.
SDKs now define the macro when the `ANDROID_NEW_NDK` Make variable is set to
anything else than `no`.
- mono_threads_suspend_policy_name
- mono_threads_suspend_policy_are_safepoints_enabled
- mono_threads_suspend_policy_is_multiphase_stw_enabled
- mono_threads_suspend_policy_is_blocking_transition_enabled
The normal accessors (mono_threads_are_safepoints_enabled, etc) just apply the
policy acessors to the current policy
- Allow creation of JavaScript objects without resorting to json parsing and creating hooks.
- Small cleanup of the bindings routines.
- Modify WasmHttpMessageHandler to use new routines and take out the hackish calls.
* Adds portable version of EncodingTable
Most of the implementation is extracted from CoreRT
* Use string comparer directly
* Remove no longer used COMNlsInfo
* Adds localization support
* Removes FeatureCoreFxGlobalization configuration
* Remove redudant encodings look up from GetEncoding
* Keep Hashtable for nameToCodePage as it does not lock on read
* Replace locked dictionary lookup with short switch
* Include comment with msbuild task link used to generate the data file
Signed-off-by: dotnet-bot <[email protected]>
In the common case where it need to replace a non-empty extension with a non-empty extension, it currently incurs a substring without the original extension prior to then concatenating with the new extension. This PR avoids that.
(As the Path implementation is in corelib, this uses string.FastAllocateString and then formats into it with a span; if we wanted to avoid that, string.Create could also be used.)
* Add internal String.Concat overloads for spans
* Use span-based string.Concat overloads in several places
Signed-off-by: dotnet-bot <[email protected]>
* Fix bug in pulse transition - the suspend count was lost and incorrectly
swapped to 0.
* finish_async_suspend transition - add assertions that the suspend count is
positive. Try to catch incorrect states sooner.
Fixes https://github.com/mono/mono/issues/12235
[interp] Fix resuming into interp frame during EH
During EH, we can have the same frame twice on the stack, the original one and when invoking clauses in the same frame from EH. When having a resume state, we need to check if we should catch it in the current frame, or the original.
<!--
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
-->
Large portion of the current culture handling in the unmanaged runtime inherited from desktop has been no-op. The nativeInitCultureAccessors QCall that it used to depend on desktop got (almost) never called in CoreCLR.
- Delete resetting of current culture on threadpool threads. It was needed in desktop because of a very tricky flow of current culture between appdomains. It is superseded by the flowing the current culture via AsyncLocal in CoreCLR.
- Comment out fetch of managed current culture for unmanaged resource lookup. It has number of problems that are not easy to fix. We are not localizing the unmanaged runtime currently anyway, so it is ok to just comment it out.
- Fix the rest to call CultureInfo directly without going through Thread.CurrentThread
Signed-off-by: dotnet-bot <[email protected]>
We use SR.Format in almost all places where we format resource strings (without a format provider), but there were a few stragglers.
Signed-off-by: dotnet-bot <[email protected]>
When we do need to normalize, we're currently allocating the StringBuilder/char[] for the full path length. As long as the path length is less than the max cacheable size (360), we'll now use a cached builder.
Signed-off-by: dotnet-bot <[email protected]>
The former calls GetLowerBound(0) on both src and dst, which is unnecessary when the arrays are T[] and thus always have a lower bound of 0.
Signed-off-by: dotnet-bot <[email protected]>
* Change array construction with rank>4 to use not use varargs -- localalloc.
This fixes https://github.com/mono/mono/issues/12193.
This is alternative to https://github.com/mono/mono/pull/12200.
They are both pretty good approaches.
12200 uncovered a hash order dependency which should be fixed either way.
* Fix C++.
* Remove unused MONO_ARCH_VARARG_ICALLS and ARCH_VARARG_ICALLS.
```
typedef struct {
.
.
.
MonoMethod *method;
MonoMethod *inlined_method; /* the method which is currently inlined */
MonoMethod *current_method; /* The method currently processed by method_to_ir () */
MonoMethod *method_to_register; /* The method to register in JIT info tables */
} MonoCompile;
```
so at least remove one of them that is not really used.
* Consolidate identical functions type_from_handle and cominterop_type_from_handle
mostly into mono_type_from_handle.
However keep them separate for registration/patching sake, since
will error if register twice, else need to arrange to register once.
* [Coop] Convert {remoting,cominterop}type_from_handle.
* Fix warning about missing icall declaratons.
Typo fix
<!--
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
-->
System.Web.Caching.CacheItemLRU.this[string].get modifies LRU list so it
must be called under write lock. Cache.GetKeyLastChange violates this
constraint by acquiring only a read lock.
Fixes#12218
- In spin-wait loops that are not expected to last too long, Sleep(1) significantly delays threads from completing the operation
- From eliminating Sleep(1) in such spin-wait loops, there can be a tradeoff, better fairness vs worse throughput, because Sleep(1) removes threads from contention and in some cases fewer threads can make faster progress at the cost of delaying the Sleep(1) threads relatively significantly. Eliminating the Sleep(1) in such spin-wait loops seems to be a good tradeoff.
Signed-off-by: dotnet-bot <[email protected]>
* Moves generic comparer to shared CoreLib
* Keep Index/LastIndexOf optimizations in CoreCLR only
* Moved runtime-specific enum helper to runtime-specific partial type
Signed-off-by: dotnet-bot <[email protected]>
* Remove dead checks in Guid parsing
* Minor cleanups in Guid
* Delete unused failureMessageFormatArgument
Signed-off-by: dotnet-bot <[email protected]>
- This will download the most recent version of headless to use.
- Add junit-reporter to output a tests output file to be used for jenkins CI in the future.
ICALL_EXPORT should not be placed on HANDLES() functions.
Only the auto-generated wrappers need it, and they get it from the macro expansion.
And the explicit function declarations are generally redundant - the macro creates declarations, too.
This method doing blind find&replace of "mscorlib" with "System.Private.CoreLib". It is both incorrect (e.g. if the typename happened to contain "mscorlib" string) and inefficient (unnecessary allocations and use of reflection).
Signed-off-by: dotnet-bot <[email protected]>
Synchronized the code as much as possible with CoreCLR. The one major piece that I have excluded is tracing. I will look into doing that separately.
Signed-off-by: dotnet-bot <[email protected]>
* Updating the SIMD intrinsics to check for the `[Intrinsic]` attribute
* Ensure that the existing Vector/Vector<T> intrinsic methods are marked as such.
* Fixing Vector<T>.DotProduct and Vector.AndNot to be treated as intrinsic
* Fixing `SIMDIntrinsicBitwiseAndNot` to swap the operands for XARCH
Signed-off-by: dotnet-bot <[email protected]>
* [Coop] Mostly convert 30+ icalls used via register_icall.
And infrastructure to support that.
The infrastructure is not as ideal as it could be.
In future the C preprocessor wrappers should be marshal-ilgen wrappers,
so the handles are more efficiently created.
Some of the conversion is incomplete and just goes back to raw pointers,
but mostly it is good.
Some of the conversion is by replacing previously manual conversion
with more automatic conversion, but most of it is new.
* Replace `foo_raw` with `foo` and `foo` with `foo_impl` per https://github.com/mono/mono/pull/11941#discussion_r243436712.
* Replace gchandle with no_safepoints in mono_string_builder_to_utf16_impl.
https://github.com/mono/mono/pull/11941#discussion_r243438706
at least the one loop.
* Fix windows build: mono_string_to_utf8str vs. mono_string_to_utf8str_impl.
* Fix boehm ves_icall_string_alloc vs. ves_icall_string_alloc_raw.
* Reduce apparent or actual diff.
* Add link to GitHub issue.
* Fix merge.
* Reduce another apparent but probably not actual diff.
* FIXME missing error
* Reduce diff in comment.
* Reduce diff in comment.
This commit ensures that CVE 2018-8292 is fixed by not setting
auto-redirect in the first request done by CFNetwork. CFNetwork has the
same bug, but we can work around it by performing the first request,
checking the response and, if it is a rediret, follow it without the
Authorization headers.
I noticed that some controls do not dispose tooltips and timers. Depending on the underlying implementation these may use native resources. Therefore I'd suggest to dispose these with the parent control to not rely on the garbage collector to eventually release the resources.
Additionally, in the case of `ToolStrip.cs` `CloseToolTip` would first create the objects before turning them off.
* [Coop] Mostly convert System.String icalls. But do not pin due to perf/profiler.
* Use MONO_ENTER_NO_SAFEPOINTS / MONO_EXIT_NO_SAFEPOINTS
* Add FIXME to MONO_HANDLE_RAW (mono_ldstr_metadata_sig ()), looks like a reasonable place to temporarily suspend the coop conversion graph walk.
* Restore MonoObjectHandleOut to mono_handle_assign_raw (was mono_handle_assign).
* [runtime] Convert TypedReference icalls to handles, return the result using an out argument since wasm doesn't support TypedReference returns from icalls.
* Bump corlib version.
* [runtime] Change ArgIterator icalls to return typedref results using an out argument since wasm doesn't support typedref returns from icalls.
* Use MONO_HANDLE_RAW () only at the end.
Forward port of #10139
Needed for arm64_32 (#11691): We still need to build AOT compilers that are 32bit, which is only possible with Xcode9. However, arm64_32 needs Xcode10.
Relax HttpMessageRequest url scheme validation for wasm so that urls with a blob scheme make it to the host backend. Fixes#11681
note: the browser tests fail when running chrome 71 in headless mode, they work in chrome 70 and 72
* Bump to latest SQLite for Mac bundle
* Explicitly disable editline support.
SQLite assumes that if editline is enabled (the default), then NCurses was compiled with TermInfo support, which is not true on Mac
ystem.Exception: Generic Error [GDI+ status: GenericError]
at System.Drawing.GDIPlus.CheckStatus (System.Drawing.Status status) [0x00079] in <bb99ab19679c4cf79f4136bd0faf8b5e>:0
at System.Drawing.Graphics.FillRectangle (System.Drawing.Brush brush, System.Int32 x, System.Int32 y, System.Int32 width, System.Int32 height) [0x00025] in <bb99ab19679c4cf79f4136bd0faf8b5e>:0
at System.Drawing.Graphics.FillRectangle (System.Drawing.Brush brush, System.Drawing.Rectangle rect) [0x0002c] in <bb99ab19679c4cf79f4136bd0faf8b5e>:0
at (wrapper remoting-invoke-with-check) System.Drawing.Graphics.FillRectangle(System.Drawing.Brush,System.Drawing.Rectangle)
at System.Windows.Forms.Control.PaintControlBackground (System.Windows.Forms.PaintEventArgs pevent) [0x002ff] in <69ecb40f27a1431a99620933ba9a8b39>:0
at System.Windows.Forms.Control.OnPaintBackground (System.Windows.Forms.PaintEventArgs pevent) [0x00000] in <69ecb40f27a1431a99620933ba9a8b39>:0
at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message& m) [0x0005f] in <69ecb40f27a1431a99620933ba9a8b39>:0
at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x001a4] in <69ecb40f27a1431a99620933ba9a8b39>:0
at System.Windows.Forms.ScrollBar.WndProc (System.Windows.Forms.Message& m) [0x00000] in <69ecb40f27a1431a99620933ba9a8b39>:0
at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <69ecb40f27a1431a99620933ba9a8b39>:0
at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x0000b] in <69ecb40f27a1431a99620933ba9a8b39>:0
at System.Windows.Forms.NativeWindow.WndProc (System.IntPtr hWnd, System.Windows.Forms.Msg msg, System.IntPtr wParam, System.IntPtr lParam) [0x00085] in <69ecb40f27a1431a99620933ba9a8b39>:0
* [wasm] Add the fix for https://github.com/kripken/emscripten/issues/7399 as a patch for emscripten.
* [wasm] Factor out some flags from the makefile targets.
* [wasm] Enable EMULATED_FUNCTION_POINTERS.
G_BEGIN_DECLS is almost never needed. Esp. around entire files.
It is for "the OS" and interoperation with some code that is still C, like profilers.
MONO_BEGIN_DECLS is often used in internal headers, in which case the same, but
not addressed here.
MONO_BEGIN_DECLS is often used in public headers, along with comprehensive
MONO_API, in which case it is redundant. This would be useful if/when mono
goes back to using .def files, which are a good idea for multiple reasons.
Probably unused since a0c6e79318 in 2004.
Certainly unused since cc9c53a109 in 2008.
Except for use by MERP, replace with its implementation -- MONO_LOCALE_INVARIANT.
* [jit] Call mono_register_jit_icall_full () in more places so most jit icalls can be called directly during AOT.
* Fix a c++-ism.
* Fix a c++-ism.
* Fix a c++-ism.
This is a subset of https://github.com/mono/mono/pull/12023, maybe easier to review
in smaller pieces.
Alternatives:
1. Move more to managed.
2. Remove the feature.
* Add support for LLVM asserts in internal LLVM build on Windows.
* Only build LLVM using MSVC if not cross compiling.
If not cross compiling, building runtime where host/target is Windows, only
build and use LLVM as part of msvc build (only supported configuration),
disabled on gcc build.
Enforce 64-bit LLVM support when building using Visual Studio solution file.
* Disable Windows LLVM Visual Studio build on unsupported configurations.
Automatically disable Windows LLVM build in Visual Studio. This enables
the option to configure using --enable-llvm but still build all runtime
configurations from within Visual Studio. A warning will be issued into
build logs when LLVM support is disabled for a specific build configuration.
* Fix so build-init always have cygconf.h available when needed.
* The problem with this flaky issue was the timing of processing of the async tasks, as it was executed in background threads it was not possible to reach the end of execution because all the foreground threads exit earlier.
The solution creates a TaskScheduler that ensure that the thread that will execute the task will be a foreground thread and then the test always works.
Fixes#6997
Exposes a race condition in CoreFX when gensources tries to enumerate Cecil sources. Run it without `--trace=all`, 86 sources found. Run it with, even if redirected to `/dev/null`, 132 sources found. Eeeeeek.
[runtime] Remove duplicate merp invoke line
Looks like this broke when it got squashed down, or we overlooked it. We've got two calls where we expected one.
...of importing it at linux/macOS
this unbreaks the build on "unix" platforms like FreeBSD and AIX
(is this all needed files, and am I doing this right?)
if (klass = m_class_get_parent (klass))
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
icall.c:4408:12: note: place parentheses around the assignment to silence this warning
if (klass = m_class_get_parent (klass))
^
( )
icall.c:4408:12: note: use '==' to turn this assignment into an equality comparison
if (klass = m_class_get_parent (klass))
* [corlib] Import System.IO.TextWriter/StreamWriter from CoreFX
* Adjust a Mono test. According to CoreFX TextWriter sources, CoreNewLine should only be used for read-only purposes.
* Bump CoreCLR for bug fix on test which becomes much flakier apparently with this patch
* Bump corefx
* Bump API snapshot submodule
* [csproj] Update project files
- Reduce length computations of string builders.
- Handle zero sized StringBuilder correctly (initialize the first
not just the second character).
- Check for overflow correctly in StringBuilder -- include offset.
- Fix prototype of mono_string_to_byvalstr (gpointer vs. char*)
- Fix prototype of mono_string_to_byvalwstr (gpionter vs. gunichar2*).
- Single point of exit in mono_string_builder_to_utf8.
Includes the following from System.IO:
* FileSystemInfo
* FileInfo
* DirectoryInfo
* Directory
* FileSystem
* Path `Join()` Span API
and all of System.IO.Enumeration namespace.
Adds about 1600 System.IO tests
Behavior changes:
* `File.Replace` now replaces files even if they are read-only (using the `rename` syscall on Unix)
* Directory enumeration is no longer stable in the way that many Mono tests expect
* Some changes in when/whether some representations of directories contain a trailing separator character
* Changes in which exceptions are thrown (sometimes these are platform-dependent on CoreFX)
Issues:
* https://github.com/dotnet/corefx/issues/33486
* https://github.com/dotnet/corefx/issues/33490
Part of #7246
CC libtest_la-libtest.lo
<inline asm>:37:2: error: instruction requires: Not 64-bit mode
popl %eax
^
... same error many times
Fix ThisCall tests.
Libtest.c needs to be C++ for Visual C+++ to accept __thiscall.
gcc accepts __thiscall in C.
Visual C++ only accepts __thiscall on member functions and function pointers,
not globals. Gcc accepts on globals also.
So test what we can.
add extern C
Limit thiscall testing to Win32, even if gcc has more support.
Fix CHECK_CANARY_FOR_OBJECT.
..\mono\metadata\sgen-mono.c(1443): warning C4390: ';': empty controlled statement found; is this the intent?
(Why is this not a function?)
* [crash] Switch merp dumper to no-allocate file writer
- Pass merp directory to backend (optional)
- Adds tests that needed the named change
* [crash] Make mono-state use non-allocating format strings
* [crash] Add json formatting validators to mono/tests
* [crash] Make crash-sending icalls use const strings
* [crash] Use fork+exec for merp
* [crash] Throw exception when unable to contact merp
* [crash] Disable merp-json-valid test on non-OSX
* Elimination of mgreg_t in favor of target_mgreg_t and host_mgreg_t.
* [mips] Fix one host vs. target size.
* easier to read in narrow screen
* For posterity.
* Fix regression with building PPC JIT
d5547b1929 made an incorrect change
to `mini-ppc.c` that wouldn't build; revert that file.
* Switch to fixing mini-ops.h instead
Fixes https://github.com/mono/mono/issues/11317
(I guess I need to update culture-info-tables.h via make but it doesn't work on Windows, I have to switch to macOS).
CC libtest_la-libtest.lo
<inline asm>:37:2: error: instruction requires: Not 64-bit mode
popl %eax
^
... same error many times
Fix ThisCall tests.
Libtest.c needs to be C++ for Visual C+++ to accept __thiscall.
gcc accepts __thiscall in C.
Visual C++ only accepts __thiscall on member functions and function pointers,
not globals. Gcc accepts on globals also.
So test what we can.
add extern C
Limit thiscall testing to Win32, even if gcc has more support.
mono_class_init_internal is what mono_class_init was.
mono_class_init *adds* missing GC mode transitions and calls mono_class_init_internal.
Replace mono_class_init with mono_class_init_internal.
/s/mono/mono/mini/interp/interp.c: In function 'interp_entry_from_trampoline':
/s/mono/mono/mini/interp/interp.c:2422:3: warning: 'orig_domain' may be used uninitialized in this function [-Wmaybe-uninitialized]
mono_threads_detach_coop (orig_domain, &attach_cookie);
^
/s/mono/mono/mini/interp/interp.c: In function 'interp_exec_method_full':
/s/mono/mono/mini/interp/interp.c:2695:4: warning: 'locals' may be used uninitialized in this function [-Wmaybe-uninitialized]
memset (locals, 0, rtm->locals_size);
^
/s/mono/mono/mini/method-to-ir.c: In function 'mini_handle_enum_has_flag':
/s/mono/mono/mini/method-to-ir.c:3416:9: warning: 'load' may be used uninitialized in this function [-Wmaybe-uninitialized]
load = mono_decompose_opcode (cfg, load);
^
At least the first two seem to be compiler weakness.
2b029b3df4 broke ppc JIT tracing by
moving it into mini and changing the arguments. Since the mini IR
emitter handles tracing now, rip out the tracing code from the JIT.
(Looks like SPARC will need a similar change, but someone needs to
love SPARC first.)
The existing tests work with JavaScript Engines and do not have any way to test code that works only in the browser. The JavaScript Engines do not have access to any browser API’s so functionality like the WasmHttpMessageHandler can not be tested.
- Add test suite that uses Headless Chrome and Node.js with Karma.
- Allows testing the browser API.
Alternatively, safer, since it never worked, remove it.
/s/mono/mono/utils/mono-error.c:124:28: warning: comparison of constant 'MONO_ERROR_CLEANUP_CALLED_SENTINEL' (65535) with expression of type 'short' is always true [-Wtautological-constant-out-of-range-compare]
g_assert (orig_error_code != MONO_ERROR_CLEANUP_CALLED_SENTINEL);
~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fixing this reveals problems in ves_icall_System_Threading_Thread_GetAbortExceptionState,
i.e. the repaired assert fails, so this depends on https://github.com/mono/mono/pull/11889.
Also cleanup and optimize nearby.
This isn't correct for Win64 but that should be ok.
It is correct for all other platforms.
/s/mono/mono/sgen/sgen-memory-governor.c:309:5: warning: format specifies type 'ssize_t' (aka 'long') but the argument has type 'unsigned int' [-Wformat]
entry->promoted_size / 1024,
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/s/mono/mono/sgen/sgen-memory-governor.c:310:5: warning: format specifies type 'ssize_t' (aka 'long') but the argument has type 'unsigned int' [-Wformat]
entry->major_size / 1024,
^~~~~~~~~~~~~~~~~~~~~~~~
/s/mono/mono/sgen/sgen-memory-governor.c:311:5: warning: format specifies type 'ssize_t' (aka 'long') but the argument has type 'unsigned int' [-Wformat]
entry->major_size_in_use / 1024,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/s/mono/mono/sgen/sgen-memory-governor.c:312:5: warning: format specifies type 'ssize_t' (aka 'long') but the argument has type 'unsigned int' [-Wformat]
entry->los_size / 1024,
^~~~~~~~~~~~~~~~~~~~~~
/s/mono/mono/sgen/sgen-memory-governor.c:313:5: warning: format specifies type 'ssize_t' (aka 'long') but the argument has type 'unsigned int' [-Wformat]
entry->los_size_in_use / 1024);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/s/mono/mono/sgen/sgen-memory-governor.c:321:5: warning: format specifies type 'ssize_t' (aka 'long') but the argument has type 'unsigned int' [-Wformat]
entry->los_size / 1024,
^~~~~~~~~~~~~~~~~~~~~~
/s/mono/mono/sgen/sgen-memory-governor.c:322:5: warning: format specifies type 'ssize_t' (aka 'long') but the argument has type 'unsigned int' [-Wformat]
entry->los_size_in_use / 1024);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/s/mono/mono/sgen/sgen-memory-governor.c:332:5: warning: format specifies type 'ssize_t' (aka 'long') but the argument has type 'unsigned int' [-Wformat]
entry->los_size / 1024,
^~~~~~~~~~~~~~~~~~~~~~
/s/mono/mono/sgen/sgen-memory-governor.c:333:5: warning: format specifies type 'ssize_t' (aka 'long') but the argument has type 'unsigned int' [-Wformat]
entry->los_size_in_use / 1024);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/s/mono/mono/sgen/sgen-memory-governor.c:337:5: warning: format specifies type 'ssize_t' (aka 'long') but the argument has type 'unsigned int' [-Wformat]
entry->major_size / 1024,
^~~~~~~~~~~~~~~~~~~~~~~~
/s/mono/mono/sgen/sgen-memory-governor.c:338:5: warning: format specifies type 'ssize_t' (aka 'long') but the argument has type 'unsigned int' [-Wformat]
entry->major_size_in_use / 1024);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/s/mono/mono/metadata/w32file-unix.c:4688:1: warning: no previous prototype for function 'ves_icall_System_IO_DriveInfo_GetDriveType' [-Wmissing-prototypes]
ves_icall_System_IO_DriveInfo_GetDriveType (const gunichar2 *root_path_name, gint32 root_path_name_length, MonoError *error)
^
/s/mono/mono/metadata/remoting.c:2143:1: warning: no previous prototype for function 'mono_context_set_icall' [-Wmissing-prototypes]
mono_context_set_icall (MonoAppContext *new_context_raw)
^
/s/mono/mono/mini/mini-posix.c:229:2: warning: unused variable 'ctx' [-Wunused-variable]
MONO_SIG_HANDLER_GET_CONTEXT;
And beware icall-decl.h + Boehm producing:
w32file-unix.c:4905:16: error: implicit declaration of function 'GC_dlopen' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
libc_handle = dlopen ("/usr/lib/libc.dylib", 0);
^
or, if you fix that, unreferenced symbol _GC_dlopen.
* [corlib] Make by-ref struct actually ref now C# supports them.
This is technically breaking change but the types are already specialized
in C# compiler to be ref structs therefore the breaking change is more
theoretical than practical
* [mcs] Improves error reporting for special runtime types
* Bump API snapshot submodule
While working on PR #11829 I stress-tested the tests by running multiple test
runs in parallel, and it turned out that many tests were not parallel-safe,
because they used the same temporary file names and ended up stomping on
eachother.
So I implemented a helper method that creates a guaranteed unique temporary
directory, and I've changed all tests to use this new helper method.
Fix order of parameter processing.
New parameter addition was put in wrong spot in the parameter list. Also the offsets on the stack were incorrect as 32-bit values are placed in 64-bit aligned slots on s390x. Therefore, even though these are gbooleans the appear to be treated as gulongs.
<!--
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
-->
* [bcl] add fullaotinterp_llvm preset
That is, the AOT compiler uses the LLVM backend for BCL. AOT+LLVM is
used in the 'Release' configuration on Xamarin.iOS.
* [aot_full_interp_llvm] enable corlib tests
* More mgreg_t to host_mgreg_t or target_mgreg_t conversion.
Mostly target_mgreg_t.
Note that this is all optional, in the sense that cross compilers
never run their runtime. So mgreg_t is always target_mgreg_t, or
they are the same.
But agreement is to ban mgreg_t.
* [bcl] Disable some tests under WASM.
* [bcl] Pass a stack mark through TypeSpec.Resolve ().
* [runtime] Avoid freeing an error which gets passed back from an icall.
* [wasm] Make Environment.GetCommandLineArgs () work. Allow excluding tests on the command line.
* Fix some stackframe tests.
* [wasm] Add a missing dependency to the ninja files.
Fix https://github.com/mono/mono/issues/11898
This regressed six months ago at https://github.com/mono/mono/pull/9503/files#r238093574.
There are two identical sounding functions:
mono_string_handle_to_utf8:
What we usually use. Sounds reasonable. Usually is reasonable.
Allocates with malloc.
mono_string_to_utf8str_handle:
What should be used here. Allocates with CoTaskMemAlloc.
So it can be freed with marshal_free => CoTaskMemFree.
i.e. The allocator and the freeer need to agree.
It's only available in automake 1.13+. Since we only use it for tests
we can just make it optional on systems with earlier automake.
Fixes https://github.com/mono/mono/issues/11809
Removing BindingFlags checks from native code to instead
trust the checks made in managed code. This fixes the case
when events were incorrectly returned from types that
have overridden private or static events.
This might invalidate all existing data however and perhaps 32bits is enough.
/s/mono/mono/utils/mono-merp.c:227:63: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
g_string_append_printf (output, "BlameModuleOffset: 0x%x\n", merp->moduleOffset);
~~ ^~~~~~~~~~~~~~~~~~
%zx
/s/mono/mono/utils/mono-merp.c:231:59: warning: format specifies type 'unsigned int' but the argument has type 'guint64' (aka 'unsigned long long')
[-Wformat]
g_string_append_printf (output, "StackChecksum: 0x%x\n", merp->hashes.offset_free_hash);
~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%llx
/s/mono/mono/utils/mono-merp.c:232:55: warning: format specifies type 'unsigned int' but the argument has type 'guint64' (aka 'unsigned long long')
[-Wformat]
g_string_append_printf (output, "StackHash: 0x%x\n", merp->hashes.offset_rich_hash);
~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%llx
The first one isn't really a truncation but fix the warning.
Or use guint32 for module offsets instead of size_t.
* [interp] Remove some useless code
* [interp] Remove useless variable
When unwinding, we get the last interp frame that was executing from the LMF marker.
* [interp] Rethrow from the actual ip
Before we would rethrow from ip - 1 which could be part of another clause, screwing up EH.
* [interp] Enable all bcl disabled tests
* [tests] Include corlib suite on fullaotinterp
Disable more appdomain tests on fullaotinterp
* [interp] Bump again trampoline number for fullaotinterp
It wasn't enough for corlib and System.Core suites
Sync `X509Certificate2` implementation with CoreFX, similar to how we did for `X509Certificate` in "Blue" (#9650).
* Introducing `X509Certificate2ImplUnix` as new common base class for `X509CertificateImplApple`, `X509CertificateImplBtls` and `X509Certificate2ImplMono`. This uses the internal `CertificateData` class from CoreFX instead of the old "fallback" implementation from "Mono.Security".
* `MonoBtlsProvider`, `X509CertificateImplBtls`: the "fallback" option has been removed since we now always provide this functionality via the managed `CertificateData`.
* `X509CertificateImplMono`: This has been largely stripped down to use the new `X509CertificateImplUnix`.
```
abcremoval.c: In function 'process_block':
abcremoval.c:1061:6: warning: variable 'inst_index' set but not used [-Wunused-but-set-variable]
int inst_index;
^
driver.c: In function 'mini_regression_step':
driver.c:514:12: warning: 'func' may be used uninitialized in this function [-Wmaybe-uninitialized]
result = func ();
^
aot-compiler.c: In function 'emit_method_info':
aot-compiler.c:6388:10: warning: variable 'method_index' set but not used [-Wunused-but-set-variable]
guint32 method_index;
^
mini-codegen.c: In function 'mono_print_ins_index_strbuf':
mini-codegen.c:727:3: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'gpointer' [-Wformat=]
g_string_append_printf (sbuf, " %s", ins->inst_p1);
^
CC libmini_la-mini-exceptions.lo
mini-exceptions.c: In function 'summarize_frame':
mini-exceptions.c:1556:25: warning: unused variable 'ud' [-Wunused-variable]
MonoSummarizeUserData *ud = (MonoSummarizeUserData *) data;
```
Probably from:
https://jenkins.mono-project.com/job/build-package-dpkg-mono-pullrequest/label=ubuntu-1404-amd64/326/console
As of https://github.com/mono/mono/pull/11342 the regression tests (builtin-types.cs) call into System.Native incidentally as part of Interop.Sys type initialization. The --regression command line option was causing the --config part of the mono invocation to be ignored, resulting in a buried 'System.DllNotFoundException: System.Native' during the test run,
* [sdks] Reduce android provisioning to minimum
It's not in use by XA anymore, so we only care about what we require
* [sdks] Rework targets generation
* [jit] Refactor the constrained call handling code into a separate function. NFC.
* [jit] Move the low level call related code to calls.c. NFC.
* [jit] Use mini_emit_get_rgctx_klass () in a few more places.
* [jit] Add calls.c to common_sources.
* Fix some c++-isms.
* Fix the windows build.
Refactor tests to use system-assigned ports whenever possible, so that we
avoid the potential race condition in NetworkHelpers.FindFreePort.
This should make it much less probable to run into spurious "Address already
in use" exceptions.
In some cases I kept the call to NetworkHelpers.FindFreePort:
* When the test is not binding/listening on a port, but instead trying to
connect to an inexistent port (for tests that verifies error handling /
exceptions). In this case there is still a race condition (if a test tries
to verify that a connection fails, it may unexpectedly succeed instead).
* Sometimes the test doesn't actually use the port (the test is verifying
something very different, for instance a ArgumentNullExceptions, which are
thrown before the port is used).
* Some API doesn't allow for requesting a system assigned port:
* HttpListener: in this case I elected to re-try a few times in case of
"Address already in use" exceptions.
* The 'UdpClient (string, port)' constructor (other constructors work
fine): these turned out a bit complicated to work around (or would
modify the test more than would be reasonable), so for these we still
have to hope for the best.
Hopefully fixes https://github.com/xamarin/maccore/issues/604.
This is a no-op on gcc ppc for AIX, Linux, and FreeBSD, and should
not be used until gcc implements this. (It *does* on ARM, RISC-V,
Alpha, and MIPS, however - but not PowerPC or x86, based on a skim
of gcc source.)
Should fix#11527.
While working on PR #11829 I stress-tested the tests by running multiple test
runs in parallel, and it turned out that the X509StoreTest is not parallel-safe.
This fixes the X509StoreTest test to parallel-safe.
- Adds the ability for the packager to search in additional folders when resolving assemblies.
- Ignore missing symbols when resolving assemblies, which can happen for facade assemblies.
[interp] Fix interp inline
<!--
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
-->
This reverts commit e15b8c53ff.
It broke other builds.
Revert "[bench] Revert hardcoding of microbenchmarks to run-jenkins (#11787)"
This reverts commit 7a81ac67a2.
* [interp] Check for exception if we always catch it in coop case
* [interp] Enable more fullaotinterp tests
billions and billions
* [interp] Reorganize tests for fullaotinterp
* [interp] Don't include internal frames in stack trace
For handled exceptions. On unhandled exceptions we leave them for debugging purposes.
Fixes exception18.cs
When doing AOT build of builtin-types.exe using a debug compiled LLVM build the
following assert occurs:
Assertion failed: C1->getType() == C2->getType() &&
"Operand types in binary constant expression should match",
file C:\github\mono\external\llvm\lib\IR\Constants.cpp, line 1717.
This happens due to an optimization in cfold.c that removes the widening
done to a const variable in C:\github\mono\mono\mini\mini-native-types.c@224
and when that variable is later used in 64-bit LLVM lowering of OP_LNEG, OP_LNOT
they mismatch the static const 64-bit int used as operands triggering the assert.
Fix is to make sure the operand used when lowering these opcodes are converted
to matching operands.
Incorrect calculation of start of nullable buffer caused stack corruption.
Currently this was only identified on Windows x64 due to use of alternative
ABI register storage types. Fix resolves crash in test_0_dyncall_nullable.
* [runtime] Add a mono_runtime_get_caller_from_stack_mark () function, use it in a few places. NFC.
* [bcl] Add a stackMark argument to AppDomain.Load () calls.
[mini] use AOT trampolines in interp mixed mode
Fixes this on mscorlib/mixed mode on Xamarin.iOS:
```
[FAIL] NonExceptional.Serialization_Deserialization : System.Runtime.Serialization.SerializationException : An error occurred while deserializing the object. The serialized data is corrupt.Â
[FAIL] NonExceptional.Serialize_Deserialize_FixedDateRule : System.Runtime.Serialization.SerializationException : An error occurred while deserializing the object. The serialized data is corrupt.Â
[FAIL] NonExceptional.Serialize_Deserialize_FloatingDateRule : System.Runtime.Serialization.SerializationException : An error occurred while deserializing the object. The serialized data is corrupt.Â
[FAIL] SerializationTests.Serialization_Deserialization : System.Runtime.Serialization.SerializationException : An error occurred while deserializing the object. The serialized data is corrupt.Â
[FAIL] TimeZoneTest.CurrentTimeZone_SerializationRoundtrip : System.Runtime.Serialization.SerializationException : An error occurred while deserializing the object. The serialized data is corrupt.Â
```
* [corlib] Refactor Type:GetName () to reduce differences with refsources and make it easier to add support for
stack marks later.
Move the icall to RuntimeTypeHandle. Pass a unused stack mark and a unused reflectionOnly parameter.
* Bump API snapshot submodule
[interp] Add inlining of small methods
Avoid call overhead by inlining small methods. We replace stinarg opcodes with storing of the arguments in locals allocated in the parent frame (for each argument).
TODO
- support for methods with locals
- maybe add inline costs to prevent over inlining
On microbenchmark inlining can improve up to 3.5x (less than the 5x that I observed with jit).
Contributes to #11531
Yes, I do know of a possible refactor, but why not get this working? This will enable `System.Net.Sockets.Socket` to depend IPv4/IPv6 are working, and thus, fix a LOT of issues on CI; a bunch of test suites have one or two things that depend on loopback, which is currently busted unless you nop out Socket's protocol check.
Also made a note that the Mac version of the backend is actually likelier to work under other OSes. Structures are kinda ugly, but they work; it took a whole morning and night beating them into submission.
Untested under PASE, though I've marked notes for self to what's different. (My guess: it works, but not as well as it should - but good enough so that Socket starts working again.)
And hey, the Mac backend can't do this!
```
csharp> NetworkInterface.GetAllNetworkInterfaces().Select(x => $"The MTU of {x.Name} is {x.GetIPProperties().GetIPv4Properties().Mtu}");
{ "The MTU of en0 is 1500", "The MTU of lo0 is 16896" }
```
We weren't checking whether the runtime returned a zero exit code which
means if the compilation failed we still reported success.
Now the exit code is propagated all the way up and we report an error
both to make and to the xml result file.
Since iltests.exe contains a test with expected invalid IL this would
now cause a failure. The easiest fix is to just move that test from
mono/mini to mono/tests since all other tests are fine.
Fixes https://github.com/mono/mono/issues/11091
Try to make all entry points into the loader look more uniform by taking a request
struct instead of a big pile of arguments. Where it makes sense, make the
structs subtypes of each other so that more general arguments are shared.
- Pass assembly load arguments in a struct
- Pass assembly open arguments in a struct
- Push MonoAssemblyOpenRequest creation to some callers
- Drop is_private argument to try_load_from
It's been dead code for ten years since c9e8bac0c3
- Get rid of mono_assembly_open_a_lot
- Drop dead static function
- Replace mono_assembly_load_full_nosearch by mono_assembly_request_byname_nosearch
- replace mono_assembly_load_full_internal by mono_assembly_request_byname
- Make mono_assembly_request_byname the internal API
pass a no_postload_search flag in MonoAssemblyByNameRequest, usually FALSE.
Pass TRUE in the one caller of the old mono_assembly_request_byname_nosearch.
- Pass the requesting assembly via MonoAssemblyByNameRequest
- Prepare loader Requests with an initialization function
prevent endless recursion in ListView.ToString()
do not access the Items[] in ListView.ToString() in VirtualMode
as this might cause an endless recursion if ToString() is called
from within the RetrieveVirtualItem event handler
Fixes#11049
* [runtime] Initialize MethodBody objects by calling a ctor instead of accessing the object directly. This allows the MethodBody type to be removed by the linker.
* [bcl] Preserve CustomAttributeData and related types using PreserveDependency attributes on the GetCustomAttributesDataInternal () icall.
* Fix a test.
* Fix C++ build failures.
* Bump API snapshot submodule
* [wasm] Add the declaring types assembly name to the mangled name for instances during dedup. Fixes failures when two assemblies have a generic type with the same name.
* [runtime] Rename MONO_WRAPPER_UNKNOWN to MONO_WRAPPER_OTHER.
* [aot] Make the aot name mangling a little denser.
* [wasm] Don't emulate lojg shifts/multiplications.
* [runtime] Fix warnings.
* [aot] Small cleanups to the dedup code:
* Fix the dedup logging in llvmonly mode.
* Split mono_compile_assembly () into 2 functions, the second one doing the emission.
* Split the setting of cfg->skip from emit_code ().
* Skip more code and some logging for the other assemblies in the dedup-include case.
* [jit] Do the conversion to JIT intrinsics somewhat earlier.
This is needed to avoid emitting the code for passing the mrgctx etc. for
generic intrinsics like RuntimeHelpers.IsReferenceOrContainsReferences ().
* [aot] Implement sharing of gsharedvt wrappers passing/receiving
valuetype arguments based on their layout.
This is done by replacing valuetypes with instances of the
newly added Mono.ValueTuple generic structures inside the
wrappers. For example, for the type:
struct FooStruct {
int i; object o;
}
and the gsharedvt out wrapper:
gsharedvt_out (ref FooStruct v);
This will be replaced by:
gsharedvt_out (ref ValueTuple<int, object> v);
The two structures have the same layout so as far as the JIT is
concerned, they are identical.
* [aot] Share native int/native uint with int32/uint32 in gsharedvt wrappers on 32 bit platforms.
* [bcl] Make the Mono.ValueType structs internal.
Can either have a multi-dimensional array type or an array with a lower
bound, not both. (eg `System.Int32[,,]` vs `System.Int32[*]`, but not `System.Int32[*,]`)
Fixes https://github.com/mono/mono/issues/11684
* Revert "[wasm][binding] Allow the cleanup of transparent/bridged marshalled objects causing leaks. (#11660)"
This reverts commit 75741eb68d.
* Revert "[wasm] Add the declaring types assembly name to the mangled name for instances during dedup (#11724)"
This reverts commit 63fb96c61a.
* Revert "[runtime] Skip sentry upload when tool fails to build (#11726)"
This reverts commit cb690285fb.
* Revert "[sdks] Add mac-{mac32,mac64} and ios-tools64 targets (#10964)"
This reverts commit 6f1537ef58.
- Example: When a delegate is marshalled to JS it is allocated so that it is not GC'd. Since we do not know when JS is finished with the delegate we need a way, for right now, to tell the Runtime to de-allocate the object and remove the transparent/bridged instance from JS as well. The side-effect of not doing this is that any local that is captured (used) by a lambda became heap memory and were allocated as fields on the object. Since the delegate is never a candidate for GC the local that was captured was never released either.
- Fix an error with Windows Edge and Windows IE that threw an exception `Object doesn't support this action` on certain host objects. This only affected Windows Edge and IE when using the JavaScript delete operator to clean up an object after being disposed.
- Cleanup marshalled Tasks after completion. The marshalled tasks and their continuation objects were never un-allocated thus not allowing them to be GC'd.
## Problem
Even after #10942, menus and toolstrips still look awful with a dark theme:

## Previous attempt
#10942 was a first stab in the dark at what was going on here, before I managed to get mono to compile for testing. I was hopeful that it would address this, but the problem was different.
## Another red herring
Later I thought the problem might be that `SystemColors.ButtonFace.IsSystemColor` was `false`. It looked like this might have caused the runtime to interpret `ButtonFace`'s special 168 value as an RGB code instead of a system color marker.
This fix had no effect (see below for true cause), but I'll include it anyway; the lower bound of the upper system colors block needs to decrease from 170 to 168 to allow `ButtonFace` and `ButtonHighlight` to be considered system colors:
https://github.com/mono/mono/blob/44db64c620c2c957a49b3f5a69cb09c19c1c8c1a/mcs/class/System.Drawing/System.Drawing/KnownColor.cs#L200-L203
## Actual cause
The toolstrip color comes from `ProfessionalColorTable.ToolStripGradientBegin` and `ProfessionalColorTable.ToolStripGradientEnd`. The latter color is hard coded to a light shade, but the former defaults to `SystemColors.ButtonFace`.
These are the colors that are loaded from the GTK system theme:
https://github.com/mono/mono/blob/b104565ccfde477fc7b6308f2d3e4efff0af5848/mcs/class/System.Windows.Forms/System.Windows.Forms/X11DesktopColors.cs#L111-L116
Note that `ButtonFace` is not among them. This means that it uses a compile time default, and is not a good choice for the background of a control. `ToolStrip` is using it anyway, but other controls use `SystemColors.Control` instead.
## Changes
There are two obvious ways to fix this:
1. Use `SystemColors.Control` instead of `SystemColors.ButtonFace` in `ProfessionalColorTable`
2. Load `SystemColors.ButtonFace` from the system theme
This pull request does both. In addition, it also sets the other end of the toolstrip gradients to `SystemColors.ControlLight` instead of a hard coded value. The choice of `ControlLight` was made because in those cases where alternate hard coded values were available for both sides of the gradient, the "other" side was consistently lighter. Now it looks better:

* [threading] Add `pulse` transition and begin_pulse_resume_and_request_suspension operation.
A `pulse` atomically resumes a preemptively suspended GC Safe thread and
requests that it suspend again.
If the thread reaches a GC Safe -> GC Unsafe transition, it will self-suspend.
If it doesn't, another iteration of the 'mop up' STW phase will async suspend
it again.
* [threading] Use pulse_resume_and_request_suspension in STW
With non-hybrid suspend, a pulse is just a resume.
With hybrid suspend, a `pulse` is a combination of a resume of a preemptively
suspended GC Unsafe thread and a request that it suspend again - as if we
atomically resumed the thread and then applied the initial phase of two-phase
suspend again. If the now-running thread comes to a GC Safe -> GC Unsafe
transition it will suspend. If not, we will preemptively suspend it again
during the mop-up phase.
The important thing is that we don't want the thread to transition to GC Unsafe
again: if it does so, it may try to take a lock that some other
async-suspended thread is holding, and it will never reach a safepoint ---
exactly the situation that two-phase suspend is supposed to solve.
* [threads] Add mono_threads_is_multiphase_stw_enabled
Flip the logic in mono_thread_info_begin_pulse_resume_and_request_suspension
The previous code read all the .dll and .exe files even when there actually wasn't any mono_crash.*.json file to process.
In the happy case of no crash file this cuts the time from 60s to 5s.
We can also use more efficient patterns in Directory.GetFiles() instead of getting _all_ files and filtering in-memory.
Lastly we also ignore printing a message when a debug symbols file wasn't found for an assembly, this is an expected case for a lot of our assemblies.
Using InMemory Cecil reading shaves another 20s off.
PASE is the Unix subsystem of IBM i, and is binary compatible with AIX. Since IBM i is not a Unix, there are some subtle differences between both environments.
There is an issue with the way PASE on IBM i 7.2 behaves differently than AIX with regards to the POWER_n_ANDUP defines for CPU compatibility. When trying to build on i as opposed to AIX, the following errors appear which break the build:
```
make[5]: Entering directory '/home/YVANJ/mono-on-i/mono/mono/utils'
CC libmonoutils_la-mono-hwcap-ppc.lo
mono-hwcap-ppc.c: In function 'mono_hwcap_arch_init':
mono-hwcap-ppc.c:67:6: error: implicit declaration of function '__power_4_andup' [-Werror=implicit-function-declaration] if (__power_4_andup())
^~~~~~~~~~~~~~~
mono-hwcap-ppc.c:67:2: warning: nested extern declaration of '__power_4_andup' [-Wnested-externs]
if (__power_4_andup())
^~
mono-hwcap-ppc.c:69:6: error: implicit declaration of function '__power_5_andup' [-Werror=implicit-function-declaration] if (__power_5_andup())
^~~~~~~~~~~~~~~
mono-hwcap-ppc.c:69:2: warning: nested extern declaration of '__power_5_andup' [-Wnested-externs]
if (__power_5_andup())
```
This commit adds `#ifdef`s to handle this condition so the build works on IBM i 7.2 now. The resulting application code should not differ from the AIX output, however, this patch fixes the build failure.
test_lib_dir is only defined after the library.make include so we need
to move the logic further down.
Additionally we don't even need to build this assembly ourselves since
corefx already contains a prebuilt binary.
Currently, setting IsWrapped=false on a MessageContract leads to an error in serialization due to an empty element being present where the wrapper element would have been, instead of it being gone entirely.
The serialization then fails because the empty string is not valid localName (which of course is fine).
The helix binaries weren't getting included so the uploader tool failed to build.
While we don't need them for a tarball build it's easier to just include them.
[configure] Pass -stdlib=libc++ to clang on darwin to build C++ code
On iOS 6.0 (`-miphoneos-version-min=6.0`), this is needed to get modern C++11
headers like `<type_traits>`. It does not seem to harm anything to
over-approximate and pass it to clang always when building on Darwin.
This pull request fixes starting a process with an empty environment variable collection in `ProcessStartInfo`. As per the issue it fixes a regression that it used to work but currently an empty environment variable collection works like it was never touched.
I also made a minor fix to remove the `StringBuilder` because a simple `string.Concat` does the job without the `StringBuilder` allocation and overhead.
I've included unit tests. Please let me know if you'd like any changes.
Fixes#8766
* [metadata] Compute interface offsets of ginst by inflating the GTD instead of doing it from the grounds up. Fixes#10837
Say you have;
```
interface Bar<T> { T Bla(); }
class Foo<A,B>: IBar<A>, IBar<B> {
int IBar<int>.Bla)() { ... }
}
```
The GTD of Foo will have the following interface offsets table:
```
4: IBar<A>
5: IBar<B>
```
With the existing code, if you have Foo<int,int> the interface offsets table will look like this:
```
4: IBar<int>
```
The problem with that is it will produce a hole in the vtable and subclasses of Foo<int,int> will have not on slot 5.
That would be just wasteful, unless you have this:
```
class Sub: Foo<int,int>, IBar<int> {
int IBar<int>.Bla)() { ... }
}
```
IOW, a subclass that overrides the interface implementation in Foo. The problem is that it's not always reliable to which iface offset
calls to `IBar<int>` will go through and thus it's possible to have calls made against instances of `Sub` to execute the code from its base
class.
The solution is to inflate the interface offsets table from the gtd as that will preserve the number of entries and will cause the
rest of the vtable layout code to fill the duplicated slots correctly.
* Add regression test for #10837.
* [sre] Replace assert with proper error handling.
* [metadata] Don't mono_class_init ifaces, just have offsets setup.
* [metadata] Make setup_interface_offsets not depend on mono_class_init and fix lazy iid computation.
All that interface offset setup needs are iid as the output in interfaces_packed is sorted by it. Remove
the need to use mono_class_init by properly extracting and making iid setup lazy.
Beyond that, make mono_get_unique_iid not return 0 as a valid iid.
Otherwise we don't have a proper sentinel value when lazily computing iid.
* [metadata] Keep interfaces in the same relative order when computing offsets
qsort() is not guaranteed to be a stable sort (one that keeps elements with the
same key in the same order). For example, the msvc qsort isn't stable.
Add an insertion_order field to ClassAndOffset to keep interfaces with the same
interface_id in the same relative order.
This is all relevant because in setup_interface_offsets we could see the same
interface multiple times (for example, with generics) at different offsets.
* [sdks] Compile support/{zlib-helper,nl}.c so XA doesn't have to cherry-pick it.
* [sdks] Fix ios and android compilation and use of tests
The tests are already built as part of the archive, so there is no need to recompile them. We just need to pick them from the right folder.
[interp] Small fixes
<!--
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
-->
Some jobs pre-clone repositories into acceptance-tests/external, those
would be removed. We don't need to do that, all we want is to have
clean submodule repos so just cd into the repos and clean them.
Right now we create a separate FileSystemWatcher for each file in
CacheDependency. On systems where inotify handles are limited this
leads to problems. As a workaround we can share the FSW which watches
the same directory. Since this wasn't extensively tested, hide it behind
and environment variable.
We enable this in the Helix environment only for now.
The test-bundle target copies all assets needed for test execution
to a specified directory. We upload this directory to Helix and use it
to run our mainline tests.
build. LLVM build follows similar pattern as BTLS build and will be build
as part of regular Visual Studio build Mono runtime if LLVM has been enabled
through the autogen.sh, --enable-llvm or –with-llvm argument. It is also
supports msbuild properties MONO_ENABLE_LLVM, MONO_EXTERNAL_LLVM_CONFIG,
if Visual Studio Mono runtime has been built without using autogen.sh.
When just using –enable-llvm, LLVM build will try to build internal LLVM
branch under external/llvm or if override has been set in props file
(using MONO_INTERNAL_LLVM_SOURCE_DIR), an alternative LLVM source
directory path. If –with-llvm has been used pointing to an llvm-config.exe,
no internal LLVM will be build, but the external LLVM build will be used.
Needed LLVM executables (opt.exe, llc.exe) will be installed into regular
Visual Studio Mono runtime build output directory.
The internal Mono LLVM 6.0 release will build as part of changes to this
commit, but it has not yet been fixed to work as expected during runtime.
That work will be done in different commit. The Mono LLVM 3.6 branch will
however work as expected for Windows x64 and can be setup and used using
–with-llvm argument or build as part of Visual Studio build Mono runtime
by enabling msbuild properties, MONO_ENABLE_LLVM and
MONO_INTERNAL_LLVM_SOURCE_DIR.
* Clean up leaks in the WasmHttpMessageHandler.
- Most of the leaks present themselves during a Cancel of a streaming request.
* Make WasmHttpMessageHandler the default handler for WebAssembly
- Required libraries WebAssembly.Net.Http.dll and WebAssembly.Bindings.dll.
* Clean up spacing
So this is possible now:
```console
$ REGRESSION_FILTER_METHOD=test_0_return ./mono/mini/mono-sgen --single-method=inline ./mono/mini/basic.exe
$ # or
$ REGRESSION_FILTER_METHOD=test_0_return ./mono/mini/mono-sgen --regression --interp ./mono/mini/basic.exe
```
* [corlib] Move Stack and Queue to mscorlib as we want to used them by
implementation code in mscorlib
* Bump API snapshot submodule
* [csproj] Update project files
.NET resource assemblies live in subdirectories named after the culture
of the resource. We need to package these assemblies too.
Follow up to https://github.com/mono/mono/pull/11575
[icalls] remove DISABLE_POLICY_EVIDENCE
Originally it was introduced with https://github.com/mono/mono/commit/db3591bb93dfe913c39ff73b95194effb88c880a . It seems like only the icall definitions were disabled for device runtimes (which aren't shipped there anyway), however the icalls themselves are _included_ in the device runtime. Note that the definitions are available to the AOT compiler.
Not sure what the rationale was behind this. Since the original change is very old, I think it just happened to be like that today. When running with the interpreter we need the icalls definitions at run-time available too (via the optional icall table that is linked in, so no additional cost for the fullAOT runtime due to this change).
Also remove `HANDLES_MAYBE` since it isn't needed anymore.
I think eventually we want to have `--enable-minimal=policy_evidence` that _also_ excludes the actual icalls, but this will need changes on the BCL side as well.
Don't override default LLVM's opt & llc args via llvmopts-add and llvmllc-add commands
Currently we can pass custom arguments to LLVM's `opt` and `llc` via:
```
mono --aot=llvm,llvmopts="...",llvmllc="..."
```
but those completely override the default arguments mono uses (some of them are required).
E.g. lets say I need to add `-foo` to both opt and llc, I should do:
```
mono --aot=llvm,llvmllc="**-foo** -march=x86-64 -mattr=sse4.1 -asm-verbose=false
-disable-gnu-eh-frame -enable-mono-eh-frame -mono-eh-frame-symbol=_mono_aot_p_eh_frame
-disable-tail-calls -no-x86-call-frame-opt -relocation-model=pic
-filetype=obj,llvmopts="**-foo** -O2 -disable-tail-calls"
```
So this PR introduces new commands `llvmopts-add` and `llvmllc-add` to be able to simply do:
`mono --aot=llvm,llvmopts-add="-foo",llvmllc-add="-foo"`
PS: let me know if you don't like the `-add` suffix
/cc: @migueldeicaza
[mini] do not emit safepoints for methods without calls and loops
with this optimization, running Roslyn with mono on
`mono/tests/pinvoke11.cs` compiles:
* 2019 methods without safepoints, and
* 9443 methods with safepoints.
1) We try to include every source in .sources but that doesn't work
for generic _test.sources since we'd need to prepend the Test/ path.
2) MonoNativeConfig.cs.in was removed in 273f120c52
In preparation of the upcoming FSW support, `Mono.Native` now supports icall registration
and has a test added for this. This doesn't actually hook up FSW yet on iOS, but all the
preparations have been made as well as some tests for it.
* When using Bitcode (iOS only), we now link against the Mono runtime because we cannot have
any undefined symbols. Without Bitcode, the `mtouch` tool will do the linking for us.
* Add `-framework GSS` if needed.
* Removed `common/MonoNativeConfig.cs` - the test harness in `xamarin-macios/tests/xharness`
now takes care of that.
* Include a few more `System.Native` files on IOS.
* `mono_native_initialize()`: New native method to initialize the module and register any
necessary icalls. We register a new `Mono.MonoNativePlatform::IncrementInternalCounter`
icall for testing purposes.
* `mono_native_is_initialized()`: New native method for testing.
* `MonoNativePlatform.Initialize()`, `IsInitialized()`: Managed side of these.
* `MonoNativePlatform.IncrementInternalCounter()`: New icall, which is registered by
`mono_native_initialize()` - this is used by the test suite to make sure the icall
registration works.
* `NativePlatformTest`: Removed compat / unified check, see above. Add tests to call
the other managed APIs via reflection.
* Reduce TLS accesses.
Functions with HANDLE_FUNCTION_ENTER, only call mono_thread_info_current once,
instead of 1 + per-MONO_HANDL_NEW.
This can be extended in future in multiple potential ways.
1 Macro split from HANDLE_FUNCTION_ENTER.
This is easiest/no downside, i.e. for functions that do not HANDLE_FUNCTION_ENTER
but that do multiple MONO_HANDLE_NEW, call other macro
just to mono_thread_info_current () into local.
2 Pass TLS as seperate parameter. Probably not actually, see 4.
3 Store TLS in handles -- too large? Probably not actually, see next.
4 Store TLS in MonoError. i.e. MonoError is "call context", chained
up to "thread context".
* [threads] Add a no_safepoints bit to the thread state machine.
Only valid on RUNNING or ASYNC_SUSPEND_REQUESTED.
Currently no transitions set the bit, but the expectation is that it can only
be set/unset by the current thread on itself and only in RUNNING or
ASYNC_SUSPEND_REQUESTED.
Transitions to suspended states or to GC Safe states are forbidden if
wont_safept is set.
The intention is that this is used by a thread to mark a scope where it will
not safepoint (perhaps because it wants to manipulate a raw ptr to a managed
object).
The wont_safept bit only makes sense for cooperative suspension. For async, we
have the critical regions (which should be much more rarely needed).
* [threads] Add state machine funcs to query/set/uniset wont_safept
* [threads] add MONO_ENTER_NO_SAFEPOINTS/MONO_EXIT_NO_SAFEPOINTS macros
A region between MONO_ENTER_NO_SAFEPOINTS/MONO_EXIT_NO_SAFEPOINTS must not call
any function that could: reach a safepoint (and suspend the current thread),
allocate memory from the managed heap, or transition to GC Safe. In such a
region it is safe to dereference a pointer to managed memory and use read/write
from it (an alternative to avoid the no safepoints region is to pin the memory
with a global GC handle before manipulating it). GC Write barriers still need
to be used.
The current design doesn't allow nesting - the underlying thread state
transitions check that the flag isn't already set - keep the regions short and simple.
* [sgen] Don't initiate STW from a thread in a NO_SAFEPOINTS region
In other words, if you were in
MONO_ENTER_NO_SAFEPOINTS/MONO_EXIT_NO_SAFEPOINTS, you shouldn't be calling
anything that would start the GC
Move the allocation of got offsets for calls to a separate pass after all methods have been compiled. This means
that got offsets do not need to be allocated for calls which can be turned into direct calls.
Upcoming changes to monolinker will make additional optimizations when no instance ctors are marked.
To be safe, add preservations for the ctor's of types that are created in the runtime.
The change to preserve the .ctor() of`System.Runtime.Remoting.Messaging.AsyncResult` was made for more than out of caution. We have a simple delegate test that hung without this.
* Modification to allow deserialization of derrived types
* white space correction
* second attempt
* third attempt
* fourth
* whitespace
* maybe fix null ref exception
* missed same condition in other method
* fixing condition
* hopefully correcting the test failure in AOT
* Modification to allow deserialization of derrived types
white space correction
second attempt
third attempt
fourth
whitespace
maybe fix null ref exception
missed same condition in other method
fixing condition
hopefully correcting the test failure in AOT
formatting
missed some formatting
* adding a test for PR #11194
* fixing a few exceptions
* adding ref
We aot only the bcl (--aot=full,interp) while the tests code is interpreted.
<!--
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
-->
The change which made the handler return (rather than crashing the
runtime) did not consider this control flow path that causes the sigterm
signal handler to trigger the merp dumper if we return.
We now always return.
This was previously so that a random sigterm could be used to trigger a
dump. This isn't really used, and won't work right now anyways
(we don't register it until right before we dump). My fix is to remove
it, and to make the signal handler only work as part of the dumper
machinery.
[interp] Optimise method execution start
This can lead to 4% general speedup
<!--
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
-->
* [metadata] Fix strict prototype warning.
* [metadata] Remove unused variable.
* [metadata] Fix unused function warning.
* [metadata] Fix unused function warning for swap_with_size().
* [metadata] Fix "may be uninitialized" warnings.
* [metadata] Simplify missing ICustomMarshaler exception throwing case.
With current code there is no reason to have explicit jump label.
* [llvm] Rewrite the bitcode get_method () generated method to load the result from a table on wasm instead of a huge
switch statement.
This might be usable on other platforms in the future but having a table full of function pointers might lead to linking
problems.
* [llvm] Make direct calls to jit icalls without wrappers as well.
* [llvm] Export mono_llvm_clear_exception () with G_EXTERN_C, its called from llvm generated code.
* [wasm] Emit target layout/target triple into bitcode files.
* [aot] Allow the decoding of references to icall wrappers, so compiled code can reference them directly using a MONO_PATCH_INFO_METHOD.
* [llvm] Call icall wrappers directly from corlib code in llvmonly mode instead of going through the GOT.
* [llvm] Instance methods without got accesses don't need initialization in llvmonly mode.
- Adds support for HttpCompletionOption.ResponseHeadersRead by delaying reading of the response body into HttpContent
- Adds optional support for streaming responses in supported browsers
- Adds support for canceling in flight fetch requests
Create docs directory and update sample documentation.
- Add getting started docs directory
- Add section of obtaining the mono distribution.
resolves: https://github.com/mono/mono/issues/11346
Fix distribution package from wasm build to have the same structure as `packager.exe` is expecting.
resolves: https://github.com/mono/mono/issues/11344
* Integrate msvc build into make build system.
Add support to perform msvc build as part of regular make build. By default
msvc build will not automatically be done and needs to be enabled using
--with-msvc argument passed to ./autogen.sh. Doing msvc build as part of
regular make will automatically set MONO_EXECUTABLE to build msvc build
Mono runtime used in BCL and Test build as well as runtime used when running
tests.
* Add support to install msvc build mono runtime.
* Disable --with-msvc argument for none Windows builds.
* Fix VS2015 Build Tools build environment.
* Updated with review feedback switching to --enable-msvc.
On all platforms, mono_w32file_get_volume_information is only asked for its last parameter.
So replace mono_w32file_get_volume_information with mono_w32file_get_file_system_type that
only takes that parameter.
* [reflection] Implement RuntimeType.IsByRefLike
* [runtime] Add MonoClass:is_byreflike bit
Not set anywhere yet.
* [custom_attrs] Add mono_class_metadata_foreach_custom_attr
Unlike mono_custom_attrs_from_class_checked, this iterator function iterates
over the metadata without taking the loader lock or constructing class
instances, so it is safe to use during assembly loading or class initialization.
* [class-init] Set is_byreflike from attributes in mono_class_create_from_typedef
* [class-init] Set is_byreflike for generic instances
* [class-init] fail arrays of IsByRefLike elements
* [class-init] Check for ByRefLike struct fields
ByRefLike types only allowed as instance fields of structs that are
themselves ByRefLike.
* [runtime] Disallow instantiating generics with ByRefLike types
Instantiating a generic with a `ref struct` is not allowed.
* [runtime] Disallow instantiating generics with TypedReference
Reverts f457a01416. That was a hack to support
gsharedvt (gsharedvt worked by hijacking TypedReference to instantiate generic
vars since it's a lightly used class) that we no longer rely on (we now
instantiate generic vars by types that are synthesized for purpose).
* [mini] Don't box IsByRefLike types
* [runtime] Disallow boxing IsByRefLike types
* Bump corlib version
* [tests] Test that JIT won't box or instantiate IsByRefLike types
* [metadata] Don't inflate methods with invalid generic arguments
* [metadata] Make mono_is_valid_generic_argument non-static
Make it callable from other translation units.
* [class-init] Check for invalid generic instantiations
Disallow instantiations that contain void, TypedReference or IsByRefLike structs.
* [interp] Don't box IsByRefLike structs
We need xunit xml output for Helix.
The new mode which doesn't rely on build tree paths can be enabled by passing the special value "out-of-tree" as the build dir.
Respects the MONO_EXECUTABLE env variable and bases everything off of that.
Also unified run_test and run_test_sgen since we only have sgen nowadays and we only need one.
[marshal] Delete unused locals in emit_managed_wrapper_ilgen
`ex_local` and `e_local` were used prior to
https://github.com/mono/mono/commit/b20d5ce1e5d69512242dd42ae6ff1afc2483c16d
in order to store an exception raised by the managed method before passing it
to `ftnptr_eh_callback`. After that commit, we invoke the callback from the
stack unwinder, rather than from the method wrapper. As a result both of the
locals are now dead code.
Adding .NET 4.7.2 reference assemblies by updating submodule reference and adding new framework to mcs/tools/xbuild/frameworks and update Makefile to ship as described in #8657.
* [wasm] Handle the /dev/random problems by defining 'crypto' in runtime-tests.js instead of in the runtime/library_mono.js.
Print a stack trace if runtime_invoke () throws a JS exception.
* [wasm] Add a mono_wasm_setenv () function to the MONO module.
* [wasm] Mark some corlib tests as MultiThreaded/NotWasm.
Remove ICALL_EXPORT on all implementations.
Add ICALL_EXPORT on two declarations.
ICALL_EXPORT is on declarations, correctly,
and either isn't needed on implementations, or is incorrect.
On non-handles() implementations, it isn't needed but is ok.
On handles() implementations, it is incorrect.
Add ICALL_EXPORT on mono_object_hash_internal and mono_monitor_exit_internal.
Previously many declarations were missing, which was a reason we put it on implementations.
* [build] Enable netstandard facade in the "build" profile
It is necessary for a helix tool which I'm building in this profile
and it relies on NS2.0.
Adding full NS2.0 would require building System.Transactions.dll,
System.Runtime.Serialization.dll and System.Data.dll too but those
in turn rely on a whole bunch of other junk that I don't want to bring
into the build profile. Therefore I just added stubs for the types
directly into netstandard.dll.
* [csproj] Update project files
A couple of missing mono_class_from_mono_type_internal changes
Two instances were missed when mono_class_from_mono_type was changed to mono_class_from_mono_type_internal
* [System.Core]: Stub out `Interop.Sys.GetEUid` and `SetEUid`.
This is a temporary fix; the native side still needs to be ported from c++
and tested.
* [csproj] Update project files
* [aot] add unbox_arbitrary_trampoline for fullaot/interp mixed mode
On a virtual call where the receiver is a value type, the value type is
boxed at the caller's site, but must be unboxed before passed to the
callee. In FullAOT this happens with the help of the `unbox_trampoline`,
which is attached to the AOT'd assembly for every virtual method with a
value type as receiver, so we have a specific `unbox_trampoline` for
each such `MonoMethod`.
In mixed mode it can happen that an FullAOT'd method is calling such a
method which is _not_ FullAOT compiled, therefore it has to be executed
by the interpreter. We have to insert a trampoline between AOT caller
and interp callee (being a native-to-interp entry), that does the
unboxing and has a configurable target address at run-time. So that:
AOT caller -> unbox_arbitrary_trampoline -> native-to-interp entry
Note on testing: Tested on three different configurations
* amd64/macos with --full-aot-interp and `make -C mcs/class/corlib TESTNAME=MonoTests.System.ArrayTest.BinarySearch_ArgPassingOrder`. This will be covered soon by https://github.com/mono/mono/pull/11307.
* arm64/linux, same as above.
* arm64/iOS which has a different code path due to trampoline pages being used. Tested with `monotouch-tests` mixed mode (i.e. mscorlib.dll FullAOT, rest is interpreter).
armv7 isn't implemented yet.
* fix llvm aot compiler
* unbox_arbitrary_trampoline support for ARM
Comment out code to convert NSUrlError to WebExceptionStatus, because the
result isn't used. Looking through git history it seems the resulting
WebExceptionStatus was never used.
Fixes this warning:
HttpClientEx.cs(83,8): warning CS0219: The variable 'webExceptionStatus' is assigned but its value is never used
Mono doesn't use libxml2 and neither do the LLVM bits used by Mono when building
the AOT cross-compilers. Presence of `-lxml2` on the command line breaks 32-bit
builds on 64-bit Linux hosts:
libtool: link: cc -shared -fPIC -DPIC -Wl,--whole-archive ./.libs/libmini.a ./.libs/libmono-ee-interp.a ./.libs/libmono-dbg.a ../../mono/metadata/.libs/libmonoruntimesgen.a ../../mono/sgen/.libs/libmonosgen.a ../../mono/utils/.libs/libmonoutils.a ../../mono/eglib/.libs/libeglib.a -Wl,--no-whole-archive -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle -L$HOME/xamarin-android/external/mono/sdks/out/llvm-llvm32/lib -lz -ltinfo -lxml2 -lstdc++ -lm -lrt -ldl -lpthread -O0 -ggdb3 -m32 -g -mno-tls-direct-seg-refs -Wl,-export-dynamic -Wl,-soname -Wl,libmonosgen-2.0.so.1 -o .libs/libmonosgen-2.0.so.1.0.0
mv -f .deps/libmini_la-aot-runtime-wasm.Tpo .deps/libmini_la-aot-runtime-wasm.Plo
/usr/bin/ld: skipping incompatible //usr/lib/x86_64-linux-gnu/libxml2.so when searching for -lxml2
/usr/bin/ld: skipping incompatible //usr/lib/x86_64-linux-gnu/libxml2.a when searching for -lxml2
/usr/bin/ld: cannot find -lxml2
collect2: error: ld returned 1 exit status
make[7]: *** [Makefile:1495: libmonosgen-2.0.la] Error 1
Installation of `libxml2-dev` (on Ubuntu/Debian + friends) for the x86
architecture (or x86_64 architecture on 32-bit host) would be possible but then
it would break the 64-bit build because the 64-bit version of the library would
be absent. It would be a problem if Mono+LLVM actually used xml2, but since it
doesn't we can just disable the feature completely.
Handles for icall parameters allocated in managed (but not native), can just be pointers to locals or parameters.
Currently the managed stack is scanned conservatively.
When this changes, there will be metadata provided to find these, so this approach will just keep working and should still be ideal (aside from nohandles or staying in managed).
For ObjIn, use pointer to parameter.
For ObjOut/ObjInOut, the parameter might, though it is far fetched, point to a native frame, which isn't convincing. Therefore for those, use a pointer to a managed volatile local, closer to how handles looked like.
For ValueTypeRef, make the parameter volatile so it is sure to survive.
We use volatile instead of merely address-taken because 1. a hypothetical aggressive whole program compiler/optimizer could see through address-taken (runtime and wrappers and corlib compiled together). 2. ValuetypeRef is even easier to optimize/break because the address-taken is dead.
FIXME: Tests that exercise every icall, coop and otherwise.
FIXME: Gcstress.
Collateral damage: The one rarely run assert that handles are not out of scope
cannot be so easily implemented so is removed. It might come back though, if we type tag the handles.
Furthermore, the handle stack setup/cleanup can be done in native instead of managed.
Furthermore, the error check can either be done in native instead of managed, or the fast path inlined in the JIT. Here we just move it to native (and inline the fast path in native).
Therefore coop icalls go from 3 + handle-count managed/native transitions, to just always one, *and* at least some of their handle allocation is exceedingly fast and free of TLS.
The typed handle wrappers change from returning a handle to returning a raw pointer.
Because previously the handle would be allocated in the handle frame setup by the JIT.
Now the JIT doesn't setup a handle frame.
There is a weakreference test that is seemingly very sensitive to stack layout.
For this reason at least, the MonoError is still allocated on the managed side.
Moving it to native broke the test.
This might also be preferable for the public interface.
Coop icalls retain some costs:
- The volatile might cost a little -- lack of enregistration.
- Native code allocating handles.
- Still TLS access.
- JIT icalls (vs. metadata-driven) still native-only handle allocation, and still fully manual conversion.
- Coop icalls that return an object always allocate a handle -- could be more efficient out or inout handle instead, though inout is currently very rare.
Some of this can be further mitigated.
Mainly, the metadata icall signatures could move the "local" handles to be out parameters, in order for managed to allocate them.
The JIT icalls could have richer signatures than just "ptr" and gain these wrappers, or previous (ref parameters, retyped as handles).
* [Reflection] Reverse custom modifiers order in ParameterInfo's GetRequiredCustomModifiers and GetOptionalCustomModifiers methods to follow NetFX/CoreFX behavior.
* Move reversing custom modifiers from managed code to native one.
* Small refactoring
* Disable System.Reflection.Emit related test on Full AOT mode.
* [threads] Make mono_add_internal_call external only
The runtime should use mono_add_internal_call_internal or
mono_add_internal_call_with_flags.
The thread suspend mechanism needs to know if an icall is added via the legacy
mono_add_internal_call API (which is not coop-aware, and so the registered
icalls must run in GC Safe mode), or if it is added by the runtime or by a
cooperative client (currently either the profiler or the System.Native PAL)
which knows to add GC transitions and safepoints and not to block indefinitely.
* [marshal] Factor out GCSafeTransitionBuilder
Make a local builder for creating the GC Safe transition calls for a method wraper.
* [sgen] Add coop GC transitions in mono_gc_toggleref_add
Also mark it external only. It's not used inside the runtime.
* [marshal] Emit GC Safe transitions around foreign icalls.
A foreign icall is added using mono_add_internal_call and that is not coop GC
aware. (The runtime uses mono_add_internal_call_with_flags or
mono_add_internal_call_internal)
Under hybrid suspend, foreign icalls will run in GC Safe mode and transition to
GC Unsafe only when the call back into the runtime or invoke managed code.
Fixes https://github.com/mono/mono/issues/11138
* [cxx] function type overloads for mono_add_internal_call_internal
and mono_add_internal_call_with_flags
* [runtime] Add new API call mono_dangerous_add_raw_internal_call
Under hybrid suspend, this adds an icall that is assumed to run in GC Unsafe
mode. As such it has additional requirements for correct operation: it must
not run loops without periodically polling the runtime, and it must not perform
blocking operations such as blocking I/O or taking locks without manually
switching to GC Safe mode.
In general this is achieved by renaming mono_foo to mono_foo_internal,
and mono_foo_bar calls mono_foo_bar_internal, possibly adding a GC mode change
to mono_foo_bar and removing from mono_foo_bar_internal.
We can also consider other names like m_foo_bar, mi_foo_bar, m.foo_bar, m->foo_bar, m::foo_bar, using mi = mono_internal; mi::foo, foo.bar(), etc.
* [test] Report dlsym failure with an assertion failure and give the symbol.
* Compilation of external-only.c/.o needs special care.
Because it is dead code, except for exports, the linker does not necessarily eagerly look into it (.o within .a), and export anything. This is the usual behavior of Windows linker. Unix linker I guess it varies between programs and shared libraries, but it was observed and broke a test, and a small case was constructed to demonstrate the behavior (i.e. where the dlsym assert is added), even though I assumed the opposite -- so must be program vs. sharedlibrary.
Therefore, we `#include external-only.c` in object.c.
Longer term we should probably use Windows .def files and their Unix equivalent, and/or be sure to list external-only.o directly on the link command line, instead of burying it in a static library.
.def files were used in the past and have other advantages/differences.
Other than guaranteeably reaching into .a/.lib files to find exports, they also export on NT/x86 as plain "mono_foo" instead of "_mono_foo", easing portability of LoadLibrary / GetProcAddress.
The loss of the x86 C name mangling *could* be viewed as a loss, of a tiny amount of safety.
They also make declspec(dllimport) and declspec(dllexport) both pointless, at least for C functions -- dllimport remains significant for data and C++ (no need to list mangled names in .def file), and to microoptimize one instruction out of some calls on non-LTCG builds.
* Add support for BTLS assembler build on Windows (cygwin/msvc).
Building BTLS with assembler support on Windows requires several
additional build tools (except cmake) for both cygwin/msvc builds.
On cygwin, perl and yasm will be needed and on msvc, ninja, perl
and yasm. On msvc builds BTLS doesn’t support Visual Studio generator
when building with assembler support, so this commit adds support for
ninja build system covering that scenario. This commit adds support for
auto detection of needed build tools and enable assembler builds if all
needed tools have been identified as available. Commit also fixes the
execution of msbuild on CI to just use the original PATH variable instead
of the cygwin PATH to make sure correct version of identified build tools
gets used (Windows version of git, ninja, perl and yasm). Both cygwin and
msvc build will use nasm compiler (through use of yasm) since generated
assembler won’t compile with mingw’s gcc version.
* Bump BTLS commit.
* Fix a couple of warnings on BTLS build.
* Fix failing certificate import test using BTLS on Windows.
Mono BTLS library assumes all passwords are ANSI encoded strings since
SafePasswordHandle gets passed directly through pinvokes. This is only true for
SafePasswordHandle implemented on Unix:es. On Windows, SafePasswordHandle stores
passwords as Unicode, most likely due to Windows Crypto API accepting Unicode
passwords. When using BTLS on Windows this difference submerged since passwords
passed to BTLS will be Unicode encoded failing the decryption of PCKS12 structure.
Keeping the pattern already in place, passing SafePasswordHandler all the way
through pinvokes, the needed conversion will be done just before calling into OpenSSL
library as part of mono's BTLS library adapter.
* [class] Ensure 'cast_class' is initialized for array type classes.
Fixes https://github.com/mono/mono/issues/9507
Background: Monoclass:cast_class is used internally to allow for some interfaces to be assignable to each other if they share a "storage class" instead of the class's element class. This is used to i.e. implement IList<ulong> being assignable from IList<long> (IList<ulong> has cast_class=long)
Consider a GenericClass<T> with a T[] field. On instantiation with e.g. GenericClass<ulong> , the ulong[] array class will be generated. As above, ulong[] has cast_class=long
When mono_class_init() is called on an array class, its element_class is also initialized.
If GenericClass<T>:Method() uses any type/subtype checking (e.g. if (field is double[]) ), those may attempt to use cast_class, which is not ensured as initialized.
* Fix typo
Co-Authored-By: alexischr <[email protected]>
* [jit] Add support for accessing method arguments in the profiler in llvmonly mode, by generating code to store them into the MonoProfilerCallContext.args array.
* [jit] Use ctx->args instead of ctx->context for accessing arguments in the profiler.
* Update after review comments.
* [jit] Switch --trace to use the profiler infrastructure.
* Fix a rebase problem.
* Fix c++ failures.
* [wasm] Fix the creation of runtime.js in ninja mode.
* [wasm] Exit with an error code if the emscripten runtime hits an abort.
* [wasm] Error out when mono_wasm_load_runtime () fails too.
* [wasm] Wrap some code in ENVIRONMENT_IS_SHELL.
* [aot] Emit runtime invoke wrappers for up to 40 parameters for bitcode, newly added tests depend on it.
* [aot] Fix a buffer overflow in mini_get_gsharedvt_out_sig_wrapper_signature ().
* [wasm] Remove some filesystem code which is no longer needed.
* [wasm] Disable coop gc on the cross compiler, it effects the generated code.
* [wasm] Use a different random device under wasm so we can override its behavior. This is needed because /dev/random no longer works in emscripten 1.38.13 in JS shells.
* [wasm] Bump emscripten to 1.38.13.
* [wasm] Print a stack in one more abort case.
* [wasm] Add putchar to EXPORTED_FUNCTIONS, llvm-lto seems to create references to it after linking.
Since we've started embedding test resources inside of the test assembly
we've sometimes seen a strange error on Jenkins during the test run:
```
Msg: Error initializing task StringTestTask: Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
Msg: Error initializing task StringTestTask: System.TypeLoadException: Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
at (wrapper managed-to-native) System.RuntimeType.GetConstructors_native(System.RuntimeType,System.Reflection.BindingFlags)
...
```
However this was from an xbuild_12 run so how come it tried to load xbuild 14 stuff?
The reason is there's a race condition between when TestTasks.dll gets
built and when it's embedded inside of the test assembly.
If we're building the xbuild_12 and xbuild_14 profile at the same time
we could end up embedding the xbuild_14 version of TestTasks.dll instead
of the correct one since we're copying it to the same file name.
The fix is to remove the unnecessary copying logic since we can just tell
the compiler to embed the file under the correct name.
This is an alternative or precursor to https://github.com/mono/mono/pull/10212.
- Removes the dependency of some ABIs passing a pointer and a pointer in a struct the same.
- Therefore gives all platforms the same type safety.
- *If* we move to C++, allows us to have member functions in coop handles.
- Having the coop signatures available in C can provide benefits, though we should
probably generate them from reading metadata -- though they won't match w/o more changes,
since we mixup types in several places, like IntPtr vs. pointers.
JIT now traffics in old type-unsafe handles, and wrappers are generated with C preprocessor to trivially convert.
This way the JIT doesn't have to pass structs by value here, which was tried/failed.
The C preprocessor machinery can/should be extended for additional gains.
In particular driving managed/native coop icall transitions from 3+ per call to 1 (like https://github.com/mono/mono/pull/10212).
That will require better verification of the signatures in icall-def.h, either automated and en masses or gradually manually. Embedders will likely do something else, or at least have to independently invent similar.
Whereever a native function was exposed via multiple managed names, wrappers are reused.
* [wasm] Sample program in wasm sdks does not run.
- Add `mono-config.js` reference to html file.
resolves: https://github.com/mono/mono/issues/11239
* Fix `runtime.js` to reference `mono-config.js` variables.
* Fix packager.exe where it deletes the `runtime.js`.
- Replaced the File Delete and Copy with a Copy if new call.
- re-add the generation of a skeleton `runtime.js` file if one can not be found.
Flags to DrawText never reached MeasureText therefore strings with '&' were measured incorrect when drawn with flag TextFormatFlags.NoPrefix.
Fixes#6352
* [System] Don't throw NIE for ServicePoint.ConnectionLeaseTimeout and .ReceiveBufferSize
Instead return a no-op value. This is the same behavior as .NET Core.
Fixes https://github.com/dotnet/standard/issues/642
* Bump API snapshot submodule
* [tests] Renumber duplicate return codes
* [metadata] Fix crash related to custom attributes (#10737)
When a class doesn't contain the desired custom attribute we used
to return the last available attribute. This prevented
`cominterop_ccw_queryinterface()` to detect that the interface
isn't implemented and lead to a crash.
This change fixes#10737.
* [cominterop] Switch to GC Unsafe in IUnknown and IDispatch impls
These methods can be called directly from embedding APIs.
They require the additional files:
- mono/eglib/eglib-config.h: that's to build `libmonodroid`
- mcs/build/Consts.cs: that's to build `Mono.Posix` and `Mono.Data.Sqlite`
This should help get information on native crashes that happen in hard-to-debug environments.
To quote https://github.com/mono/mono/issues/10157 :
When a mono runtime is attached to a managed debugger and the debugged runtime is induced to cause a crash, the state of that crash is not communicated to the managed debugger. This, combined with the difficulty in having the debugged runtime both attached to the managed debugger and lldb, makes this type of crash difficult to interactively debug.
When the managed debugger is the only connection someone has with the runtime because it is embedded in a way that is resistant to unmanaged debugging (watchOS application on-device, for instance), this is an even more difficult problem.
By adding an SDB protocol event that sends a type of "runtime death" and a blob of opaque json (version dependent, no protocol guarantees), people can report these crashes without having to assist a mono runtime engineer in observing a crash on device.
In the case that spurious bugs in this manner are submitted, it will require less effort as well to spot stack frames that indicate misuse of mixed managed-unmanaged APIs (which offer the ability to drive a segfault or g_assert
* [arm64] Remove the limitation on the number of nullable arguments for dyncalls.
Fixes https://github.com/xamarin/xamarin-macios/issues/4984.
* [amd64] Remove the limitation on the number of nullable arguments for dyncalls.
* [jit] Add tests for dyncalls with lots of nullable arguments.
* Mark AddRefInternal as NOHANDLES(). Its signature was incorrect.
* Change ves_icall_System_Runtime_InteropServices_Marshal_ReleaseInternal to NOHANDLES.
* Mark ves_icall_System_Runtime_InteropServices_Marshal_QueryInterfaceInternal NOHANDLES.
* ves_icall_System_Runtime_InteropServices_Marshal_BufferToBSTR to nohandles().
* ves_icall_System_Runtime_InteropServices_Marshal_FreeBSTR to nohandles().
* ves_icall_System_Runtime_InteropServices_Marshal_FreeHGlobal nohandles().
* ves_icall_System_Runtime_InteropServices_Marshal_FreeCoTaskMem nohandles().
* Fix the signature of ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMemSize.
* [coop] Remove most uses of out_of_memory_ex.
We only build it if we're explicitly building the monodroid profile and for the
monodroid_tools profile we only build the test assembly but not dtest-app.exe
## Problem
`MessageBox` displays as black-on-dark in a dark theme:

This can be difficult to read.
## Cause
The text is drawn with a hard coded color of `Color.Black`. This assumes that the background under the text will be light to contrast with black.
## Changes
Now the color is `SystemColors.ControlText` instead, to match the background of the popup.
In a normal theme this will still be black.
* [bcl] Run System.Windows.Forms.DataVisualization tests
* [bcl] Run Mono.Messaging.* tests
* [bcl] Use correct label for mdoc tests
* [runtime] Skip verifying an xunit-binaries assembly
* [corlib] Import System.IO.IOException/FileLoadException from CoreFX
* [corlib] Remove unused string
* [corlib] Remove another test assert for BadImageFormatException
Exception message no longer includes the file name
During the code refactoring this summer, support for native apple certificates
has been dropped on watchOS.
* add `apple-certificates.sources` and move all certificate-related code from
`appletls.sources`.
* move non-network related code from `MacProxy` into a new `AppleTypes`.
* add the `MONO_FEATURE_APPLE_X509` magic to `System/Makefile` where it was missing from.
* [sdks] Build BCL profiles without configure flags
* [sdks] Add BclTemplate to build BCL profiles
This is to avoid building all the profiles in a single `sdks/out/bcl` directory which will be shared between android, ios and wasm.
* [sdks] Simplify call to BclTemplate
* [mcs] Make directory dependency as order-only
We would otherwise always rebuild the target since the directory is updated whenever something is added to the directory. This is a common Makefile technique.
* [sdks] Build tests for BCL targets
* [runtime] Fix the signature of some native type tests.
* [runtime] Add stubs for the ves_icall_System_Net_NetworkInformation_MacOsIPInterfaceProperties_ParseRouteInfo_internal () icall, needed for AOT.
* [wasm] Print a native stack trace on asserts.
* [wasm] Avoid mmaps with zero length, it leads to an exception under emscripten.
* [bcl] Preserve CustomAttributeData:.ctor (), its called from the runtime.
* [wasm] Print out full test names in the test runner.
* [wasm] Preserve System.Threading.WasmRuntim.
* [wasm] Rename config.js to mono-config.js
* [wasm] Add targets to build aot versions of the test suites.
* [wasm] Exit with a nonzero exit code in case of a failure.
* [wasm] Disable crash reporting.
* [wasm] Use mono headers for public functions.
* [wasm] Enable building AOT tests on CI.
* [wasm] Run some AOT test suites on CI.
* [runtime] Make MonoBundledAssembly.size non-const.
* [wasm] Add a --setenv=VARIABLE=VALUE argument to runtime-tests.js which allows the setting of environment variables.
* [wasm] Update cross compiler executable name.
* [wasm] Remove unused aot-driver.js file, runtime-tests.js has the same functionality.
* [wasm] Run mini tests with AOT on CI.
* [wasm] Error out if the linker fails.
* [wasm] Fix building the AOT tests from another directory.
* [wasm] Use a matching Mono.Cecil.dll for the linker.
* [wasm] Fix running aot tests on CI.
* Revert "[sdks] Switch the invocation of the offsets too to 64 bit on osx. (#10903)"
This reverts commit 2989a83f23.
This seems to cause failures on linux+webassembly.
The VS4M team is making a tool that makes a symbolication lookup table. This enables symbolication without access to the relevant binary.
For unmanaged, it's much harder to precompute things because we were presenting the instruction address. From the address, any lookup needs to find the function enclosing this interior pointer.
To make it easier, this reports the address of the native method as well as the offset. A lookup table can simply key on the function start address with this now.
ie:
```
{
"native_address" : "0x1003a6340",
"native_offset" : "0x00046",
"native_module" : "mono"
}
```
```
$ nm mini/mono-sgen | grep '1003a6340'
00000001003a6340 t _mono_runtime_run_main_checked
```
```
$ nm mini/mono-sgen | grep ' t ' | sort -n
00000001000a4e90 t _alloc_ireg
00000001000a4eb0 t _decompose_long_opcode
00000001000aae90 t _mono_decompose_long_opts
00000001000aaea0 t _mono_decompose_vtype_opts
00000001000ae130 t _m_class_get_byval_arg
00000001000ae150 t _alloc_dreg
............
```
Note:
- This memory isn't accessed until we're crashing
- On any modern machine, unused static memory is lazily allocated. When
we access it, the fault will trigger the MMU to map memory for us.
- This is guaranteed to be reentrant and safe. mmap (the alternative) is
surely fairly stable on many systems, but this is not guaranteed. The
documentation pages for mmap specifically claim it as not safe in these async
contexts.
`Mono.Native` is the new name for both `System.Native` and `System.Security.Cryptography.Apple`.
It is built as a stand-alone shared library and not bundled with the runtime because we
may need to build two different versions of it.
Starting with macOS 10.12+ and iOS 10+, Apple introduced a new Unified API for some of the
crypto primitives that we're using as part of System.Security.Cryptography.Apple.
On Desktop, we can check at runtime whether the OS version is recent enough and switch
implementation accordingly. We build a single `libmono_native` shared library.
However, on Mobile we cannot have any undefined symbols as this would break Bitcode.
During the mobile build, we are called with `CC` containing an explicit minium version flag,
which is either `-mmacosx-version-min=`, `-mios-simulator-version-min=` or `-miphoneos-version-min=`
depending on platform.
We build two versions of the shared library:
- `libmono_native_compat` is built with whichever minimum version is passed to us via `CC`.
- `libmono_native_unifed` is built with the minimum version set to macOS 10.12+ / iOS 10+.
For testing purposes, there is a function called `mono_native_get_platform_type ()`
(see mono/native/mono-native-platform.c), which returns a `MonoNativePlatformType` enum value.
There is also `Mono.MonoNativePlatform.GetPlatformType ()` (see mcs/class/corlib/Mono/MonoNativePlatform.cs).
This can be called by automated tests both to ensure that the library has been correctly installed and also
to verify that it's the correct version of it.
* `configure.ac`: add new configure checks for Mono.Native.
* `mono/native/`: new directory - this replaces the `System.Native` code that was previously in `mono/metadata`.
* `mcs/class/corlib/Mono`: New internal `MonoNativePlatformType` and `MonoNativePlatform` classes.
* `-s` removes all symbols.
* `-x` removes non-global symbols.
This is needed in order to get human readable output with `MONO_VERBOSE_METHOD=method`, so instead of:
```
Disassembly of section .text:
00000000 <.text>:
0: e92d4900 .word 0xe92d4900
4: e24dd05c .word 0xe24dd05c
8: e1a0b00d .word 0xe1a0b00d
c: e58b0030 .word 0xe58b0030
10: e58b1034 .word 0xe58b1034
[...]
```
It is this now:
```
Disassembly of section .text:
00000000 <.text>:
0: e92d4900 push {r8, fp, lr}
4: e24dd05c sub sp, sp, #92 ; 0x5c
8: e1a0b00d mov fp, sp
c: e58b0030 str r0, [fp, #48] ; 0x30
10: e58b1034 str r1, [fp, #52] ; 0x34
[...]
```
This is needed due to a newer toolchain on our ARM bots. Tested on armv7 and aarch64.
* [wasm] Fix the build.
* [wasm] Add --copy parameter to packager
- copy parameter
```
--copy=always|ifnewer Set the type of copy to perform
'always' overwrites the file if it exists.
'ifnew' copies or overwrites the file if modified or size is different.
```
- Fix wasm build target in do-runtime target.
* [wasm] Add support for Module.locateFile to runtime loading
See issue https://github.com/mono/mono/issues/11099 for more information.
resolves issue: https://github.com/mono/mono/issues/11099
* Fix spelling of option `ifnew` to `ifnewer`
* Build BTLS on Windows.
* Quote more cmake paths
Should fix issue on Windows build where cmake is installed in C:\Program Files
* Fix btls cygwin x86, x64 Windows build.
NOTE, cygwin btls build depends on cygwin installed cmake, update cygwin
install to include cmake before building.
* Disable BTLS as default for Windows builds.
* [interp] Avoid unnecessary allocations when pinvoke void functions
* [amd64] Refactor interp pinvoke context computation
* [amd64] Interp trampoline for interpreter entry
* [aot] Don't include interp_in_wrapper when we use entry trampoline
These wrappers take a lot of space in the image.
* [exceptions] continue program execution when mapping of stack overflow guard page fails
Related: https://github.com/mono/mono/issues/10415
* turn comment into warning
* fix mono_gc_register_altstack call when no guard page is mapped
I don't know what the specific code is or what changed, etc.
This addresses Mac/x86:
https://jenkins.mono-project.com/job/test-mono-pull-request-i386-osx/15364/parsed_console/log.html
```Unable to compile method 'int Tests:calli_sig_check_2 ()' due to: 'Invalid IL code in Tests:calli_sig_check_2 (): IL_000b: calli 0x11000044```
which then fails an assert and fails overall.
CI goes deep into bash w/o echoing commands but a repro is:
cd mono/mini
MONO_PATH=./../../mcs/class/lib/net_4_x lldb -- ./mono --aot iltests.exe
The code is meant to be invalid, and meant to raise an exception,
which is catchable/resumable (at least in the JIT case where
executing IL the first time, can raise an exception while caller is
running, vs. AOT where the codegen all happens offline -- leaving what?
A note made at AOT time that calling the code should raise an exception?).
It isn't meant to fail an assert in either case.
This change set represents a major set of changes to the crash reporting mechanism.
1) Coordination involving mandatory timeouts and signals have been changed greatly, to instead use semaphores and to end waiting as soon as possible.
2) Dumping of unmanaged symbols outside of mono has been made possible. Embedders that want to get information on frames outside of mono-sgen can register the library with an icall. This carefully preserves both privacy (opt-in) and resiliency (can't crash/lose more info when misused).
3) The dumper has moved from a workflow that kills the runtime after a long delay into one that can dump individual threads or the entire runtime in a prompt manner. The runtime doesn't die at the end of the dump, but allows threads to resume what they were doing and returns to the caller.
4) This has allowed for the addition of a number of tests that stress both parallel and concurrent dumping of threads. These run fairly quickly, and leave the runtime in a state to continue testing.
5) With this lightweight testing setup created, a long burn-in testing period was done. Places we were using locks or trying to malloc resulted in crashes or hangs. After making the needed changes, it managed to run the dumping tests in a loop for a whole weekend on a Linux x64 configuration without any problems.
This has resulted in a dumper with dramatically improved stability and performance.
* [runtime] Fix mismatched parenthesis on exc-s390x
* [runtime] Fix mismatched static function type declaration on s390x
* [runtime] Fixup b7c18caf0c for s390x
The makefile uses $(dir $<) which has `../` and so refers to `llvm/external/llvm` rather than `external/llvm` now that we're using llvm from a submodule in external/
[interp] Optimize static field access
Do most of the work on transform side and include the field address in the instruction stream. We need to run cctor at runtime to preserve expected order. This makes static field access 4 times faster.
<!--
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
-->
* [build] Unify bootstrap profiles
We can now rely on build only as we have reliable monolite and package
compilers
* Fixes genproj dependencies
* [csproj] Update project files
It is hacky to have to avoid includes in order to have conflicting/incorrect declarations.
And hacky to use extern "C" when the reason is to have incorrect prototypes.
It is arguably hacky to suppress the gcc warning -- granted, the functions are never called, and merely their addresses taken and put into void* -- arguably gcc's warning is too strict and should only trigger for calls or taking address into a non-void*.
Arguably the declarations should be moved around the tree.
Perhaps we should omit the prototypes from C++.
* [llvm] Fix the icall signature of a few llvm EH icalls.
* [wasm] Disable com/remoting in the linker.
* [wasm] Enable direct icalls.
* [wasm] Generate the configuration into a config.js file instead of rewriting the runtime.js file.
* [wasm] Enable icall symbol map in the cross compiler, compile the device runtime with -fexceptions.
* [wasm] Rename runtime-tests.g.js -> runtime-tests.js.
* [wasm] Add mono_wasm_assembly_get_entry_point () function to obtain the entry point of an assembly.
* [wasm] Add profiler support to the packager.
* [wasm] Add support for running a normal .net executable to the test runner.
Do most of the work on transform side and include the field address in the instruction stream. We need to run cctor at runtime to preserve expected order. This makes static field access 4 times faster.
* [wasm] Harden the debugger against invalid breakpoints.
This happens when you reload a page and the old BPs land in now invalid code regions.
* Add node support to library_mono.js
* [wasm] Correctly register pdb files.
* [sdks] Build Android SDKs archive in Debug configuration on master builds
* [sdks] Drop `product-` prefix from Android and iOS SDKs CI_TAGS parameters
* Mitigation for spawn FD closing taking forever with a big FD limit
On systems with a large file descriptor limit, Mono takes a very
long time to spawn a new process; with informal testing on the AIX
CI builder, (with a POWER7) it took ~30 minutes. This is obviously
very undesirable, but hand our is forced - libraries the user might
be calling could be creating non-CLOEXEC files we're unaware of. As
such, we started from the FD limit and worked our way down until we
hit stdio. Using APIs such as posix_spawn aren't desirable as we do
some fiddling with the child before we exec; and even then, closing
FDs with posix_spawn relies on non-standard file actions like
Solaris' addclosefrom not present on many systems. (All of this is
unnecessary on Windows, of course.)
This presents an alternative way (currently only implemented on AIX
but with notes how for other platforms) to try to close the child's
loose FDs before exec; by trying to get the highest number FD in
use, then work our way down. In the event we can't, we simply fall
back to the old logic.
See #6555 for a discussion and the initial problem being mitigated.
* Use an another strategy of closing only known to be open handles
...on FreeBSD and AIX.
Use the kinfo_getfiles library call on FreeBSD and only close what's
safe to close. On AIX, use the third and fourth arguments to getprocs
to check what's open. However, the array to get all the handles takes
1 MB, so allocate it on the heap; like what kinfo_getfiles does. We
don't need to free these as the child will exec or exit, which blows
it all away.
The previous strategy from previous commit is still used and on AIX,
enhanced.
* Add Linux strategy to fork FD close
Tested on WSL, shows benefits with big FD ulimit.
initialization, but rather code that is portable to C89 and C++98.
The alternative is also ok, just costs typically a pointer and a relocation per array element,
things most people wouldn't notice but was presumably the point here.
* [aot] Add clangxx option to --aot that removes the hardcoded clang++ in our aot compiler.
* [mini] Make --aot addictive.
* Update CI script for bitcode.
The makes the following classes optional to the runtime:
System.Reflection.CustomAttributeData
System.Text.StringBuilder
System.Math
System.Console
System.Diagnostics.StackTrace
Those are all types that can be clearly made optional. There are a lot of other types
we could, but there are deeper dependencies in places as threadpool or marshal.
* [runtime] Kill mono_defaults.console_class.
* [runtime] Kill mono_defaults.asyncresult_class. Doesn't help much as it's still needed by the TP.
* [runtime] Remove mono_defaults.stack_trace_class.
* [runtime] Remove dead field.
* [runtime] Remove mono_defaults.math_class
* [runtime] Cleanup handleref resolution to use the access macros.
* [runtime] Remove mono_defaults.stribuilder_class.
* [runtime] Remove System.Reflection.CustomAttributeData
* [corlib] Update linker description.
* [runtime] Fix compilation of the iOS SDK.
When passing FIXTURE or TESTNAME to "make run-test" we automatically
prepended `MonoTests.` to the value since all of our NUnit tests
start with that to save you from typing a few chars.
Now that we have xUnit tests as well this is confusing since it doesn't
happen there. Better to remove it for consistency.
Right now if anything goes wrong in the security stack you get a message like this:
```
System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED
```
This is confusing since SSPI is a Windows-only thing and is not used on Mono.
We inherited this error message string from referencesource.
Change the string to something more generic which also aligns us with CoreFX:
https://github.com/dotnet/corefx/blob/a10890f4ffe0fadf090c922578ba0e606ebdd16c/src/System.Net.Security/src/Resources/Strings.resx#L210-L212
Before we only did this for PR builds but it turns out it's needed for
normal master/branch builds too.
In situations where there are two Mac builds at roughly the same time
the downstream Windows builds would otherwise both refer to the same/latest
commit since they just checkout the latest ref on the branch.
Now we reset the Windows build to the sha1 which is passed to it.
* Add support for strongly typed marshalling of C# enums.
JavaScript does not have the concept of Enums like TypeScript. Strings are used to represent enums. This PR allows a strongly type contract between C# values and the string representations used by a lot of the JavaScript API's.
Example:
DOM InputElement type -> https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-type#Form_<input>_types
The InputElement types are represented by strings. button, checkbox, color, date, datetime-local etc....
These string can be represented and marshalled back and forth by defining an enum as shown below with an `Export` data contract attribute.
```
public enum InputElementType
{
[Export(EnumValue = ConvertEnum.ToLower)]
Button,
[Export(EnumValue = ConvertEnum.ToLower)]
CheckBox,
[Export(EnumValue = ConvertEnum.ToLower)]
Color,
[Export(EnumValue = ConvertEnum.ToLower)]
Date,
[Export("datetime-local")]
DateTimeLocal,
}
```
The enum conversion allows controlling the marshalling:
- Default - Marshals the enum name as is
- ToLower - Marshals the enum name to lower case string
- ToUpper - Marshals the enum name to upper case string
- Numeric - Marshals the enum numeric values.
Marshalling from C# to JavaScript using the SDK Bindings should be made as easy and pain free as possible.
Marshalling the string values from JavaScript to C# will need a little help. The SDK Bindings Runtime provides a method to transport the string value to a strongly typed enum.
```
WebAssembly.Runtime.EnumFromExportContract(typeof(InputElementType), inputElementType);
```
* Add marshalling of C# Enums to method calls.
* Add tests to bindings-test harness for testing marshalling of C# enum values.
* Modify test for marshalling enum value without Export contract.
[interp] fixes for native types
please look at single commits.
------------------------
[interp] fix op_implicit/op_explicit conversions for native types
Conversion operators have been mostly broken in the interpreter, for example conversion from nint to float didn't work. While some conversions are easy to intrinsify (like nint -> I8), there are harder cases like nint -> decimal. The JIT actually falls back to the managed implementation, so let's do this in the interpreter as well.
However the managed implementation expects a pointer to the value type, i.e. the container type System.nfloat instead of float/double primitives. In such cases the value is going to be stored in a local and then the address of its storage is pushed on the stack before invoking the managed implementation of the conversion.
Added test cases for scenarios observed in Xamarin.iOS.
-----------------------
[interp] support ntype.CompareTo ()
-----------------------
[interp] support ntype.Equals ()
-----------------------
[interp] support nfloat.*Infinity
-----------------------
[interp] support ntype.ToString ()
-----------------------
The conversion issue creeped everywhere in Xamarin.iOS since it heavily relies on nint/nuint/nfloat. With this PR we are getting close to a green monotouch tests 😁
<img width="874" alt="screen shot 2018-09-21 at 23 24 36" src="https://user-images.githubusercontent.com/75403/45907566-b457eb80-bdf8-11e8-9cc7-b8cf311dd269.png">
needs backporting to 2018-06 and 2018-08
* bump external/binary-reference-assemblies
* use Mono.Android for netstandard
* use API_BIN_REFS
* move ifeq monodroid upper
* use Mono.Android in System.Drawing.Primitives instead of ns
* fix typo
* Add Mono.Android back to ns as API_BIN_REFS
* Bump API snapshot submodule
* [csproj] Update project files
We didn't include cmods when inflating var/mvar cuz we'd mono_metadata_type_dup' the inflated type
and not the (m)var MonoType.
The solution is to add a variant of mono_metadata_type_dup that takes the source of cmods to use.
Conversion operators have been mostly broken in the interpreter, for
example conversion from nint to float didn't work. While some
conversions are easy to intrinsify (like nint -> I8), there are harder
cases like nint -> decimal. The JIT actually falls back to the managed
implementation, so let's do this in the interpreter as well.
However the managed implementation expects a pointer to the value type,
i.e. the container type System.nfloat instead of float/double primitives.
In such cases the value is going to be stored in a local and then the
address of its storage is pushed on the stack before invoking the
managed implementation of the conversion.
Added test cases for scenarios observed in Xamarin.iOS.
xamarin-macios currently builds zlib-helper.o using mono's source code.
It would be preferrable to use a version built by mono, and since
zlib-helper.o is a byproduct of building libMonoPosixHelper, we need to build
libMonoPosixHelper (we already build it for simulator architectures), even
though we don't need/use libMonoPosixHelper itself.
So they are next to their NUnit counterparts.
Move xunit remote executor app to tests dir too and compile it when
compiling the test assembly instead of doing it before running the test.
We need to use an absolute path for the xunit remote executor and it
needs to be in Windows format on Windows since we pass it as an env var
to the xunit tests.
When building the SDKs on CI, the output is very scrambled. There are simultaneously outputs from making multiple runtimes, uncompressing some tar archives, cloning some repos, building various BCL profiles, etc. This makes it quite hard to easily understand what's going wrong when the build fails.
By using `--output-sync=recurse`, we make sure that even if many targets are executed in parallel, the output is still as if it was executed sequentially.
If another thread locked at least one of the other handles, and there is a
cooperative GC STW happening, this function will loop forever.
Add GC Safe transitions around the call to sleep to give this thread a chance
to suspend.
Fixes https://github.com/mono/mono/issues/10863
The `X509Certificate(byte[])` constructor should call `CertificateProvider.Import(byte[])`
to use the native apple implementation if possible.
Add temporary hack to `X509Certificate2(byte[])` to ensure that we always get an
`X509Certificate2Impl`.
* Fix problem with HttpClientHandler not returning the response status text if available when there is an http error.
resolves: https://github.com/mono/mono/issues/10842
* Extend C# sample to include:
- Calling JavaScript functions from C#
- Calling C# functions from JavaScript.
- Referencing JavaScript objects
- Getting and Setting JavaScrip object properties.
- Invoking JavaScript object functions.
- Setting up the default HttpClientHandler
- Instantiating a default WasmHttpMessageHandler.
- Setting up HttpClient calls
- Parsing and testing the correct results returned from the HtppClient.
- Obtaining a byte array and string array from response.
- Obtaining a reference to a global script function defined in the .html file and calling it.
- Working with DOM objects using the SDK's WebAssembly.Bindings.dll
resolves: https://github.com/mono/mono/issues/7548
* Update sample usage docs
* [cxx] Do not define C++ keywords: bool, inline, final, it can break things.
https://jenkins.mono-project.com/job/d/421/parsed_console/log.html
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xkeycheck.h(250): fatal error C1189: #error: The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro. [d:\j\workspace\d\msvc\libmonoruntime.vcxproj]
* PR: Leave profiler defining C++ keywords (define bool char).
* PR: Restore libgc. (mainline removed the code in 2011).
* [sdks] Remove redundant --enable-cxx
* [sdks] Shorten `-m32`/`-m64` parameters detection for runtimes
* [sdks] Build BCL profiles without configure flags
* [sdks] Add BclTemplate to build BCL profiles
This is to avoid building all the profiles in a single `sdks/out/bcl` directory which will be shared between android, ios and wasm.
* [sdks] Create archive targets for pre-building on CI
* [sdks] Use archive-{android,ios,wasm} on CI
* [sdks] Run archive-llvm-llvm{,win}{32,64} on CI
thread-suspend-suspended and thread-suspend-selfsuspended tests has showed long
execution times on low core Windows machines running wow64. It looks like an OS
related issue where ResumeThread Win32 API takes a lot longer time to complete
when running a test scenario like thread-suspend-suspended and this additional
time adds up over many iterations pushing it over to timeout. NOTE, the same behavior
has been identified running on .NET framework, so it's not a mono specific issue and
only reproduce under wow64 on low core machines (probably when one core is busy
just leaving us with one core for most of the test).
Since the purpose of the test is to run GC when t1 is suspended, doing this more
deterministic will fix the ResumeThread issue under wow64 on low core count as
well as making the tests more deterministic, always having t1 in a suspended state
when running GC (that will test the suspend suspended scenario).
Full investigation can be found in, https://github.com/mono/mono/issues/10508.
On cooperative suspend, the wrapper frames capture the exception
in a MonoError, which then must be thrown. The problem with treating
it as a CIL THROW opcode is that every time you THROW, you completely
reset the stacktrace's collectin of saved frames.
The RETHROW opcode will force the JIT to rely on an in-flight exception,
that in our case has been taken our of the in-flight context.
By relying on the new MONO_RETHROW, we will take an explicit exception
and put it back in-flight without clearing the stored stacktrace.
mono/mini/mini-runtime.c so it can use the correct ifdefs
which should fix WebAssembly compilation and let it work on
Mac and Win32 also. This means we no longer need HOST_LINUX in configure.ac either.
Note that for Win32 we don't have the same sort of execution
of a debugger for this to help, but you can see it works
if you run in a debugger and break on mono_sigsegv_signal_handler_debug.
SUBDIRS= mk po $(libgc_dir) llvm mono $(ikvm_native_dir) support data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests
ifENABLE_MSVC
build_with_msvc= msvc
build_without_msvc=
else
build_with_msvc=
build_without_msvc= msvc
endif
ifENABLE_NETCORE
update_submodules=
else
update_submodules= update_submodules
endif
SUBDIRS=$(build_with_msvc) mk po $(libgc_dir) llvm mono $(ikvm_native_dir) support data runtime scripts man samples $(tools_dir)$(build_without_msvc)$(docs_dir) acceptance-tests
# Keep in sync with SUBDIRS
DIST_SUBDIRS= m4 mk po $(libgc_dir) llvm mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests
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
all:update_submodules
all:$(update_submodules)
SUBMODULE_ERROR='Could not recursively update all git submodules. You may experience compilation problems if some submodules are out of date'
# Source for this file was taken from https://github.com/microsoft/azure-pipelines-task-lib/blob/11c9439d4af17e6475d9fe058e6b2e03914d17e6/powershell/VstsTaskSdk/LoggingCommandFunctions.ps1
# NOTE: You should not be calling these method directly as they are likely to change. Instead you should be calling the Write-Pipeline* functions defined in tools.ps1
$script:loggingCommandPrefix='##vso['
$script:loggingCommandEscapeMappings=@(# TODO: WHAT ABOUT "="? WHAT ABOUT "%"?
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
<Project Sdk="Microsoft.NET.Sdk">
<!--
This MSBuild file is intended to be used as the body of the default
publishing release pipeline. The release pipeline will use this file
to invoke the PushToStaticFeed task that will read the build asset
manifest and publish the assets described in the manifest to
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
<Project Sdk="Microsoft.NET.Sdk">
<!--
This MSBuild file is intended to be used as the body of the default
publishing release pipeline. The release pipeline will use this file
to invoke the PublishSymbols tasks to publish symbols to MSDL and SymWeb.
Parameters:
- PDBArtifactsDirectory : Full path to directory containing PDB files to be published.
- BlobBasePath : Full path containing *.symbols.nupkg packages to be published.
- DotNetSymbolServerTokenMsdl : PAT to access MSDL.
- DotNetSymbolServerTokenSymWeb : PAT to access SymWeb.
- DotNetSymbolExpirationInDays : Expiration days for published packages. Default is 3650.
!!! Changes made in this directory are subject to being overwritten by automation !!!
The files in this directory are shared by all Arcade repos and managed by automation. If you need to make changes to these files, open an issue or submit a pull request to https://github.com/dotnet/arcade first.
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
<Project Sdk="Microsoft.NET.Sdk">
<!--
This MSBuild file is intended to be used as the body of the default
publishing release pipeline. The release pipeline will use this file
to invoke the the SignCheck tool to validate that packages about to
be published are correctly signed.
Parameters:
- PackageBasePath : Directory containing all files that need to be validated.
- SignCheckVersion : Version of SignCheck package to be used.
- SignValidationExclusionList : ItemGroup containing exclusion list to be forwarded to SignCheck.
- EnableJarSigningCheck : Whether .jar files should be validated.
- EnableStrongNameCheck : Whether strong name check should be performed.
-->
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<!--
From 'Signing.props' we import $(SignValidationExclusionList)
echo"Creates a toolchain and sysroot used for cross-compiling for Android."
echo.
echo"Usage: $0 [BuildArch] [ApiLevel]"
echo.
echo"BuildArch is the target architecture of Android. Currently only arm64 is supported."
echo"ApiLevel is the target Android API level. API levels usually match to Android releases. See https://source.android.com/source/build-numbers.html"
echo.
echo"By default, the toolchain and sysroot will be generated in cross/android-rootfs/toolchain/[BuildArch]. You can change this behavior"
echo"by setting the TOOLCHAIN_DIR environment variable"
echo.
echo"By default, the NDK will be downloaded into the cross/android-rootfs/android-ndk-$__NDK_Version directory. If you already have an NDK installation,"
echo"you can set the NDK_DIR environment variable to have this script use that installation of the NDK."
echo"By default, this script will generate a file, android_platform, in the root of the ROOTFS_DIR directory that contains the RID for the supported and tested Android build: android.21-arm64. This file is to replace '/etc/os-release', which is not available for Android."
exit1
}
__ApiLevel=21# The minimum platform for arm64 is API level 21
echo"BuildArch can be: arm(default), armel, arm64, x86"
echo"LinuxCodeName - optional, Code name for Linux, can be: trusty, xenial(default), zesty, bionic, alpine. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen."
echo"lldbx.y - optional, LLDB version, can be: lldb3.9(default), lldb4.0, lldb5.0, lldb6.0 no-lldb. Ignored for alpine"
echo"--skipunmount - optional, will skip the unmount of rootfs folder."
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
# Please remember to update the documentation if you make changes to these parameters!
parameters:
HelixSource:'pr/default'# required -- sources must start with pr/, official/, prodcon/, or agent/
HelixType:'tests/default/'# required -- Helix telemetry which identifies what type of data this is; should include "test" for clarity and must end in '/'
HelixBuild:$(Build.BuildNumber) # required -- the build number Helix will use to identify this -- automatically set to the AzDO build number
HelixTargetQueues:''# required -- semicolon delimited list of Helix queues to test on; see https://helix.dot.net/ for a list of queues
HelixAccessToken:''# required -- access token to make Helix API requests; should be provided by the appropriate variable group
HelixConfiguration:''# optional -- additional property attached to a job
HelixPreCommands:''# optional -- commands to run before Helix work item execution
HelixPostCommands:''# optional -- commands to run after Helix work item execution
WorkItemDirectory:''# optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects
WorkItemCommand:''# optional -- a command to execute on the payload; requires WorkItemDirectory; incompatible with XUnitProjects
WorkItemTimeout:''# optional -- a timeout in seconds for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects
CorrelationPayloadDirectory:''# optional -- a directory to zip up and send to Helix as a correlation payload
XUnitProjects:''# optional -- semicolon delimited list of XUnitProjects to parse and send to Helix; requires XUnitRuntimeTargetFramework, XUnitPublishTargetFramework, XUnitRunnerVersion, and IncludeDotNetCli=true
XUnitWorkItemTimeout:''# optional -- the workitem timeout in seconds for all workitems created from the xUnit projects specified by XUnitProjects
XUnitPublishTargetFramework:''# optional -- framework to use to publish your xUnit projects
XUnitRuntimeTargetFramework:''# optional -- framework to use for the xUnit console runner
XUnitRunnerVersion:''# optional -- version of the xUnit nuget package you wish to use on Helix; required for XUnitProjects
IncludeDotNetCli:false# optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion
DotNetCliPackageType:''# optional -- either 'sdk' or 'runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json
DotNetCliVersion:''# optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json
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
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()
continueOnError:false# optional -- determines whether to continue the build if the step errors; defaults to false
Loaded 100 of 5468 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.