platform/upstream/dotnet/runtime.git
5 years agoRemove problematic assert from SIGILL handler
Alexis Christoforides [Thu, 29 Aug 2019 15:33:39 +0000 (11:33 -0400)]
Remove problematic assert from SIGILL handler

mono_handle_native_crash() function can actually return if the native crash has triggered or has been trigerred by  more than one signal. So it is possible to reach the point of the assert

Commit migrated from https://github.com/mono/mono/commit/001398e05bc5f16119e17a737102f6f6fb027047

5 years agoAdd stub of new function when crash reporting is disabled
Alexis Christoforides [Tue, 6 Aug 2019 07:51:20 +0000 (10:51 +0300)]
Add stub of new function when crash reporting is disabled

Commit migrated from https://github.com/mono/mono/commit/8d4c0f3553d91704e2ff1aae6d954716ca3aa5e2

5 years agoSet out_module, to avoid getting no useful information in the printout
Alexis Christoforides [Tue, 16 Jul 2019 18:42:51 +0000 (14:42 -0400)]
Set out_module, to avoid getting no useful information in the printout

It seems that without this, most/all entries in the unmanaged frames list are have no useful information.

Commit migrated from https://github.com/mono/mono/commit/4b02c3eb9df654784cdfcd40f6a9a9ab590fb337

5 years ago[merp] Add API method that whitelists all native libraries
Alexis Christoforides [Tue, 9 Jul 2019 00:35:17 +0000 (20:35 -0400)]
[merp] Add API method that whitelists all native libraries

This is so that complex consumers such as Visual Studio for Mac can forego attempting to enumerate all loaded libraries, register them one at a time and potentially keep the list updated

Commit migrated from https://github.com/mono/mono/commit/40a8d88d8e0178d333c53ea3cb0e53363c2304ba

5 years ago[wasm] Avoid aligning the stack bounds, they are not page aligned on wasm.
Zoltan Varga [Tue, 3 Sep 2019 17:27:24 +0000 (13:27 -0400)]
[wasm] Avoid aligning the stack bounds, they are not page aligned on wasm.

Commit migrated from https://github.com/mono/mono/commit/aad54942583f8658ab6d7e7af5ffe3b76b3f35b3

