* [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.
Switch NUnit BCL tests to use embedded test resources instead of reading from the repo
Right now a lot of our tests expect to be able to read resources directly from the repository, e.g. `File.Open ("../../resources/some-file.txt")`
In order to run these tests in a standalone, clean environment without access to the source repo we need to change that. The most straightforward way to achieve that is to embed all the resources inside of the test assemblies and extract/read them from there during test execution time.
The new TestResourceHelper helper class extracts all embedded test resources to a temporary directory and cleans them up when the test runner process exits. This allows us to make relatively small changes to the tests as opposed to rewriting them all to read directly from the embedded resource stream (which isn't even possible in all cases).
It turns out some Debian versions identify themselves as `Debian GNU/Linux`, add
this string to the list of distributions which have mingw. This *should* fix the
PR builds (fingers crossed)
Part of #9660.
The changes:
- included corefx version of EventInfo type;
- included related xunit tests from corefx System.Reflection;
- made System.Reflection/EventInfo.cs partial and left some Mono-specific stuff only there.
Some changes will be done in corefx part.
Look like:
https://github.com/mono/mono/commit/e8029e1474b701184840f6e0abea51966d048831
caused issues in the parameters for this test since caller was not updated
accordingly.
This fixes so that the caller pass needed additional argument + simplify the
AOT use case for Windows since different tested versions will need different
toolchain versions that in turn will cause additional complexity. Since the
test doesn't validate the compile/link of AOT module (and don't handle errors)
anyways, Windows versions of this test will just generate assembler output.
Debian and its derivatives include full mingw chain (both 64 and 32-bit) and so
they don't need to build the toolchain at all. However, the current detection of
Linux flavor takes into account only Ubuntu and all other distros are configured
to *require* MXE but they do *not* build them.
This commit fixes detection of distros which provide the mingw toolchain in a
way that makes it easy to extend the set of compatible distributions as needed.
In order to mark a distribution as one with MinGW one has to add the `:Distro:`
string to the `LINUX_WITH_MINGW` make variable in `mxe.mk`. The `Distro` string
is whatever the `determine-linux-flavor.sh` script returns.
MONO_API here was dubious, as all systems have it, except Visual C++ was configured away.
In Visual C++, it is in ucrt, so present in 2015 also.
More information in nearby comments.
This PR cleanups C++SDKs support and gets them all passing for the first time, esp. Android (WebAssembly already was, iOS uncertain before, green here).
* Current Visual C++ has signbit.
* Rework C++ linkage to C99 math-- trunc, isnan, isinf, etc.
Go through mono wrappers that are compiled as C.
Remove support for Visual C++ pre-2015 and non-C99 Solaris.
(Solaris has plenty of other problems compiling.)
Cleanup Windows ssize_t support.
* Remove trunc and aintl autoconfigury.
Use trunc unconditionally. (aintl is a Solaris near equivalent to trunc).
* Replace dis_isnan with mono_isnan.
* Interpreter already assumes presence of isinf and isfinite, so everywhere else might as well too.
A fair amount of cleanup therefore -- autoconf, ifdef, etc.
If this changes back, the mono_isinf, etc. wrappers are likely, but not necessarily, where to handle it for everyone, not sprinkling ifdefs and alternate implementations around -- assuming all users want the same fallback.
As well, we might want to import some good BSD libc versions of all these if there is any remaining question of portability. *Everyone* except old VAX and Cray have always used the same 32bit float and 64bit double representations since circa 1985 so these are all probably about one line of portable C89/C++98 each, maybe with endian sensitivity.
* [wasm] Fix linker changes.
* Revert "[wasm] Enable the mini test suite under AOT. (#10670)"
This reverts commit 9cb832ff2a.
Revert this, it doesn't work yet.
* [wasm] Run AOT tests on CI.
* Fix the CI label.
* [wasm] Disable the aot test on CI, it doesn't yet run on linux.
* [wasm] Fix the computation of code_start/code_end for wasm.
* [llvm] Avoid passing a dummy extra args to wrappers which don't need it.
* [wasm] Enable gshared.
* [llvm] Fix the build.
* [llvm] Avoid passing a dummy arg to string:memcpy/bzero.
* [wasm] Enable exception catching.
* [wasm] Enable explicit division by zero checks.
* [wasm] Patch emscripten with the patch from https://github.com/kripken/emscripten/pull/7182.
* [wasm] Use '.' instead of source in the ninja build scripts since they might be ran with sh/dash instead of bash.
* [wasm] Reenable check-aot on CI.
* [wasm] Run emcc using bash -c since the emsdk_env.sh scripts contains bash-ishms.
* [wasm] Don't error out if the emscripten patch is already applied.
* [wasm] Fix do-aot-sample.
* [wasm] Disable AOT test on CI, it still doesn't work.
* [llvm] Add support for OP_RCNEQ.
* [jit] Make some tests in builtin-types.cs static.
* [wasm] Fix the return value of mono_wasm_exec_regression ().
* [wasm] Make aot-sample uses mini_tests.dll.
* [Coop] Mostly convert appdomain.c.
* Mostly don't convert mono_domain_try_unload at this time -- it was causing failures and maybe the domain swapping needs to be considered carefully with handles.
* Also a few assignments to non-local raw pointers remain, and should probably be suppressed.
See https://jenkins.mono-project.com/view/All/job/test-mono-mainline-staticanalysis-and-code-coverage/Centrinel_Report/
appdomain.c has 34 warnings. This should drop it significantly.
* [runtime] Allow strings when doing alloc-less cattr decoding.
* [runtime] Remove dead define.
* [wasm] Disable broken method under wasm.
* [wasm] Add mono_exec_regression to use mini's regression driver and make it work with WASM interp&AOT.
* [wasm] Remove dead targets. Packager is used for all test suites now.
* [wasm] Cleanup csc flags.
* [wasm] Move aot-sample to use mini_tests_basic again.
* [wasm] We no longer need to exclude FULLAOT from the test suite.
* [wasm] Expose mono_wasm_exec_regression.
* [wasm] Remove dead test driver.
* [wasm] Fix the provisioning step.
* [wasm] Bindings don't link well with the aot sample.
* [wasm] Update the test driver to include --regression support.
* [wasm] Change how regression tests are executed so we exec over aborts.
* [wasm] Appease the C++ typechecker.
* [wasm] Add more casting to make c++ happy.
There is wrong cursor placement after the \t character. Example:
textBox1.Multiline = true;
textBox1.Text = "aa\taa\r\nbb\tbb\r\n";
Point pt = textBox1.GetPositionFromCharIndex(4); //pt.X is wrong for index 4 or any other char after \t in the line.
The default behavior is still to produce an NUnit xml file but we can
now produce xunit format too with the --xunit option.
Slightly refactored the xml reporting into distinct methods for NUnit/xunit.
Roslyn submodule was updated to enable more automated tests. This bumps our submodule revision, and uses roslyn's script to run tests instead of ours.
@monojenkins skip
Part of #6991
* [ci][cxx][sdks] C++ support for SDKs.
* Remove cplusplus support, only cxx.
* [cxx][sdks] Provide isinf and isnan.
https://jenkins.mono-project.com/job/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/1/parsed_console/log.html
/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/mono/mini/jit-icalls.c:994:14: error: 'isinf' was not declared in this scope
if (isinf (v) || isnan (v))
/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/mono/mini/jit-icalls.c:994:27: error: 'isnan' was not declared in this scope
if (isinf (v) || isnan (v))
* Change target card mask from gpointer to mgreg_t.
Consider in future target_gsize instead, though if registers are larger than pointers (x32, arm64_32), ok.
Change inst_imm from mgreg_t to target_mgreg_t.
https://jenkins.mono-project.com/job/test-mono-pull-request-wasm-cxx/1/parsed_console/log.html
/mnt/jenkins/workspace/test-mono-pull-request-wasm-cxx/mono/mini/mini-runtime.c:3657:24: error: cast from 'gpointer {aka void*}' to 'mgreg_t {aka int}' loses precision [-fpermissive]
g_assert ((((mgreg_t)arg) & 1) == 0);
^ ^~~~
/mnt/jenkins/workspace/test-mono-pull-request-wasm-cxx/mono/mini/mini-runtime.c:3658:30: error: cast from 'gpointer {aka void*}' to 'mgreg_t {aka int}' loses precision [-fpermissive]
arg = (gpointer)(((mgreg_t)arg) | 1);
In file included from /mnt/jenkins/workspace/test-mono-pull-request-wasm-cxx/mono/mini/method-to-ir.c:75:0:
/mnt/jenkins/workspace/test-mono-pull-request-wasm-cxx/mono/mini/method-to-ir.c: In function 'void mini_emit_write_barrier(MonoCompile*, MonoInst*, MonoInst*)':
/mnt/jenkins/workspace/test-mono-pull-request-wasm-cxx/mono/mini/ir-emit.h:703:39: error: cast from 'gpointer {aka void*}' to 'mgreg_t {aka int}' loses precision [-fpermissive]
inst->inst_imm = (mgreg_t)(imm); \
^
/mnt/jenkins/workspace/test-mono-pull-request-wasm-cxx/mono/mini/method-to-ir.c:2989:4: note: in expansion of macro 'MONO_EMIT_NEW_BIALU_IMM'
MONO_EMIT_NEW_BIALU_IMM (cfg, OP_PAND_IMM, offset_reg, offset_reg, card_table_mask);
^~~~~~~~~~~~~~~~~~~~~~~
* [cxx][sdks] Move include out of extern "C" where it never belongs.
https://jenkins.mono-project.com/job/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/4/parsed_console/log.html
template<typename _Tp, typename _Up, typename _Vp,
^
/Users/builder/android-toolchain/mxe-b9cbb53/lib/gcc/x86_64-w64-mingw32.static/5.4.0/include/c++/ext/type_traits.h:205:3: error: template with C linkage
template<typename _Tp, typename _Up, typename _Vp, typename _Wp,
^
In file included from /Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/mono/utils/mono-compiler.h:31:0,
from /Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/mono/utils/dlmalloc.h:33,
from /Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/mono/utils/dlmalloc.c:27:
/Users/builder/android-toolchain/mxe-b9cbb53/lib/gcc/x86_64-w64-mingw32.static/5.4.0/include/c++/cmath: In function 'constexpr float std::abs(float)':
/Users/builder/android-toolchain/mxe-b9cbb53/lib/gcc/x86_64-w64-mingw32.static/5.4.0/include/c++/cmath:87:16: error: conflicting declaration of C function 'constexpr float std::abs(float)'
abs(float __x)
* Expand cmath to wasm.
https://jenkins.mono-project.com/job/test-mono-pull-request-wasm-cxx/5/parsed_console/log.html
/mnt/jenkins/workspace/test-mono-pull-request-wasm-cxx/mono/mini/mini-llvm.c:4189:6: error: 'isnan' was not declared in this scope
if (isnan (val))
^~~~~
* Provide cmath std::isnan for WebAssembly C++.
* Provide cmath std::isfinite for Android C++.
* Add cmath std::isunordered for Android
/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/mono/mini/interp/interp.c:3282:14: error: use of undeclared identifier 'isunordered'; did you mean 'std::isunordered'?
CONDBR_S(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f <= sp[1].data.f)
^~~~~~~~~~~
std::isunordered
* Add cmath std::isinf for Android.
https://jenkins.mono-project.com/job/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/10/parsed_console/log.html
/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/mono/mini/interp/interp.c:3751:8: error: use of undeclared identifier 'isinf'
if (isinf (sp [-1].data.f))
* "using std::isinf" sometimes breaks on Android, sometimes fixes Android,
because Android sometimes has global isinf.
/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/mono/mini/interp/interp.c:92:12: error: target of using declaration conflicts with declaration already in scope
using std::isinf;
^
/Users/builder/android-toolchain/toolchains/arm64-v8a-clang/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../include/c++/4.9.x/cmath:604:3: note: target of using declaration
isinf(double __x)
^
/Users/builder/android-toolchain/toolchains/arm64-v8a-clang/bin/../sysroot/usr/include/math.h:234:6: note: conflicting declaration
int (isinf)(double) __pure2;
There are still some errors in new lanes (WebAssembly works, Android does not, iOS not sure), to be addressed shortly, possibly by redoing some of the cmath stuff.
* mono_w32handle_wait_multiple: Duplication is ok for WaitAny, exception for WaitAll.
Fixes https://github.com/mono/mono/issues/9089
* Duplicate detection in mono_win32_wait_for_multiple_objects_ex, like mono_w32handle_wait_multiple.
* Move wait duplicate tests from mono/tests to mcs/class/corlib/Test/System.Threading/WaitHandleTest.cs.
Run them with e.g.:
`PATH="/s/mono2/runtime/_tmpinst/bin:/Users/jay/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin:/Users/jay/bin" MONO_REGISTRY_PATH="/Users/jay/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" DBG_RUNTIME_ARGS="" MONO_PATH="./../../class/lib/net_4_x-macos/:./../../class/lib/net_4_x-macos//tests:./../../../external/xunit-binaries:.:$MONO_PATH" /s/mono2/runtime/mono-wrapper --debug ./../../class/lib/net_4_x-macos/nunit-lite-console.exe ./../../class/lib/net_4_x/tests/net_4_x_corlib_test.dll -exclude=NotOnMac,MacNotWorking,NotWorking,CAS -format:nunit2 -result:TestResult-net_4_x.xml -test:MonoTests.System.Threading.WaitHandleTest.DuplicateWaitAll`
`PATH="/s/mono2/runtime/_tmpinst/bin:/Users/jay/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin:/Users/jay/bin" MONO_REGISTRY_PATH="/Users/jay/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" DBG_RUNTIME_ARGS="" MONO_PATH="./../../class/lib/net_4_x-macos/:./../../class/lib/net_4_x-macos//tests:./../../../external/xunit-binaries:.:$MONO_PATH" /s/mono2/runtime/mono-wrapper --debug ./../../class/lib/net_4_x-macos/nunit-lite-console.exe ./../../class/lib/net_4_x/tests/net_4_x_corlib_test.dll -exclude=NotOnMac,MacNotWorking,NotWorking,CAS -format:nunit2 -result:TestResult-net_4_x.xml -test:MonoTests.System.Threading.WaitHandleTest.DuplicateWaitAny`
Find the full names with:
`PATH="/s/mono2/runtime/_tmpinst/bin:/Users/jay/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin:/Users/jay/bin" MONO_REGISTRY_PATH="/Users/jay/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" DBG_RUNTIME_ARGS="" MONO_PATH="./../../class/lib/net_4_x-macos/:./../../class/lib/net_4_x-macos//tests:./../../../external/xunit-binaries:.:$MONO_PATH" /s/mono2/runtime/mono-wrapper --debug ./../../class/lib/net_4_x-macos/nunit-lite-console.exe ./../../class/lib/net_4_x/tests/net_4_x_corlib_test.dll -exclude=NotOnMac,MacNotWorking,NotWorking,CAS -format:nunit2 -result:TestResult-net_4_x.xml -explore`
and look at the resulting .xml file.
I ran them w/ and w/o the fix, verify they both failed w/o and passed w/.
(w/o the fix was a slight hack of the fix)
* Move null checks so other uses can still null dereference.
* Short circuit duplicate search, correct either way.
* Fix windows build -- missing include.
* Add MonoError to mono_win32_wait_for_multiple_objects_ex, probably did this earlier but lost it somewhere in git.
* Add missing include.
* Follow shorter convention of rest of directory.
* Make the code slightly more complicated per PR.
* PR: Split into small used-once functions.
* cleanup
* add static
* PR: sizeof (array [0]) vs. sizeof (type)
* Convert or partially convert mono_domain_try_type_resolve_typebuilder, mono_domain_try_type_resolve, mono_domain_try_type_resolve_name.
In order to use TYPED_HANDLE_DECL, this required splitting handle.h into at least two pieces,
here called handle-decl.h and handle.h.
A fair amount of early returns had to be converted.
* PR: Move mono_domain_try_type_resolve_name from domain-internals.h to reflection-internals.h.
Move mono_domain_try_type_resolve_typebuilder ditto.
Move ves_icall_TypeBuilder_create_runtime_class from object-internals.h to reflection-internals.h.
Move TYPED_HANDLE_DECL (MonoReflectionAssembly) from handle-0.h to reflection-internals.h (previously object-internals.h)
Move TYPED_HANDLE_DECL (MonoReflectionTypeBuilder) ditto.
Add MONO_HANDLE_BOOL to handle.h so we can 1. Stop inverting tests and 2. Prefer
true first in ternary.
x = MONO_HANDLE_BOOL (y) ? z : 0
instead of
x = MONO_HANDLE_IS_NULL (y) ? 0 : z
Add include "reflection-internals.h" to mono-security.c
Add include "reflection-internals.h" to security.h
object-forward.h:
Place MONO_RT_MANAGED_ATTR on MonoReflectionTypeBuilder.
Really it should just be MonoObject, and then implied
by everything that contains it.
Place MONO_RT_MANAGED_ATTR consistently.
Sort by native then managed.
mono_reflection_get_type_with_rootimage: Rename assembly to refection_assembly
and then use assembly to reduce occurences of MONO_HANDLE_GETVAL (assembly, assembly).
mono-security.c: include config.h unconditionally and just once.
* Change mono_class_get_ref_info_raw to return MonoReflectionTypeBuilder* instead of MonoObject*.
Remove casts on mono_class_get_ref_info_raw calls.
Change mono_class_get_ref_info to return MonoReflectionTypeBuilderHandle instead of MonoObjectHandle.
Move mono_class_get_ref_info from object-internals.h to reflection-internals.h.
Use mono_class_get_ref_info instead of mono_class_get_ref_info_raw.
* Cleanup -- MONO_HANDLE_BOOL and contains instead of cast.
* PR: Fix incorrect comment. Fix precise GC hole wrt invoke.
It's assuming a device or emulator is already attached or running. On our CI, a new emulator is automatically started at the beginning of the job and shutdown at the end of it.
When building 32-bit binaries on a 64-bit system and vice versa, it is necessary
to pass the `-m32` or `-m64` compiler flags, respectively. Failure to do so will
result not only in linking problems (different binary architecture) but also in
problems when using some system headers which are sensitive to the architecture.
For instance, `ucontext.h` contains register set definitions for different
architectures and building Mono runtime with a 64-bit compiler targetting 32-bit
architecture results in this error:
.../mono/mono/utils/mono-sigcontext.h:173:74: error: ‘REG_EIP’ undeclared (first use in this function); did you mean ‘REG_RIP’?
#define UCONTEXT_REG_EIP(ctx) (((ucontext_t*)(ctx))->uc_mcontext.gregs [REG_EIP])
The issue here is that the compiler defines the `__x86_64__` macro which causes
`ucontext.h` to choose declarations for amd64 (which does not use `REG_EIP` but
has `REG_RIP` instead) while Mono runtime assumes its building for a 32-bit host
and uses 32-bit register names. Passing `-m32` to the compiler will fix the
issue as now the compiler will define the `__i386__` macro and all parties will
agree where they are and what they want.
This commit uses a rather baroque statement when constructing compiler flags to
build the Mono runtime to check whether the host triple targets 32 or 64-bit
host and adds the appropriate flag.
* [System]: Make sure `HttpWebRequest` observes exceptions on timeout. #10488.
`HttpWebRequest.RunWithTimeoutWorker()` needs to observe the worker task's exception
on timeout to prevent it from being thrown via the `TaskScheduler.UnobservedTaskException`
event. Fixes#10488.
* Add `TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.OnlyOnCanceled` as suggested by Marek.
* Use 'OnlyFaulted' only.
PAL_gssapi.c was converted to C recently in corefx but since our fork is not up to date I copied `PAL_gssapi.c` and `PAL_gssapi.h` into mono/metadata (I guess I should just cherry-pick those files to our fork).
For System.Data it will allow users to connect to sql servers using SSPI (Security Support Provider Interface).
See https://github.com/mono/mono/issues/9028 and https://github.com/mono/mono/issues/9751
on macOS (and iOS) it uses built-in GSS.framework.
on Linux it requires an additional package (`krb`) to be installed (see .NET Core prerequisites, e.g. https://docs.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x#ubuntu).
Unfortunately it's not installed on our CI yet.
* Some cleanup in appdomain.c.
- Combine exit paths.
- npaths is always incremented, so remove test against 0 (assuming no overflow).
* Change g_strdelimit first parameter from string to character.
* Fix C++ -- goto around init.
* PR: Restore legacy types gint, gchar.
* [wasm] Add beginnings of linker support in AOT mode.
* Fix the compilation of monolinker.exe.
* Link in libmono-icall-table.a as well.
* Copy monolinker.exe instead of building it.
* [jit] Fix a constant propagation problem on 32 bit with iconst+conv.i8, we would be setting inst_imm even for long opcodes.
* [llvm] Fix the special casing of OP_LCOMPARE_IMM, its not needed.
* Use TARGET_SIZEOF_VOID_P.
* [wasm/gc] It's valid to register for finalization an object without a finalizer. Don't register for fin objects added to refqueues under sgen.
The refqueue change undo part of 87fb34d18a.
This is due to how track resurrection weak refs are implemented under boehm and sgen. Sgen natively supports them so we don't
need to emulated it by registering them for finalization. This produces a lot of useless work for the GC.
* [wasm] Enable SRE.
[interp] Optimize ldtoken + GetTypeFromHandle pair
As we do with jit. Improves speed of typeof operator by 10-15 times.
<!--
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
-->
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.
* Fix outarg_vt processing. Fixes#10549
* Cleanup unused bits and pieces
* Correct the handling of structures being retuned from a call
* Restore vtcopy code etc.
[llvm] Make sure OP_LSHL_IMM is transformed to a 64 bit shift even if the input is 32 bit, which can happen because the JIT IR is not regular. Fixes bug-17590.exe on arm64+fullaot+llvm.
Fixes https://github.com/mono/mono/issues/10527
* mono_aot_get_unbox_trampoline: amd64 compute unbox trampoline size correctly via runtime disassembly.
This fixes: MonoTests.System.Linq.ParallelEnumerableTests.TestGroupBy frequently crashing on FullAOT/LLVM/Linux/amd64 CI.
https://github.com/mono/mono/issues/10441https://github.com/mono/mono/issues/9554https://github.com/mono/mono/issues/9046
Race condition because the code varies in what actually runs.
Sometimes System_Linq_Parallel_WrapperEqualityComparer_1_T_GSHAREDVT_GetHashCode_System_Linq_Parallel_Wrapper_1_T_GSHAREDVT is called,
sometimes not.
FullAOT+LLVM for obvious reasons.
Very sensitive to exact code presumably because the bug depends on whether the first
unbox trampoline has the same size as the unbox trampoline for System_Linq_Parallel_WrapperEqualityComparer_1_T_GSHAREDVT_GetHashCode_System_Linq_Parallel_Wrapper_1_T_GSHAREDVT?
For example, this could be the only unbox trampoline or it could be first.
For example System_Security_Cryptography_ECCurve_get_Oid gets the first unbox trampoline and compiling it with mini or LLVM makes a difference.
Guessing here:
When the first unbox trampoline is 9 bytes in size and
System_Linq_Parallel_WrapperEqualityComparer_1_T_GSHAREDVT_GetHashCode_System_Linq_Parallel_Wrapper_1_T_GSHAREDVT
is 6 bytes in size, then System_Linq_Parallel_WrapperEqualityComparer_1_T_GSHAREDVT_GetHashCode_System_Linq_Parallel_Wrapper_1_T_GSHAREDVT's
unbox trampoline, which comes right before System_Linq_Parallel_WrapperEqualityComparer_1_T_GSHAREDVT_GetHashCode_System_Linq_Parallel_Wrapper_1_T_GSHAREDVT
is thought to be 9 bytes also, which overlaps System_Linq_Parallel_WrapperEqualityComparer_1_T_GSHAREDVT_GetHashCode_System_Linq_Parallel_Wrapper_1_T_GSHAREDVT.
So the binary search finds that, which goes wrong somehow -- mono_aot_find_jit_info returns NULL (for reasons not debugged).
And then we fail to wrap System_Linq_Parallel_WrapperEqualityComparer_1_T_GSHAREDVT_GetHashCode_System_Linq_Parallel_Wrapper_1_T_GSHAREDVT
with a gsharedvt trampoline.
In the normal course when things work, calling System_Linq_Parallel_WrapperEqualityComparer_1_T_GSHAREDVT_GetHashCode_System_Linq_Parallel_Wrapper_1_T_GSHAREDVT
goes through both gsharedvt_out_trampoline and gsharedvt_trampoline.
The first turns a byref into a byvalue, the second turns it back into a byref.
When the second is skipped, we end up treating the value as a pointer and SIGSEGV.
This can be seen using https://github.com/mono/mono/pull/10582.
mini amd64 unbox trampolines are always 9 bytes -- 4 byte add, 5 byte jmp
LLVM amd64 unbox trampolines vary 6 or 9 -- 4 byte add, 2 or 5 byte jmp.
There are *many* possible ways to fix this.
1. Runtime disassembly to measure the trampoline size, each trampoline, allowing just two variations. This was written, tested, works. Downside is inhibits breakpoints, at an unlikely time and place, and inhibits execute only memory protection, also unlikely. Looks a little gnarly, but really is not.
2. Get the assembler to output fixed size trampolines.
This is known for GNU assembler -- (disp32) jmp and jmp.d32.
This is not known for Apple assembler, either the older cctools or LLVM, but maybe.
The problem *seemed* to be Linux only, but the underlying causes do not.
If this were looked into more closely and a Linux-specificity actually found, then depending on GNU as is more reasonable.
3. Output object files instead of assembly text. Good and bad idea otherwise. Super non-trivial.
4. Construct the tramp_info at compile time, with compiler/assembler/linker-computed size. This should be possible and otherwise beneficial, but not trivial, and not super beneficial, only mildly.
const static data/code is generally prefer over dynamic.
5. Don't bother with the trampinfo at all. It should not be needed, even for stackwalk, as these are leaf functions (don't change nonvolatiles), so stackwalk is just *rsp++.
Good idea for another day, as it is a simple net reduction in code, pending testing a not easy to test case -- need to make a function that just jmps to self, point a thread at it, wait till it gets there, suspend it, and stackwalk it. A good exercise, for another time.
6. Pad out trampolines to at least 9 bytes by adding 3x 0xcc.
Sometimes 12 bytes.
And hardcoding size as 9 at runtime -- don't use the actual computed size, as it could be 12, apply that to a 9 byter, and back with the same problem.
That is one incorrect solution in there -- just merely adding 3 bytes of padding seemed at first like a good idea, but would not likely work.
7. Or rather, no need to pad, hardcode to 6 at runtime.
8. Or rather, hardcoding to 5 suffices. Interior bytes of last instruction need not be described, pretend it is of size 1. 2 is no more accurate than 1, when some of them are actually 5.
9. Can hardcode in compiler or runtime.
Both developed, easy.
10. Try current assemblers. Maybe the original reason to switch from 0xe9 to jmp is moot.
But continue to work with old assemblers? (in a test-only scenario?)
Not attempted.
11. Use separate source files to help achieve distance or assembler ignorance of distance.
Not attempted.
12. Move all the trampolines adjacent, with 128 bytes of padding on either end.
Not attempted.
13. Asserting the trampolines are 16-aligned would maybe work. And/or following them with a 16-aligned entity.
Here we option 9, hardcode to 5 in the compiler. It is essentially a one line change.
Removing the trampinfo and testing async stack walk is left as a future change.
This is really the best option but has more significant test burden.
* Increment MONO_AOT_FILE_VERSION to invalidate old bad images.
The badness is borderline -- limited to FullAOT+AMD64+LLVM, which is nonexistant outside test environments. This version should probably be a guid also.
It is not clear how this should be represented.
https://docs.microsoft.com/en-us/windows/desktop/api/processthreadsapi/nf-processthreadsapi-createprocessa
"Note that an ANSI environment block is terminated by two zero bytes: one for the last string,
one more to terminate the block.
A Unicode environment block is terminated by four zero bytes: two for the last string,
two more to terminate the block."
Is unambiguous however.
* Add support for:
- Get global object - This allows developers access to variables of javascripts global space. For example the window object in the Browser.
- Add reference counting to the javascript object registry in the bindings. This can prevent a javascript object that is in the object registry from being removed unexpectedly.
- Add AddRef and ReleaseRef to manage object registry reference counting if it is needed.
* Add support for an HttpMessageHandler that works for WASM.
- Needs real world testing before we decide to make this a default.
- Depends on the delivered bindings.dll and the bindings support built.
- Due to the bindings dependency there is no need to add extra javascript library to the build.
- Works only through a browser session at this time as it works directly with window.fetch.
* Free the Task Completion Source after the promise completes.
* There are some headers that can only be attached to the Content's Headers.
- If the header returned from fetch can not be added to the response header then try to add it to the Content headers.
- Fix misspelling in binding_support.js
* Remove reference counting from bindings.
- Remove object disposal from WasmHttpMessageHandler.
* Add bindings.dll requirement to wasmhttp.dll build.
* Clear the HttpResponseMessage after setting the TaskCompletionSource so it can be garbage collected.
* [interp] move thread attach to interpreter entry
We want to attach a thread before any TLS operation is done by the
interpreter. In the JIT this happens inside the native-to-managed
wrapper via `mono_threads_attach_coop ()`. Unfortunately, this is too
late for the interpreter as it already requires a working TLS before
even calling into the wrapper.
Also, fixup naming of locals in the native-to-managed wrapper.
* [interp] do not propagate uninitialized ThreadContext to JIT TLS
* [interp] fix memory corruption around pinvoke wrapper allocation
* [interp/jit] fix memory leak in pinvoke wrapper allocation
* Make test.js use generated driver and bindings.
- bindings_tests.dll uses the generated bindings.dll.
- Modify packager to accept a template parameter that overrides the default `runtime.g.js`.
- Modify the tests to call runtime.js in the test-suite directory
- The runtime.js is automatically created in the test-suite library so no need to do extra copies.
- resolves https://github.com/mono/mono/issues/10244
* Add -template option to packager
- Part of merge conflict resolution
* Add -asset option that allows an extra asset to be copied to the output directory.
- --asset=x Add specified asset 'x' to list of assets to be copied
- An asset option needs to be specified for each asset to be copied.
Handle ref returns in runtime invoke wrappers.
Indirectly load ref return values in invoke wrappers and return by value.
Don't share wrappers with ref returns since indirect load is used.
Add soft debugger support for methods with ref returns.
* [metadata] Hack - get mono_use_interpreter from metadata
Don't use this, it's a mistake. The granularity is all wrong, for one: in the
future the interpreter may not be an all-or-nothing deal.
* [marshal] Don't emit CEE_MONO_JIT_ATTACH except for interpreter
Always use the mono_threads_coop_attach/mono_threads_coop_detach pair.
* [aot] Drop MONO_PATCH_INFO_JIT_THREAD_ATTACH
We always emit the mono_threads_attach_coop icalls now.
Bump MONO_AOT_FILE_VERSION
* [mini] mark mono_jit_thread_attach external only
It's used by Xamarin.Mac and possibly other embedders.
Interpreter still used mono_jit_thread_attach_interp until it's fixed to work
with coop.
There shouldn't be any other callers.
* [interp] Add a thread attach EE callback
Use it to set the interpreter thread context on the JIT tls value
* [marshal] Always emit mono_threads_attach_coop instead of CEE_MONO_JIT_ATTACH
Use the coop icall for the interpreter, too.
* [interp] Drop MINT_MONO_JIT_ATTACH and detach opcodes
* [metadata] Drop CEE_MONO_JIT_ATTACH and detach opcodes
* Revert "[metadata] Hack - get mono_use_interpreter from metadata"
This reverts commit c3d2f488b824dcdfa261f8292013c805740f353f.
* [mini] Drop unused mini_jit_thread_attach_interp
It was a temporary workaround for the interpreter; no longer needed.
* [coop] Switch to GC Safe in mono_jit_thread_attach.
It's an external-only function that's not called by the runtime on any
threads. So the only calls are explicit uses by Mono API clients. Leave the
thread in GC Safe mode and leave it to the n2m invoke wrappers or MONO_API
entry points to switch to GC Unsafe.
* [interp] Add MINT_MONO_THREADS_ATTACH_COOP opcode
Because this icall can be called from detached threads, don't go through
do_icall () which needs initialized tls keys
* fixup for c++ build
* fixup indentation and comments
* fixup C++ a bit more
* [mini] Bump MONO_EE_API_VERSION
* Revert "[interp] Add a thread attach EE callback"
This reverts commit 8a343d6ce15f0475a62936f28264f638ebf0344f.
* [interp] sync jittls context before entering EH machinery
Indirectly load ref return values in invoke wrappers and return by value.
Don't share wrappers with ref returns since indirect load is used.
Add soft debugger support for methods with ref returns.
* [wasm] Rename 'wasm-aot' to 'wasm-cross' for consistency with the other SDKs.
* [wasm] Use the separate libmono-ee-interp.a library for linking in the interpreter.
* [wasm] Unify interp and aot runtimes.
* [wasm] Avoid cleaning the emscripten toolchain when cleaning the runtime or cross compilers.
* [wasm] Use the sdk llvm targets to build the cross compiler, so it can use a downloaded llvm instead of building its own.
* [offset-tool] Add WASM support.
* [wasm] Generate offsets file for wasm.
* [wasm] Switch packager.exe to use Mono.Options, add a --mono-sdkdir option to specify the path to the mono sdk.
* [wasm] Emit a ninja build file from the packager when the --builddir argument is given.
* [wasm] Auto generate the aot registration code by generating a driver-gen.c file and including it into driver.c.
* [wasm] Add emcc link step to the ninja build script.
* zoltan's changes.
* [wasm] Fix merge conflicts from picking Zoltan's patches.
* [sdks] Fix the wasm build so the package target doesn't build 394839840 llvms.
* [wasm] Fix mono_arch_create_specific_trampoline to work with the AOT compiler reverse lookup of icalls
* [wasm] Don't set minimum memory size, let it dynamically grow.
* [wasm] Remove old aot targets. Now do-aot-sample does the whole magic.
* [wasm] Attept at making the offsets-tool work on linux.
* [wasm] Cleanup the hacks early in this PR.
* [wasm] Fix rebase issue.
* Fix rebase
* Fix rebase
* [llvm] Only emit the dummy arg when targeting wasm.
Part of #9660.
The changes:
- included corefx version of PropertyInfo type;
- included related xunit tests from corefx System.Reflection;
- moved `GetPropertyFromHandle `method to MonoProperty type;
- moved `internal_from_handle_type `extern method and related icall to MonoProperty type;
- fixed some edge cases where exception is expected;
- removed obsolete System.Reflection/PropertyInfo.cs.
<!--
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.IO] Enable CoreFX FilesystemWatcher on Android
This was the last user of the 'InotifyWatcher' Mono implementation, so this is also removed.
* [csproj] Update project files
* Ensure the finalization of SafeHandle and GCHandle in DeflateStreamNative is performed in the correct order.
* Do not access BaseStream from finalizer.
* Fix Mono Windows cross compiler using mono LLVM release_60 branch.
For scenario where llvm-config.exe can't be run (none WSL/CygWin build target)
Build will fallback to hard coded libraries not working with mono LLVM release_60
branch.
Added an exact mirror of what llvm-config.exe is returning for different components
on mono LLVM master and mono LLVM release_60 branch.
The selected codegen libraries (passed in as extra_libs) was not handled in any cases
so added them into the build script as well.
* Split parameter between lvm codegen libs and llvm extra libs.
Need to explicit pass -lz in case where configure have detected zlib availability
and llvm-config.exe can't be executed. In cases where zlib is not available, default
in mingw installs, this check make sure link step won't fail due to missing library.
* Fix inversion of aarch64codegen libs.
* Enable package-android-cross-{arm,arm64,x86,x86_64}-win builds on CI.
* Fix incorrect checks when compiling Windows cross compiler.
Windows cross compiler could have a target that is !TARGET_WIN32 but still
running on a Windows host, so check needs to look at !HOST_WIN32 to determine
if Unix source files can be included or not.
* [metadata] Fix Thread.Yield icall function signature
The signature exposed on the C# side has a boolean return but the actual C implementation used to be marked as void.
This caused an issue with the WASM backend as the interpreter would try to jump to the icall using an `MINT_ICALL_V_P` opcode. Since emscripten does function pointer jumps based on a function signature key and the signature mismatched on the C side, the jump would fail triggering the `nullFunc_i(x)` on the mono.js side.
* [wasm] Add facade resolving to packager tool
* [wasm] Use correct mono_bindings_init syntax to initialize bindings library
* [interp] Remove some duplicated code
* [interp] Don't abort in critical wrappers
Fixes premature exiting of special threads due to aborts (like threadpool threads), instead of catching exception and resuming to native code.
By default, all projects are build using "default" compiler based on source
file extension. There is a property in mono.props, MONO_COMPILE_AS_CPP
that could change this and build selected projects (eglib, libgcmonosgen,
libmini, libmono-dynamic, libmono-static, libmonodac, libmonoruntime,
libmonoutils, mono, monodis, monograph and pedump) using C++ compiler.
MONO_COMPILE_AS_CPP property could be set when calling msbuild
or through VS property manager IDE. Default value is false building using
"default" compiler (current behavior). When setting MONO_COMPILE_AS_CPP=true
the build prefix will be altered to make sure the C++ build gets its own build
folder, parallel to default build folders.
Example of building using C++ compiler from msbuild:
msbuild /p:PlatformToolset=v140 /p:Platform=x64 /p:Configuration=Release /p:MONO_TARGET_GC=sgen /p:MONO_COMPILE_AS_CPP=true msvc/mono.sln
We can't decrement the size on removal as we use tombstones.
When using tombstones, the invariant to keep is on the number of null entries as those
are used as search stop-marks.
Without this change, it's possible that a long series of add/remove operations could leave the array with no null entries,
just tombstones and filled entries. In that case, search would degenerate into a linear search that would look into all array elements.
This change fixes worst-case perf of not-found searches to be bound to the load factor.
Additionally, clear the array to null entries, otherwise we fall into the above trap even more easily.
* gmisc-win32.c(136): error C2664: 'HRESULT SHGetKnownFolderPath(const KNOWNFOLDERID&,DWORD,HANDLE,PWSTR *)': cannot convert argument 1 from 'const GUID *' to 'const KNOWNFOLDERID
REGUID is const GUID& in C++, const GUID* in C*.
It is impossible to have portable C/C++ that deals with this.
This feels like a mistake, but it is ancient and not changing.
* gpath.c(102): error C2440: '=': cannot convert from 'const char *' to 'char *'
Add const, like in the non-Windows case right before.
* sgen-gc.c(1381): error C4576: a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax
A inline function would trivially portably standardly solve this,
but wrap in compiler-specific pragma to suppress.
* [cxx] abi.c(60): error C2059: syntax error: '.'
Remove designated initializer.
[mono] Compiler warnings fixes
This fixes a bunch of warnings in threads.c. Compare-exchange cast is unfortunate because it would do without if we had platform long sized cas helper around - tid is always u32 on Windows (DWORD), and pthread_t is always long int, which could be 32 or 64 bit.
* Adapt typesafe coop handles to be valid standard C++. i.e. valid for Visual
C++, w/o gcc/clang language extension __typeof__. This is not meant to be
long term idiomatic C++, just enough to get us by for now.
The solution does not quite work for type unsafe handles, because
checking for this == NULL is not defined. A non-member function
would be needed.
C++11 decltype could be used instead at the MONO_TYPEOF_CAST level,
but this solution is trivial C++98.
Visual C++ historically was seen to have trouble giving names
to member functions of anonymous types -- an unusual construct.
So the previously anonymous structs are given a name here.
* Go back to anonymous type.
https://jenkins.mono-project.com/job/test-mono-pull-request-amd64-osx-products-sdks-ios/4408/parsed_console/log.html
CC libmonoruntimesgen_la-method-builder-ilgen.lo
/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-ios/mono/metadata/marshal-ilgen.c:6403:29: error: use of undeclared identifier 'MONO_OFFSET_MonoObjectHandlePayload___raw'; did you mean 'MONO_OFFSET_MonoObjectHandle___raw'?
mono_mb_emit_ldflda (mb, MONO_HANDLE_PAYLOAD_OFFSET (MonoObject));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MONO_OFFSET_MonoObjectHandle___raw
/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-ios/mono/metadata/handle.h:426:42: note: expanded from macro 'MONO_HANDLE_PAYLOAD_OFFSET'
^
/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-ios/mono/metadata/handle.h:425:50: note: expanded from macro 'MONO_HANDLE_PAYLOAD_OFFSET_'
^
/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-ios/mono/metadata/abi-details.h:56:42: note: expanded from macro 'MONO_STRUCT_OFFSET'
^
<scratch space>:89:1: note: expanded from here
0dbcdd5c28 added CFLAGS etc in front of the
command but that's not something the TESTCMD can execute.
We need to pass those variables to the whole process.
Part of https://github.com/mono/mono/issues/9660
The changes:
- included corert version of CustomAttributeTypedArgument type;
- included related xunit tests from corefx System.Runtime;
- updated corert/Type.cs to have some required properties from corert Type.Internal.cs;
- removed obsolete System.Reflection/CustomAttributeTypedArgument.cs;
- moved back "array case" handling in CustomAttributeTypedArgument ctor (via related PR);
- re-enabled "Arrays" test in CustomAttributeDataTest on mobile.
* [cxx][metadata] Cast from void.
* [cxx][metadata] Casts, mostly from void*.
* [cxx] [metadata] MONO_BEGIN_DECLS / MONO_END_DECLS only in public headers.
G_BEGIN_DECLS / G_END_DECLS are ok in private headers (and .c), but the vast majority of uses are not needed. In this case, every function is MONO_API anyway.
* [cxx] [metadata] Add template for mono_mb_emit_native_call under #ifdef __cplusplus.
* [cxx] [metadata] Loosen the parameter type in mono_vtype_get_field_addr from guint8* to gpointer.
* [cxx][metadata][profiler] Add G_ENUM_FUNCTIONS (MonoProfilerCallInstrumentationFlags), outside of the public header MonoProfilerCallInstrumentationFlags is defined in.
* [cxx][metadata][profiler] Cast void* to function pointer MonoProfilerCallInstrumentationFilterCallback.
* [cxx][metadata] Cast from void*.
* [cxx][metadata][sgen] Change sgen_client_root_registered(source) from int to enum MonoGCRootSource.
* [cxx][metadata][sgen] Change report_conservative_roots(root_report_address) from char* to void*.
* [cxx][metadata][sgen] In mono_gc_register_obj_with_weak_fields, cast parameter from void* to MonoObject*.
* [cxx][metadata][sgen] In sgen_client_gchandle_created and sgen_client_gchandle_destroyed, cast handle_type from int to MonoGCHandleType. This could be better.
* [cxx][metadata][sre] In mono_dynimage_encode_constant, change local box_val from char* to void*.
* [cxx][metadata][sre] Change swap_with_size(dest, val) from {,const}char* to {,const}void*. Move function starting brace to its own line.
* [cxx][metadata][sre] encode_cattr_value(argval) from char* to const void*.
* [cxx][metadata][sre] Add ICALL_EXPORT to ves_icall_TypeBuilder_create_runtime_class.
* [cxx][metadata] Templatize mono_thread_create_internal and mono_thread_create_checked. FIXME: Fix the parameter type and inputs.
* [cxx][metadata][threads] Cast from void* to MonoCoopMutex*.
* [cxx] Fix return type of start_wrapper_internal -- guint32 vs. gulong.
* [cxx][metadata] In start_wrapper_internal, cast function pointer to void*. Later we should get all the types correct.
* [cxx][metadata] Fix return type of start_wrapper from gsize to mono_thread_start_return_t.
* [cxx][metadata] create_thread: Remove cast on first parameter to mono_thread_platform_create_thread.
* [cxx][metadata] Add ICALL_EXPORT on ves_icall_System_Threading_Thread_GetPriority.
* [cxx][metadata] g_cast does not allow for ternary operator though it could with one line; add casts to workaround; remove cycle optimization from error path, favoring smaller code.
* [cxx][metadata] ves_icall_System_IO_MonoIO_Read, ves_icall_System_IO_MonoIO_Write: Change relatively untyped data from char* to void*.
* [cxx][metadata] Add parentheses around define INVALID_HANDLE_VALUE to avoid surprises.
* [cxx][metadata] In mono_w32handle_convert_wait_ret, cast between int and enum MonoW32HandleWaitRet. We could also give up on enums for this type.
* [cxx][metadata]ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal: Add cast to HWND.
* [cxx][metadata] Cast to HMODULE. Add const.
* [cxx] w32process.h: Add missing ICALL_EXPORT.
* [cxx][metadata] w32socket-win32.c: add const on string literals.
* [cxx] mono_w32socket_recvbuffers: cast to LPWSAOVERLAPPED and LPWSAOVERLAPPED_COMPLETION_ROUTINE.
* [cxx] mono_w32socket_send: cast from void* to char*.
* [cxx]mono_w32socket_sendbuffers cast to LPWSAOVERLAPPED and LPWSAOVERLAPPED_COMPLETION_ROUTINE.
* [cxx] mono_w32socket_getsockopt cast from void* to char*.
* [cxx] mono_w32socket_setsockopt cast from const void* to const char*.
* [cxx] mono_w32socket_ioctl fix out parameter written from glong* to DWORD* to avoid casts.
* [cxx] [w32socket] Remove casts on calls to mono_w32socket_getsockopt and mono_w32socket_setsockopt since they nicely accept void* and const void*.
* [cxx][w32socket] Change output_bytes from glong to the correct DWORD to avoid casts.
* [cxx] Add ICALL_EXPORT to ves_icall_cancel_blocking_socket_operation.
* [cxx] Remove keyword 'template'.
* PR: Revert "[cxx] Fix return type of start_wrapper_internal -- guint32 vs. gulong."
This reverts commit 8e02c9cf732a80b77af59b9a11fceaca7490a87c.
https://github.com/mono/mono/pull/10432#discussion_r215009888
This area of thread creation needs work.
1. We have function pointers with almost gratuitous casts,
2. inconsistent return types (motivating function pointer casts)
3. return values ignored
https://github.com/mono/mono/issues/10467https://github.com/mono/mono/issues/10319#issuecomment-417739621
and more.
* [cxx][mini] compile_methods: cast function pointer passed to mono_thread_create_internal to void*. This should be improved in future.
* [cxx][mini] mono_read_method_cache: C++ does not allow goto around initialization.
* [cxx][mini] mono_read_method_cache: C++ does not allow goto around initialization.
* [cxx][mini] decode_exception_debug_info: Use Enum a |= b instead of a = (Enum)(a | b); one of these might be have recent damage.
* [cxx][mini] init_method: C++ does not allow goto around initialization.
* [cxx][mini] get_new_trampoline_from_page: cast twice to guint8* instead of void*.
* [cxx][mini]Strengthen MonoAotFileInfo.runtime_version from void* to char*.
* [cxx][mini] Weaken decode_vtype(addr, buf) from guint8* to void*, but then assign right back to guint8* locals for easy to author and read diff.
* [cxx][mini] Weaken decode_value(addr, buf) from guint8* to void*, but then assign right back to guint8* locals for easy to author and read diff. (like previous but decode_vtype vs. decode_value)
* [cxx][mini] vm_commands: standard C++ has no designated initializers; actual support by compilers varies, but effectively no support and trivial to do without. (current clang++ good support, current g++ some support, g++4.4 no support, msvc presumed no support).
* [cxx][mini] Cast function pointer from void* to correct type.
* [cxx][mini] exceptions-amd64.c: mono_arch_ip_from_context: cast from integer to void*.
* [cxx][mini] exceptions-amd64.c: mono_arch_ip_from_context: cast from void* to MonoContext*.
* [cxx][mini] exceptions-amd64.c: fast_find_range_in_table_no_lock_ex: Cast from void* to DynamicFunctionTableEntry* twice. On the second one, it might be clearer to put the cast further to the left, i.e. just after =.
* [cxx][mini] exceptions-amd64.c: initialize_unwind_info_internal: Cast parameter to mono_arch_unwindinfo_create to void**.
* [cxx][mini] exceptions-arm.c: mono_arm_get_exception_trampolines: Change local variable tramp from guint8* to void*.
* [cxx][mini]exceptions-wasm.c: Cast returned function pointers to void* a few times.
* [cxx][mini] exceptions-x86: Fix win32_handle_stack_overflow(sctx) to be CONTEXT* instead of struct sigcontext *.
* [cxx][mini] exceptions-x86: win32_seh_init: Cast mono_win32_get_handle_stackoverflow() from void* to correct function type.
* [cxx][mini]mono_arch_exceptions_init: Cast GetProcAddress() to correct function pointer type and call through correctly typed function pointers.
* [cxx][mini]exceptions-x86.c: mono_arch_ip_from_context: Cast from integer to void*.
* [cxx][mini]exceptions-x86.c: mono_arch_handle_exception: Cast from void* to struct sigcontext*.
* [cxx][interp] C++ deprecates the register keyword, remove it.
* [cxx][interp] C++ deprecates the register keyword, remove it.
* [cxx][mini] liveness.c: Change MonoPtrSet to a union and then use GHashTable* instead of void* instead of casting from void*.
* [cxx][mini] main.c: probe_embedded: Change local item_size from uint64_t to uint32_t to fix error about it being truncated when initializing MonoBundledAssembly. Could cast instead.
* [cxx][mini] C++ does not allow goto around initialization.
* [cxx][mini]Do not mixup enum types between MONO_CEE_ and CEE_. This fixes an error. We might wanto have the one set of values alias the other, but this wasn't a big problem actually.
* [cxx][mini] C++ does not allow goto around initialization.
* [cxx][mini] Cast from void*.
* [cxx][mini] Cast pointer to pointer-sized integer before casting
to integer or enum. Otherwise errored.
* [cxx][mini] Cast function pointer to void* to mono_arch_instrument_prolog() and mono_arch_instrument_epilog().
* [cxx][mini] Change get_delegate_invoke_impl() from void* to guint8* -- probably reduced need for additional casts.
* [mini] A field per line (MonoCompileArch.omit_fp, omit_fp_computed).
* [cxx][mini] Cast mono_aot_get_trampoline() to guint8* from void*.
* [cxx][mini] Cast parameters to __builtin___clear_cache from guint8* to char*.
* [cxx][mini] Remove casts on mono_arch_get_seq_point_info().
* [cxx][mini] Cast g_hash_table_lookup() from void* to SeqPointInfo*.
* [cxx][mini] Cast integer to enum MonoJumpInfoType. Could maybe change the incoming type to MonoJumpInfoType.
* [mini] A field per line (MonoCompileArch.omit_fp, omit_fp_computed).
* [cxx][mini] Remove cast to CallInfo*.
* [cxx][mini]mini-arm64.c: Cast pointer to pointer-sized integer before casting to other integer or enum.
* [cxx][mini] Cast from void* to guint8*, though this one is now covered by g_cast.
* [cxx][mini] Change types and add casts due to void*/non-void* mix.
* [cxx][mini] mini-exceptions.c: first_managed change local data from void*** to void**, and likewise the cast on its assignment.
* [cxx][mini][profiler] Cast integer to enum MonoExceptionEnum multiple times.
* [cxx][mini] Weaken mono_handle_exception(obj) from MonoObject* to void*, and then store it right into a local MonoObject*. This alleviates casts elsewhere.
* [cxx][mini] Cast g_hash_table_lookup() from void* a few times.
* [cxx][mini] More pointer casts.
* [cxx][mini] Change get_delegate_invoke_impl() from void* to guint8* to alleviate casts.
* [cxx][mini] Cast result of mono_arch_instrument_prolog() and mono_arch_instrument_epilog().
* [cxx][mini]Change MagicTypeInfo.{big_stack_type,small_stack_type,stack_type} from short to enum MonoStackType : 16, under #ifdef __cplusplus, to allevate casts and strengthen types.
* [cxx][mini] Cast from integer to enum MonoStackType. This can probably be improved, i.e. by changing the source type to enum.
* [cxx][mini]emit_intrinsics: Change local stack_type from int to MonoStackType to alleviate casts and strengthen types.
* [cxx][mini] Cast from integer to enum MonoStackType. This can probably be improved, i.e. by changing the source type to enum.
* [cxx][mini] Cast pointers g_hash_table_lookup() and profiler input (byte* instead of void*).
* [cxx][mini] Fix the function pointer parameter type to add_signal_handler so avoid casts, but add one cast from function pointer to function pointer for systems lacking MONO_ARCH_USE_SIGACTION.
* [cxx][mini] mini-posix.c: sampling_thread_func: Remove designated initializer.
* [cxx][mini] Change get_delegate_invoke_impl() from void* to guint8*() to reduce casts at its callers.
* [cxx][mini] Undo g_cast support on mono_arch_instrument_prolog() and mono_arch_instrument_epilog(), probably a mistake from a recent other PR, harmless. i.e. remove parens from around that suppress macro expanstion
* [cxx][mini] Cast return of mono_arch_instrument_prolog and mono_arch_instrument_epilog to guint8*.
* [cxx][mini] Remove a layer from some TLS access -- macro vs. function that might not inline.
* [cxx][mini] Strengthen the parameter to mono_set_lmf_addr() from void* to MonoLMF**.
* [cxx][mini] Provide a typedef MonoAbortFunction for MonoJitTlsData.abort_func.
* [cxx][mini] Strengthen the output of setup_jit_tls_data from void* to MonoJitTlsData* and the input function pointer from void* to MonoAbortFunction, eliminating existing and future casts.
* [cxx][mini] A few pointer and enum/int casts.
* [cxx][mini] Change mini_llvmonly_initial_imt_tramp locals from gpointer* to IMTTrampFunc** to alleviate casts.
* [cxx][mini] Cast some function pointers to void*.
* [cxx][mini] Cast void* to MONO_SIG_HANDLER_INFO_TYPE* for the non-HAVE_SIG_INFO case. We could maybe change the void* local to MONO_SIG_HANDLER_INFO_TYPE*, since we are casting it to that anyway.
* [cxx][mini] Cast function pointer to void*.
* [cxx][mini] Cast void* to GSList* twice.
* [cxx][mini] Cast function pointer to mono_runtime_init_checked. In future we should get all these types and parameters to match.
* [cxx][mini] Cast result of mono_arch_instrument_prolog/mono_arch_instrument_epilog to guint8*.
* [cxx][mini]Change return type of get_delegate_invoke_impl from void* to guint8*.
* [cxx][mini] Cast result of mono_arch_instrument_prolog/mono_arch_instrument_epilog to guint32*.
* [cxx][mini] Cast function pointers to void*.
* [cxx][mini] Cast from void* to non-void*.
* [cxx][mini] Change types and add casts due to void*/non-void* mix.
* [cxx][mini] Pointer casts.
* [cxx][mini] Pointer and int/enum casts, and widen pointer before casting to smaller integer.
* [cxx][mini] Strengthen types from void* to non-void* within x86 MonoCompileArch. (void *cinfo, *ss_tramp_var, *bp_tramp_var; => CallInfo *cinfo; MonoInst *ss_tramp_var; MonoInst *bp_tramp_var;)
* [cxx][mini] int/enum casts
* [cxx][mini] create_jit_info: Use Enum a |= b instead of a = (Enum)(a | b); one of these might be have recent damage.
* [cxx][mini] Pointer/int/enum casts.
* [cxx][mini] Change mono_cfg_set_exception(int) to mono_cfg_set_exception(MonoExceptionType) to reduce casts elsewhere.
* [cxx][mini] Pointer cast.
* [cxx][mini] Change mono_cfg_set_exception(int) to mono_cfg_set_exception(MonoExceptionType) to reduce casts elsewhere.
* [cxx][mini] Pointer casts.
* [cxx][mini] recursively_make_pred_seq_points: Fix parameter to g_array_index from void* to MonoInst*.
* [cxx][mini] Change parameter to decompose_vtype_opt_load_arg from guint32* to gint32*, and assign right back to local guint32*, to avoid casts, and limit diff, and obviously preserve semantics.
* [cxx][tasklets] Add include loader-internals.h.
* [cxx][mini]Fix cast mono_win32_get_handle_stackoverflow() to function pointer restore_stack.
* [cxx][mini] Casts. See https://jenkins.mono-project.com/job/test-mono-pull-request-amd64-osx-products-sdks-android/4480/parsed_console/log.html.
* PR: Replace goto up with goto down, and split decl/init instead.
https://jenkins.mono-project.com/job/w/15083/parsed_console/log.html
assembly.obj : error LNK2001: unresolved external symbol "struct _IMAGE_DOS_HEADER __ImageBase" (?__ImageBase@@3U_IMAGE_DOS_HEADER@@A) [d:\j\workspace\w\msvc\libmono-dynamic.vcxproj]
d:\j\workspace\w\msvc/./build/boehm/Win32\bin\ReleaseCxx\mono-2.0-boehm.dll : fatal error LNK1120: 1 unresolved externals [d:\j\workspace\w\msvc\libmono-dynamic.vcxproj]
Since it is data, extern "C" w/o braces is confusing, but maybe valid, so begin/end form is used.
When creating a diff on windows, the lines are split on the `\n` so the `\r\n` results in multiple lines:
**START SNIP**
Obsoleted methods:
```diff
[Obsolete ("Use AddRoundRect instead.")]
public void AddRoundedRect (SKRect rect, float rx, float ry, SKPathDirection dir);
```
**END SNIP**
This PR makes sure to use the platform line endings everywhere. When adding line endings, use the same that `StringBuilder` uses - platform endings. This makes it easy to split - just use the platform as that is what everyone is using.
* Fix mkbundle alignment to work with Windows. See https://github.com/mono/mono/issues/8225.
Consider doing this only for Windows.
* Align only first file at 64K, the rest the previous 4K.
* Ensure strings are nul terminated, if alignment doesn't handle it.
StringPairs already are.
* Save 30K on average on Unix, for an entire bundle (not per file within, but the entire bundle).
* Probe runtime for for MZ signature to determine if target
is Windows. "Style" is about host.
* [sdks] Add CrossRuntimeTemplate
* [sdks] Add cross-{arm,arm64,x86,x86_64}{,-win} runtimes for XA
* [sdks] Use CrossRuntimeTemplate for iOS
* [sdks] Factor various variables for RuntimeTemplate
* [sdks] Use MonoRuntime template for desktop-x86_64
* [sdks] Unify provisioning of LLVM for both Android and iOS.
A global CFLAGS would be set in `run-jenkins.sh`, and that would screw up with LLVM. The global CFLAGS makes sense as long as we are only building Mono, but that's not the case with LLVM anymore.
* [sdks] Remove android-armeabi, it's been removed from XA already and the target has been deprecated in the NDK
* [jit] Add intrinsics for Math.Round/Floor/Cecil () on SSE41.
* Add LLVM support.
* Fix the build.
* Move the code to mono_arch_emit_inst_for_method ().
* Fix the build.
* [Mono.Options] Add `CommandSet.GetCompletions()`
Add a `Mono.Options.CommandSet.GetCompletions()` method, which returns
all possible commands which match a given "completion prefix".
This is intended for e.g. bash completion support.
* Bump API snapshot submodule
Part of #9660.
The changes:
- included FieldInfo type from CoreFX + related xunit tests;
- made Mono-implemented class partial; removed duplicated code;
- moved GetOptionalCustomModifiers and GetRequiredCustomModifiers methods to MonoField type;
- moved GetTypeModifiers extern method and related icall to MonoField type;
- updated ToString method in CustomAttributeTypedArgument type with CoreFX implementation;
* [cxx] Add const, and static while there.
* [cxx] Auto cast in ARM_EMIT
* [cxx] Cast from int to enum.
* [cxx] Cast from void*.
* [cxx] Cast function pointer to void*.
* [cxx] Cast int to GCHandleType.
* [cxx] Cast to GCObject*.
* [cxx] Cast unsigned char* [cxx] to char*.
* [utils] Cast void* [cxx] to function pointer (FIXME) and remove extra parens (former macro?).
* [cxx] Change int parameter to enum MonoGCRootSource.
* [cxx] Do not goto around init.
* [cxx] Fix cast -- void* [cxx] vs. void**, and volatile per error but it is optional.
* [cxx] Fix type for pointer to array element -- void** [cxx] vs. void*.
* [cxx] Remove duplicate line from Makefile.
* [cxx] Remove incorrect cast.
* [cxx] Remove unneeded cast.
* [cxx] Spell out enum values for easier to read headers.
* [cxx] Split up compound initialization with NULL because the types vary, i.e. remove implicit conversion from void* that would need a cast.
* [cxx] Static thread locals fail to link on Linux; make them extern. FIXME?
* [cxx] Strengthen void* [cxx] to SGenFinalizationProc.
* [cxx] Templatize mono_native_thread_create (FIXME).
* [cxx] Use G_BEGIN_DECLS not MONO_BEGIN_DECLS in non-public headers, for brevity and subtle extra annotation.
* [cxx] Widen integer to pointer-size before casting to pointer.
* [cxx] Wordsmith comment.
* [cxx] Wrapping a bunch of includes in extern "C" is generally in poor form and unnecessary.
* [cxx] [sgen] Remove unnecessary cast.
* [cxx] [sgen] casts
* [cxx] [utils] Add const with a string literal.
* [cxx] [utils] Casts from void* [cxx] and between int/enum.
* [cxx] [utils] Clarify empty macros.
* [cxx] [utils] Compile more as C++ if enabled.
* [cxx] [utils] extern "C" mono_file_map_error. (FIXME?)
* [cxx] [utils] Remove autocast from mono_lock_free_alloc.
* [cxx] [utils] ifdef wasm the type in unused mono_pages_not_faulted so it compiles, remove incorrect comment, add FIXME.
* Use typedefs of structs in the usual fashion.
* [cxx] externC to the 'operating system'
* [cxx] Add externC for debugger interop.
* Fix indentation.
* [cxx] externC on chkstk.
* [cxx] externC on sys_icache_invalidate.
* [cxx] externC on __aeabi_read_tp.
* [cxx] externC on sys_icache_invalidate.
* Remove exactly duplicated license.
* __EGLIB_X11 is defined but never used.
* Let compiler decide inline.
* Get ves_icall_System_Environment_GetOSVersionString declaration from environment-internal.h.
* Put ves_icall_System_Reflection_Assembly_GetCallingAssembly at start of line for grep ^foo.
* Remove accidental space.
* Remove casts and error_init.
* Fix warning: sgen-mono.c:959:36: warning: incompatible pointer to integer conversion passing
'void *' to parameter of type 'MonoGCDescriptor'
(aka 'unsigned long long') [-Wint-conversion]
return mono_gc_alloc_fixed (size, NULL, source, key, msg);
* Add a comment and associate comment more closely with code.
* Remove gratuitous pragma -- header is only included once, fix the include.
* [cxx] Just enough extern "C" for profilers, libtest, MonoSupportW, MonoPosixHelper, THREAD_INFO_TYPE, WebAssembly interop.
Some of this is redundant, i.e. in glib.h and mono-threads-coop.h.
But if someone removes otherwise unnecessary header wrappers, these become meaningful.
This is an alternative to:
https://github.com/mono/mono/pull/10160 Remove most G_BEGIN_DECLS but add back to make things work.
https://github.com/mono/mono/pull/10284 Port libtest to C++
https://github.com/mono/mono/pull/10294 Rework mono-threads.h THREAD_INFO_TYPE parameterization to not violate C++ typesafe linkage.
https://github.com/mono/mono/pull/10297 Fix typesafe linkage problem in gc-internals.h THREAD_INFO_TYPE parameterization.
https://github.com/mono/mono/pull/10341 Port all of MonoPosixHelper MonoSupportW to C++, including K&R zlib.
https://github.com/mono/mono/pull/10342 Port profilers to C++
https://github.com/mono/mono/pull/10378 Port all of MonoPosixHelper MonoSupportW to C++, except K&R zlib.
https://github.com/mono/mono/pull/10375 Eliminate THREAD_INFO_TYPE by suggestion, to fix typesafe linkage.
https://github.com/mono/mono/pull/10379 Mark the 14 functions used by MonoPosixHelper as extern "C" (basically this PR)
Most of the alternatives are very reasonable and remain viable, except porting K&R zlib.
Hopefully in future, SgenThreadInfo will derive from MonoThreadInfo, improving the THREAD_INFO_TYPE fixes.
* [cxx] Replace invalid two extern "C" with just one.
* Strengthen MonoImage.aot_module and _MonoJitInfo.aot_info to be MonoAotModule* instead of void*.
* Strengthen thread locals away from void*.
* Strengthen _MonoThreadInfo from void* to HandleStack*.
* Elminate "struct".
Introduce mono-forward.h and mono-forward-internal.h.
Add cast for profiler.
* Strengthen tramp_info; remove struct on JitInfo; remove a cast.
* Tweak and add #includes accordingly.
Any header that was providing a typedef, or forward declaring a struct and now
using typedef instead must include a header to get it.
Internal types must come from internal header.
Internal header may include internal header.
Public header must not include internal header.
foo.c does not have to include what foo.h must include to declare foo.c's functions (mono-tls.c
does not need to include mono-forward-internal.h)
I misssed mono/metadata/metadata-internals.h: void *image_info; do it later.
* Remove use of sln dependencies and use csproj project references instead
* Rewrite jay.vcxproj so it builds correctly even without help from the sln file
* Force pre-build event to run after references are resolved. Change how culevel.exe path is computed to be more resilient.
* [csproj] Update project files
See my comments in https://github.com/mono/mono/pull/10134 for details.
The problem was that
1. It is wrong to assume that `chain != null`. In fact, it likely won't be if `wantsChain == false`.
2. Similarly, the `storeCtx` should only be used if `storeCtx != NULL && wantsChain == true`.
3. It was missing `MonoBtlsX509Error.HOSTNAME_MISMATCH`.
4. I reformatted and re-indented the method to match Mono's style.
Since `mono_raise_exception_deprecated` never returns, the transition won't be
balanced. This fixes a cookie-counting problem (assert on mono shutdown) in
coop and hybrid checked builds using the new test case:
MONO_THREADS_SUSPEND=coop MONO_CHECK_MODE=thread,gc mono mono/tests/install_eh_callback.exe
* [cxx] Port mono main to be in C++.
This allows to remove more extern "C" from glib.
* [cxx] DllMain should be extern "C".
* [cxx] Make OutOfProcessFunctionTableCallback and OutOfProcessFunctionTableCallbackEx externC.
* Remove do-nothing line and change .o to $(OBJEXT).
[sgen] Fix string size inconsistency between alloc/scan
This could lead to crashes when having strings with size at the LOS boundary.
https://github.com/mono/mono/issues/10309
<!--
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
-->
Pass arguments to LLVM's LLC via --aot=llvmllc
Currently we can override arguments passed to llvm's `opt` via `--aot=llvm,llvmopts="some args"`, this PR introduces a similar capability for `llc` - `llvmllc` parameter.
E.g. for my environment Mono uses the following arguments for llc:
```
-march=x86-64 -mattr=sse4.1 -asm-verbose=false -disable-gnu-eh-frame
-enable-mono-eh-frame -mono-eh-frame-symbol=_mono_aot_fffff_eh_frame
-disable-tail-calls -no-x86-call-frame-opt -relocation-model=pic
-filetype=obj -o "mono_aot_IWvNWm/temp-llvm.o" "mono_aot_IWvNWm/temp.opt.bc"
```
what if I want to test some avx stuff, e.g. `-march=core-avx2 -O2` and test other parameters.
Extracted custom marshaler logic into managed code.
Fixed crash when using mono_verbose_method
Fixed free of zero desc ptr in mini_method_compile when verbose method variable doesn't resolve to a method
If the cfg is in verbose mode emit a brief message on abnormal termination of IR generation
Use CEE_MONO_CLASSCONST to store the type of the custom marshaler since it appears to work with AOT
Handle various error conditions in Marshaler.GetInstance and produce exceptions that roughly match .net framework
Use ValueTuple instead of a custom tuple type. Use LazyInitializer to init dictionary for marshalers on demand.
Add test case for custom marshalers in linker tests (disabled because the linker does not understand custom marshalers yet)
* [cxx] Make some code valid C++, esp. adding casts and esp. not touching allocators.
* [cxx] PR: Update comment on MonoThreadPriority.
* [cxx] PR: Provide templates for register_icall mono_mb_emit_icall
mono_register_jit_icall mono_register_jit_icall_full mono_aot_register_jit_icall
to cast from arbitrary type to gpointer or gconstpointer.
Ideally this would be limited to function pointers but anything is progress here.
* [cxx] Move C++ template mono_add_internal_call from loader.h to new loader-internals.h.
[cxx] Add C++ template register_opcode_emulation.
[cxx] Add C++ template register_icall.
[cxx] Add C++ template register_icall_no_wrapper.
[cxx] Add C++ template register_icall_with_wrapper.
[cxx] Add C++ template mono_emit_jit_icall.
[cxx] Add C++ template mini_register_opcode_emulation.
[cxx] Add #include loader-internals.h.
[cxx] Remove preemptive extern "C++" until/unless needed.
* [cxx] Change preexisting #define register_icall to C++ templates.
- #define HAVE_SGEN_GC in order to get missing prototype of sgen_sort.
- Move main to static libraries, in order to compile as C++ but not link as C++.
Linking pedump as C++ in particular broke running it in Windows x64 CI.
- Some const fix.
- "class" => "klass"
There are advantages and disadvantages here.
adv: No file rename.
dis: Not linking to libc++ -- which broke Windows x64 CI running pedump.
adv: Linking with -xc++ incorrectly treats .o/.a files as C++ text and fails to link; avoids that.
Moving these to C++ enables the runtime to not need extern "C" sprinkled around
on internals -- which was done but not accepted (https://github.com/mono/mono/pull/10160#pullrequestreview-148551783).
Free the thread_info_key and thread_exited_key during unload
Fixes a crash where pthread_key_clean_all will call destructors that should have been freed before unload.
[mini] fix memory dumping on devices
also, guard for `IP == NULL`: I haven't seen it in the wild, but when messing with EH I have seen it happen and then we have a segfault in the signal handler, which is... bad 😄
we should backport this to `2018-06` and `2018-08`.
- Add a private static variable to HttpClient called `Func<HttpMessageHandler> GetHttpMessageHandler` that will be used to obtain the default message handler and can be set for example as follows:
```
var httpMessageHandler = typeof(HttpClient).GetField("GetHttpMessageHandler",
BindingFlags.Static |
BindingFlags.NonPublic);
httpMessageHandler.SetValue(null, (Func<HttpClientHandler>) (() => {
return new MyHttpClientHandler ();
}));
```
- If a handler is not set or returns null the default implementation HttpClientHandler will be returned.
- Add HttpClient.wasm.cs implementation to handle the default HttpClient
- Add simple test to the wasm test harness bindings-test.
- Reference https://github.com/mono/mono/issues/9941
<!--
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
-->
* [cxx] int vs. enum.
There are at least three or so approaches to this.
1. Sprinkle around casts.
2. Overload operators.
2a. Bit-only (| & ^ |= &= ^=) This PR.
2b. Also math (+ - ++ -- == !=)
3. typedef to int instead (https://github.com/mono/mono/pull/10231)
They all have tradeoffs.
1. Casts: The most line damage. Not huge, but the most.
2. Overloads: New idiom to some but an old idiom. Supported in this way by windows.h even.
This is the most "C++y solution".
3. int: Highest level of source compat and semantic compat. Least line damage (just
change the declarations). Least debuggable and least typesafe.
In terms of semantic compat, even in C the guarantees aren't particularly strong.
Some enums will be int, some unsigned, depending on the values and the compiler.
Perhaps even other types, but I doubt it.
I observe C++ compilers don't tend toward unsigned the same way, so switching
to C++ will on some platforms lose unsignedness. Given we didn't have it portably
anyway, should be ok.
A typesafe enum has the properties that enum A cannot be silently assigned to enum B (ok,
there might be a warning), or from an integer.
A typesafe enum, bitfield or otherwise, can/will be shown symbolically by a debugger.
(lldb does not handle bitfields, only strict enums)
A C enum might be debuggable, w/o typesafety.
A C enum can be freely mixed with other enums and integers.
A C++ enum is more restricted.
Using typedef int, is a maybe surprising option, but does provide the closest meaning to C enum.
Per guidance, this PR also changes one enum to #defines + int.
* PR: "mono" => "g"
"T" => "type"
static_cast where it works (not to reference)
Use templatized typedef instead of macro, if it works on g++4.4.
Add test.
Provide to build eglib tests.
Borrow CXXFLAGS_COMMON from https://github.com/mono/mono/pull/10271.
Add some const to test harness.
* g++4.4 compat (not quite C++11) -- use macro, not template typedef.
* Fix real problem with aliasing seen with g++4.4.
Use attribute(may_alias) when casting pointers/references.
* Add mono/eglib/test/enum.cpp.
gcc/clang do have __restrict and/or __restrict__.
On MacOSX, __restrict is preprocessed out of the headers for C++.
On Linux, __restrict is used and preserved for C++.
I didn't check others.
__restrict does not appear to be part of the function signature.
You cannot overload on it.
It is not in the mangled name.
If you declare one way and implement the other, there is no warning or error.
Therefore, remove restrict.
There are alternatives.
One could preserve it for C only.
One could preserve it for C and for Linux/C++.
One could preserve it based on autoconf, and autoconf results on Mac and Linux.
Perhaps as well we will autoconf or ifdef wasm away use of these functions?
If we merely if them away, we still need them.
Needed for TimeZoneInfo.
Imports CoreFX's Registry API for Windows. Other platforms use old mono file-based Registry API implementation because CoreFX doesn't support it yet, see: https://github.com/dotnet/corefx/issues/14896
(however, some basic types such as enums are imported for all platforms)
Part of #8131
When the TLS Handshake fails in `MonoTlsStream.CreateStream()`, then we must dispose
the `SslStream` to avoid a memory leak.
In addition to this, `MonoTlsStream` now implements `IDisposable` and is disposes
in `WebConnection.CloseSocket()`.
Fixes#8689
Part of #9660.
The imported CoreFX types:
- MemberInfo;
The changes:
- used MemberInfo type from CoreFX;
- moved MetadataToken property from MemberInfo to leaf classes; added unit tests.
- updated icall-def.h for related types;
- updated corlib version;
- added overridings for new HasSameMetadataDefinitionAs property to leaf classes;
- included more MemberInfo xunit tests to verify HasSameMetadataDefinitionAs property;
- renamed MemberInfoExtensions class to DbLinqMemberInfoExtensions in System.Data.Linq assembly to avoid a conflict with the class imported to System.Reflection namespace.
- [acceptance-tests] removed AssemblyExtensions class which duplicates the same functionality introduced in System.Reflection.
* Fix layout of scrollbars in combobox.
* Fix TextBox height fixup to work properly inside TableLayout.
* Fix changing TextBox font before the Control handle has been created.
* Add test case.
* Reintroduce fix for TextBoxTest.Bug82749. We need to save the user requested control bounds outside of ExplicitBounds since ExplicitBounds are used by table layout engine.
The issue was that packager.exe was using Mono.Cecil from net_4_x, which is only built/installed if the desktop sdk is built. We replace
Finally, we change the CI script to disable desktop as well to ensure we don't regress in that scenario.
The llvm/llvm_config.mk makefile fragment just includes make (not automake)
variable definitions. So there is no need to regenerate the mini/Makefile.am
file if the fragment updates - the include will pick it up.
* [w32socket] Refactor ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal and ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal into common mono_w32socket_getname.
* [w32socket] Zero consistently. Note that a statically sized struct sockaddr_storage would be appropriate here.
* [cxx] Remove goto around init.
* PR: [w32socket] Use gboolean local instead of function-pointer/string to mono_w32socket_getname.
Restore lost comment.
* [cxx] [w32socket] Remove ternary operator on allocators so that rvalue constructor
can be removed here: https://github.com/mono/mono/pull/10027#issuecomment-414848498
Provide for void* to non-void* conversion on common allocators (g_malloc, etc.) to "just work", via perhaps a bit of a surprising twist ("hack" or "technique"?).
This greatly reduces the churn of C to C++ conversion.
This helps handle.h in 3 places, at least 2 of which could use C++11 `auto` instead.
Ternary operator has reduced functionality as a result.
Either:
1. Put in rvalue constructor, omitted here.
2. Cast both sides of the ternary.
3. Don't ternary.
This impacted only here:
https://github.com/mono/mono/pull/10206/commits/b543f3f0fd71e5801af059663b4d7b01a6390707
Add some explicit casts.
Remove `register`, as it is deprecated (warning or error) and means little (it does prevent taking-address, which helps optimizers).
Add parens missing in macros.
Favor `gssize` over `long` for consistency on Win64.
Implement a two-phase hybrid suspend scheme:
1. In the _entente phase_ put all threads in the suspend request state (either `ASYNC_SUSPEND_REQUESTED` or `BLOCKING_SUSPEND_REQUESTED`). Wait for pending operations (but only wait for the async ones) and let all threads try to self-suspend.
2. In the _aggressive mop-up phase_ - preemptively suspend any threads that are still in `BLOCKING_SUSPEND_REQUESTED`.
* [coop] Check async suspend status in ReqSuspendInitSuspendBlocking case
So the issue is that calling begin_suspend_for_blocking_thread under hybrid
suspend will perform a preemptive suspension of the victim thread.
The preemptive suspend doesn't always succeed.
In particular, thread_state_init_from_sigctx or thread_state_init_from_handle
could return FALSE and into->suspend_can_continue will be set to FALSE.
When the thread_state_init_* functions return FALSE, they also set the
MonoThreadUnwindState:valid to FALSE.
So it is important to check the value of MonoThreadInfo:suspend_can_continue
before proceeding with a suspension.
As a result in suspend_sync in the ReqSuspendInitSuspendRunning case we call
check_async_suspend which checks (for preemptively suspended threads) whethere
suspend_can_continue is true. If it isn't, we resume the victim thread and
loop once more in suspend_sync_nolock and try again.
We didn't have a check_async_suspend call in the ReqSuspendInitSuspendBlocking
case, so a thread could be considered suspended even if we couldn't capture a
valid MonoThreadUnwindState for it.
That breaks the assertion the call to mono_thread_info_get_last_managed in
async_suspend_critical which needs a valid MonoThreadUnwindState.
Fixes https://github.com/mono/mono/issues/10031
* fixup - remove coop assertion in check_async_suspend
result for coop could be iether BeginSuspendOkCooperative or
BeginSuspendOkNoWait depending on whether the thread was running (Ok) or
blocking (OkNoWait)
* [coop] suspend_can_continue if async raced with self-suspend (osx + win32)
Companion to 006d6ce097 from earlier this year
which applied this fix for POSIX signal based suspend. This is the
corresponding OSX and Win32 fix.
In hybrid suspend, in the case where a suspend initiator needs to preemptively
suspend a thread, but the thread self-suspended while after the suspend
initiator put it into the blocking_suspend_requested state, we want to allow
the suspend to continue. We do have to call the syscall to undo the native
async suspend, but after that, we can leave the victim to continue waiting for
a resume.
This should not have any effect on full cooperative or full preemptive suspend
- in the full coop case we never call async suspend, in the full preemptive
case the thread never self-suspends in blocking.
When we execute the certificate verification callback we just don't test for success and set status11. Now we get the error (if any) and map the error code to those defined by ChainStatusFlags and add it to a list of X509ChainStatus objects for that chain. Now when get_ChainStatus is called we convert that list to an array of X509ChainStatus and return it.
Use argv for cli_launcher on OSes that don't return full path for process names; fix mono_w32process_get_path on Free/NetBSD
Should fix process-leak test on AIX, maybe more. Also tested that it fixes the
same behaviour on FreeBSD. Other OSes may be affected; consult and test with the
files `w32process-unix-*.c`.
From comments:
```c
/*
* XXX: verify if other OSes need it; many platforms seem to have it so that
* mono_w32process_get_path -> mono_w32process_get_name, and the name is not
* necessarily a path instead of just the program name
*/
/*
* mono_w32process_get_path on these can only return a name, not a path;
* which may not be good for us if the mono command name isn't on $PATH,
* like in CI scenarios. chances are argv based is fine if we inherited
* the environment variables.
*/
```
There is a small race condition during the completion of a native thread join
call. During that period of time the tid is no longer included on the
internal list tracking joinable threads so a thread that will join on the
tid while another thread (like the finalizer thread) is waiting on native
join to complete for the same tid, will cause the managed Thread.Join call
to complete before the native join call has completed. This race could cause
issues on some OS:es that clear's up some thread resources, like abandoned
mutexes when the thread has exited. This race is hit by WaitAnyWithSecondMutexAbandoned
since the call to Thread.Join will return before the thread owning the mutex
has terminated meaning that it doesn't get ownership of the abandoned mutex
as assumed by the test.
Fix makes sure Thread.Join won't complete until native thread join is complete.
Increasing the join timeouts in the test also eliminates a timeout error making it
harder to hit the problematic code path, primarily during reproduction
in the debugger.
Fix also switch to coop mutex for joinable threads.
And they are not checked in a consistent order, leading to bugs, or at least
somewhat surprises. This incorrect/unintended code fails to compiles as C++.
We should check them in a consistent order.
This favors Win32 over unistd.h but the opposite is probably ok too.
Also fix infinite loop in error path.
See https://jenkins.mono-project.com/job/x/12739/parsed_console/log.html
```
sgen-protocol.c: In function 'void binary_protocol_open_file(gboolean)':
sgen-protocol.c:101:31: error: invalid conversion from 'int' to 'HANDLE {aka void*}' [-fpermissive]
binary_protocol_file = open (filename, O_CREAT | O_WRONLY, 0644);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sgen-protocol.c:102:32: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
if (binary_protocol_file == -1) {
^
sgen-protocol.c:114:38: error: invalid conversion from 'HANDLE {aka void*}' to 'int' [-fpermissive]
ftruncate (binary_protocol_file, 0);
^
In file included from ../../mono/utils/mono-compiler.h:14:0,
from sgen-gc.h:30,
from sgen-protocol.c:16:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/unistd.h:65:18: note: initializing argument 1 of 'int ftruncate(int, off32_t)'
__CRT_INLINE int ftruncate(int __fd, off32_t __length)
^~~~~~~~~
sgen-protocol.c:116:36: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
} while (binary_protocol_file == -1);
^
sgen-protocol.c: In function 'void close_binary_protocol_file()':
sgen-protocol.c:164:36: error: invalid conversion from 'HANDLE {aka void*}' to 'int' [-fpermissive]
while (close (binary_protocol_file) == -1 && errno == EINTR)
^
In file included from /usr/x86_64-w64-mingw32/sys-root/mingw/include/unistd.h:10:0,
from ../../mono/utils/mono-compiler.h:14,
from sgen-gc.h:30,
from sgen-protocol.c:16:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/io.h:328:15: note: initializing argument 1 of 'int close(int)'
int __cdecl close(int _FileHandle) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
^~~~~
sgen-protocol.c: In function 'void binary_protocol_flush_buffer(BinaryProtocolBuffer*)':
sgen-protocol.c:229:82: error: invalid conversion from 'HANDLE {aka void*}' to 'int' [-fpermissive]
ret = write (binary_protocol_file, buffer->buffer + written, to_write - written);
^
In file included from /usr/x86_64-w64-mingw32/sys-root/mingw/include/unistd.h:10:0,
from ../../mono/utils/mono-compiler.h:14,
from sgen-gc.h:30,
from sgen-protocol.c:16:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/io.h:344:15: note: initializing argument 1 of 'int write(int, const void*, unsigned int)'
int __cdecl write(int _Filehandle,const void *_Buf,unsigned int _MaxCharCount) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
^~~~~
```
That is, >=0x80000000 does not fit in a signed 32bit long.
Linux manpage acknowledges the mess and says "unsigned int" will work "for most systems".
So let's do that and hope, "most systems" and other C runtimes besides glibc.
http://man7.org/linux/man-pages/man2/statfs.2.html
The __fsword_t type used for various fields in the statfs structure
definition is a glibc internal type, not intended for public use.
This leaves the programmer in a bit of a conundrum when trying to
copy or compare these fields to local variables in a program. Using
unsigned int for such variables suffices on most systems.
Remove excess const and add more meaningful const.
* Truncate MachineName (and UserDomainName) at first period
Unix machines often put their FQDN as the host name, and domain
name is used for things such as yp. As such, truncate the FQDN to
just the hostname, as other Unix utilities seem to do.
Matches the .NET Core and .NET Framework behaviour, and MS seems to
require this for a future project. Fixes#9839.
* Add a unit test for bug
* Formatting tweaks
* For ProcessArchitecture, use the DllMap arch of the runtime.
* For OSArchitecture, make an educated guess combining ProcessArchitecture and Environment.Is64BitOperatingSystem.
* For non-Intel/ARM architectures, (supported by Mono and not on the chopping block are PPC32/64, z, and WebAssembly) please dogpile onto dotnet/corefx#30706.
macOS 10.14 introduces a Network framework, which means Xamarin.Mac now has a Network namespace.
This conflicts with 'using Network = System.Net':
> mono/mcs/class/System.Xml.Linq/Test/System.Xml.Schema/ExtensionsTest.cs(97,27): error CS0576: Namespace '<global namespace>' contains a definition conflicting with alias 'Network'
so just remove the using and use the full 'System.Net' namespace instead.
* [wasm] add wasm-aot and wasm-aot-runtime
* [runtime] Add MONO_STRUCT_SIZE that works similarly to MONO_STRUCT_OFFSET and handles mini types.
* [wasm] Add enough scafold for the AOT compiler.
* [wasm] Make some functions available for the interp to satisfy the linker.
* [wasm] Add aot-sample and link-sample helper targets for AOT development.
* [wasm/sdks] Update documentation.
* Update README.md
broken:
```c
#include <math.h>
void * pmod = fmod;
fmod-broken.cpp:3:15: error: address of overloaded function 'fmod' does not match required type 'void'
void * pmod = fmod;
^~~~
```
fixed:
```c
#include <math.h>
typedef double (*fmod_t)(double, double);
fmod_t pfmod = fmod;
```
A wrapper function would also work:
```c
double mono_fmod (double a, double b)
{
return fmod (a, b);
}
fmod_t pfmod = mono_fmod;
```
This may be advantagous, if the standard allows fmod to be a macro ("cannot take address of macros") or its signature to not match this.
However this would veer even further from apparent C compatibility (if our previous code was portable), so probably not.
* [reflection] Assembly.LoadFile should throw ArgumentException for relative paths
Fixes https://github.com/mono/mono/issues/9943
* [mcs/tests] Use full path in the compiler-tester
Otherwise the call to LoadFile will fail
* [mono/tests] Use full path in LoadFile in test-multi-netmodule-4-exe
* [mono/tests] Use the test runner for a couple of tests
* [fullaot] Disable test-multi-netmodule-4-exe and custom-attr-errors.exe
* [tests] Use Path.GetFullPath and Path.Combine in AssemblyTest
Fix windows test failures
EH still uses the original ip for determining whether there are any abort protected blocks to be exited, once the frame is unwinded.
Fixes delegate2.exe
https://jenkins.mono-project.com/job/x/12802/parsed_console/log.html
ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken(gpointer, MonoError*)':
mono-security-windows.c:214:62: error: invalid conversion from 'int (*)(int)' to 'gpointer {aka void*}' [-fpermissive]
return DuplicateToken (token, SecurityImpersonation, &dupe) ? dup : NULL;
^
The code is confusing the local variable dupe with an 'e' at the end
with the function dup.
* [System.Reflection] CoreFX import for ManifestResourceInfo and ResourceLocation types.
Part of #9660.
* Bump API snapshot submodule
* [csproj] Update project files
Longer term some functions accepting function pointers can/should take
a stronger type, and the parameters match w/o casting.
Also cast int to enum one same line.
One of these is under if 0.
Should fix the following:
attach.c:494:13: error: no matching function for call to 'mono_thread_create_internal'
internal = mono_thread_create_internal (mono_get_root_domain (), receiver_thread, NULL, MONO_THREAD_CREATE_FLAGS_NONE, error);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
../../mono/metadata/threads-types.h:82:1: note: candidate function not viable: no known conversion from 'gsize (void *)' (aka 'unsigned long (void *)') to 'gpointer' (aka 'void *') for 2nd argument
mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, MonoThreadCreateFlags flags, MonoError *error);
^
threadpool-io.c:585:7: error: no matching function for call to 'mono_thread_create_internal'
if (!mono_thread_create_internal (mono_get_root_domain (), selector_thread, NULL, MONO_THREAD_CREATE_FLAGS_THREADPOOL | MONO_THREAD_CREATE_FLAGS_SMALL_STACK, error))
^~~~~~~~~~~~~~~~~~~~~~~~~~~
../../mono/metadata/threads-types.h:82:1: note: candidate function not viable: no known conversion from 'gsize (gpointer)' (aka 'unsigned long (void *)') to 'gpointer' (aka 'void *') for 2nd argument
mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, MonoThreadCreateFlags flags, MonoError *error);
^
gc.c:957:14: error: no matching function for call to 'mono_thread_create_internal'
gc_thread = mono_thread_create_internal (mono_domain_get (), finalizer_thread, NULL, MONO_THREAD_CREATE_FLAGS_NONE, error);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
../../mono/metadata/threads-types.h:82:1: note: candidate function not viable: no known conversion from 'gsize (gpointer)' (aka 'unsigned long (void *)') to 'gpointer' (aka 'void *') for 2nd argument
mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, MonoThreadCreateFlags flags, MonoError *error);
^
attach.c:494:13: error: no matching function for call to 'mono_thread_create_internal'
internal = mono_thread_create_internal (mono_get_root_domain (), receiver_thread, NULL, MONO_THREAD_CREATE_FLAGS_NONE, error);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
../../mono/metadata/threads-types.h:82:1: note: candidate function not viable: no known conversion from 'gsize (void *)' (aka 'unsigned long (void *)') to 'gpointer' (aka 'void *') for 2nd argument
mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, MonoThreadCreateFlags flags, MonoError *error);
^
threadpool-io.c:585:7: error: no matching function for call to 'mono_thread_create_internal'
if (!mono_thread_create_internal (mono_get_root_domain (), selector_thread, NULL, MONO_THREAD_CREATE_FLAGS_THREADPOOL | MONO_THREAD_CREATE_FLAGS_SMALL_STACK, error))
^~~~~~~~~~~~~~~~~~~~~~~~~~~
../../mono/metadata/threads-types.h:82:1: note: candidate function not viable: no known conversion from 'gsize (gpointer)' (aka 'unsigned long (void *)') to 'gpointer' (aka 'void *') for 2nd argument
mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, MonoThreadCreateFlags flags, MonoError *error);
^
:411:24: error: no matching function for call to 'mono_create_ftnptr'
func = (TestMethod)mono_create_ftnptr (mono_get_root_domain (), func);
^~~~~~~~~~~~~~~~~~
../../mono/mini/mini-runtime.h:432:11: note: candidate function not viable: no known conversion from 'TestMethod' (aka 'int (*)()') to 'gpointer' (aka 'void *') for 2nd argument; take the address of the argument with &
gpointer mono_create_ftnptr (MonoDomain *domain, gpointer addr);
driver.c:1170:2: error: no matching function for call to 'mono_thread_create_checked'
mono_thread_create_checked (mono_domain_get (), compile_all_methods_thread_main, &args, error);
^~~~~~~~~~~~~~~~~~~~~~~~~~
../../mono/metadata/threads-types.h:441:1: note: candidate function not viable: no known conversion from 'void (CompileAllThreadArgs *)' to 'gpointer' (aka 'void *') for 2nd argument
mono_thread_create_checked (MonoDomain *domain, gpointer func, gpointer arg, MonoError *error);
^
LLVM was using the helper for the abandoned prototype linkonce work that
much predated when I picked up the project.
This is a problem because it can lead to aot-compiler thinking a method
is dedupable, while llvm thinking it's not. When this happens, the
symbol does not have the Assembly baked into it's name to ensure
uniqueness.
We now adopt CoreFX's behavior in `X509Certificate` regarding serialization and immutability.
* All serialization APIs now throws `PlatformNotSupportedException`.
(this was initially part of #9650, but had to be taken out due to problems with Xunit 2.4).
* All `Import()` overloads now throw `PlatformNotSupportedException`.
* The property setter of `X509Certificate2.PrivateKey` now also throws `PlatformNotSupportedException`.
If an AOT library is loaded that was compiled with safepoints, but currently
we're running with preemptive suspend (e.g. MONO_THREADS_SUSPEND=preemptive is
set), don't assert. `mono_polling_required` will always be false, so the
safepoint will be ignored.
Fixes https://github.com/mono/mono/issues/9947
- Remove two unused types from corlib (DecoupledTask is not used since migrating to StreamReader/StreamWriter from referencesources).
- Fix indentation in System.Security.Policy/Site.cs which mixed tabs and spaces.
- Fix comment in Test/System.Diagnostics/DebuggerTypeProxyAttribute.cs (to avoid false results when using grep on the source code).
* Add support for marshalling ArrayBuffer and TypeArrays from JavaScript to C#.
- The ArrayBuffer object is used to represent a generic, fixed-length raw binary data buffer. More Info ---> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays#ArrayBuffer
- JavaScript typed arrays are array-like objects and provide a mechanism for accessing raw binary data. (...). More Info ---> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays
- Some examples of API's that use these are Fetch, WebGL, Canvas, Web Audio API, XMLHttpRequests, WebSockets, Web Workers, Media Source API and File APIs.
| ArrayBuffer | uint8_t | byte[] | byte or Byte (unsigned byte)
| Int8Array | int8_t | sbyte[] | byte or SByte (signed byte)
| Uint8Array | uint8_t | byte[] | byte or Byte (unsigned byte)
| Uint8ClampedArray| uint8_t | byte[] | byte or Byte (unsigned byte)
| Int16Array | int16_t | short[] | short (signed short)
| Uint16Array | uint16_t | ushort[] | ushort (unsigned short)
| Int32Array | int32_t | int[] | int (signed integer)
| Uint32Array | uint32_t | uint[] | uint (unsigned integer)
| Float32Array | floa t | float[] | float
| Float64Array | double | double[] | double
- Added tests to the bindings-test test harness.
* Add support for marshalling TypeArrays from C# to JavaScript.
- Add tests to test harness.
<!--
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
-->
iconv in eglib was broken due to a broken define. Also fix linking
of iconv when iconv isn't in libc.
Also remove the usage of a GNU libcharset specific function and rely
on a standard POSIX function that outputs the same value on every
modern Unixoid I've tried it on. (Ubuntu/macOS/i/FreeBSD)
This comment explains a lot of things for the latter:
```c
/*
* This function used used to use the "locale_charset" call in
* libiconv's libcharset library. However, this isn't always
* available on some systems, including ones with GNU libc. So,
* instead use a function that's a standard part of POSIX2008.
*
* nl_langinfo is in POSIX2008 and should be on any sane modern
* Unix. With a UTF-8 locale, it should return "UTF-8" - this
* has been verified with Ubuntu 18.04, FreeBSD 11, and i 7.3.
*
* The motivation for using locale_charset was likely due to
* the cruftiness of Unices back in ~2001; where you had to
* manually query environment variables, and the values were
* inconsistent between each other. Nowadays, if Linux, macOS,
* AIX/PASE, and FreeBSD can all return the same values for a
* UTF-8 locale, we can just use the value directly.
*
* It should be noted that by default, this function will give
* values for the "C" locale, unless `setlocale (LC_ALL, "")`
* is ran to init locales - driver.c in mini does this for us.
*/
```
Fix s390x build broken by incorrect specification of the msgfi instruction used in MUL_IMM type operations. The instruction had been encoded as its 32-bit counterpart (msfi).
In addition, the s390x microcode makes the mono_strength_reduction_division unnecessary so this can be bypassed.
The change to basic.make is just to avoid error messages when basic-profile-check.exe hasn't been built yet.
<!--
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 build on AIX
* crash reporting requires dladdr, a function AIX (at least
the version on CI) lacks
* fix build with a powerpc64-*-(aix|os400)* triplet as IBM
wishes to do
* Fix some stuff for Haiku
Some stuff requires CoreFX PAL changes that haven't been merged and
thus one or two more items for configure to detect.
* sigaltstack is broken for haiku
* getifaddrs is available and PAL would like it, so fix it
* Fix detection of flock64
This erroneously detected flock64 on platforms that lacked it.
Fixes the build of CoreFX PAL on FreeBSD and Haiku.
* Fix flock64 define
* Fix define for flock64 in PAL block
* Remove nonsense comment that only applied to an older unreleased version of the patch
Noticed this today when the corlib test which checks for unknown filesystems failed. Turned out it was because of a .dmg I had mounted:
```
$ mount | grep nullfs
/Volumes/Skype Meetings App/Skype Meetings App.app on /private/var/folders/cs/kt8x25p14g9dlk_p192rd7th0000gn/T/AppTranslocation/957CCB05-C113-4897-9C80-700C2CE4809E (nullfs, local, nodev, nosuid, read-only, noowners, quarantine, nobrowse, mounted by alexander)
```
By default ```msbuild bcl.sln``` will fail because of our non-standard platform names and the need to restore nuget packages. Add a default response file so it just works. (Response files can be suppressed)
This imports github.com/kumpera/ws-proxy into mono.
It facilitates distribution and coordination of upstream as there's a clean version connect between the two bits.
The proxy is currently version locked with the runtime.
* [wasm] Call the correct single step trampoline. Fixes some step-into scenarios.
* [wasm] Make the debugging sample a bit more complicated.
* [wasm] Add debugger support for removing breakpoints.
* [cxx] mono-logger.c int vs. enum and casts void* to non-void*
mono-logger.c:18:16: error: cannot initialize a variable of type 'GLogLevelFlags' with an rvalue of type 'int'
GLogLevelFlags mono_internal_current_level = INT_MAX;
^ ~~~~~~~
mono-logger.c:19:16: error: cannot initialize a variable of type 'MonoTraceMask' with an rvalue of type 'int'
MonoTraceMask mono_internal_current_mask = ~((MonoTraceMask)0);
^ ~~~~~~~~~~~~~~~~~~~
mono-logger.c:305:17: error: cannot initialize a member subobject of type 'const MonoTraceMask' with an rvalue of type 'int'
{ "io-layer", MONO_TRACE_IO_LAYER_PROCESS
^~~~~~~~~~~~~~~~~~~~~~~~~~~
mono-logger.c:315:12: error: cannot initialize a member subobject of type 'const MonoTraceMask' with an rvalue of type 'int'
{ "all", ~((MonoTraceMask)0) },
^~~~~~~~~~~~~~~~~~~
mono-logger.c:316:11: error: cannot initialize a member subobject of type 'const MonoTraceMask' with an rvalue of type 'int'
{ NULL, 0 },
^
mono-logger.c:392:30: error: cannot initialize a variable of type 'UserSuppliedLoggerUserData *' with an lvalue of type 'void *'
UserSuppliedLoggerUserData *ll =logCallback.user_data;
^ ~~~~~~~~~~~~~~~~~~~~~
mono-logger.c:400:30: error: cannot initialize a variable of type 'UserSuppliedLoggerUserData *' with an lvalue of type 'void *'
UserSuppliedLoggerUserData *ll = logCallback.user_data;
^ ~~~~~~~~~~~~~~~~~~~~~
mono-logger.c:451:30: error: cannot initialize a variable of type 'UserSuppliedLoggerUserData *' with an rvalue of type 'gpointer' (aka 'void *')
UserSuppliedLoggerUserData *ll = g_malloc (sizeof (UserSuppliedLoggerUserData));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 errors generated.
* [cxx] Add missing cast from void* to non-void* in g_renew.
* [cxx] mono-flight-recorder.c:97:22: error: cannot initialize a variable of type 'MonoFlightRecorder *' with an rvalue of type 'gpointer' (aka 'void *')
MonoFlightRecorder *recorder = g_malloc0 (size_of_recorder_prefix + size_of_item_ptrs + size_of_items);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
add cast
* [cxx] mono-error.c:769:18: error: cannot initialize a variable of type 'MonoErrorBoxed *' (aka '_MonoErrorBoxed *') with an rvalue of type 'gpointer' (aka 'void *')
MonoErrorBoxed* box = mono_image_alloc (image, sizeof (MonoErrorBoxed));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cast from void* to non-void*
* [cxx] lock-free-alloc.c:358:27: error: no viable overloaded '='
new_anchor = old_anchor = *(volatile Anchor*)&desc->anchor.value;
~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lock-free-alloc.c:90:9: note: candidate function (the implicit copy assignment operator) not viable: 1st argument ('volatile Anchor') would lose volatile qualifier
typedef union {
^
lock-free-alloc.c:90:9: note: candidate function (the implicit move assignment operator) not viable: 1st argument ('volatile Anchor') would lose volatile qualifier
typedef union {
^
lock-free-alloc.c:465:27: error: no viable overloaded '='
new_anchor = old_anchor = *(volatile Anchor*)&desc->anchor.value;
~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lock-free-alloc.c:90:9: note: candidate function (the implicit copy assignment operator) not viable: 1st argument ('volatile Anchor') would lose volatile qualifier
C++ does not by default allow copying volatile aggregates (struct, union, class).
This is mostly reasonable because, imagine the struct does not fit in a register. How would it work?
Here, and it is probably common, the struct does fit in a register and the intent and implementation
is pretty obvious.
Anyway, you can provide operator= or copy the constituents (i.e. one integer that unions over the rest).
* [cxx] mono-threads.c strengthen type from gpointer to actual type,
add casts from void* to non-void*, add casts between int and enum,
remove excess GSList type that caused some errors.
mono-threads.c:568:2: error: no matching function for call to 'mono_threads_signal_thread_handle'
mono_threads_signal_thread_handle (handle);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mono-threads.c:491:1: note: candidate function not viable: cannot convert argument of incomplete type 'gpointer' (aka 'void *') to 'MonoThreadHandle *' for 1st argument
mono_threads_signal_thread_handle (MonoThreadHandle* thread_handle);
^
mono-threads.c:570:2: error: no matching function for call to 'mono_threads_close_thread_handle'
mono_threads_close_thread_handle (handle);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mono-threads.h:516:1: note: candidate function not viable: cannot convert argument of incomplete type 'gpointer' (aka 'void *') to 'MonoThreadHandle *' for 1st argument
mono_threads_close_thread_handle (MonoThreadHandle *handle);
^
mono-threads.c:776:12: error: cannot initialize return object of type 'MonoThreadInfoFlags' with an rvalue of type 'gint32' (aka 'int')
return mono_atomic_load_i32 (&info->flags);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mono-threads.c:783:22: error: cannot initialize a variable of type 'MonoThreadInfoFlags' with an rvalue of type 'gint32' (aka 'int')
MonoThreadInfoFlags old = mono_atomic_load_i32 (&info->flags);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mono-threads.c:794:8: error: definition of type 'GSList' conflicts with typedef of the same name
struct GSList {
^
../../mono/eglib/glib.h:330:24: note: 'GSList' declared here
typedef struct _GSList GSList;
^
mono-threads.c:811:22: error: assigning to 'GSList *' (aka '_GSList *') from incompatible type 'gpointer' (aka 'void *')
wait_request.next = old;
^~~
mono-threads.c:852:10: error: assigning to 'GSList *' (aka '_GSList *') from incompatible type 'gpointer' (aka 'void *')
old = old_read;
^~~~~~~~
mono-threads.c:866:3: error: no matching function for call to 'mono_os_sem_post'
mono_os_sem_post (curr->data);
^~~~~~~~~~~~~~~~
./mono-os-semaphore.h:166:1: note: candidate function not viable: cannot convert argument of incomplete type 'gpointer' (aka 'void *') to 'MonoSemType *' (aka 'unsigned int *') for 1st argument
mono_os_sem_post (MonoSemType *sem)
^
mono-threads.c:1865:10: error: cannot initialize return object of type 'MonoThreadInfoWaitRet' with an rvalue of type 'int'
return MONO_THREAD_INFO_WAIT_RET_SUCCESS_0 + (res - MONO_OS_EVENT_WAIT_RET_SUCCESS_0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9 errors generated.
* [cxx] mono-threads-coop.c In C++, enums are not quite ints.
Their default underlying type (you can change it, per type, nice!), is int,
but they are unique types not automatically interchangable with int.
mono-threads-coop.c:530:9: error: cannot initialize return object of type 'MonoThreadsSuspendPolicy' with an rvalue of type 'int'
return 0; /* unset */
^
mono-threads-coop.c:558:27: error: cannot initialize a variable of type 'MonoThreadsSuspendPolicy' with an rvalue of type 'int'
MonoThreadsSuspendPolicy policy = 0;
^ ~
mono-threads-coop.c:571:27: error: cannot initialize a variable of type 'MonoThreadsSuspendPolicy' with an rvalue of type 'int'
MonoThreadsSuspendPolicy policy = 0;
^ ~
mono-threads-coop.c:590:34: error: cannot initialize a variable of type 'MonoThreadsSuspendPolicy' with an rvalue of type 'int'
static MonoThreadsSuspendPolicy policy = -1;
^ ~~
4 errors generated.
* [cxx] mono-utility-thread.c; cast from void* to non-void*.
mono-utility-thread.c:85:21: error: cannot initialize a variable of type 'MonoUtilityThread *' with an rvalue of type 'gpointer' (aka 'void *')
MonoUtilityThread *thread = g_malloc0 (sizeof (MonoUtilityThread));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mono-utility-thread.c:128:27: error: cannot initialize a variable of type 'UtilityThreadQueueEntry *' with an rvalue of type 'gpointer' (aka 'void *')
UtilityThreadQueueEntry *entry = mono_lock_free_alloc (&thread->message_allocator);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mono-utility-thread.c:154:27: error: cannot initialize a variable of type 'UtilityThreadQueueEntry *' with an rvalue of type 'gpointer' (aka 'void *')
UtilityThreadQueueEntry *entry = mono_lock_free_alloc (&thread->message_allocator);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 errors generated.
* [cxx] Fix assignment of volatile aggregate without raising specter of ifdef __cplusplus.
Does this violate the abstraction? i.e. wouldn't it be better to assign entire aggregate
at the caller than to dig into its constituent member data?
All the casts of (x) can be replace with G_CAST (x) that I developed this morning and am working through.
mono_metadata_read_constant_value was extracted from mono_get_constant_value_from_blob
but removing the bits that require GC interaction. This function will be used to read corlib version without allocating strings.
mono_string_from_blob decodes a string from a blob pointer, returns g_malloc'd memory.
* [cxx] Port complex math to small portable C and C++ with the only dependency being hypot and non-complex math, and small preexisting code we already had for msvc.
I.e. we already had two versions, with varying portability.
Use one of them, adding about three lines to it.
There was some debate back and forth about macros/renames here.
This version significantly reduces line damage and is much easier to read.
Doing the rename as a separate step may still be advisable, to erase any doubt as to portable semantics, i.e. namespace isolation.
Mono style divergence is also left unfixed to avoid further line damage.
i.e. consider `double_complex` => `MonoComplex`.
`mono_double_complex_` => `mono_complex_`.
A recent commit revealed that in cases where we select based on a mix of host platform and profile, genproj csproj files can end up with duplicate sources because the existing <ItemGroup Condition= approach could make multiple groups match for a given compile when we really just want one.
This PR changes to generating a cascade of msbuild <Choose> elements, which give if-else selection to ensure that we only ever build a single set of files.
* [cxx] C++ does not allow goto around initialization.
The result would be undefined/uninitialized -- presumably that is what we get in C,
not as safe as it seems. Though, since variable not typically/ever used after goto target, it is ok. A little bit of language requirement for the compiler to do such analysis would have gone a long way, not sophisticated analysis, just used/not-used.
Not a problem in C89 because variables only at top.
Not a problem in idiomatic C++ because, often, early return + destructors.
But definitely a problem with C99, and goto for error handling.
Not a problem with msvc in default permissive mode.
Not likely a problem with gcc due to permissive option.
But a problem with clang.
* [cxx] Split declaration from initialization, instead of go up to within if (0).
* [cxx] mono-merp.c:83:9: error: implicit default constructor for 'MERPStruct' must explicitly initialize the const member 'systemModel'
There are possible other solutions involving initializing up front, and later casting away const for additional initialization. Having public-const private-mutable is a good-seeming interface, but is pretty rare. Maybe in [cxx]future can restore const, add a constructor, etc.
* Remove toplevel const in struct for extremely obscure reasons, again pretty rare pattern.
The obscure reason:
given:
```
typedef struct foo
{
const int i; // remove const to fix
} foo;
foo global = { 1 };
```
compiled as C++, with some recent versions of Visual C++, there is a regression
where it thinks this is a dynamic initialization. Which is usually ok, but can be a problem in unusual cases (true story..delayload implementation..).
The icall was converted to use HANDLES(), so the icall wrapper will set the
pending exception from the MonoError. If the icall does it, too, the second
use (in the wrapper) will assert that the MonoError is being reused after
cleanup without being reinitialized.
Also add an assertion in mono_error_get_message that we're not trying to get a
message from a cleaned up MonoError.
Fixes https://github.com/mono/mono/issues/9935
* console-unix.c:221:21: error: cannot initialize a variable of type 'MonoMethod *' (aka '_MonoMethod *') with an rvalue of type 'gpointer' (aka 'void *')
static MonoMethod *System_Console_DoConsoleCancelEventBackground_method = ((gpointer)-1);
^ ~~~~~~~~~~~~~~
* ../../mono/metadata/opcodes.h:27:14: error: ISO C++ forbids forward references to 'enum' types
typedef enum _MonoOpcodeEnum MonoOpcodeEnum;
* w32socket-unix.c:601:9: error: no matching function for call to 'mono_w32socket_send'
ret = mono_w32socket_send (((MonoFDHandle*) sockethandle)->fd, buffers->Head, buffers->HeadLength, 0, FALSE);
Change parameter from char* to void*.
* In file included from console-unix.c:479:2: error: no matching function for call to 'set_control_chars'
set_control_chars (MONO_ARRAY_HANDLE_PIN (control_chars_arr, gchar, 0, &h), mono_attr.c_cc);
^~~~~~~~~~~~~~~~~
^
console-unix.c:362:1: note: candidate function not viable: cannot convert argument of incomplete type 'gpointer' (aka 'void *') to 'gchar *' (aka 'char *') for 1st argument
set_control_chars (gchar *control_chars, const guchar *cc)
add cast in MONO_ARRAY_HANDLE_PIN
* w32socket-unix.c:635:11: error: assigning to 'gchar *' (aka 'char *') from incompatible type 'gpointer' (aka 'void *')
buffer = g_malloc (SF_BUFFER_SIZE);
^~~~~~~~~~~~~~~~~~~~~~~~~
Change buffer to gpointer, and another similar.
* w32socket-unix.c:1136:99: error: cannot initialize a member subobject of type 'gpointer' (aka 'void *') with an lvalue of type 'gboolean (SOCKET, OVERLAPPED *, guint32, guint32)' (aka 'int (int, OVERLAPPED *, unsigned int, unsigned int)')
{ {0x7fda2e11,0x8630,0x436f,{0xa0,0x31,0xf5,0x36,0xa6,0xee,0xc1,0x57}} /* WSAID_DISCONNECTEX */, extension_disconect },
^~~~~~~~~~~~~~~~~~~
w32socket-unix.c:1137:99: error: cannot initialize a member subobject of type 'gpointer' (aka 'void *') with an lvalue of type 'gboolean (SOCKET, gpointer, guint32, guint32, OVERLAPPED *, TRANSMIT_FILE_BUFFERS *, guint32)' (aka 'int (int, void *, unsigned int, unsigned int, OVERLAPPED *, TRANSMIT_FILE_BUFFERS *, unsigned int)')
{ {0xb5367df0,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}} /* WSAID_TRANSMITFILE */, extension_transmit_file },
Add cast to gpointer.
Also add const while there.
* w32process-unix.c:2189:14: error: no matching function for call to 'process_wait'
waitret = process_wait (process_info->process_handle, MONO_INFINITE_WAIT, NULL);
Add cast from void* to non-void*.
* w32process-unix.c:2099:3: error: cannot jump from this goto statement to its label
goto done;
^
w32process-unix.c:2111:13: note: jump bypasses variable initialization
gunichar2 *args = utf16_concat (utf16_quote, lpFile, utf16_quote, lpParameters ? utf16_space : NULL, lpParameters, (const gunichar2 *)NULL);
^
w32process-unix.c:2104:19: note: jump bypasses variable initialization
const gunichar2 *lpDirectory = coop.length.working_directory ? coop.working_directory : NULL;
^
w32process-unix.c:2103:19: note: jump bypasses variable initialization
const gunichar2 *lpParameters = coop.arguments;
^
w32process-unix.c:2102:19: note: jump bypasses variable initialization
const gunichar2 *lpFile = coop.filename;
^
w32process-unix.c:2285:3: error: cannot jump from this goto statement to its label
goto exit;
^
w32process-unix.c:2291:13: note: jump bypasses variable initialization
gunichar2 *dir = coop.length.working_directory ? coop.working_directory : NULL;
^
w32process-unix.c1 error generated.
:2288:13: note: jump bypasses variable initialization
gunichar2 *args = coop.length.arguments ? coop.arguments : NULL;
etc.
Separate declaration from initialization.
* appdomain.c:554:22: note: jump bypasses variable initialization
MonoAppDomainHandle ad = mono_domain_create_appdomain_internal (friendly_name, setup, error);
^
appdomain.c:590:2: error: cannot jump from this goto statement to its label
goto_if_nok (error, leave);
^
etc.
Split local declaration from initialization.
* w32process-unix.c:1914:27: error: no matching function for call to 'mono_handle_new'
and error on every typesafe MONO_HANDLE_NEW call
Have MONO_HANDLE_TYPECHECK_FOR return MonoObject* instead of gpointer, by casting.
Could probably also change mono_handle_new to accept gpointer.
* class-accessors.c:247:9: error: cannot initialize return object of type 'MonoMarshalType *' with an rvalue of type 'void *'
return mono_property_bag_get (m_class_get_infrequent_data (klass), PROP_MARSHAL_INFO);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:265:18: error: cannot initialize a variable of type 'Uint32Property *' with an rvalue of type 'void *'
Uint32Property *prop = mono_property_bag_get (m_class_get_infrequent_data (klass), PROP_REF_INFO_HANDLE);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:273:19: error: cannot initialize a variable of type 'Uint32Property *' with an rvalue of type 'void *'
Uint32Property *prop = mono_property_bag_get (m_class_get_infrequent_data (klass), PROP_REF_INFO_HANDLE);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:279:18: error: cannot initialize a variable of type 'Uint32Property *' with an rvalue of type 'gpointer' (aka 'void *')
Uint32Property *prop = mono_class_alloc (klass, sizeof (Uint32Property));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:294:19: error: cannot initialize a variable of type 'PointerProperty *' with an rvalue of type 'gpointer' (aka 'void *')
PointerProperty *prop = mono_class_alloc (klass, sizeof (PointerProperty));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:334:9: error: cannot initialize return object of type 'MonoClassPropertyInfo *' with an rvalue of type 'void *'
return mono_property_bag_get (m_class_get_infrequent_data (klass), PROP_PROPERTY_INFO);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:347:9: error: cannot initialize return object of type 'MonoClassEventInfo *' with an rvalue of type 'void *'
return mono_property_bag_get (m_class_get_infrequent_data (klass), PROP_EVENT_INFO);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:372:18: error: cannot initialize a variable of type 'Uint32Property *' with an rvalue of type 'void *'
Uint32Property *prop = mono_property_bag_get (m_class_get_infrequent_data (klass), PROP_DECLSEC_FLAGS);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:379:18: error: cannot initialize a variable of type 'Uint32Property *' with an rvalue of type 'gpointer' (aka 'void *')
Uint32Property *prop = mono_class_alloc (klass, sizeof (Uint32Property));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:412:18: error: cannot initialize a variable of type 'WeakBitmapData *' with an rvalue of type 'gpointer' (aka 'void *')
WeakBitmapData *info = mono_class_alloc (klass, sizeof (WeakBitmapData));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:423:18: error: cannot initialize a variable of type 'WeakBitmapData *' with an rvalue of type 'void *'
WeakBitmapData *prop = mono_property_bag_get (m_class_get_infrequent_data (klass), PROP_WEAK_BITMAP);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:454:19: error: cannot initialize a variable of type 'DimConflictData *' with an rvalue of type 'gpointer' (aka 'void *')
DimConflictData *info = mono_class_alloc (klass, sizeof (DimConflictData));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:469:19: error: cannot initialize a variable of type 'DimConflictData *' with an rvalue of type 'void *'
DimConflictData *info = mono_property_bag_get (&klass->infrequent_data, PROP_DIM_CONFLICTS);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cast from void* to non-void*.
* class.c:3005:16: error: assigning to 'char *' from incompatible type 'const char *'
if ((nested = strchr (name, '/'))) {
^~~~~~~~~~~~~~~~~~
class-init.c:437:11: error: assigning to 'MonoClass *' (aka '_MonoClass *') from incompatible type 'gpointer' (aka 'void *')
klass = mono_image_alloc0 (image, sizeof (MonoClassGtd));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-init.c:442:11: error: assigning to 'MonoClass *' (aka '_MonoClass *') from incompatible type 'gpointer' (aka 'void *')
klass = mono_image_alloc0 (image, sizeof (MonoClassDef));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-init.c:500:5: error: cannot jump from this goto statement to its label
goto parent_failure;
^
class-init.c:599:6: note: jump bypasses variable initialization
int first_method_idx = cols [MONO_TYPEDEF_METHOD_LIST] - 1;
^
class-init.c:597:6: note: jump bypasses variable initialization
int first_field_idx = cols [MONO_TYPEDEF_FIELD_LIST] - 1;
^
class-init.c:496:5: error: cannot jump from this goto statement to its label
goto parent_failure;
^
class-init.c:599:6: note: jump bypasses variable initialization
int first_method_idx = cols [MONO_TYPEDEF_METHOD_LIST] - 1;
^
class-init.c:597:6: note: jump bypasses variable initialization
int first_field_idx = cols [MONO_TYPEDEF_FIELD_LIST] - 1;
^
class-init.c:490:4: error: cannot jump from this goto statement to its label
goto parent_failure;
^
class-init.c:599:6: note: jump bypasses variable initialization
int first_method_idx = cols [MONO_TYPEDEF_METHOD_LIST] - 1;
^
class-init.c:597:6: note: jump bypasses variable initialization
int first_field_idx = cols [MONO_TYPEDEF_FIELD_LIST] - 1;
^
class-init.c:838:14: error: no matching function for call to 'class_kind_may_contain_generic_instances'
image_set = class_kind_may_contain_generic_instances (eclass->class_kind) ? mono_metadata_get_image_set_for_class (eclass) : NULL;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* class.c:3005:16: error: assigning to 'char *' from incompatible type 'const char *'
if ((nested = strchr (name, '/'))) {
^~~~~~~~~~~~~~~~~~
class.c:427:10: error: cannot initialize a variable of type 'char *' with an rvalue of type 'const char *'
char *s = strchr (klass_name, '`');
^ ~~~~~~~~~~~~~~~~~~~~~~~~
add const, add cast, and also fix adjacent integer truncation
* assembly.c:2964:8: error: cannot initialize a variable of type 'char *' with an rvalue of type 'const char *'
char *eqsign = strchr (pair, '=');
add cast
* cominterop.c:664:2: error: no matching function for call to 'register_icall'
register_icall (cominterop_get_method_interface, "cominterop_get_method_interface", "ptr ptr", FALSE);
^~~~~~~~~~~~~~
repeatedly
Add cast in macro.
Also another need for a cast on a string (error not recorded).
* [cxx] icall.c:
casts
change char* to void*
split local declaration from initialization
add extern "C" around external code (environ -- probably merged to master already)
* image.c:726:8: error: no matching function for call to 'strcmp'
if (strcmp (list_iter->data, name) == 0) {
^~~~~~
image.c:1184:20: error: constant expression evaluates to 2218203019 which cannot be narrowed to type 'int' [-Wc++11-narrowing]
IGNORED_ASSEMBLY (0x8437178B, SYS_NET_HTTP, "C0E04D9C-70CF-48A6-A179-FBFD8CE69FD0", "4.3.0 net46"),
^~~~~~~~~~
repeatedly
add casts
* [cxx] marshal.c
marshal.c:224:3: error: no matching function for call to 'register_icall'
register_icall (mono_marshal_string_to_utf16, "mono_marshal_string_to_utf16", "ptr obj", FALSE);
repeatedly; add cast in macro
Also possible int/enum mixup -- add cast.
* [cxx] property-bag.c
property-bag.c:44:37: error: cannot initialize a variable of type 'MonoPropertyBagItem *' (aka '_MonoPropertyBagItem *') with an lvalue of type 'void *'
MonoPropertyBagItem *cur, **prev, *item = value;
Add cast here, and another.
* [cxx] metadata.c
add casts from void* to non-void*
indicate future enum instead of int
remove designated intitializers
* [cxx] more appdomain.c
* PR: Repatriate orphaned comment.
* PR: include opcodes.h instead of duplicating MonoOpcodeEnum
Otherwise I get consistent access failures for CALLVIRT from mono_method_to_ir().
Stacktrace looks like this:
```
System.InvalidOperationException: WinForms_SeeInnerException ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MethodAccessException: Method `System.__ComObject..ctor()' is inaccessible from method `System.__ComObject..ctor()'
445286 at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_throw_method_access(intptr,intptr)
445287 at System.__ComObject..ctor () [0x00000] in <430892d2beef407ea6b21748b72c1144>:0
445288 at (wrapper cominterop-invoke) System.__ComObject..ctor()
445289 at (wrapper managed-to-native) System.Reflection.MonoCMethod.InternalInvoke(System.Reflection.MonoCMethod,object,object[],System.Exception&)
445290 at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in <b683bf5ced8643af8ec2e589dfb23c2b>:0
445291 --- End of inner exception stack trace ---
445292 at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00014] in <b683bf5ced8643af8ec2e589dfb23c2b>:0
445293 at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x000a8] in <b683bf5ced8643af8ec2e589dfb23c2b>:0
445294 at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00009] in <b683bf5ced8643af8ec 2e589dfb23c2b>:0
445295 at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00027] in <b683bf5ced86 43af8ec2e589dfb23c2b>:0
445296 at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00020] in <b683bf5ced8643af8ec2e589dfb23c2b>:0
445297 at System.Activator.CreateInstance (System.Type type) [0x00000] in <b683bf5ced8643af8ec2e589dfb23c2b>:0
```
My understanding is that misleading exception message is due to exact same name used for dynamic type, in fact it means that some type in dummy assembly can't access internal method from corlib.
* [threads] switch to GC Safe around pthread calls in mono_thread_internal_set_priority
Observed pthread_getschedparam taking a lock on OSX
* [win32] Capture GetLastError before MONO_EXIT_GC_SAFE
* Fix Tasks and Promises in bindings.
- Tasks were not being marshalled correctly in some circumstances. The only place that I could reproduce this was in the bindings tests. Running from outside the test harness would not reproduce this error.
- Promises would intermittently throw Exceptions: NullReferenceException, ArrayIndex out of bounds.
- When using Promises from JS to CS there were random Memory access exceptions. Looks like memory was being trampled on. Adding an integer variable to the create_task_completion_source call fixed these problems as the CreateTaskSource is defined as receiving an int variable. This also fixed the NullReferenceExceptions and ArrayIndex out of bounds exceptions.
* Make JSObject disposable
- Add the ability to dispose of a JSObject.
- The dispose will remove the object from the tracked object list and will allow the reference counter to be recycled later.
- By keeping a recycled list of references and reusing those will keep the tracked objects array from growing out of hand.
- Add test to the Test Harness.
- Modifiy the way the bindings init works by passing in of the Assembly and Class `[asm]namespace.class`. Modfiy test.js to use the new format.
* Add support for Get and Set of javascript properties on a JSObject.
* The namespace problem was fixed in https://github.com/mono/mono/pull/9836
* Cleanup unused and duplicate definitions
* [runtime] Add mono_runtime_get_caller_no_system_or_reflection
Exposes an already existing stackwalk that we use to find out who called a corlib API.
* [loader] Consult asmctx of executing assembly for Assembly.Load
if an assembly in LoadFrom context calls Assembly.Load, the given assembly name
should be tried in the basedir of the executing assembly, and the resulting
loaded assembly should be in LoadFrom context.
* [loader] Assemblies in individual asmctx can reference assemblies in application base
If an assembly was loaded with LoadFile, it can reference assemblies from the
application base, the GAC or MONO_PATH.
Fixes https://github.com/mono/mono/issues/8575
* [loader] Pass requesting assembly to mono_assembly_open_predicate
In LoadFrom and LoadFile icalls, pass the currently executing assembly as the
requesting assembly.
* [utils] Add mono_path_filename_in_basedir
* [loader] Add mono_install_asmctx_from_path_hook
Add a hook that can be used to check whether a given path belongs to some
assembly load context.
For example if a given path is in the application base of the current
appdomain, an appdomain hook would set out_asmctx to MONO_ASMCTX_DEFAULT and
return TRUE.
* [loader] Use appdomain base dir and loadfrom asmctx hooks
1. If an assembly filename is in the GAC, always open the assembly in default
context.
2. If an assembly filename is in the appdomain search path (base directory or
private bin path) always open the assembly in default context.
3. If an assembly filename is in the base dir of the requesting assembly and
the requesting assembly was in LoadFrom context, always open the assembly in
LoadFrom context.
Fixes https://github.com/mono/mono/issues/9753
and Fixes https://github.com/mono/mono/issues/9542
* [tests] Test loading references from LoadFrom and LoadFile contexts
The LoadFrom assembly loading context and the individual assembly loading
context (aka LoadFile aka "no context") behave differently when requesting a
referenced assembly - for LoadFile we expect the runtime to probe the appdomain
base, the GAC + MONO_PATH but not the basedir of the requesting assembly. For
LoadFrom the basedir of the requesting assembly _is_ included. So the tests
here try all the possible variations.
* [tests] AOT assembly-load-reference tests
* [metadata] Cache method signature in correct image hash
When freeing dynamic methods in mono_free_method, we remove entries in the method image's hashtables, hashed by the soon to be freed method signature.
* [metadata] Avoid unnecessary alloc
Fixes https://github.com/mono/mono/issues/9869.
<!--
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
-->
* [coop] Turn hybrid suspend on by default on desktop platforms
Use hybrid suspend by default on x86 and amd64 OSX, Windows and Linux
Pass `--disable-hybrid-suspend` to configure to disable at build time, or set the environment variable `MONO_THREADS_SUSPEND=preemptive` when running Mono to use preemptive suspend (the previous default).
Pass `--disable-hybrid-suspend --enable-cooperative-suspend` to configure cooperative suspend at build time.
* [sdks] Disable coop and hybrid suspend for iOS and Android
Only the devices and simulator builds, not the host ones.
* [coop] Add mono_threads_suspend_override_policy ()
Do not use it. It provides a last resort method to ignore configure and environment settings and use a hardcoded threads suspend policy.
* [interp] Override suspend policy - warn and use preemptive
Until the interpreter supports safepoints and performs threads suspend states switches in its trampolines, always use preemptive suspend if the interpreter is used.
* [coop] Enter GC Safe around mono_threads_join_lock ()
Like other uses of mono_threads_join_lock, enter GC Safe before trying to take the lock.
* [interp] Use preemptive suspend with --full-aot-interp
Move safepoint suspend check to mono_runtime_set_execution_mode
* [test] fullaotmixed - force preemptive suspend[test] fullaotmixed - force preemptive suspend
Force preemptive suspend in fullaotmixedcheck. We must compile the AOT images without safepoints.
* [sdks] Run the offset-tool in 64 bit mode.
* [sgen] SgenDescriptor should use the target wordsize.
* [sdks] Fix 'Run the offset-tool in 64 bit mode.'
* Manually add a csproj file for cil-stringreplacer
Adjust trace level for genproj
* Manually add cil-stringreplacer to bcl.sln and set it as a dependency of corlib
* Fix typo
* Add post-build event to corlib that runs cil-stringreplacer on it in mscorlib mode
* [csproj] Update project files
Right now, the set of mono-api-tools only works as console apps. This PR will make them work as normal dlls so they can be consumed by other apps and libraries. They will still work as .exes, so nothing visibly changes for existing users.
The motivation for this is for some build process or third party tool to take an assembly and generate an .xml doc from it. Since the writer is in-memory, the tool can then parse the .xml and do whatever it needs to. The same goes for the diff tools - if the diff happens in-memory, then the tool can process it without having to save and then load from the file system.
## Libraries
- [x] mono-api-info -> `Mono.ApiTools.ApiInfo`
- [x] mono-api-diff -> `Mono.ApiTools.ApiDiff`
- [x] mono-api-html -> `Mono.ApiTools.ApiDiffFormatted`
## Major changes
- the existing `Driver` classes are now just thin wrappers to parse the args and pass it on to the generators
- the "options" are now abstracted into config classes to avoid methods with numerous parameters
- the APIs have new support for reading assembly and info `Stream`s instead of just file paths
- added compiler flags to control the namespace and type visibility to make the library APIs nicer
- added compiler flag to remove the `Driver` class and `Mono.Options` dependencies
- the mono-api-info tool has some more options to allow it to run on libraries, and ignore dependencies that it cannot find - this makes it easier to use so that the entire dependency chain does not have to be loaded just to output the current assembly API
## Compiler defines
- `EXCLUDE_DRIVER` will remove the console entry point and remove the dependency of Mono.Options
- `USE_MONO_API_TOOLS_NAMESPACE` will switch the namespace to `Mono.ApiTools` so that libraries can have a nice API
- `USE_INTERNAL_VISIBILITY` will make any non-essential, `public` APIs turn `internal`
## Review points
- are there any variables/fields that are still static?
- are there any exposed types/members that need to be hidden?
- are the new names for the APIs and config classes OK?
- are my whitespaces according to the guidelines?
- did I go horribly wrong?
- Public headers should be wrapped in it (all but one are).
- MONO_API should include it.
But it is not needed "everywhere".
Placement of "extern" therefore tweaked.
- Remove from functions where it is meaningless and gets in the way.
- Mark data with MONO_API_DATA instead of MONO_API.
[not yet]Sprinkle in a few G_BEGIN_DECLS for monodis and where THREAD_INFO_TYPE makes prototypes incorrect.
include/add prototypes for all icalls. [undone per PR, possibly a misunderstanding]
A problem would be, if embedders manage to use functions that are neither MONO_API nor
in public headers.
Some parts of the larger solution are omited here in the hopes of finding better options.
In particular, compiling all of monodis as C++ so we don't need some extern "C" for it,
and THREAD_INFO_TYPE at least incoming being gpointer so declaration and definition match.
This is based on https://github.com/mono/mono/pull/9812/commits/40315ee475bdf89c40189707a8cca86b3f6d91c8 and is an alternative to https://github.com/mono/mono/pull/9782.
We also can/should prune the preexisting G_BEGIN_DECLS / G_END_DECLS uses.
* [runtime] Add a MONO_ABI_SIZEOF(MonoObject) define, use it instead of sizeof(MonoObject). Add a few helper functions to avoid sizeof(MonoObject) in many places.
* [aot] Add a 'deterministic' testing argument to have the compiler produce deterministic output by turning off the generation of the AOT id.
* [jit] Use target sizes in many places.
* [runtime] Avoid corlib checks in cross compile mode, its not possible to read the field value from corlib.
* [runtime] Fix the arm build.
Every different locale getter in unmanaged attempts to
cache the result from this icall. Some of them fail to do so in a manner
that is correct.
CFLocaleCopyCurrent (); in get_darwin_locale ends up being called
thousands of times. In an app with a few dozen printfs, it's easy to see
18mb of leaked memory through this.
Rather than trying to fix them all in unmanaged in a perfect manner, I
thought it better to also avoid the icall overhead and to cache it in
C#.
Without this fix, a memory traffic stress test (debian shootout's pidigits) leads to 66% of
memory pressure being due to this icall. With this fix, it is 4.3%.
If this caching is wrong for correctness reasons (we expect it to change?),
I would like to point out that we have similar caching done in unmanaged
and that we should then bring both into a correct design.
Right now we have a race condition where parallel make on CI will barge ahead and start building things before monolite+basic-profile-check have completed, which results in some weird behavior - gensources silently fails to run, etc. Testing some possible fixes for this.
* [offsets-tool] Add i386-apple-darwin11.2.0 as an abi target, used only for development.
* [offset-tool] Emit sizes for structures.
* [runtime] Cleanup the cross targets in configure.ac and add more target defines.
Redefine SIZEOF_REGISTER to refer to the target size.
Add TARGET_SIZEOF_VOID_P define and target_mgreg_t type.
* [runtime] Add missing object offsets for x86.
* [runtime] Avoid trying to execute assembly load hooks in aot mode.
* [runtime] Fix the windows build.
* [offset-tool] Fix indentation.
* [runtime] Add a mono_gc_get_target_card_table () function which is the same as mono_gc_get_card_table () but returns information for the target. Use it in the JIT and in places where we generate IL code.
* [aot] Save the card table parameters in the AOT image and check them at load time.
* Fix llvm support.
Using solution dependencies in ```bcl.sln``` seems flaky and seems like it might not establish the full ordering we need to ensure that ```Consts.cs``` exists before we build things that require it. Let's try using project references (where ```corlib.dll``` 'depends' on ```genconsts.exe```) instead. This should also insert the dependency for any project that includes Consts.cs instead of just corlib.
This PR also makes update-solution-files actually fail if ```genconsts.exe``` fails to build because it was driving me mad.
Part of #6886
* Add check for a generic method when invoking in debugger
VSTU will try to invoke a generic (uninflated) method in certain
situations, which was causing the Mono debugger to assert and crash
Unity. Added a check for this situation before the invoke so the
debugger can return an error to the client. Previously, this case
wasn't caught until the method was in JIT compilation, which will
assert when this situation is detected.
* Fixing typo
The version imported and attempted to patch didn't work fully. This
preserves the .NET representation while converting if directives to
runtime checks, which CoreCLR inlines.
Testing was done poking some values in the REPL and running some
test suites (System.Json, System.Decimal) that broke as a result.
mcs should also properly handle constants; again, the "bits" inside
are consistent with amd64, and just converted as needed.
Unless I fucked up, should fix#9772.
Carbon implementation now throws exception instead of crashing in the mismatched p/invoke calls.
Cocoa implementation now support 64-bit mode and uses the handle of `NSView` that is passed in instead of relying on `NSGraphicsContext.CurrentContext`. It also fixes handling of flipped views.
Requires up to date libgdiplus.
* [appdomain] MONO_API mono_domain_set needs GC Unsafe
* [runtime] MONO_API mono_domain_set_config needs GC Unsafe
* [runtime] MONO_API mono_dllmap_insert sometimes needs GC Unsafe
When adding a global mapping, don't do the state transition because the thread may not be attached yet. When adding a per-image mapping, do the transition.
* [runtime] MONO_API mono_g_hash_table_insert needs GC Unsafe
* [runtime] MONO_API mono_g_hash_table_new_type needs GC Unsafe
* [runtime] MONO_API mono_gc_reference_queue_new needs GC Unsafe
* [runtime] mono_thread_detach_if_exiting thread state change
1. Mark it external only, it's unused in the runtime.
2. If detaching, switch to GC Unsafe before detaching
* [metadata] Make mono_class_get_fields external only
- Runtime should use mono_class_get_fields_internal
- MONO_API mono_class_get_fields needs GC Unsafe
* [runtime] MONO_API mono_gc_reference_queue_add needs GC Unsafe
* [metadata] Make mono_class_get_name and namespace external only
- Runtime should use m_class_get_name and m_class_get_name_space
- MONO_API mono_class_get_name and mono_class_get_namespace need GC Unsafe
* [metadata] MONO_API mono_class_get_parent needs GC Unsafe
- mark it external only; runtime should use m_class_get_parent
* [metadata] Make mono_class_is_delegate external only
- runtime should use m_class_is_delegate
- MONO_API mono_class_is_delegate needs GC Unsafe
* [metadata] Make mono_class_is_valuetype external only
- runtime should use m_class_is_valuetype
- MONO_API mono_class_is_valuetype needs GC Unsafe
* [metadata] Make mono_class_is_enum external only
- runtime should use m_class_is_enum_type
- MONO_API mono_class_is_enum needs GC Unsafe
* [metadata] Mark mono_class_get_element_class external only
- runtime should use m_class_get_element_class
- MONO_API mono_class_get_element_class needs GC Unsafe
* Add support for Blazor custom interop support.
This adds additional ability to perform unmarshalled calls for advanced but high-performance shared-memory interop.
* Note: * This is only safe in Blazor's case because of its exact usage patterns.
* Add dotnet_support.js backing file.
Instead of accessing them using the inst_ls_word/inst_ms_word macros which use the union in MonoInst.data, access them normally using
MonoInst.Data.i8const.
It wasn't possible to debug any F# app that contained PInvokes.
The F# compiler omitted MethodDebuginformation for PInvokes which in
turn caused Mono to fail on an assertion.
```
* Assertion at metadata.c:1117, condition `idx < t->rows' not met
```
https://github.com/mono/mono/commit/0f0e31842f1f394c4e95d3726c20af547e706278 added a new pipes_pns.sources file
but we forgot to add it to EXTRA_DISTFILES so it gets included in the tarball.
Given that this happens almost all the time when we add a new .sources file
we should just always include all *.sources
* [cxx] Build/CI support for C++.
configure -enable-cplusplus and CI_TAGS=cplusplus
https://jenkins.mono-project.com//job/test-mono-mainline-linux-cplusplus/
* [cxx] Rename CPLUSPLUS/cplusplus to CXX/cxx.
* [cxx] Add C++ build support to mini.
* [cxx] Jenkins/CI support for cxx not just cplusplus.
* [interp] Fix some conv ovf opcodes
* [interp] Correctly hande a few conv ovf cases
For conversion from unsigned value to i1 and i2.
* [interp] Fix multiplication overflow case
* [interp] Remove some constants from code
* Use System.Security.Policy.Publisher from corefx (they essentially stubbed it out).
Fixes the XUnit 2.4 problem.
* Use `PublisherMembershipCondition` from CoreFX as well (stubbed out in there) and remove the tests.
* Bump API snapshot submodule
* [Coop] System.IO mark all remaining NOHANDLES().
* Functions take no parameters, not any parameters -- () vs. (void).
* [Coop] Mark System.Threading.Interlocked as mostly NOHANDLES().
* [Coop] ves_icall_System_Threading_Thread_MemoryBarrier is NOHANDLES().
* [Coop] System.Threading volatile reads/writes are NOHANDLES().
* Make YieldInternal NOHANDLES and remove two potential layers.
* [Coop] Make ves_icall_System_Threading_Thread_current_lcid NOHANDLES().
* [Coop] mono_100ns_ticks nohandles.
* [Coop] More nohandles volatile reads/writes.
* [Coop] NOHANDLES() System.Security.SecurityManager.
Return objects from load_cattr_value () using an additional out parameter. Add a variant of
mono_reflection_create_custom_attr_data_args () which can only decode a subset of cattr types, but
it doesn't allocate any objects. Use this in marshal.c/marshal-ilgen.c to avoid allocating objects
while decoding FixedBufferAttribute and UnmanagedFunctionPointerAttribute.
* [interp] Refactor MINT_ICALL opcodes
Remove integer versions, since they add unnecessary complexity, and with some signatures we were already implicitly casting int to gpointer.
* [interp] Use fast versions for icalls
* [interp] Include more fast pinvoke/icall signatures
These cover almost all icalls
* [interp] Fix fast icall return value
The returned value needs to be converted to the stackval representation
* [corlib]: Cleanup `X509Certificate` implementation and sync it with CoreFX.
Completely refactored the `X509Certificate` implementation to make it based very closely on CoreFX.
We cannot fully switch to their implementation yet because we are missing things and they also have
a few issues in their implementation. However, this will make it a lot easier to do this at a later time.
The internal `X509CertificateImpl` has been cleaned up as well, using properties instead of methods in
most places and the `ToString()` implementation is now shared between all platforms.
* `X509Certificate.CreateFromSignedFile()`: in CoreFX, this is the same as `CreateFromCertFile()`.
Our old implementation was incomplete and did not verify the signature - we even had a test where
loading a certificate with an invalid signature was supposed to work; this test has been disabled
because we're now throwing an exception.
* `X509CertificateImpl.KeyAlgorithmParameters`: this is supposed to throw `CryptographicException`
on error, see `Certificate13` in `X509CertificateTest.cs`.
* We now match CoreFX's behavior regarding serialization - while the `X509Certificate` type is still
marked as `[Serializable]`, we now throw `PlatformNotSupportedException` when attempting to serialize
or deserialize it.
* Bump API snapshot submodule
* [csproj] Update project files
* Make `corlib` internals visible to `System.Security` on all profiles, not just monotouch watch.
* Moves all generated `SR` files and their generation logic from `System` and `System.Security` into `corlib`. Since `corlib` internals are visible to these assemblies, we don't need to duplicate the resource strings.
* Cleanup the `RESX_RESOURCE_STRING` is `corlib` and sort them alphabetically.
* Add the internal `Internal.Cryptography.Helpers` helper class from CoreFX to `corlib` (currently unused, but "Blue" will need it).
* Fix up behaviour of verbose method with arguments
Given a method spec which looks like:
`MainClass:Do(int,int,int)`
Via f024e820a025aacc1cf80eb82a8aee4552c3ac11 the code would match 3 methods:
`MainClass:Do(int`, `int`, `int)`, crashing the runtime.
Accept the multiple method matches via `;`, rather than `,`.
Now, the behaviour is changed so:
`MainClass:Do(int,int,int);MainClass:Do(int,int)`
Get parsed as:
`MainClass:Do(int,int,int)`
`MainClass:Do(int,int)`
* Add tests
* add test file and make tests actually output something
* Smarter unit test around disassembling methods
* Try single quoting environment variable value
* Try using non-throwing setter
Temporarily switch back to ref-source impl for `CharUnicodeInfo` which contains a few special BE patches while I am trying to upstream them.
Fixes#9684
Both `Certificate_11_Properties` and `Certificate_14_Properties` use an invalid
certificate that violates X.690 11.8.2 (UTCTime under a DER encoding).
This will no longer be supported once we switch to CoreFX's PAL code.
See also https://github.com/dotnet/corefx/pull/31293.
Instead of digging around in the environment for the coop and hybrid suspend
settings, define in terms of mono_threads_suspend_policy (or the
MONO_ENABLE_BLOCKING_TRANSITION env var as before).
Set to one of "preemptive", "coop" or "hybrid".
Unlike the old MONO_ENABLE_COOP, MONO_ENABLE_COOP_SUSPEND,
MONO_ENABLE_HYBRID_SUSPEND, the value of MONO_THREADS_SUSPEND will take
priority over the configure flags default.
For compatability the old environment variables will be respected if neither
MONO_THREADS_SUSPEND nor a configure flag was set. A warning will be emitted
if MONO_THREADS_SUSPEND isn't set. (Rationale: maybe the environment set both
because they're not sure which version of Mono they will be running - so don't
nag them).
Rework of #5448, contributes to #7143.
The anonymous pipes were tested on macOS, build was tested only on few configurations (hoping to solve some issue through Jenkins builds). Named pipe tests get stuck on macOS, but it may be unrelated Xunit issue and needs some proper debugging.
@Therzok, do you know of anything else that is missing for parallel MSBuild? Do you have some test environment for it by chance?
[MacOS] On Mac, use the copyfile API to copy files
Rebase of #9038 with added fix for the failing unit tests. Note that there's a race condition in the check between `source file == destination file` and the `copyfile` call, but a similar race condition already exists there in the current code except the outcome is different.
* `X509Helper`, `X509CertificateImpl`, `X509Certificate2Impl` and `ISystemCertificateProvider` now use `SafePasswordHandle` instead of strings.
* `X509Certificate`: actually implement `SecurePassword` based APIs using `SafePasswordHandle`.
* `mono_btls_pkcs12_import()`: when passed an empty password, try both the empty string and null.
After the dependency injector changes, the `X509Certificate` code in corlib now uses the implementation from `System.dll`, including the platform-specific switch via `MONO_TLS_PROVIDER` / `MonoTlsProviderFactory`.
This adds a new `X509Certificates2` category to the corlib tests and runs them with `MONO_TLS_PROVIDER=btls` on OS X (where the default is applets).
* [interp] fix stack type warning around ldlen instruction
removes this warning in e.g. mcs-tests:
> Object.CallSite.Target: Store local stack type mismatch 0 1
> Object.CallSite.Target: Store local stack type mismatch 0 1
> Object.CallSite.Target: Store local stack type mismatch 0 1
> Object.CallSite.Target: Store local stack type mismatch 0 1
> Object.CallSite.Target: Store local stack type mismatch 0 1
> Object.CallSite.Target: Store local stack type mismatch 0 1
* [interp] fix compiler warning around MINT_INTRINS_BYREFERENCE_CTOR
fixes those warnings:
> interp/interp.c:3924:13: warning: unused variable 'valuetype_this' [-Wunused-variable]
> stackval valuetype_this;
> ^
> interp/interp.c:3926:13: warning: unused variable 'retval' [-Wunused-variable]
> stackval retval;
> ^
> 2 warnings generated.
Adds 1192 xunit tests for System.XML from CoreFX
Also, moves common lines from `mobile_System.Xml.sources` and `System.Xml.sources` to `common.sources`
Part of #8132
* Use __declspec(thread) with Visual C++, and __thread with Win32/gcc,
instead of much slower TlsGetValue / TlsSetValue
* Avoid affecting Boehm.
* Replace HAVE_KW_THREAD and USE_KW_THREAD with MONO_KEYWORD_THREAD.
* Refactor the AppleTls Certificate code into a PAL-based approach.
* Added the internal `SafeHandle` based classes from CoreFX's PAL:
`SafeSecCertificateHandle`, `SafeSecIdentityHandle`, `SafeKeychainItemHandle`
and `SafeSecKeyRefHandle`.
* Added a new static internal class `MonoCertificatePal`:
- `Mono.AppleTls/MonoCertificatePal.cs` is shared between OS X and Mobile.
- `Mono.AppleTls/MonoCertificatePal.OSX.cs` contains the OS X specific parts.
- `Mono.AppleTls/MonoCertificatePal.Mobile.cs` contains the Mobile specific parts.
This split allows us to avoid all the `MONOTOUCH` conditionals in the code.
* In the `Mono.AppleTls` directory, all code from `Certificate.cs`, `Items.cs` and
`ImportExport.cs` have all been merged into the new `MonoCertificatePal` class.
* The entire AppleTls code is now using these safe handles instead of the old
Mono-specific types. This allows us to swap out the implementation of the certificate
code with CoreFX's PAL code.
* Cleaned up and removed some ancient dead code.
* `build/profiles/build.make`: Don't set `MONO_FEATURE_APPLETLS` here.
* Add `appletls.sources` and cleanup `MONO_FEATURE_APPLETLS` conditionals.
* [csproj] Update project files
These programs work if you just compile them with g++ and most of the automake/autoconf/libtool
flags, but not if you use all of them. Something to do with search paths perhaps.
* [linker] Add BCL size regression testing
We're now tracking the size of the BCL after it was processed by the linker
across various profiles we care about (currently net_4_x, monotouch and monodroid).
The way it works is that we keep a file with size measurements in the repo
and during CI we run the linker against the current state and compare.
Right now we're simply running the linker tests as they are a good approximation
of various usages (this PR additionally adds more comprehensive linker tests we had in XI).
If changes are found there's a report to check where the increase/decrease came from.
The changes can be applied via `@monojenkins commit sizediff` similar to
existing csproj and apidiff usages.
Fixes https://github.com/mono/mono/issues/6992
* Don't run new linker tests yet, just use for size checking
The mono_load_runtime_and_bcl allows upstream to remap requests and report download progress.
This cb semantics might change in the future when we implement more agressive loading.
The `mono_threads_attach_coop` / `mono_threads_detach_coop` icalls are called
from the wrapper around managed methods that will be called from native code
`emit_managed_wrapper_ilgen`.
If the managed method throws an exception, the mono_threads_detach_coop will
not be called, and the checked build
`mono_threads_enter_gc_unsafe_region_internal`/`mono_threads_exit_gc_unsafe_region_internal`
accounting will be mis-matched which will break later checked mode checks.
(The unbalanced thread state transition is not a problem - the next outermost
exit_gc_unsafe will operate just fine - it's just the checked mode check that's
wrong)
Once we lost the try/finally in b20d5ce1e5 these
should have become unbalanced.
* [Coop] Convert 3 more functions and strengthen some types to be not just gpointer.
i.e. to see in debugger and for static type checking
* ves_* probably shall not call ves_*.
non-ves_* (mono_*) really shall not call ves_*.
Only C#/icall-def.h shall call ves_*, and only ves_*.
Where there is a contradiction, rename ves_* to mono_*,
have ves_* and mono_* call mono_*, and possibly cleanup.
For example, removing MonoError* parameter, and moving asserts
around to preserve or improve semantics.
* Remove incorrect comment.
This adds a simple script for generating Consts.cs that can run on Windows, and makes it a dependency of corlib.csproj in the BCL solution file. From my initial testing this will autogenerate Consts.cs if it's missing and then corlib will successfully build.
This (mostly?) addresses issue https://github.com/mono/mono/issues/6886.
This currently has an awkward dependency on ```winsetup.bat``` and I modified it slightly to make it clearer whether the batch file succeeded.
Rather than always writing to the std out, provide an option to write to a file. This makes things easier for tooling by not requiring `RedirectStandardOutput = true`
* [interp] Check delegates for null this
* [interp] Resolve target method for delegates created with abstract methods
* [interp] Fix delegate invocation
Previously, when first calling the Invoke method on a delegate we would silently transform the delegate invoke wrapper of the delegate on which Invoke is called, after which all calls would go through this method. This is problematic because the same Invoke method can be called on a different delegate afterwards (the delegate_invoke wrapper needs to be tied to the delegate and it's not global for all invokes of same type),
We solve this by storing the invoke method in the delegate, similarly to the JIT.
* [interp] Remove unused argument
[llvm] Avoid using the preserveall calling convention in another plac…
…e on watchos.
Fixes https://github.com/mono/mono/issues/9318.
<!--
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
-->
Generate similar array-coop*.cs files from pieces.
System.Array icall logging/testing tweaks.
Add const, but only in comment.
[Coop] Convert ves_icall_System_Array_CreateInstanceImpl.
PR feedback: Don't have icall call icall, refactor into common helper instead.
Add more disabled printing.
test_get_generic_value fails even CI JIT due to AOT runtime,
but does work with full JIT configuration.
Generic ref/out parameters are not supported by HANDLES(), so
NOHANDLES(SetGenericValueImpl)
NOHANDLES(GetGenericValueImpl)
Also add MONO_REQ_GC_UNSAFE_MODE because of unsafe gpointer value (which reinforces NOHANDLES?)
Remove extra evaluation of arg.
Enable 3 more tailcall tests on x86.
Enable more tailcall AOT tests.
Program to split fsharp-deeptail.il into separate tests.
Split up F# test into individual tests.
Simplify test IL and make it stack overflow upon failure.
Cleanup test code before splitting.
Program to split tailcall-interface-conservestack into separate tests.
Enable split up versions of tailcall-interface-conservestack and F#.
There is a problem in that we use gsharedvt unexpectedly, and gsharedvt
has almost-fundament contradiction with tailcall.
Need to figure out why it used, if that is correct.
Disable some FullAOT tests that are broken by gsharedvt.
Lower apparent memory use.
Move tests into directories and reset disabled lists.
Centralize tailcall debug helpers.
Add comments why test_virt.exe fails on 32bit x86.
Remove tail. prefixes that are besides the point, and add noise to the logging.
Print more in failure.
Better align the stack for x86, so tests pass.
There were already tailcalling and conserving stack, but still using a little stack.
Real world code will use zero or a little. The test self-check is very strict
and wants zero, and prints how much.
Rename duplicate tests, and sort them.
Otherwise we were missing split tests.
Add 96 ARM failures and 30 FullAOT failures, mostly all understood.
ARM cannot pass extra parameter in a tailcall (except bitcode that we do not fix).
FullAOT uses gsharedvt a lot even for statically discovered types created, due to
interface and virtual.
Convert to C++98 and fix warnings about /* in //
Split the tests up in the build instead of ad hoc by developer.
Disable tests on wasm and win32 (and cross) due to build problem.
* [Coop] Convert ves_icall_System_Runtime_InteropServices_Marshal_IsComObject.
* [Coop] cominterop and marshalling partial conversion and cleanup.
* Some refinement/correction/commenting to mono_string_to_utf8str_handle.
* Fix index out of bounds.
* Fix error handling.
* Remove some mono_error_set_pending_exception.
* Fix icall interface -- string vs. ptr/len.
* tweaks
* Restore the corlib interface, and maybe address the apidiff gate.
* cleanup
* Fix PtrToStructure GC assertion failure tests/marshal2 interpreter.
* Fix merge.
* Revert "Restore the corlib interface, and maybe address the apidiff gate."
This reverts commit ca8456a05f75f0fc05f6559e2f075e18a455a362.
* Try harder to support fixed in array copying.
* Allow for overlap.
* Put mono_ in front of type and fix Windows.
* Fix small problems on Windows build.
* Fix Windows and support larger data.
* [arm64] Make OP_CHECK_THIS read only a byte, to prevent unaligned access errors.
* Bump corlib higher.
* Merge with https://github.com/mono/mono/pull/9430/files.
* Bump API snapshot submodule
* cominterop_get_interface(gboolean throw_exception) throw_exception is always true.
* Remove unused cominterop_get_hresult_for_exception.
* Guids are constant.
* Replace g_assert (mono_error_ok (error)) with mono_error_assert_ok (error).
* Move function name to start of line for grep ^foo.
* PR feedback: g_assert(ex)
* Cleanup cominterop_get_interface -- single point of exit, more canonical non-coop form,
assert error indicator equivalence.
* Cleanup cominterop_get_interface_checked: early return and assert equivalent error indicators.
* Combine two versions of mono_cominterop_init.
* g_new0 instead of g_new+memset
* Remove obviously redundantly error_init.
* Inline cominterop_get_idispatch_for_object into its only caller ves_icall_System_Runtime_InteropServices_Marshal_GetIDispatchForObjectInternal,
and make it a more coop-friendly.
* add const
* Combine forks of some functions and ifdef out more on Win32.
* Initialize with declaration.
* Use integers for sizes, not pointers.
* More asserts though redundant.
* Combine two forks of mono_marshal_safearray_set_value.
Dependency Injector
===================
* `corlib/Mono/DependencyInjector.cs`: this is corlib's entry point.
* `corlib/Mono/ISystemDependencyProvider.cs`: this interface is implemented in `System.dll`.
* `System/Mono/SystemDependencyProvider.cs`: the `System.dll` side of it.
To use this, we need to call `SystemDependencyProvider.Initialize()` during system startup on Mobile
(this is already done for Android, but still needs to be done for XI/XM).
For Desktop, this will be triggered by a few `System.dll` based APIs such as for instance `SslStream`
or `X509Certificate2` - and the corlib side can use reflection if needed.
The corlib side should use `DependencyInjector.GetSystemDependency()`.
X509Certificate - corlib side
=============================
We previously had a mechanic called `INativeCertificateHelper` (which unfortunately was not really
working as intended) to use the BTLS code (which lives in System) in corlib. This has now been
replaced to use the new dependency injector.
The actual implementation as well as all the platform conditionals have now been moved into `System.dll`
where they can take advantage of existing PAL code.
This also removes all `Mono.Security.X509` usage from the `System.Security.Cryptography.X509Certificates`
namespace (it is still used by some of the other crypto classes, so we can't remove it yet).
* `Mono/ISystemCertificateProvider.cs`: this interface is now hooked up via the new
dependency injector and replaces `INativeCertificateHelper`.
* `System.Security.Cryptography.X509Certificates/X509Helper.cs`: this file has been completely
reworked and is now just a tiny stub around `ISystemCertificateProvider` and will eventually go
away completely. The entire implementation has been moved into `System.dll`.
* `System.Security.Cryptography.X509Certificates/X509CertificateImplMono.cs`: removed, we now use
`X509Certificate2ImplMono` from System via `ISystemCertificateProvider`.
* `System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs`: moved into `System.dll`
and slightly reworked there.
* `System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs`: removed, we do not have any
platform-specific code here anymore; the new `ISystemCertificateProvider` provides this for us.
X509Certificate - System side
=============================
The actual implementation as well as all the platform-specific code now lives in `System.dll`.
* `Mono/SystemCertificateProvider.cs`: the `System.dll` implementation of `ISystemCertificateProvider`.
We do the platform / TLS Provider checks in here, then construct a custom PAL class.
* `Mono/X509Pal.cs`: New internal static class.
* `Mono/X509PalImpl.cs`: New abstract internal class. It contains some common code, including the
fallback implementation.
* `Mono/X509PalImpl.Mono.cs`: Fallback PAL, used by platforms without SslStream / MonoTlsProvider.
* `Mono.Btls/X509PalImpl.Btls.cs`: BTLS implementation.
* `Mono.AppleTls/X509PalImpl.Apple.cs`: We are using the `MONO_FEATURE_APPLE_X509` conditional in
here, so it can be used without the actual Apple TLS code.
* `Mono.AppleTls/X509CertificateImplApple.cs`: moved here from corlib.
* `Mono.AppleTls/*.cs`: Use the `X509CertificateImplApple(IntPtr)` constructor everywhere instead of
`X509Certificate(IntPtr)` to make sure we are using the "correct" PAL.
* [System]: Fix `mono_btls_x509_get_public_key()` implementation.
* Copy corlib's `X509CertificateTest.Certificate8` into System, call it
`Corlib_Test_Certificate8` and use `X509Certificate2`.
The test in corlib does not expose the problem because it would use the
fallback implementation.
* Use `[SetCulture ("")]` as suggested by Marek.
[coop] Fix MONO_HANDLE_TRACK_OWNER build
<!--
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
-->
Originated from PR #1283, they now pass because we're using referencesource
code for the hash algorithm classes now.
In RSAPKCS1SignatureDeformatterTest.cs we weren't testing against the
actual `badSignature` (it doesn't make a difference since the referencesource
code or .NET Framework throws NullReferenceException anyway, but is more correct).
Closes#1283
* `HashCode` is now enabled in all profiles.
* Added `RNGCryptoServiceProvider` based fallback implementation.
* Added internal `RNGCryptoServiceProvider.GetRandom(byte*,IntPtr)` overload.
* The fallback implementation is enabled by default in `corlib.dll.sources`,
platforms which provide a native implementation need to add it to their
`.exclude.sources`.
[sdb] Avoid calling vm.GetThread () in the event callback, it could c…
…all into the debuggee leading to a deadlock if the thread mirror object has not been created yet.
<!--
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
-->
[interp] fullaotmixedcheck 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
-->
It is too easily trashed, e.g. by mono_thread_info_uninstall_interrupt.
See https://github.com/mono/mono/pull/9104.
See https://github.com/Unity-Technologies/mono/commit/b6f1ba89f7ab285a0990e696e78798f7cf18dafb
Which this should be an alterate fix for, as discussed in 9104.
This is a small change, but ultimately we should be able to thread
gint32 *win32error around enough, such as to eliminate the thread local on Unix.
It doesn't appear to take much. Thread locals, it turns out, are not a good mechanism.
They are sensitive to loss as addressed here. They are slower to access than regular globals
or locals. They do have the advantage of "automatic threading through a callgraph", as long
as you are very careful with their use (this PR demonstrates that problem).
As well we could/should move the GetLastError calls down one layer on Win32,
from w32file.c to w32file-win32.c.
But this change addresses only ReadFile/WriteFile.
Also remove unnecessary void** vs. void* cast.
Also combine Unix mono_w32file_read and mono_w32file_write.
[mini] make interp work with AOT image generated with aot=interp
[aot-compiler] use mono_aot_mode_is_interp instead of directly using the flag
---------
[interp] add FULL_AOT flags to AOT image when `--aot=interp` is used
fixes regression from 67e995c6e2
---------
partial forward port of https://github.com/mono/mono/pull/9266
needs backporting to `2018-06`
* Fix unit tests to use SERIALNUMBER instead of OID.2.5.4.5 in X.500 names. Modify the code to pass the tests.
* Add SERIALNUMBER for BTLS implementation.
* Fix one more place where SERIALNUMBER was not handled.
[interp] Optimise allocation path
Speeds up allocation by 30-40%
<!--
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
-->
As part of #7589
- CoreFX import only for Windows platform (no support for non-Windows platforms, see https://github.com/dotnet/corefx/issues/22510)
- left Mono managed implementation for non-Windows platforms
- removed DataProtectionScope parameter value check (no such a check in CoreFX and NET Framework, see https://github.com/dotnet/corefx/pull/30726) and couple of related unit tests
- added CoreFX xunit tests
When implementing Windows x64 valuetype ABI mono’s SIMD optimization didn’t
handle the case when passed arguments uses ArgValuetypeAddrInIReg/
ArgValuetypeAddrOnStack so optimization was disabled on Windows x64.
This commit fixes mono SIMD support for ABI’s passing value types using
ArgValuetypeAddrInIReg/ArgValuetypeAddrOnStack on Windows x64. It does this
as part of regular value type decomposition, including a pass decomposing SIMD
intrinsic ending up as arguments of type OP_ARG into correct load/store of the
value type reference before argument can be used by SIMD instructions.
All JIT and full AOT regression tests pass with enabled SIMD optimization
on Windows x64. Running this optimization on some vector intensive applications
showed some great performance increase. Just running this on basic-simd.exe
regression shows:
Elapsed time: 0.040471 secs (no optimizations at all)
Elapsed time: 0.015756 secs (only simd and intrins optimization)
So in this small, isolated test, the optimization indicates a 2.5x performance increase.
* [runtime] Map memory used by code managers with MAP_JIT on osx.
* [runtime] Use MAP_JIT only on osx mojave and later, it seems to cause crashes on earlier versions.
* [runtime] Add a constant for darwin 18.
* [runtime] Fix the race in get_darwin_version ().
* Fix indentation.
When doing full AOT of System.dll on Windows and other platforms building
runtime without HOST_DARWIN or HOST_BSD we will get an ugly error,
but compilation will still succeed leaving the user confused around the result.
The following error is printed:
--------------------------------------
cant resolve internal call to
"System.Net.NetworkInformation.MacOsIPInterfaceProperties::ParseRouteInfo_internal"
(tested without signature also)
Your mono runtime and class libraries are out of sync.
The out of sync library is: C:\github\mono\msvc\build\fullaot\winaot\system.dll
When you update one from git you need to update, compile and install
the other too.
Do not report this as a bug unless you're sure you have updated correctly:
you probably have a broken mono install.
If you see other errors or faults after this message they are probably related
and you need to fix your mono install first.
cant resolve internal call to
"System.Net.NetworkInformation.MacOsIPInterfaceProperties::ParseRouteInfo_internal"
(tested without signature also)
Your mono runtime and class libraries are out of sync.
The out of sync library is: C:\github\mono\msvc\build\fullaot\winaot\system.dll
When you update one from git you need to update, compile and install
the other too.
Do not report this as a bug unless you're sure you have updated correctly:
you probably have a broken mono install.
If you see other errors or faults after this message they are probably related
and you need to fix your mono install first.
--------------------------------------
The problem is that MacOs/BSD specific NetworkInformation classes are build into
System.dll on all platforms. One way to solve this is to start splitting the different
platforms specific implementations into different source files so we could start to
include/exclude sources per platform and profile in a nicer way instead of just
ifdef:ing inside current source files. This strategy also matches how corefx have
structured their NetworkInformation sources making it easier in the future to bring
mono’s NetworkInformation implementation closer to corefx. This PR implements this strategy.
Due to the fact that we don’t have platform specific configs for all profiles
(like basic and build) we can’t exclude all platform specific sources from
common.sources in System and move them to platform specific profiles. Ones we
have that full capability we could drop the #if WIN_PLATFORM in all the Win32*
files and exclude them from common.sources and only include them in the corresponding
win32 specific profiles. The same strategy could then be applied for other platform
specific profiles as well.
For Windows specific profiles, like win32_net_4_x_System.dll and winaot_System.dll we
use the .exclude.sources to remove the unix/linux/macos NetworkInformation sources,
so with this commit we will get a System.dll that only includes the Win32 specific
NetworkInformation classes and none of the unix/linux/macos, this will make sure the
compile error during full AOT won’t happen since there is no classes left including
the icall not available on a Windows mono runtime.
Other platforms will have the same classes in System.dll as before for now
but the source code is now structured making it possible to include/exclude platform
specific source files for other platforms as well, when needed.
The previous system was a nice prototype, but it ran into the problem of
taking a global lock on every thread doing logging. A fully lockless
implementation of a data structure with so much state would have been
madness to debug, and I really didn't want to spend much time in the future
debugging this.
What I did is to make a thread that reads from a lockless queue and logs the
message from the queue.
Most of the rest of this code is to address the fact that hazard
pointers depend on state that is initialized after logging is expected
to come up.
[checked-build] don't collect state transition backtraces on abort_blocking
for the same reason as the other cases in this function - if we're in `RUNNING`
or `ASYNC_SUSPEND_REQUESTED` under hybrid suspend we're supposed to cooperatively
suspend. If we call `backtrace()`, we might block waiting for the low-level
dynamic linker mutex on Linux which may be held by a thread that was
preemptively-suspended already.
Returns a text description of the suspend policy currently in effect.
Also combine logic that probes for suspend policy defines and environment
variables into a single function that returns an enum value; use that to drive
the individual boolean predicate functions.
The policy is subject to configure flags from when mono was built, and the
assorted environment variables at runtime:
MONO_ENABLE_COOPERATIVE_SUSPEND
MONO_ENABLE_COOP
MONO_ENABLE_HYBRID_SUSPEND
(the second one is a backward-compatible alias for the first)
The logic is:
If coop xor hybrid is enabled by configure flags, always return that policy.
Otherwise if coop and hybrid env vars are set simultaneously, it's an error.
Otherwise if MONO_ENABLE_COOP or MONO_ENABLE_COOPERATIVE_SUSPEND is set use full coop.
Otherwise if MONO_ENABLE_HYBRID_SUSPEND is set use hybrid.
Otherwise use full preemptive suspend.
[mini] respect additional flags when caching runtime invoke wrappers
depending on `virtual_` and `need_direct_wrapper` we generate slightly
different IL. The interpreter always set `need_direct_wrapper`, but the
JIT doesn't, so this gets problemantic with mixed mode. We need to be
careful when we cache those results.
This bug has been lurking for four years, being introduced in commit
5b2bb8c901. BYTE_ORDER != G_BYTE_ORDER.
Not throughly tested, but System.Decimal from csharp seems to return
sane results again. (related: is z or AIX CI available for PR checks?
if not, what test suite is System.Decimal under?)
Also remove my shoddy workaround from a few months ago, it got the
BCL building, but was incorrect.
* [sdb] Add a AssemblyMirror.GetMetadata () method to read the metadata from the debuggee, make AssemblyMirror.Metadata return it, or null if its not set/read yet.
Fixes a regression introduced by b26a41cc3e. Parts of Mono.Debugger.Soft would check
AssemblyMirror.Metadata against null, and that would throw an exception when the debuggee was using an older protocol version.
* Bump API snapshot submodule
This PR prepares the upcoming removal of the Legacy TLS Provider.
- The internal (and soon-to-be-removed) class `MD5SHA1` has been moved and changed namespace.
- `Novell.Directory.Ldap.Connection` now uses `SslStream` instead of Legacy TLS, this ports the Novell Ldap library to use TLS 1.2, see #9363.
- Removed obsolete Ssl/Spnego authentication from `System.ServiceModel`.
- Removed duplicate copy of the Legacy TLS Provider from `System.ServiceModel`.
- Ported `System.Web.Mail.SmtpClient` to use `SslStream`.
- Removed the `Mono.Security.Protocol.Tls` documentation.
* Functions at start of lines for grep ^foo.
* [Coop] Convert System.Security.Cryptography.RNGCryptoServiceProvider.
* Remove 'count' in more places in favor of inc/dec buffer/size.
Guard all loops with while (size > 0).
Don't pretend that sizeof int32/16/8 is other than 4/2/1.
assert instead of loop forever of degenerate systems with small RAND_MAX and
without better random.
* [Coop] Some conversion of custom-attrs.c. (#9309)
* Add comment explaining mono_array_addr_with_size_fast vs. mono_array_addr_with_size.
* Have mono_array_addr_with_size reuse mono_array_addr_with_size_fast.
* split create_custom_attr_data into self and create_custom_attr_data_into_array, to avoid handle creation in loop (like alloca in loop)
Note there is a subtle semantic change here, in that previously
when invoke failed, we'd still store into the array.
The caller checks the error and throws out the data so it should be ok,
the same in the end.
* Combine mono_cominterop_get_com_interface and ves_icall_System_Runtime_InteropServices_Marshal_GetIUnknownForObjectInternal which are nearly identical.
* Fix disabled COM.
* Replace unformative and possibly dangerous g_assert_not_reached with safer more informative g_assertf.
Fix many warnings like: icall.c:666:2: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
Most uses of mono_error_set_argument do not take a format string.
So rename mono_error_set_argument to mono_error_set_argument_format
and provide mono_error_set_argument that just takes one string, not to be formated.
Visit every call to mono_error_set_argument and change just a few to be mono_error_set_argument_format.
While there, notice that method_encode_code forms up extra data and does not use it.
* [debug] mono_pmip shouldn't assume it's called from an attached thread
`mono_pmip` calls `get_method_from_ip` which needs to make a string with the
name of a method. It used to call `mono_method_full_name` which is a `MONO_API`
function and so tries to switch to GC Unsafe mode (which requires the thread to
be attached).
However `mono_pmip` is often used from GDB/LLDB and it might be invoked by the
developer from a stopped thread that isn't currently attached which would assert.
Instead call `mono_method_get_name_full` in `get_method_from_ip` which doesn't
switch the thread state.
* [coop] mono_coop_cond_signal and mono_coop_cond_broadcast should switch to GC Safe
Under Linux/glibc `pthread_cond_signal` and `pthread_cond_broadcast` can block
on a futex in `__cond_quiesce_and_switch_g1`, so switch the thread to GC Safe
mode around the blocking operation.
* [coop] ves_icall_System_Threading_WaitHandle_SignalAndWait_Internal shouldn't swith to GC Safe
On Win32, still do the thread state change here; on other platforms
its handled in the implementation of mono_w32handle_signal_and_wait
Add support for platform customization of native crash info output.
Add support to replace implementation of a post native crash handler behavior
if needed (used on none desktop Windows platforms).
NOTE, currently alternative implementations are in separate source file only
for Windows (since there was a need to implement in sources keept in external
closed repository). All other platforms (none Windows) still uses the exact same
logic still located in the same source file as before.
[interp] fix scope issue regarding `klass` var
`klass` exists in the main loop, but we defined `klass` again inside the
block, so the outer `klass` never had the right value.
Fixes https://github.com/mono/mono/issues/9023
* Update genproj makefile to include gensources
Update genproj argument parser to be more generous about displaying help
* Checkpoint
* Checkpoint
* Checkpoint
* Checkpoint
* Checkpoint
* Checkpoint
* Checkpoint
* Checkpoint
* Fix rebase issue
* Checkpoint
* Checkpoint
* Fix built sources only being added to one profile
* Fix typo
* Checkpoint
* Fix indentation
* Use csc instead of mcs
* Checkpoint
* Fix BUILT_SOURCES only being handled for the first profile processed
* Checkpoint
* Checkpoint
* Strip double slashes from paths to fix spurious csproj change
* Checkpoint
* Checkpoint
* Checkpoint
* Checkpoint: Fix genproj compilation
* Checkpoint
* Checkpoint
* Checkpoint
* Fix crash when no targets were loaded (due to an error)
* Checkpoint
* Checkpoint
* Checkpoint
* Fix TryParseTargetInto bug
* Checkpoint
* Shuffle exclude logic around so that it works correctly during genproj diffing
* Remove gensources tracing
* Checkpoint
* Fix handling of oddball sources paths from executable.make
* Fix jay not being set to build
* Fix wrong slashes being used for embedded resource paths
* [csproj] Update project files
We had a problem with order of operations before. Makefile.am.in is
interpolated twice in the standard build. The first time happens when
autoconf runs. The second time happens when we enter the mono/mini directory
and execute our build. In the refresh, we lose our AM_CONDITIONAL conditionals
defined that aren't also AC_DEFINE variables on linux.
That's what it's vital to define all variables in all namespaces to have maintainable
automake code.
Furthermore, some of the CFLAGS logic we defined is designed for older LLVM copies, as
it includes some flags like O3 and Wall that we don't want.
In order to not get hacky with this, I moved the logic for using llvm-config into
a bash file in /llvm that creates a makefile fragment. The logic says that this fragment
should be null on calling autoconf, and then will be instantiated after we build llvm.
This fixes the build on Linux. We can expect bash behavior to be more consistent between
OSX and Linux than we can with automake too. I think this is a reorg with good long-time
maintainability.
* Use System.Security.Cryptography.Oid* from CoreFX.
* [csproj] Update project files
* Add CoreFX unit tests.
* Add obsolete S/MIME OID to make the Oid CoreFX tests pass on non-Mac systems.
* Enable Windows specific implementation of OidLookup.
* [sdks] Only rebuild MXE when it doesn't exist, not when we just cloned the sources
* [sdks] Default to ~/android-toolchain and ~/android-archives to better share with XA
Current DYNCALL on AMD64 didn’t handle scenario when spilling parameters from
registers to stack and that parameter was of type float/double. It then incorrectly
updated the floating-point register slot, but should have written it into the general
stack slot, making sure it will be correctly placed on callers stack in correct slot.
Current DYNCALL implementation didn’t handle the Windows x64 ABI when hitting a scenario
when spilling a valuetype into stack, it currently only supported the regular ArgOnStack
storage type, but Windows x64 will use ArgValuetypeAddrOnStack storage type.
There was also an additional issue with the number of stack slots allocated since it used
the stack argument offset instead of number of slots represented by the offset
(as used in later calculations). This caused to much stack space to be allocated and copied
(but things still worked as expected).
Commit also include a number of new test in aot-tests.exe mini regression test hitting above
issues.
* Modernize Windows random number generation.
- Less code.
- Less chance for failure.
- Not seedable.
- Requires Windows 7 or newer -- er, require Vista or newer until/unless Unity drops it, under ifdef.
This might get much further pruned with CoreFX import, which is on hold here, and doesn't really change much, except to indeed drop Vista support. (https://github.com/mono/mono/pull/9249)
After fixes issues in DYNCALL Windows x64 ABI all aot-tests.exe previously
excluded using !FULLAOT-AMD64 can now be reenabled since outstanding issues
have been fixed. There is one new test still failing on Windows x64,
test_42_arm64_dyncall_vtypebyval, that is now excluded until investigated
and fixed.
Correctly handle use cases when parameter storage is ArgValuetypeAddInIReg
or ArgValuetypeAddrOnStack. This is used for value types not fitting into
registers on Windows x64.
The Winx64 calling convention handles parameters in a way that was not
correctly implemented in some DYNCALL use cases. When using a method signature
like this (double, int, double), the Winx64 ABI dictates that the first parameter
goes into first floating point parameter register (XMM0), second parameter goes into
second general register (RDX) and third floating point goes into third floating point
parameter register (XMM2). So above call should use registers XMM0, RDX and XMM2,
but current DYNCALL implementation will just use next floating-point register,
like XMM0, RDX and XMM1 and this will load wrong parameter registers as expected by callee.
For an example https://msdn.microsoft.com/en-us/library/zthk2dkh.aspx#Anchor_2
Fix makes sure mono_arch_start_dyn_call uses the already evaluated registry information
for floating point parameters. Currently it assumes floating point registers are assigned
in a linear fashion and that works for System V ABI, but not for Winx64’s ABI.
Commit also adds a couple of tests into ao-test.cs that works with mixed signatures
together with DYNCALL.
* [wasm] Add helper target to update the runtimes.
* [wasm] Reenable tests that previously crashed due to JS engine issues.
* [wasm] Update jsvu 1.3.1 so we get jsc on linux. Fix uname magic on OSX.
Omitting positional parameters works for gdb linked to python 2.7 / 3.1+. On older systems (e.g. redhat 6, centos 6) gdb might be linked to python 2.4-2.6 or 3.0, adding parameter ordinals enables proper backtraces on those systems.
Fixes#9292.
* [System]: `HttpWebRequest` now throws `WebExceptionStatus.RequestCanceled` on abort. #9031.
Cleanup the internal `HttpWebRequest.RunWithTimeout()` function and use
`GetWebException()` everywhere to throw `WebException` with
`WebExceptionStatus.RequestCanceled` on abort.
New tests for this will be added to the web-tests by extending the existing
`Xamarin.WebTests.HttpInstrumentationTests.AbortDuringHandshake` to check the
synchronous and begin/end async APIs as well, using both `GET` and `POST`.
See https://github.com/xamarin/web-tests/blob/master/Xamarin.WebTests.Tests/Xamarin.WebTests.HttpInstrumentationTests/AbortDuringHandshake.cs.
Fixes#9031.
* Fix exception checks, setting `TransferEncoding` without `SendChunked` is supposed to throw `InvalidOperationException`.
* [System]: Renegotiation in AppleTls requires OS X 10.12+.
* Make renegotiation version check conditional to `!MONOTOUCH`.
The rest of the renegotiation code is currently conditional to `!MONOTOUCH`
as well, we might want to eventually revisit this at some point.
Fixes#9234
Had additional restructure not been ok, at least typedefing the function pointer
would have helped.
Add const for efficiency -- make the copy-on-write faults count for more and
not take extra readonly data with them.
Remove unused and actually confusing parameter -- it is just zeroed memory
and almost cannot be used for anything (granted, could hash it).
* [sgen] Use longs with nursery array fill
Objects are 8 byte aligned. This enables us to support nurseries of up to 32GB.
* [sgen] Add explicit limit to nursery size
* g_string_insert does not update string->len, and copies the wrong number of characters around,
and does not allow for overlapping parameters,
and is not used -- remove it.
g_string_erase does not always update string->len,
and is not used -- remove it.
g_string_prepend does not update string->len.
Switch the only use to append in the reverse order, and fix a leak.
[runtime] Fix debugger dumping when unused
Somewhere in the daily rebasing to edit the PR, I lost the correct version of the early-exit. This fixes our native crash when we did not use the debugger. It's important to merge, or we'll crash before MERP/gdb dumping happens.
Using dynamic symbol resolve (LoadLibrary/GetProcAddress) for all unwind info related registration functions enables
building the same code on all Windows platforms where JIT is build and included.
There are Windows platforms (like UWP) that doesn't support getenv. The implementation
of g_getenv makes it possible to replace the implementation at build time on
none desktop platforms.
The throwing of the pending exception after the finally blocks are executed was in unreachable code.
Refactor the code a bit and exit the abort protected block directly in endfinally. We throw the abort after all guarding finally blocks were invoked, to avoid throwing from inside a finally block. Guard also fault handler, which are called from EH.
* [runtime] Implement tombstone scrubbing for our concurrent hashtables.
Tombstones must be scrubbed as they can end up taking up all space of a hashtable and make lookup fail.
* [runtime] Added regression stress test for #9176
This test triggers insertion and removal from runtime_invoke_hash to the point
that if there's no scrubbing it will cause a deadlock.
* [runtime] Disable new test under full-aot as it uses SRE.
The callback consists in `mono_thread_info_abort_socket_syscall_for_close` which itself calls `mono_threads_suspend_abort_syscall`. The problem with the previously existing interrupt callback is that, even if `mono_threads_suspend_abort_syscall` is called by the thread suspend mechanism, it would still call `mono_thread_info_abort_socket_syscall_for_close` which would duplicate the call to `mono_threads_suspend_abort_syscall`
* Helper scripts running mini regression tests in JIT/Full AOT on Windows.
A set of helper scripts running all mini regression tests, supporting both
JIT and full AOT (including building full AOT assemblies) using local build
Visual Studio mono runtime (can be switched in setp.env.bat). Includes logic
to pick correct Visual Studio toolchain and support to setup command prompt
targeting x64 full AOT build and running tests. NOTE, the scripts are not limited
to the mini regression tests, only includes a set of predefined assemblies making
it easier to execute regression tests.
Full AOT scripts includes capabilities to build dynamic library, static linked objects
or assembler output, it also supports switches to use LLVM when building full AOT
assemblies if supported by local build mono runtime.
By default, scripts follow default build configurations used by mono BCL builds and
Visual Studio x64 Release build mono runtime.
Examples to run all JIT regression tests:
run-jit-regression.bat all
To run individual programs using JIT (doesn’t need to be a regression test):
run-jit.bat [full path to assembly]
NOTE, for regression tests there is a shortcut making them easier to locate,
so then just the assembly name can be used, not the full path is needed.
run-jit.bat basic.exe
Examples to build all regression tests using full AOT:
build-full-aot-regression-tests.bat all
Builds all regression tests in full AOT including all needed support and
BCL assemblies. All build assemblies will end up in msvc\build\fullaot\winaot
folder by default. It is possible to build individual assemblies as well using:
build-full-aot-regression-tests.bat [full path to assembly]
NOTE, for regression tests there is a shortcut making them easier to locate,
so then just the assembly name can be used, not the full path is needed.
build-full-aot-regression-tests.bat basic.exe
Examples to run all regression tests using full AOT:
run-full-aot-regression-tests.bat all
Runs all regression tests in full AOT. It is possible to run individual assemblies
as well using:
run-full-aot-regression-tests.bat [full path to assembly]
NOTE, for regression tests there is a shortcut making them easier to locate,
so then just the assembly name can be used, not the full path is needed.
run-full-aot-regression-tests.bat basic.exe
There are some more features included in the scripts as well, but above shows
basic usage. It could also be possible to reuse the scripts in Visual Studio
build targets going forward to at least run the JIT regression tests
as part of Visual Studio build.
* Fixed some review feedback.
* Switching to 1 instead of -1 in case of errors.
* Used case insensetiv compare for some if's.
* Dropped use of ECHO OFF/ON in nested scripts.
* Removed clear of PATH (was not intended).
* [mini] Implement delegate tramp info using gsharing context.
* [mini] Remove duplicate patch type.
* expand a FIXME to include what needs fixing.
* [mini] Copy MonoDelegate::method from the delegate tramp info instead of emiting a rgctx fetch. This is 6% faster on a delegate microbenchmark.
* Fix Process.ProcessName on AIX
AIX has a procfs with raw structures congruent with Solaris. For i,
which lacks procfs, fall back to a libc call.
This doesn't solve the Process weirdness that bungs up the test
suite, but I hope it's a start.
* Bye bye, annoying AIX setschedparam warning
AIX (but weirdly, not i) complains every time you do this. Squelch
the warning on AIX and avoid line noise.
* Remove more assumptions of /proc on AIX
* should probably always use getprocs64 for w32process,
but looks like we could just use proclib on the fallback?
* there's some more cases relating to resource usage stat,
will have to investigate those cases further
* Basic process modules support on AIX (but not i)
Not aware of a PASE compatible API, but this will work on AIX. Not
sure about .ModuleName versus .FileName, but it seems to fill it in...
The gensources.cs currently checked in to master doesn't fail on missing files by default because it didn't work at the time. This turns that behavior on. It is currently only in my other in-progress branch so I'm moving it here.
Fixes#9232
* Enable failing on missing files in gensources
* Copy over the missing file checks from genproj2
* Trim whitespace off file names from sources files
* Strip double slashes from paths to fix spurious csproj change
Previously we called it only if gdb was enabled, and we called it after
we invoked handlers asynchronously, in ways that could eat our session
state. By moving it higher up, we can increase the numbder environments in which
debugger crashes are logged, and log them even in the case when
telemetry dumping kills the runtime quickly.
* [runtime] MONO_API mono_assembly_get_object needs GC Unsafe
* [runtime] MONO_API mono_array_length needs GC Unsafe
* [runtime] Make MONO_API mono_reflection_load_from_full external only
Also mono_reflection_load_from ()
Also make them both transition to GC Unsafe
* [runtime] Make MONO_API mono_assembly_load_full external only
And make it transition to GC Unsafe
* [runtime] Make MONO_API mono_assembly_loaded external only
Runtime should use mono_assembly_loaded_full.
Make mono_assembly_load transition to GC Unsafe
* [runtime] MONO_API mono_assembly_open needs GC Unsafe
Also mono_assembly_open_full
* [runtime] MONO_API mono_check_corlib_version needs GC Unsafe
* [runtime] MONO_API mono_class_enum_basetype needs GC Unsafe
* [runtime] MONO_API mono_value_box needs GC Unsafe
* [runtime] Make mono_type_get_object external only
Runtime should use mono_type_get_object_checked or mono_type_get_object_handle
* [runtime] MONO_API mono_string_to_utf8 needs GC Unsafe
* [runtime] MONO_API mono_raise_exception needs GC Unsafe
* [runtime] Make mono_reflection_type_get_type external only
Also make it use GC Unsafe.
Runtime should use mono_reflection_type_get_handle
* [runtime] MONO_API mono_object_new needs GC Unsafe
* [runtime] MONO_API mono_domain_assembly_open needs GC Unsafe
* [runtime] MONO_API mono_method_get_object needs GC Unsafe
* [runtime] MONO_API mono_method_full_name needs GC Unsafe
* [runtime] MONO_API mono_method_signature needs GC Unsafe
* [runtime] MONO_API mono_thread_create needs GC Unsafe
* [runtime] MONO_API mono_field_get_type needs GC Unsafe
* [runtime] MONO_API mono_field_get_value needs GC Unsafe
* [runtime] MONO_API mono_field_set_value needs GC Unsafe
* [runtime] Mark mono_image_open_from_data_with_name external only
Runtime should use mono_image_open_from_data_internal
* [runtime] MONO_API mono_image_open_from_data_with_name needs GC Unsafe
* [runtime] MONO_API mono_field_static_set_value needs GC Unsafe
* [runtime] MONO_API mono_property_set_value needs GC Unsafe
* [runtime] Make MONO_API mono_assembly_load_with_partial_name external only
Runtime should use mono_assembly_load_with_partial_name_internal.
Make mono_assembly_load_with_partial_name transition to GC Unsafe
* [profiler] Log whenever the profiler library fails to load
* [test] Fixup return type of mono_gc_toggleref_add
* [sgen] Don't pin obj in test_toggleref_callback under coop
Don't call mono_field_get_value which under coop will perform a thread state transition to GC Unsafe and that may include copying the stack data which will pin the toggle object and subsequently make the toggleref test fail. Call mono_field_get_value_internal which assumes we're already in GC Unsafe mode.
Uses mono LLVM master branch, build using cmake and VisualStudio 2015/2017.
Commit adds support for AOT/Full AOT LLVM codegen for Windows x64 Visual Studio
build mono runtime. Normal configure/make using cygwin won’t support LLVM and will
trigger an error if configured.
In order to build using LLVM first mono LLVM master branch must be build using
static linked LLVM configuration (dynamic loading can be added later),
NOTE mono LLVM build needs to include the following commit,
https://github.com/mono/llvm/commit/9b92b4b87607e137266f84dc307181b8842fe54a
in order to successfully build on Windows x64.
Build mono LLVM branch using the following cmake configuration:
-DCMAKE_BUILD_TYPE=Release
-DLLVM_ENABLE_ZLIB=OFF
-DLLVM_TARGETS_TO_BUILD="X86"
-DCMAKE_CROSSCOMPILING=False
-DCMAKE_SYSTEM_NAME=Windows
Use cmake with -G "Visual Studio 14 2015 Win64" to generate VS 2015 x64
targets. NOTE, if mono runtime is build using VS 2017, then LLVM should
be build using the same VS version using -G "Visual Studio 15 2017 Win64"
To enable LLVM build in mono.sln, set MONO_ENABLE_LLVM to “true” and make
sure MONO_LLVM_INSTALL_DIR_PREFIX points to the install directory used in
LLVM build above, default msvc/dist/llvm. Above LLVM properties can also
be set if build using msbuild.
A sample LLVM configure script has been included in msvc/llvm-cmake-config.bat.
* [typesafe coop] Go through generated token-pasted helpers
instead of casting function pointers. This should be safer and
not trigger quashed gcc warning and I had hoped it would
work with WebAssembly, but seemingly not.
Add MONO_TYPEOF_CAST to avoid repitition.
Here we have a structured log and a richer "model" of states.
This serves to be a 10-foot view of the debugger. The debugger
has a lot of layers of abstractions, and lots of intermingled
bookkeeping.
This debugger log serves to be a summary of the state of the debugger
as a whole, and our ringbuffer of recent events helps put the debugger
state into context.
It also allows us to easily identify, for instance when we resume
a new thread versus a suspended thread. We can see single-stepping
through the breakpoints added, removed, and hit. Lastly, we have a view
of how commands and events are totally ordered over the TCP socket,
helping the server to understand what the client has seen and in which
order.
Previously one had to include the proper types for this header in
the file including this header, before this header is included. Rather
than put irrelevant includes in other files, I'm adding includes here so
this file brings in its own dependencies.
* Make coop handles typesafe.
Type-safe handles are a struct with a pointer to pointer.
The only operations allowed on them are the functions/macros in handle.h, and assignment
from same handle type to same handle type (which cannot be prohibited in C, but is ok here anyway.)
Type-unsafe handles are a pointer to a struct with a pointer.
This is a leakier abstraction and besides the type-safe operations, also allows:
1. compared to NULL, instead of only MONO_HANDLE_IS_NULL
2. assigned from NULL, instead of only a handle
3. MONO_HANDLE_NEW (T) from anything, instead of only a T*
4. MONO_HANDLE_CAST from anything, instead of only another handle type
5. assigned from any void*, at least in C
6. Cast from any handle type to any handle type, without using MONO_HANDLE_CAST.
7. Cast from any handle type to any pointer type and vice versa, such as incorrect unboxing.
8. mono_object_class (handle), instead of mono_handle_class.
None of those operations were likely intended and some are crashing sort of bugs, esp.
the last two. See https://github.com/mono/mono/pull/9188 for the last two. The rest all occur also but are not necessarily harmful. Raw(NULL_HANDLE) and IsNull(NULL_HANDLE) were both access violations, so NULL just as well. MONO_HANDLE_CAST is still pretty liberal in what it allows.
NULL_HANDLE has been brought into question and this will allow grepping for it instead of the plainer NULL (i.e. returning them as handles).
The interaction of these handles with JITed code depends on the ABI to pass/return a struct
with a pointer the same as a pointer. Marshalling assumes this.
There might be some OS/CPU ABIs that do not support this.
CI suggests it is broadly but not 100% viable (disabled for non-Mac non-Windows x86, but enabled for arm, arm64, amd64, Mac/x86, Windows/x86).
* Typesafe handles enforcement brings with it a little more pointer enforcement, mostly around const and volatile. Repair a bit, and disable temporary for Windows.
* Fix MONO_HANDLE_IS_NULL (NULL_HANDLE) to not null dereference.
* Fix MONO_HANDLE_RAW(NULL_HANDLE) to not null dereference.
This depends on a gcc/clang extension, and a Visual C++ (C) quirk.
Otherwise we have to chose double evaluation, or C++, or assignment or cast from void* to temporary (possibly passing more types to more macros).
Another choice is a runtime assert, and double evaluation or not.
Asserts seen can be covered up by first checking MONO_HANDLE_IS_NULL, which will not null dereference nor assert.
Prior to making RAW(NULL) not null derefence, fixing code of the form:
```gboolean is_null_handle = handle && MONO_HANDLE_IS_NULL(handle)```
to be
```gboolean is_null_handle = MONO_HANDLE_IS_NULL(handle)```
while working on this change led to failures.
* Add gcc -Werror=incompatible-pointer-types to catch some handle type mismatches.
This has slight collateral damage on other code, mostly around const and volatile, mostly in Android-specific code. Disabled for Windows/gcc at first.
* Change mono_icall_handle_new_interior to return gpointer instead of MonoObjectHandle. It isn't returning a handle and making the non-handle typesafe is unnecessary/incorrect.
Likewise change mono_handle_new_interior to return gpointer instead of MonoRawHandle (same thing).
gpointer* is more correct, gpointer is more opaque; unclear which is preferred here.
gpointer makes this a smaller semantic change, as MonoRawHandle was already equivalent, just a rename.
* Move NULL_HANDLE, NULL_HANDLE_STRING, NULL_HANDLE_ARRAY so they are near the comment that refers to all of them.
* Remove mono_handle_new_full prototype, the function does not exist.
* Remove unnecessary casts.
* Remove unused MONO_HANDLE_INIT.
* Add an assert to handle_assign.
* A refinement of this change should enable WebAssembly and skirt underlying safety less. WebAssembly does not allow the function pointer casts used here.
Try to catch situations leading to a segv in mono_domain_assembly_search by
checking that we never put NULL into domain_assemblies and that callers of
mono_assembly_names_equal_flags never pass NULL args to it.
* [coop] Use coop mutex
ldstr_section can be taken during jit compilation.
* [runtime] Switch to non recursive mutex
ldstr_section only guards hashtable accesses.
* Import System.Security.Cryptography.Pkcs from CoreFX.
* Change 'as' operator to a cast.
* Add missing EnvelopedCms overloads.
* Include CMS signing classes in all builds.
* [csproj] Update project files
* Add missing DSACertificateExtensions class.
* Update references.
* Rename EnvelopedCms.Overloads.cs to EnvelopedCms.cs.
* Enable some of the System.Security.Cryptography.Pkcs xunit tests.
* Update references.
* Bump API snapshot submodule
* Disable xunit tests that may depend on Windows PAL.
Contributes to https://github.com/mono/mono/issues/7589
One unit test is removed as part of the commit because it is not consistent with documentation and CoreFX behaviour on non-Windows platforms (https://github.com/dotnet/corefx/issues/30416).
The main goal of this patch is to actually get meaningful error messages when constructing X509Certificate2 from a byte array. Previously PKCS#12/PFX certificate import could fail due to unimplemented features (such as ECDsa support) or bugs. The certificate import would then be retried as PKCS#7 and the original error message was lost.
* Fix some handle type violations.
* MONO_HANDLE_CAST (MonoArray, NULL_HANDLE)
is fragile and deprecated except in optimized hot paths,
prefer NEW instead. NULL_HANDLE is const and cannot be assigned to,
NEW is not const and can be assigned to. It takes extra validation
to insure NULL_HANDLE is correct, and it is usually not worthwhile.
Brings in https://github.com/mono/bockbuild/pull/67.
This fixes the msbuild build problem where it'd crash with `error MSB4242: The SDK resolver "NuGetSdkResolver" failed to run. Unexpected failure reading NuGet.Config. Path: '@/external/bockbuild/builds/msbuild-15/artifacts/toolset/restore.proj/$HOME/.config/NuGet/NuGet.Config'.`.
The reason is that bockbuild exported the `XDG_CONFIG_HOME` environment variable with the value `$HOME/.config`. The problem is that the `$HOME` in there is never expanded so it just stays as the literal value.
`XDG_CONFIG_HOME` is later used by e.g. `Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)` which is what nuget uses to construct the path to NuGet.config - hence why we end up with the weird path.
We now just expand the variables in bockbuild before we pass them on.
Fixes https://github.com/mono/mono/issues/9179
(cherry-picked from cb54c26f6c)
Threads which do things with signals and locks may end up unresponsive
to our signals. I cannot get threads that crash in a lock to respond to
SIGTERM on Darwin even if I explicitly unmask SIGTERM on those threads.
In order to defensively program against platform bugs around signals and
stubborn threads, we need to be able to abandon these threads and
continue, dumping other threads.
[tests] reduce IO load in process-stress-3
The spawned process by the test iterates through the whole mono repo,
including submodules. On a loaded machine with a already slow I/O
device, 10 seconds could be a tight time budget. Instead of increasing
the timeout, let's try to reduce the generated output.
Fixes https://github.com/mono/mono/issues/6947 hopefully.
Ubuntu Linux (possibly others too, but only Ubuntu is tested thus the
limitation) don't need to build or use `mxe`, they instead use mingw packaged
for the distribution, thus making the build faster.
This commit detects the Linux flavor in use and, if it's Ubuntu, configures the
build so that system mingw is used instead of mxe.
Followup for 9ad5255338
Note that on win32 we already did the right thing because of nested
conditionals in mono_image_open_a_lot, but on non-win32 we need the extra
check.
[mono/mini/helpers.c:195]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[mono/mini/helpers.c:197]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
* [mcs] Rename darwin paltform to macos
Darwin is common to both macOS and iOS/tvOS/watchOS, while we use the darwin platform only for macOS.
* [mcs] Add Unix platform for other Unixes than Linux
* [mcs] Remove PLATFORMS from xammac_net_4_5 since it only make sense on macos
* [bcl] Bump corlib version
* [csproj] Update project files
Android NDK supports cmake in addition to the older make-based ndk-build as the
build system and Xamarin.Android is in the process of switching the build of its
native bits to cmake. The reason for this switch is that certain parts of
Xamarin.Android (libmonodroid) are built for both the host system and
the Android target. The host system build currently uses hand-crafted code
directly in .csproj to build the native bits while the Android build uses
ndk-build. This results in duplication of code, compiler parameters are
specified in two locations - it is easy to introduce incompatibilities, bug
fixes may be applied only in one scenario etc.
Using cmake allows us to use a single build "script" for all the targets, thus
making the build more reliable. Android SDK has a cmake package which contains
full support for NDK builds and allows us to easily use cmake across all the
supported platforms without having to install cmake on the host system.
This commit adds the cmake package to the Android SDK provisiong process and,
alas, at the same time adds a workaround to properly unpack the package. Unlike
other Android SDK packages, cmake doesn't unpack to a single subdirectory of the
zip root, instead all its files and directories are placed directly in the zip
root. This requires yet another workaround to install the package properly.
[segfault] hard crash if it is not a NRE
that is, if a `ji` is available, but the offset is too large to be a
plausible implicit null pointer.
The "upper bound" must be higher, but I don't know a good value. Any good suggestions other than "increase the value until all tests are passing"?
* [mini] Change region formation pivot from BB to EH clause.
The original BB region computation would loop all BBs and search which EH clause each of them.
EH search is implemented as a linear search, meaning performance was count(BB) * count(clauses).
Since each clause generates at least one BB, it's quadratic on the number of clauses.
Degenerate methods, with tens of thousands of EH clauses, would lead to minutes of JIT time.
New code loops over the clauses and mark all BBs covered by each of them. Given EH ranges are a much
smaller subset of all BBs, this performs significantly better. It remains possible to construct methods
that leads to degenerate compilation times, but it's less likely now.
* [mini] Bound the size of a linked list during liveness.
The `visited` linked list can grown to tens of thousands of entries with some degenerate methods.
This change uses a stack allocated array and switches to a hashtable on overflow.
* [mini] Change printf to g_print
* [mini][amd64] Limit more precise branch target optimization based on number of basic blocks.
On amd64 we update branch target data before each BB is emitted. This has quadratic behavior on number of basic blocks
and can lead to excessive compilation times in degenerate cases.
Limit the increased precision to methods with less than 800 basic blocks.
Reduces compilation time of #7809 by 88% (from 44s to 5s).
When creating dynamic methods, we put those in a queue so they can be collected later via `mono_jit_free_method ()`. the interpreter part was assuming, as soon as we allocate a dynamic method, it will be executed eventually and therefore an InterpMethod must exist in `info.interp_code_hash`, but this isn't necessarily the case.
Fixes https://github.com/mono/mono/issues/9109
We can't raise event before that as the profiler depends on too much runtime
infrastructure at this point for it to reliably work.
For example, we need the threading infrastructure to be init'd so we can access the
thread-local profiler state to store events there.
issue detected by cppcheck
[mono/metadata/threads.c:3993] -> [mono/metadata/threads.c:3991]:
(warning) Either the condition 'if(location&&location->source_file)'
is redundant or there is possible null pointer dereference: location.
condition is redundant indeed, it is nested in "if (location) {"
* [jit] Add some rules to the local propagation pass to transform iconst+sext+mul into mul_imm.
* [jit] Make OP_LDLEN more general by storing the offset of the array length field in it.
* [jit] Add span intrinsics.
* [jit] Avoid converting Span.get_Length () to OP_LDLEN, it doesn't help abcrem. Avoid asserts when running on portable spans.
* [jit] Convert Span.get_Length () to OP_LDLEN, only mark the loading of array lengths invariant.
* [uwp] UWP supports: ReplaceFile CopyFile LockFile UnlockFile GetDriveType GetComputerNameW
Some of these were already supported and identical code copied.
* Remove pre-Windows 2000 support -- use GetFileSizeEx instead of GetFileSize.
UWP does not support GetFileSize.
* Introduce fine-grained ifdefs.
This should make maintenance of Win32 subsets easier (see w32subset.h).
* Generally the code should be/stay in "classic.c" and the "uwp.c" files can/should go away. The uwp.c files were a medium-sized granularlity of reuse/replace, but the fine-grained ifdefs are better/smaller -- more code reuse.
Which involves:
`serialize_object`
`deserialize_object`
`mono_object_xdomain_representation`
and then the other users of `mono_object_xdomain_representation`:
`create_unhandled_exception_eventargs`
`call_unhandled_exception_delegate`
* [runtime] Add an 'interp_method' field to MonoDelegate.
* [runtime] Add a MONO_LD_DELEGATE_PTR jit opcode which is used to load the method ptr from a delegate, so the JIT and interpreter could have a different implementation.
* [runtime] Store the interpreter method invoked by the delegate in MonoDelegate.interp_method, make MonoDelegate.method_ptr always point to a JIT callable entry point.
* [interp] Avoid sharing pinvoke and non-pinvoke signatures in mini_get_interp_in_wrapper ().
* [interp] Fix interp_get_remoting_invoke (), it receives a interp entry trampoline as well.
* [interp] Store remoting invokes into interp_method in delegates.
* [interp] Handle compilation failures in do_jit_icall (). Handle calls to delegates created in JITted code.
* [jit] Add a 'aot-skip=' MONO_DEBUG option to skip loading the Nth aot loadable method, useful for forcing mixed mode transitions during testing.
* [jit] Add tests for fullaot+interp mode
The tests work by injecting interp-jit transitions in varying locations controlled by the MONO_DEBUG=aot-skip= option.
* [interp] Avoid races when caching method pointers. Fix wasm support.
* Revert "[interp] Avoid races when caching method pointers. Fix wasm support."
This reverts commit 0f78c230b5102d625c300a4e1c6eaf97ad055dd5.
* [interp] stub native-to-managed on platforms where it is not working
* [ci] add fullaotmixed-regression step
Currently if we change for example `corlib.dll.sources` and then execute `make` - the `make` won't rebuild the lib, because it depends only on `net_4_x_corlib.dll.sources` and doesn't depend on all `#include` inside it.
As a temporarily solution we can depend on all *.sources files in the directory so a change in any of them will trigger rebuild. Unfortunately changes in un-related profiles will also trigger the rebuild but it's better than nothing for now I guess. For better experience we should fetch all #includes recursively for the current profile
The only reason for the restriction was that handle_alloc previously would not handle generic instances.
This speeded up the following microbenchmark by 19x (3.38s x 0.17s):
```
class Driver {
static T Identity<T> (T t) {
return t;
}
[MethodImpl(MethodImplOptions.NoInlining)]
static Func<T,T> MakeDelegate<T> () {
return new Func<T, T> (Identity);
}
static void Main () {
object o = new object ();
for (int i = 0; i < 400 * 1000; ++i) {
MakeDelegate<object>()(o);
}
}
}
```
* [Coop] Cleanup ahead of converting ves_icall_System_Threading_Thread_GetAbortExceptionState.
- serialize_object and deserialize_object are almost identical and
can be implemented on top of the same function.
- Error propagation was a little wierd and had FIXME comments.
It involved MonoError, MonoException, and gboolean *failed, and
some conversions. Converge on mostly MonoError, with fewer conversions,
albeit still sometimes holding a MonoException.
* Move error parameter to last.
Move static locals to global -- more easily seen in debugger.
Remove errant exclamation point.
* [jit] Make the interp_in wrappers work better with byref arguments.
* [runtime] Move some EH tests to exceptions.cs.
* [interp] Fix some problems in the interp entry/exit code in mixed mode.
* [jit] Avoid code patching from gshared code when the callee is an interp entry trampoline.
* [aot] Map byref return values to int&.
* [interp] Handle r4 return values in do_jit_call ().
if [ ! -f "TestResult-$(PROFILE).xml" ]; then echo "<?xml version='1.0' encoding='utf-8'?><test-results failures='1' total='1' not-run='0' name='bcl-tests' date='$$(date +%F)' time='$$(date +%T)'><test-suite name='$(strip $(test_assemblies))' success='False' time='0'><results><test-case name='$(notdir $(strip $(test_assemblies))).crash' executed='True' success='False' time='0'><failure><message>The test runner didn't produce a test result XML, probably due to a crash of the runtime. Check the log for more details.</message><stack-trace></stack-trace></failure></test-case></results></test-suite></test-results>" > TestResult-$(PROFILE).xml; fi; \
<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->
Loaded 100 of 2584 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.