5 years ago[coop] CustomAttributeBuilder_GetBlob, etc. (mono/mono#16579)
Jay Krell [Tue, 3 Sep 2019 22:52:41 +0000 (15:52 -0700)]
[coop] CustomAttributeBuilder_GetBlob, etc. (mono/mono#16579)

mono_reflection_get_custom_attrs_blob_checked
 ModuleBuilder_WriteToFile
 ModuleBuilder_build_metadata

Commit migrated from https://github.com/mono/mono/commit/1780e1d1f8b01feafe6ddcb2c59d241122a6e61a

5 years ago[Coop] ves_icall_InternalInvoke. (mono/mono#16625)
Jay Krell [Tue, 3 Sep 2019 22:18:21 +0000 (15:18 -0700)]
[Coop] ves_icall_InternalInvoke. (mono/mono#16625)

* [Coop] ves_icall_InternalInvoke.

(Part taken from ves_icall_InternalExecute https://github.com/mono/mono/pull/16622.)

* error_init_reuse.

* Remove stars from types.

Commit migrated from https://github.com/mono/mono/commit/651eb7696e7887597df0eb149cd7eb222ea807b4

5 years ago[debugger][android] Fixing single step inside Exception on Android (mono/mono#16596)
Thays Grazia [Tue, 3 Sep 2019 20:28:37 +0000 (17:28 -0300)]
[debugger][android] Fixing single step inside Exception on Android (mono/mono#16596)

* Fixing single step inside Exception on Android...
The method is null because on ss_create_init_args the IL is -1 when calling method Mono_UnhandledException_internal what I think it's expected, because of that I ignore the single step on android if there is no method. (debugger-engine.c)
After that the sequence point cannot be found because it's calling a method of class DynamicMethodNameCounter what I think it's expected, because of that I remove the assert on android. (debugger-agent.c)
Fixes mono/mono#14772

* Changing comment to make it clear...

Commit migrated from https://github.com/mono/mono/commit/1046dd746f3f99e97f034a2c2b51bdb4e19128ae

5 years ago[netcore] Use CoreRT's Overlapped (mono/mono#16106)
Egor Bogatov [Tue, 3 Sep 2019 20:22:04 +0000 (23:22 +0300)]
[netcore] Use CoreRT's Overlapped (mono/mono#16106)

Made it Nullability friendly

Interop.MemFree  -> Marshal.FreeHGlobal
Interop.MemAlloc -> Marshal.AllocHGlobal

Fixes https://github.com/mono/mono/issues/15308
Fixes https://github.com/mono/mono/issues/15310

Also, copy ThreadPoolBoundHandle.PlatformNotSupported.cs

Commit migrated from https://github.com/mono/mono/commit/625af20cefcc3944fa10f341329ff40fc9e27694

5 years agoFix non-netcore warning about add_assembly_to_alc. (mono/mono#16622)
Jay Krell [Tue, 3 Sep 2019 20:09:24 +0000 (13:09 -0700)]
Fix non-netcore warning about add_assembly_to_alc. (mono/mono#16622)

Commit migrated from https://github.com/mono/mono/commit/37e49876b9b5a43f4144ca2972e5bdbfa4d75090

5 years ago[netcore] Add intrinsic implementation for Unsafe.InitBlockUnaligned
Filip Navara [Fri, 30 Aug 2019 18:40:14 +0000 (20:40 +0200)]
[netcore] Add intrinsic implementation for Unsafe.InitBlockUnaligned

Commit migrated from https://github.com/mono/mono/commit/4ae804bb33e394ee5f5a32742e6b500cde913cff

5 years ago[interp] Transform ldloc/stloc pairs to a movloc instruction (mono/mono#16546)
Vlad Brezae [Tue, 3 Sep 2019 16:36:21 +0000 (19:36 +0300)]
[interp] Transform ldloc/stloc pairs to a movloc instruction (mono/mono#16546)

* [interp] Add stack information for each instruction

For each instruction PopN indicates how many values from the top of the stack are used by the instruction. PushN signals how many values are pushed back. These are also used to prevent values from the stack being optimized out, since they might still be used by an instruction. VarPop and VarPush mean that the number is not constant, so we need to inspect the data fields of the instruction (typically for an imethod or csignature) to figure out the stack usage.

* [interp] Convert ldloc/stloc pairs to movloc

The movloc instruction operates directly on locals. This is faster due to avoiding dispatch and stack indirection. More important is that it makes it easy to do copy propagation of locals and it has no stack usage, which means that it could even be killed if the destination local is no longer referenced (as well as STLOC_NP). In the future we could reuse this mechanism of tracking the value of a stack slot to do constant propagation and kill even more instructions (we might need to have _IMM versions of opcodes for this to work).

* [interp] Enable disabling of interp optimization

* [interp] Add time tracking stat for cprop optimizations

* [interp] Move stloc.np transformations to the cprop pass

It makes more sense to do such transformations here and we also don't want transformations in the generate phase prevent us from detecting alternative transformations when running the full pass.

* [interp] Add counter for instructions that were optimized away

* [interp] Make it explicit that we are dealing with IR code

It can be confusing in verbose output.

Commit migrated from https://github.com/mono/mono/commit/930a5d7d440a735b8b50e57ed397a700e3ee27b5

5 years ago[cominterop] Maintain object domain around ccw wrapper calls.
Nikolay Sivov [Mon, 2 Sep 2019 10:48:24 +0000 (13:48 +0300)]
[cominterop] Maintain object domain around ccw wrapper calls.

Commit migrated from https://github.com/mono/mono/commit/f8718c7a056938335453fd77a71a930beed51074

5 years agoRemove MAX_PATH usage in w32process (mono/mono#16553)
Ryan Lucia [Tue, 3 Sep 2019 15:41:27 +0000 (11:41 -0400)]
Remove MAX_PATH usage in w32process (mono/mono#16553)

* Remove MAX_PATH usage in w32process

* Fixes

* Shrink buffer temporarily

* More fixes

* Reset buffer size to 260

* Fix length check and add notes

* Actually free things

* Add tracing and zero len at start

* Typo

* Fix another leak

* Simplify logic

Commit migrated from https://github.com/mono/mono/commit/5377f9655d24c3ff19545398f89df462c77589b3

5 years ago[llvm] Implement more SIMD intrinsics on netcore. (mono/mono#16449)
Zoltan Varga [Tue, 3 Sep 2019 12:31:16 +0000 (08:31 -0400)]
[llvm] Implement more SIMD intrinsics on netcore. (mono/mono#16449)

* [netcore] Add intrinsics for Vector128/Vector256.Count.

* [netcore] Implement Vector<T>.get_Item () as an intrinsic.

Commit migrated from https://github.com/mono/mono/commit/98a4d5ec1eb2becf1d002a5fbb070f1079bc6fe4

5 years agoImprove Fast-Math mode for LLVM (mono/mono#16599)
Egor Bogatov [Tue, 3 Sep 2019 12:19:03 +0000 (15:19 +0300)]
Improve Fast-Math mode for LLVM (mono/mono#16599)

It turns out it's not enough to set global fast math parameters, it's also required to mark some instructions as "fast" (see https://llvm.org/docs/LangRef.html#fast-math-flags) like, for instance, clang does, see https://godbolt.org/z/U8TFST
E.g. all optimizations inside SimplifyLibCalls pass (it's a subpass of InstCombine) need it.

Commit migrated from https://github.com/mono/mono/commit/416a31796e6a34a134d251760c6055bacc39878c

5 years ago[netcore] Makefile clean up (mono/mono#16630)
Egor Bogatov [Tue, 3 Sep 2019 11:55:22 +0000 (14:55 +0300)]
[netcore] Makefile clean up (mono/mono#16630)

Remove ASP.NET sample (we currently have to download apsnet runtime everytime)
instead we can do:

dotnet new webapp

and do make patch-app APP_PATH=/path/to/myasp (works for any kind of apps/templates)

Commit migrated from https://github.com/mono/mono/commit/5692180ea21e596a08120090dd804872be3df1aa

5 years agoRelax assembly checking for 64 bit targets to allow running mixed-mode MSVC code...
Bernhard Urban [Tue, 3 Sep 2019 10:14:02 +0000 (12:14 +0200)]
Relax assembly checking for 64 bit targets to allow running mixed-mode MSVC code. (mono/mono#16330)

* [jit] Relax assembly checking for 64 bit targets to allow running mixed-mode MSVC code.

Fixes mono/mono#37913

* STACK_PTR|I8 should be the same as I8|STACK_PTR tuple

* fix i4 to ptr conv on 64bit

Commit migrated from https://github.com/mono/mono/commit/f23113afcdd2a405b402bef3fb926c0c72ba7221

5 years ago[interp] Remove varargs from InterpFrame and recompute it instead (mono/mono#16598)
Vlad Brezae [Tue, 3 Sep 2019 08:21:56 +0000 (11:21 +0300)]
[interp] Remove varargs from InterpFrame and recompute it instead (mono/mono#16598)

It is a waste of stack space.

Commit migrated from https://github.com/mono/mono/commit/f491af13f482fb42313aa5919ef6e2a030501994

5 years agoUse CMP_GE/CMP_LE/CMP_GE_UN/CMP_LE_UN instead of manual decomposition
Filip Navara [Mon, 2 Sep 2019 21:55:07 +0000 (23:55 +0200)]
Use CMP_GE/CMP_LE/CMP_GE_UN/CMP_LE_UN instead of manual decomposition

Commit migrated from https://github.com/mono/mono/commit/b9b13f0fc10496e54c5b72993c589ca24fa636ab

5 years ago[netcore] Add intrinsics for Vector.GreaterThanOrEqual/LessThanOrEqual
Filip Navara [Sun, 1 Sep 2019 09:38:54 +0000 (11:38 +0200)]
[netcore] Add intrinsics for Vector.GreaterThanOrEqual/LessThanOrEqual

Commit migrated from https://github.com/mono/mono/commit/03899588bae58b30bd13548f49c779037a4bf177

5 years agoMirror changes from mono/coreclr (mono/mono#16547)
Dotnet-GitSync-Bot [Mon, 2 Sep 2019 20:02:59 +0000 (13:02 -0700)]
Mirror changes from mono/coreclr (mono/mono#16547)

* Move FormatTypeName to Type (dotnet/coreclrmono/mono#25631)

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
* Fix for mono

Commit migrated from https://github.com/mono/mono/commit/a6b91f42951492314468e63ec7d2161baea6122b

5 years agoMerge pull request mono/mono#16624 from filipnavara/hebrew
Egor Bogatov [Mon, 2 Sep 2019 17:43:08 +0000 (20:43 +0300)]
Merge pull request mono/mono#16624 from filipnavara/hebrew

[corlib] Add hack for Hebrew calendar data

Commit migrated from https://github.com/mono/mono/commit/73c8017b1f1f9a1350c10971acd07d1b54139923

5 years ago[Coop] Monitor. (mono/mono#16608)
Alexander Köplinger [Sun, 1 Sep 2019 13:14:17 +0000 (15:14 +0200)]
[Coop] Monitor. (mono/mono#16608)

* [Coop] Monitor.

* PR: Rename function; cleanup slightly.

* PR: And then rename the icall back.

* Rename parameter back.

Commit migrated from https://github.com/mono/mono/commit/07b7c7d82452dc4255e4d626bc4843712a0129c6

5 years ago[Coop] Fully inline NULL_HANDLE (do not even access a global variable). (mono/mono...
Jay Krell [Sun, 1 Sep 2019 13:13:20 +0000 (06:13 -0700)]
[Coop] Fully inline NULL_HANDLE (do not even access a global variable). (mono/mono#16612)

Commit migrated from https://github.com/mono/mono/commit/b3e48bcf9544ad7210be374c74f51a492d8e4afd

5 years ago[netcore] Add handle frame to loop body in GetTopLevelForwardedTypes (mono/mono#16594)
Ryan Lucia [Sun, 1 Sep 2019 01:40:52 +0000 (21:40 -0400)]
[netcore] Add handle frame to loop body in GetTopLevelForwardedTypes (mono/mono#16594)

* [netcore] Add handle frame to loop body in GetTopLevelForwardedTypes

* No early returns

* Move scope of cols

* Fix C++ builds, probably

Commit migrated from https://github.com/mono/mono/commit/c9a6dd351a7efff698fd2b2dc8939ce1fc24f0cb

5 years agoLLVM: Make Buffer.Memmove intrinsic (mono/mono#16610)
Egor Bogatov [Sat, 31 Aug 2019 23:42:44 +0000 (02:42 +0300)]
LLVM: Make Buffer.Memmove intrinsic (mono/mono#16610)

* Add memmove intrinsic

* Fix typo

* Add -lower-expect

Commit migrated from https://github.com/mono/mono/commit/6327274b54cca5ad11207c79f5a611ca1623c60f

5 years agoRename parameter back.
Jay Krell [Sat, 31 Aug 2019 17:35:14 +0000 (10:35 -0700)]
Rename parameter back.

Commit migrated from https://github.com/mono/mono/commit/24180e9106d1940795363ae70634ebe1d1446fb3

5 years agoPR: And then rename the icall back.
Jay Krell [Sat, 31 Aug 2019 17:34:32 +0000 (10:34 -0700)]
PR: And then rename the icall back.

Commit migrated from https://github.com/mono/mono/commit/5d9ca2064652b75f221e633122ec34f80fb50676

5 years agoPR: Rename function; cleanup slightly.
Jay Krell [Sat, 31 Aug 2019 17:13:47 +0000 (10:13 -0700)]
PR: Rename function; cleanup slightly.

Commit migrated from https://github.com/mono/mono/commit/ea0db154b44be82f48cd13c85619f0e82295d511

5 years ago[aot] Avoid crashing with --aot=llvm is used in a runtime without llvm support. ...
Zoltan Varga [Sat, 31 Aug 2019 13:03:45 +0000 (09:03 -0400)]
[aot] Avoid crashing with --aot=llvm is used in a runtime without llvm support. (mono/mono#16577)

Commit migrated from https://github.com/mono/mono/commit/fb26a68fd1752783cbc8827ac78d2b3bbf260d62

5 years ago[Coop] Monitor.
Jay Krell [Sat, 31 Aug 2019 12:16:07 +0000 (05:16 -0700)]
[Coop] Monitor.

Commit migrated from https://github.com/mono/mono/commit/91445e2286023292b219f3733bc629ed65f06e96

5 years ago[coop] Allow SETUP_ICALL_FRAME (i.e. a loop) to reference calling frame w/o HANDLE_FU...
Jay Krell [Sat, 31 Aug 2019 12:20:44 +0000 (05:20 -0700)]
[coop] Allow SETUP_ICALL_FRAME (i.e. a loop) to reference calling frame w/o HANDLE_FUNCTION_ENTER or SETUP_ICALL_FUNCTION. (mono/mono#16498)

This is based on my read of https://github.com/mono/mono/pull/16487.

Commit migrated from https://github.com/mono/mono/commit/9b193b9ec4594c68b85a20bb7ae2bfcd6be7796b

5 years ago[interp] Fixes for il_offsets associated with instructions (mono/mono#16587)
Vlad Brezae [Sat, 31 Aug 2019 10:37:06 +0000 (13:37 +0300)]
[interp] Fixes for il_offsets associated with instructions (mono/mono#16587)

* [interp] Remove some some false is_bb_start markings

Having fewer basic blocks makes potential optimizations more effective.

* [interp] Persist variables in TransformData

Thate are not used by inlined code because we don't inline code that has multiple basic blocks or clauses.

* [interp] Enable emitting of MINT_NOP instruction

This instruction will be optimized away when compacting the instruction stream.

* [interp] Clear instructions insead of removing them

Makes everything easier.

* [interp] Fix some instructions size inconsistencies

* [interp] Add more is_bb_start markings

* [interp] Add nop instead of extending bb

We should always have an IR instruction associated with an IL offset, especially when that instruction is a bb_start since we will need to branch to it and resolve the IR instruction from the il_offset.

* [interp] Simplify resolving in offset

We should always have an in_offset associated with the il_offset we are branching to.

* [interp] Add correct il_offset for all instructions

Except for special prolog instructions that will have -1 as the offset. We don't make much use of il_offset for non bb_start instructions, but they might be useful for debugging.

* [interp] Fix il_offset of some conv opcodes

Commit migrated from https://github.com/mono/mono/commit/bf53a3a53bd0aef81e0e2eed24ab835ebb1630fa

5 years agoFollow convention -- "static inline" is only for .h files, "static" is for .c. (mono...
Jay Krell [Sat, 31 Aug 2019 07:40:33 +0000 (00:40 -0700)]
Follow convention -- "static inline" is only for .h files, "static" is for .c. (mono/mono#15502)

inlining is up to the compiler to decide.
It is used in .h files for linkage/dedup, not to affect codegen.

Commit migrated from https://github.com/mono/mono/commit/a768b1533051aa37fc34af438e9af5bab48d515d

5 years ago[coop] InternalGetHashCode (mono/mono#16583)
Jay Krell [Sat, 31 Aug 2019 07:38:12 +0000 (00:38 -0700)]
[coop] InternalGetHashCode (mono/mono#16583)

Commit migrated from https://github.com/mono/mono/commit/cba94f28bed566e7a976842d016a7b2d4ef3f91a

5 years ago[runtime] Make eglib tests run on CI (mono/mono#16187)
Aleksey Kliger (λgeek) [Sat, 31 Aug 2019 06:06:25 +0000 (02:06 -0400)]
[runtime] Make eglib tests run on CI (mono/mono#16187)

[runtime] Make eglib tests run on CI

Update mono/eglib SUBDIRS to build tests after eglib is built.

Add a check-local automake rule.

Add CI steps to run the eglib tests.

Commit migrated from https://github.com/mono/mono/commit/8bc27f6665fdd8464f3fdad15a974e5f38f9b7f2

5 years agoCleanup x86_patch and amd64_patch. (mono/mono#16474)
Jay Krell [Fri, 30 Aug 2019 21:45:55 +0000 (14:45 -0700)]
Cleanup x86_patch and amd64_patch. (mono/mono#16474)

* Cleanup x86_patch and amd64_patch.

amd64_patch has two incorrect looking probably unused cases.
 g_assert(0) and fix them.
 call and jmp indirect (one case)
 move reg RIP relative

x86_patch is large-ish inline macro.
Presumably for sharing with amd64, not inlining.
Restructure as an inline function, called once.
Try to make the code a little clearer also, with same functionality and efficiency
 (modulo the optimized perf of "if i == 4" vs. "if i")
i.e. speak of instruction_size and offset_size, not pos and boolean size.

Add to x86_patch the ability to patch jmp/call indirect,
as amd64_patch has, but which was incorrect.
This would seem useful for a later change (using "thunks"
to patch nearby data instead of patching aligned instructions,
indirect call/jmp vs. direct).

amd64_patch largely delegates to x86_patch.
One case asserts and delegates.
Move the assert to the x86 side, where an optimizing
compiler should know to remove it for x86 anyway.

Change some assert to g_assert.

Remove some unnecessary casts.

Fix an assert (https://github.com/mono/mono/pull/16471).

* Change g_assert back to assert except where making larger changes
and less expansion.

Commit migrated from https://github.com/mono/mono/commit/f735571f27738e3354f6d92650a0517d0482039d

5 years ago[mini] publish global patches after JitInfo has been added (mono/mono#16589)
Bernhard Urban [Fri, 30 Aug 2019 20:46:10 +0000 (22:46 +0200)]
[mini] publish global patches after JitInfo has been added (mono/mono#16589)

[mini] publish global patches after JitInfo has been added

Fixes https://github.com/mono/mono/issues/14080

Consider the following example:

```csharp
static void CommonCallTarget () { }

static void TailA () {
    tailcall CommonCallTarget ();
}

static void TailB () {
    tailcall CommonCallTarget ();
}
```

Since `TailA` and `TailB` are tailcalling into `CommonCallTarget`, the resolution at patch-time is a bit tricky, that is, since it's a jump-like instruction the patching machinery won't know where it was called from. That's why we maintain a global hashtable `jump_target_hash` where each jump-site is signed up to be patched. At patch-time we know the target method (in the example `CommonCallTarget`), but since we don't know where we are coming from, we will just apply all patches for that target.

This works since ages, so why did it crash on arm64 sometimes?
When the patching happens, we check if the displacement between jump-site and target fits into it (24bit). If not, which happens not very often, we have to allocate a _thunk_:
https://github.com/mono/mono/blob/mono/mono@36296ce291f8a7b19de3eccb7a32c7e4ed9df8f2/mono/mini/mini-arm64.c#L928-L942

So instead of jumping to the target directly, we'll branch to the thunk. This is a little trampoline that loads the full address of the target and then finally branches to it. This one will live close-by the jump-site, because during compilation we will reserve specifically for that scenario some space after the generated code. For this, however, we need the JitInfo of the jump-site. And that's where the origin of the race is. Let's say:

* Thread A compiles `TailA`, and then jumps into it. Thus one patch point is in the `jump_target_hash`.
* Now Thread B compiles `TailB`, registers the patch point but has _not_ yet registered its JitInfo.
* Then Thread A continues, does the tailcall into `CommonCallTarget`, enters the patching machinery, which sees two patches. Now assume when applying the patch for `TailB` the displacement is too large, thus it tries to allocate a thunk but can't find the relevant JitInfo for it that it needs to emit the thunk. So it crashes as reported in https://github.com/mono/mono/issues/14080

As far as I can tell this only affects ARM64, ARM and PPC.

<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->

Commit migrated from https://github.com/mono/mono/commit/06e63b345f0be60008597784d1cc8b3251bf60fa

5 years agoTurned the compiler server off on Windows because Named Pipes aren't fully working...
Steve Pfister [Fri, 30 Aug 2019 20:27:14 +0000 (16:27 -0400)]
Turned the compiler server off on Windows because Named Pipes aren't fully working (mono/mono#16552)

* Turned the compiler server off on Windows because Named Pipes aren't fully working

* Added win32 to the CS is turned off message

Commit migrated from https://github.com/mono/mono/commit/dbce6ac447dcb9443f50da9fe50caed50adc1d06

5 years agoRevert "[android] add hardware specific workaround for Nexus9 in armv7 mode" (mono...
Bernhard Urban [Fri, 30 Aug 2019 20:26:12 +0000 (22:26 +0200)]
Revert "[android] add hardware specific workaround for Nexus9 in armv7 mode" (mono/mono#14691)

Revert "[android] add hardware specific workaround for Nexus9 in armv7 mode"

This reverts commit mono/mono@ee90fc601e762dc31eeb90fc61b6305246ad5275 (also see https://github.com/mono/mono/pull/4878 ).

The device was released November 2014.  I think it's fair to assume it isn't widely used anymore.

Commit migrated from https://github.com/mono/mono/commit/5eb67ac88a2b26f28091d4f4876720ba3dbd8674

5 years ago[netcore] Fix make patch-local-dotnet if .dotnet has more than one netcore install...
Zoltan Varga [Fri, 30 Aug 2019 18:08:41 +0000 (14:08 -0400)]
[netcore] Fix make patch-local-dotnet if .dotnet has more than one netcore install. (mono/mono#16590)

Commit migrated from https://github.com/mono/mono/commit/4997d832916d092ee5a69bd28d0ee354a49c6e35

5 years ago[coop] mono_runtime_class_init_full (mono/mono#16580)
Jay Krell [Fri, 30 Aug 2019 17:30:58 +0000 (10:30 -0700)]
[coop] mono_runtime_class_init_full (mono/mono#16580)

Commit migrated from https://github.com/mono/mono/commit/86c45ff645e59c997341ac44e95d03d4491c50eb

5 years ago[cominterop] Respect ComDefaultInterfaceAttribute when constructing ccw. (mono/mono...
Nikolay Sivov [Fri, 30 Aug 2019 16:29:54 +0000 (19:29 +0300)]
[cominterop] Respect ComDefaultInterfaceAttribute when constructing ccw. (mono/mono#16584)

Commit migrated from https://github.com/mono/mono/commit/c8707c6e84ed5978fb21be3c2dd4fe678b904c9c

5 years ago[Coop] ves_icall_RuntimeFieldInfo_GetRawConstantValue. (mono/mono#16582)
Jay Krell [Fri, 30 Aug 2019 14:53:40 +0000 (07:53 -0700)]
[Coop] ves_icall_RuntimeFieldInfo_GetRawConstantValue. (mono/mono#16582)

Commit migrated from https://github.com/mono/mono/commit/9db00e74950a5b9572dbcfb3c6403503ae5b236d

5 years ago[configure] remove autodection of llvm-config in $PATH (mono/mono#16569)
Bernhard Urban [Fri, 30 Aug 2019 13:16:03 +0000 (15:16 +0200)]
[configure] remove autodection of llvm-config in $PATH (mono/mono#16569)

[configure] remove autodection of llvm-config in $PATH

Instead `./autogen.sh --with-llvm=<path>` should be used if a build from `external/llvm` is not preferred.

The old behavior was confusing when a `llvm-config` is on `$PATH`, which can be the case when you have LLVM packages installed on a Linux distribution. It picked that up when `./autogen.sh --enable-llvm` was used.

/cc @brianrob

Commit migrated from https://github.com/mono/mono/commit/07045604cf8e436359d04f18eff05ae00668e752

5 years ago[interp] Compress interpreter opcode names in usual way, offsets vs. pointers. (mono...
Jay Krell [Fri, 30 Aug 2019 08:27:19 +0000 (01:27 -0700)]
[interp] Compress interpreter opcode names in usual way, offsets vs. pointers. (mono/mono#16350)

* [interp] Compress the interpreter opcode names in the usual way, by changing
from an array of pointers to an array of 16 bit offsets into one large "string".

* PR: Make mono_interp_opname a function.

Commit migrated from https://github.com/mono/mono/commit/36296ce291f8a7b19de3eccb7a32c7e4ed9df8f2

5 years ago[coop] Convert System_Runtime_Remoting_Messaging_AsyncResult, etc. (mono/mono#16566)
Jay Krell [Fri, 30 Aug 2019 03:51:15 +0000 (20:51 -0700)]
[coop] Convert System_Runtime_Remoting_Messaging_AsyncResult, etc. (mono/mono#16566)

* [coop] Convert System_Runtime_Remoting_Messaging_AsyncResult_Invoke, etc.

* Remove mono_load_remote_field_checked from this PR.

* Pin ac->msg earlier (should not matter).

* Add missing barrier.

* Pin slightly earlier -- still should not matter.

Commit migrated from https://github.com/mono/mono/commit/3db78e829c0909bf9ca459e3a3e1033365386569

5 years ago[Coop] mono_runtime_class_init_full mostly single point of exit.
Jay Krell [Wed, 28 Aug 2019 00:20:02 +0000 (17:20 -0700)]
[Coop] mono_runtime_class_init_full mostly single point of exit.

Commit migrated from https://github.com/mono/mono/commit/cbb9c645eb4d4d0f03da3dab3c99a4bcc9919fbe

5 years agoBump ikvm to pick up mono/mono@caa8e7f54279a47422626005d228447f5d3670d5. (mono/mono...
Zoltan Varga [Fri, 30 Aug 2019 00:46:30 +0000 (20:46 -0400)]
Bump ikvm to pick up mono/mono@caa8e7f54279a47422626005d228447f5d3670d5. (mono/mono#16567)

* Bump ikvm to pick up mono/mono@caa8e7f54279a47422626005d228447f5d3670d5.

* [monodis] Add a missing cattr parent case.

Commit migrated from https://github.com/mono/mono/commit/796a5751315dbf95bc7dedea684840e4cce84861

5 years agoMake Math.Pow, Min and Max for doubles intrinsics (mono/mono#16561)
Egor Bogatov [Thu, 29 Aug 2019 23:01:15 +0000 (02:01 +0300)]
Make Math.Pow, Min and Max for doubles intrinsics (mono/mono#16561)

* Add new Math intrinsics

* call EB.setTargetOptions only for fast-math

* Address feedback

* rename float opcodes

* Rename opcodes

* Update CoreFX.issues.rsp

Commit migrated from https://github.com/mono/mono/commit/c3ccb6e0272a6b000a8adfb81c02c240adffc649

5 years ago[simd] Implement .ctor(T[]) and CopyTo () as intrinsics. (mono/mono#16558)
Zoltan Varga [Thu, 29 Aug 2019 23:00:59 +0000 (19:00 -0400)]
[simd] Implement .ctor(T[]) and CopyTo () as intrinsics. (mono/mono#16558)

Commit migrated from https://github.com/mono/mono/commit/210b3243471a61024d54b16d4092e90134ff098e

5 years agoCleanup trampoline size checks. (mono/mono#15624)
Jay Krell [Thu, 29 Aug 2019 20:16:14 +0000 (13:16 -0700)]
Cleanup trampoline size checks. (mono/mono#15624)

Cleanup trampoline size checks.

- named `int` everywhere
- `assert` everywhere
- assert `<=` everywhere instead of `<`
- `const` almost everywhere
Names not consistent, following existing code (`size`, `buf_len`, `kMaxCode`.)

Only touching x86/amd64, granted.

Could be better -- make them two pass and avoid the presizing.

Commit migrated from https://github.com/mono/mono/commit/5390b796dd9c16eaded61c406a4cea9c66ea8905

5 years ago[netcore] Implement AssemblyLoadContext.LoadUnmanagedDllFromPath (mono/mono#16525)
Ryan Lucia [Thu, 29 Aug 2019 16:35:15 +0000 (12:35 -0400)]
[netcore] Implement AssemblyLoadContext.LoadUnmanagedDllFromPath (mono/mono#16525)

* [netcore] Implement AssemblyLoadContext.LoadUnmanagedDllFromPath

* Fixes

Commit migrated from https://github.com/mono/mono/commit/3b57849541b35a8f6cced2957b9a6fdc0680136f

5 years ago[cominterop] Implement native-to-managed safearray marshalling. (mono/mono#16483)
Nikolay Sivov [Thu, 29 Aug 2019 12:19:09 +0000 (15:19 +0300)]
[cominterop] Implement native-to-managed safearray marshalling. (mono/mono#16483)

* [cominterop] Implement native-to-managed safearray marshalling.

* [tests] Fix index variable type.

In attempt ot fix MSVC build failure (int* vs LONG* on Windows).

* [cominterop] Use proper statement block for newly added switch entry.

* [marshal] Conditionally compile in mono_cominterop_emit_marshal_safearray().

Hopefully should fix remaining build failures.

* [cominterop] Don't free user array argument

Commit migrated from https://github.com/mono/mono/commit/421bd79f06a92372e0259be5349e4236edf0e7bb

5 years ago[Coop] mono_load_remote_field_checked single point of exit. (mono/mono#16526)
Jay Krell [Thu, 29 Aug 2019 09:00:44 +0000 (02:00 -0700)]
[Coop] mono_load_remote_field_checked single point of exit. (mono/mono#16526)

Extracted from earlier version of mono/mono#16504.
Baby steps.

Commit migrated from https://github.com/mono/mono/commit/52c1d4acfc751dd83f1964648cd91288988d7eec

5 years agoLLVM: Add more Math intrinsics, introduce `--cpu` flag (mono/mono#16309)
Egor Bogatov [Thu, 29 Aug 2019 08:32:43 +0000 (11:32 +0300)]
LLVM: Add more Math intrinsics, introduce `--cpu` flag (mono/mono#16309)

* Add Math Intrinsics, introduce --cpu flag

* cpu -> mcpu

Commit migrated from https://github.com/mono/mono/commit/2e9c5df855566402a314864580ec7dd908be2112

5 years ago[coop] Cleanup mono_reflection_get_custom_attrs_blob_checked. (mono/mono#16535)
Jay Krell [Thu, 29 Aug 2019 08:23:20 +0000 (01:23 -0700)]
[coop] Cleanup mono_reflection_get_custom_attrs_blob_checked. (mono/mono#16535)

- single point of exit
 - local variable cheaper than strcmp

Commit migrated from https://github.com/mono/mono/commit/2f2d9541e593ed6976b32bde80a5f47b25ff9148

5 years ago[netcore] Add Monitor.LockContentionCount icall (mono/mono#16538)
Filip Navara [Thu, 29 Aug 2019 00:35:07 +0000 (02:35 +0200)]
[netcore] Add Monitor.LockContentionCount icall (mono/mono#16538)

* Add Monitor.LockContentionCount icall

* Add NOHANDLES around the new icall

Commit migrated from https://github.com/mono/mono/commit/e32fb11dbea1743b495241dc648065fa1938aa54

5 years agoRead only function pointers (MonoThreadInfoRuntimeCallbacks). (mono/mono#16545)
Jay Krell [Wed, 28 Aug 2019 22:10:40 +0000 (15:10 -0700)]
Read only function pointers (MonoThreadInfoRuntimeCallbacks). (mono/mono#16545)

Read only memory is preferred, for efficiency and security.

Even if it requires relocation first.

If the runtime is loaded in more than one process, physical pages can be shared (at least on Windows, where the kernel does the relocation).

If there is memory corruption, writes to here will sigsegv/accessviolate.

The older code also copied the pointers. For lifetime purposes that could be useful, but generally is not. i.e. they live with the code they point to.

Writable function pointers are also particularly targets for attackers.
There's been tons of defenses put around them through the years.
Read only ones are not vulnerable -- unless the attacker escalates and calls mprotect first.

When there is a JIT, arguably there is just tons of attack surface.
But there is also AOT.

Structs of function pointers are usually read only in the wider world.

Commit migrated from https://github.com/mono/mono/commit/7ca965e09c35b1f9a2a7a56f68f0be997f841754

5 years agoMerge pull request mono/mono#16323 from EgorBo/ffast-math
Zoltan Varga [Wed, 28 Aug 2019 20:16:18 +0000 (16:16 -0400)]
Merge pull request mono/mono#16323 from EgorBo/ffast-math

Fast Math mode

Commit migrated from https://github.com/mono/mono/commit/c4695b8b4440e0f80c4768379fa24ba78ebff9d2

5 years ago[interp] Fix remaining MonoError reuse. (mono/mono#16533)
Jay Krell [Wed, 28 Aug 2019 19:33:48 +0000 (12:33 -0700)]
[interp] Fix remaining MonoError reuse. (mono/mono#16533)

* [interp] Fix remaining MonoError reuse.

This finishes off:
 https://github.com/mono/mono/commit/mono/mono@38aebeae38704df53ef8f2991ff63e293a3ac4de

which is *ok*, but leaves alone the other approach:
 https://github.com/mono/mono/commit/mono/mono@4d9e6ae20e536394c9ff65c61238045db294c08e
 https://github.com/mono/mono/commit/mono/mono@b654aa1ca858666539a677e96d00f594fd81c630
 https://github.com/mono/mono/commit/mono/mono@fd4956fbf277ec56a13137e01b48efb98a5556f5

Several other options are possible.

* self and peer PR: No need to cleanup successful error.

Commit migrated from https://github.com/mono/mono/commit/056d5ca545d8534fa4b9c8b9268913775607e25a

5 years agoPortably pass a full pointer and not just an integer to terminate vararg pointer...
Jay Krell [Wed, 28 Aug 2019 17:35:10 +0000 (10:35 -0700)]
Portably pass a full pointer and not just an integer to terminate vararg pointer lists. (mono/mono#15629)

i.e. because of define NULL 0.
Though I think at least Visual C++ special cases this and passes a full pointer to varargs.

Commit migrated from https://github.com/mono/mono/commit/ff73c84482f99036f04c883316246d43d17f44d4

5 years ago[interp] Possible code size savings via goto instead of macros. (mono/mono#16531)
Jay Krell [Wed, 28 Aug 2019 16:59:11 +0000 (09:59 -0700)]
[interp] Possible code size savings via goto instead of macros. (mono/mono#16531)

[interp] Possible code size savings via goto instead of macros.

Possibly the compilers do this already.

Commit migrated from https://github.com/mono/mono/commit/a0ba2cbce52dd312fb34a39d366dde5b4a878fe3

5 years agoMerge remote-tracking branch 'origin/master' into ffast-math
Egor Bogatov [Wed, 28 Aug 2019 16:01:34 +0000 (19:01 +0300)]
Merge remote-tracking branch 'origin/master' into ffast-math

Commit migrated from https://github.com/mono/mono/commit/ffc3081c3b9576c922286c79f51fe3fb3cd49f50

5 years agoMerge pull request mono/mono#16242 from lateralusX/lateralusX/windows-fix-local-value...
imhameed [Wed, 28 Aug 2019 15:23:43 +0000 (08:23 -0700)]
Merge pull request mono/mono#16242 from lateralusX/lateralusX/windows-fix-local-valuetype-copy-llvm

OP_LLVM_OUTARG_VT doesn't always create temporary vt needed by some ABI's.

Commit migrated from https://github.com/mono/mono/commit/bd3cc61301cc12d167b284316e9d99af92f2130b

5 years ago[mini] do not re-AOT whole BCL for fullaotcheck targets (mono/mono#16536)
Bernhard Urban [Wed, 28 Aug 2019 15:19:39 +0000 (17:19 +0200)]
[mini] do not re-AOT whole BCL for fullaotcheck targets (mono/mono#16536)

[mini] do not re-AOT whole BCL for fullaotcheck targets

And enable `llvmfullaotcheck` target on CI.

Fixes https://github.com/mono/mono/issues/15999

On my armv7/linux machine with a `--with-runtime-preset=fullaot_llvm` configured build, before this PR:
```console
$ time make -C mono/mini llvmfullaotcheck -j4
[...]
real    9m42.362s
user    23m2.000s
sys     0m18.480s
```
After:
```console
$ time make -C mono/mini llvmfullaotcheck -j4
[...]
real    3m1.984s
user    4m51.648s
sys     0m8.248s
```

Commit migrated from https://github.com/mono/mono/commit/71f0f0ff827b03252e8967aeb6152a14cc3198ec

5 years ago[netcore] Add missing 'prepare' dependency to run-tests-corefx
Alexander Köplinger [Wed, 28 Aug 2019 14:17:31 +0000 (16:17 +0200)]
[netcore] Add missing 'prepare' dependency to run-tests-corefx

Commit migrated from https://github.com/mono/mono/commit/2152f0a16d68021fa28a997806992ad59fd0c7e7

5 years agoMerge pull request mono/mono#16517 from vargaz/wasm-xunit4
Zoltan Varga [Wed, 28 Aug 2019 13:46:09 +0000 (09:46 -0400)]
Merge pull request mono/mono#16517 from vargaz/wasm-xunit4

[wasm] Enable xunit tests for corlib/System.Core.

Commit migrated from https://github.com/mono/mono/commit/f562c7ef6a23e9f713a53b446e937eedc63728b6

5 years agoFix assert in x86_patch regarding second byte of Jcc instructions being 0x80-0x8F...
Jay Krell [Wed, 28 Aug 2019 13:42:44 +0000 (06:42 -0700)]
Fix assert in x86_patch regarding second byte of Jcc instructions being 0x80-0x8F vs. 0x70-0x8F (6byte conditional branch with 32bit offset). (mono/mono#16471)

Commit migrated from https://github.com/mono/mono/commit/c80a1eca636c82014f8fbb9873e5391cddffa9a9

5 years ago[merp] Initialize hang_watchdog_path earlier; be lax if it's missing (mono/mono#16298)
Aleksey Kliger (λgeek) [Wed, 28 Aug 2019 12:34:30 +0000 (08:34 -0400)]
[merp] Initialize hang_watchdog_path earlier; be lax if it's missing (mono/mono#16298)

* [merp] Initialize hang_watchdog_path earlier; be lax if it's missing

Initialize hang_watchdog_path earlier - not just when
ves_icall_Mono_Runtime_EnableCrashReportingLog is called.  That function is
only expected to be called by apps that explicitly want progress reports from
MERP when it's collecting a crash report.  But we want the mono-hang-watchdog
to execute for all mono crashes (when crash reporting isn't ifdef'd out).

Also if we try to exec mono-hang-watchdog and fail for some reason, print a
nice message and then exit.  We used to call g_assert_not_reached which would
kick off another MERP of the _forked child process_ which would then get
confused because it really can't run in the forked process at all.

Commit migrated from https://github.com/mono/mono/commit/fc21168065af270d1e500fa6be618f8563d0c525

5 years ago[interp] Outline box. (mono/mono#16456)
Jay Krell [Wed, 28 Aug 2019 10:51:23 +0000 (03:51 -0700)]
[interp] Outline box. (mono/mono#16456)

With additional reasonable changes this should conserve stack.
A combined PR that demonstrates actual savings probably should/will be presented.

Commit migrated from https://github.com/mono/mono/commit/2ca04a9743ceab99714377180ba3b2b6d589ba7f

5 years ago[interp] Minor cleanup of `stackval_from_data`. Compiler can do it. (mono/mono#16534)
Jay Krell [Wed, 28 Aug 2019 10:11:56 +0000 (03:11 -0700)]
[interp] Minor cleanup of `stackval_from_data`. Compiler can do it. (mono/mono#16534)

I missed this earlier cleaning stackval_to_data.

Commit migrated from https://github.com/mono/mono/commit/56b83f489b42e076bd7259cf42b4c684e63c7785

5 years ago[interp] Asserts pessimize clang. Removing saves 16 bytes on Linux/amd64/clang. ...
Jay Krell [Wed, 28 Aug 2019 10:10:30 +0000 (03:10 -0700)]
[interp] Asserts pessimize clang. Removing saves 16 bytes on Linux/amd64/clang. (mono/mono#16530)

Paired with https://github.com/mono/mono/pull/16456, saves 16 bytes on Linux/amd64/clang.
No change with gcc.
Contributes to https://github.com/mono/mono/issues/16172.

Commit migrated from https://github.com/mono/mono/commit/c870df0aa7a8111743bab8bbe6b9f3f6fa8ed870

5 years agoRemove dead Boehm code. (mono/mono#15224)
Jay Krell [Wed, 28 Aug 2019 08:56:08 +0000 (01:56 -0700)]
Remove dead Boehm code. (mono/mono#15224)

* Remove dead Boehm code.

Unity looked similarly dead.

The key points making it dead were:

create_allocator:
  g_assert_not_reached() covering everything but local variables

mono_gc_get_managed_allocator:
  always returning NULL, killing a bunch of code
  after it

mono_gc_is_critical_method:
   looking at data that was never filled in

This should have no impact, not even on Boehm.
Boehm should continue working just the same.

It is nice because it is the few/only uses of CEE_MONO_TLS.

Commit migrated from https://github.com/mono/mono/commit/c534511003bdd84ef08dd8a7cf725d4d0f063f5e

5 years ago[mini] Cleanup MONO_MMAP_32BIT. (mono/mono#16469)
Jay Krell [Wed, 28 Aug 2019 08:54:00 +0000 (01:54 -0700)]
[mini] Cleanup MONO_MMAP_32BIT. (mono/mono#16469)

- It _presumably_ means nothing on 32bit ARM and 32bit MIPS (was there mono/mips64?).
 - Leaving only PowerPC32 and PowerPC64 (in this vicinity).
   - It presumably means nothing on PowerPC32.
   - Leaving PowerPC64 as the only user in this vicinity -- is it needed?
- Notice this is varyingly absent on x86, arm64, amd64, s390x.
  Subject of another PR maybe.

Perhaps this was to enable the debugger to be 32bit against a 64bit target
on a biarch system, so it could do a cross-process manipulation of these pages?
That makes some sense on Windows at least.
(32bit debugger cannot debug 64bit target as of Vista, but that is using the Win32
"hard" debugger API. Mono could do otherwise).

There remains amd64 mono-codeman.c define ARCH_MAP_FLAGS MONO_MMAP_32BIT left alone.

Commit migrated from https://github.com/mono/mono/commit/0375acd7c8b1634a44477f2a561a10cd4d01858a

5 years agoMerge pull request mono/mono#16520 from vargaz/fix-llvm-2
Zoltan Varga [Wed, 28 Aug 2019 07:24:01 +0000 (03:24 -0400)]
Merge pull request mono/mono#16520 from vargaz/fix-llvm-2

[llvm] Fix ctlz intrinsics, they have 2 arguments.

Commit migrated from https://github.com/mono/mono/commit/162849f97202e8a24355fb77b01657b891436383

5 years agofix cast and signature for mono_rconv_u4
Bernhard Urban [Tue, 27 Aug 2019 19:20:17 +0000 (21:20 +0200)]
fix cast and signature for mono_rconv_u4

Commit migrated from https://github.com/mono/mono/commit/d6fa5ff9c6c482582149c93613468a0e0432d2af

5 years ago[amd64] use opcode emulation for fconv/rconv
Bernhard Urban [Tue, 27 Aug 2019 16:38:57 +0000 (09:38 -0700)]
[amd64] use opcode emulation for fconv/rconv

Commit migrated from https://github.com/mono/mono/commit/460bfa9beb5159156df2256766d738debeffe706

5 years ago[llvmaotcheck] require sse3 being available for regression tests
Bernhard Urban [Tue, 27 Aug 2019 16:37:46 +0000 (09:37 -0700)]
[llvmaotcheck] require sse3 being available for regression tests

Commit migrated from https://github.com/mono/mono/commit/8e6b967391533fbbe555e8aa83a5fdf501f81c36

5 years ago[arm] use opcode emulation for fconv/rconv
Bernhard Urban [Tue, 27 Aug 2019 12:47:54 +0000 (08:47 -0400)]
[arm] use opcode emulation for fconv/rconv

Commit migrated from https://github.com/mono/mono/commit/5b20322a84bac20433103ac06a59e654cf581485

5 years ago[arm] account only 4 bytes on stack for single precision arguments
Bernhard Urban [Tue, 27 Aug 2019 12:46:06 +0000 (08:46 -0400)]
[arm] account only 4 bytes on stack for single precision arguments

Fixes `test_0_arm64_small_stack_args` in gshared.cs when
* `test_0_arm64_small_stack_args` is compiled with LLVM
* `Foo3.Floats` is compiled with Mini

Commit migrated from https://github.com/mono/mono/commit/ba824cb9213670069b85ab397a7163a50e911ff6

5 years ago[arm64] use opcode emulation for fconv/rconv
Bernhard Urban [Mon, 26 Aug 2019 20:00:06 +0000 (16:00 -0400)]
[arm64] use opcode emulation for fconv/rconv

LLVM eagerly optimizes constants such as NaN in a way that does not align with .NET behaviour. In the future we can change it so that we only do opcode emulation when LLVM is used.

Fixes https://github.com/mono/mono/issues/16411

Commit migrated from https://github.com/mono/mono/commit/475defca4d4d24dc44c660244b645df5f33e20ac

5 years agoCleanup arm64 SeqPointInfo.
Jay Krell [Mon, 26 Aug 2019 06:05:18 +0000 (23:05 -0700)]
Cleanup arm64 SeqPointInfo.

Commit migrated from https://github.com/mono/mono/commit/645c01066c08adef6d302a25d1ed9db6047e3042

5 years agoInline mono_string_length_internal and mono_string_chars_internal (mono/mono#16374)
Jay Krell [Tue, 27 Aug 2019 21:39:18 +0000 (14:39 -0700)]
Inline mono_string_length_internal and mono_string_chars_internal (mono/mono#16374)

* Inline mono_string_length_internal and mono_string_chars_internal for everyone.

* Add MONO_REQ_GC_UNSAFE_MODE.

Commit migrated from https://github.com/mono/mono/commit/f516e79dd981e174ebf04fe81b76cdbec25f6b20

5 years agoUpdate version information in System.Private.CoreLib to mimic CoreCLR and make Benchm...
Filip Navara [Tue, 27 Aug 2019 20:55:37 +0000 (22:55 +0200)]
Update version information in System.Private.CoreLib to mimic CoreCLR and make BenchmarkDotNet happy (mono/mono#16515)

BenchmarkDotNet recently updated the algorithms for .NET version detection (https://github.com/dotnet/BenchmarkDotNet/pull/1230) which made it incompatible with the version presented by Mono.

This updates the value of [ProductName](https://github.com/dotnet/coreclr/blob/mono/mono@1f428dbc5554191dadd27511cd5cd181e4a60efb/Directory.Build.targets#L7) and [Version](https://github.com/dotnet/coreclr/blob/mono/mono@c9007e73286456434ba12744e778e87a89fc1d90/eng/Versions.props#L5) to match what CoreCLR is currently reporting and makes the [BDN detection code](https://github.com/dotnet/BenchmarkDotNet/blob/mono/mono@b6d0e0f1d80ed60aa157149a0dfb704a2da4ca41/src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs#L73-L81) happy.

Commit migrated from https://github.com/mono/mono/commit/f4145ce10815b2f4a1d585dbdf462aa17015aed1

5 years ago[netcore] Change exception thrown for SetTypedReference (mono/mono#16518)
Ryan Lucia [Tue, 27 Aug 2019 20:53:37 +0000 (16:53 -0400)]
[netcore] Change exception thrown for SetTypedReference (mono/mono#16518)

This brings us in line with CoreCLR behavior.

Commit migrated from https://github.com/mono/mono/commit/f9f5fff40c2012dc9631b7128d72c945620ce4fb

5 years ago[llvm] Fix ctlz intrinsics, they have 2 arguments.
Zoltan Varga [Tue, 27 Aug 2019 20:34:27 +0000 (16:34 -0400)]
[llvm] Fix ctlz intrinsics, they have 2 arguments.

Commit migrated from https://github.com/mono/mono/commit/340289d4aed8b8fe59379991d7b1320b419a2d36

5 years ago[llvm] Fix the mixing of LLVM modules in the llvm JIT, use ctx->lmodule instead of...
Zoltan Varga [Tue, 27 Aug 2019 20:31:18 +0000 (16:31 -0400)]
[llvm] Fix the mixing of LLVM modules in the llvm JIT, use ctx->lmodule instead of module->lmodule.

Commit migrated from https://github.com/mono/mono/commit/ab1e9be35e78e6a99f5e97cc6e1df514ddbdb8ab

5 years agoFix the netcore build. (mono/mono#16519)
Zoltan Varga [Tue, 27 Aug 2019 20:30:16 +0000 (16:30 -0400)]
Fix the netcore build. (mono/mono#16519)

Commit migrated from https://github.com/mono/mono/commit/44d33673a5d390e1f691967eb776c608d60b7a64

5 years agoMerge pull request mono/mono#16487 from vargaz/cattr-data-handles
Zoltan Varga [Tue, 27 Aug 2019 19:22:30 +0000 (15:22 -0400)]
Merge pull request mono/mono#16487 from vargaz/cattr-data-handles

[runtime] Convert mono_reflection_create_custom_attr_data_args () to use handles.

Commit migrated from https://github.com/mono/mono/commit/3108d4305174a015484aa0f77226e98ea13cb948

5 years agouse gunichar2
Egor Bogatov [Tue, 27 Aug 2019 17:21:51 +0000 (20:21 +0300)]
use gunichar2

Commit migrated from https://github.com/mono/mono/commit/e9dff75d2fb049f11fdcf595b68de1f3061bdeb7

5 years agoRemove AppContext.cs that was moved to shared
Alexander Köplinger [Mon, 26 Aug 2019 23:50:15 +0000 (01:50 +0200)]
Remove AppContext.cs that was moved to shared

Commit migrated from https://github.com/mono/mono/commit/f914d900f6fc639b25eca68432133fedd4f6297b

5 years ago[interp] Remove unnecessary recomputation (mono/mono#16509)
Vlad Brezae [Tue, 27 Aug 2019 17:27:22 +0000 (20:27 +0300)]
[interp] Remove unnecessary recomputation (mono/mono#16509)

Seems to have been added by mistake in https://github.com/mono/mono/pull/16317, which was meant just to remove the locals variable from InterpFrame.

Commit migrated from https://github.com/mono/mono/commit/ccc4bf853618649602691c6a10af59f80cd18466

5 years ago[interp] Error handling refactor (optimize non-exception path) (helps clang save...
Jay Krell [Tue, 27 Aug 2019 13:31:10 +0000 (06:31 -0700)]
[interp] Error handling refactor (optimize non-exception path) (helps clang save stack) (mono/mono#16371)

While working on stack reduction, I believe I found that
the compiler could not tell how THROW_EX and/or NULL_CHECK terminate.

That is, essentially, the success paths preserve volatile registers.
They do not have to be spilled/filled.
This tweak should make it clearer to the compiler, optimized common paths, and not slow down uncommon paths.

This also cleans it up a little and reduces macro expansion, and then possibly should allow for reinlining what is now used only once.

Also add some const so it can be casted away less.

Believed to save 32 bytes of stack with Linux/amd64/clang, nothing for gcc.
And a nice cleanup.

Commit migrated from https://github.com/mono/mono/commit/00c1ec421a3d47931bd9ad719faec62e60277837

5 years agoMerge pull request mono/mono#16493 from EgorBo/impl-lzcnt
Zoltan Varga [Tue, 27 Aug 2019 10:51:03 +0000 (06:51 -0400)]
Merge pull request mono/mono#16493 from EgorBo/impl-lzcnt

Implement System.Runtime.Intrinsics.X86.Lzcnt

Commit migrated from https://github.com/mono/mono/commit/fa1288794b5a38fa717d0f8db459386c3d4b3ad3

5 years agoFix multiple SGEN_LOG to correctly scale elapsed time in usec. (mono/mono#16485)
Johan Lorensson [Tue, 27 Aug 2019 10:14:12 +0000 (12:14 +0200)]
Fix multiple SGEN_LOG to correctly scale elapsed time in usec. (mono/mono#16485)

Several SGEN_LOG entries logged usec based on result returend from TV_ELAPSED.
On SGEN's implementation of TV_ELAPSED, the result is not scaled to usec
but returned as 100ns ticks. This was not handled correctly by SGEN_LOG,
but other measures, like profile counters and SGEN binary protocol handles
it correctly.

Fix will adjust the SGEN_LOG calls currently presenting usec to correctly
scale the result. Fix also adds one additional logging measuring total
amount of time spend scanning thread data.

Commit migrated from https://github.com/mono/mono/commit/70aba13173840818246b470e425a6d2585e7672d

5 years ago [interp] Replace imethod with frame->imethod. (mono/mono#16459)
Jay Krell [Tue, 27 Aug 2019 09:51:21 +0000 (02:51 -0700)]
 [interp] Replace imethod with frame->imethod. (mono/mono#16459)

This conserves stack on Linux/amd64/gcc.

Commit migrated from https://github.com/mono/mono/commit/bfe1b6182cb4e354f94d00d3206be4b83331db1d

5 years agoCodeManager cleanup: (mono/mono#16468)
Jay Krell [Tue, 27 Aug 2019 08:40:35 +0000 (01:40 -0700)]
CodeManager cleanup: (mono/mono#16468)

- Chunks do not need flags, only codemanagers do.
 - Sort by size to minimize padding for alignment.
 - Booleans only need one bit.
 - Chunk is not spelled chunck.
 - Suggest foo accessors be named foo() and set_foo(), not get_foo() and set_foo().
   i.e. the more common "get" is implied.
- Allow free(0) w/o initialization.

Commit migrated from https://github.com/mono/mono/commit/6cf8b6e73824545709cf6556726e0460bc7e2558

5 years ago[monodis] Combine adjacent identical cases. (mono/mono#16501)
Jay Krell [Tue, 27 Aug 2019 08:36:59 +0000 (01:36 -0700)]
[monodis] Combine adjacent identical cases. (mono/mono#16501)

Commit migrated from https://github.com/mono/mono/commit/9f9e5f7803b98494ca8773876c81e0cc582d679d