platform/upstream/dotnet/runtime.git
4 years agoVtable [i] can be null so this should be check before use it. (mono/mono#16733)
Thays Grazia [Mon, 9 Sep 2019 20:07:34 +0000 (17:07 -0300)]
Vtable [i] can be null so this should be check before use it. (mono/mono#16733)

Fixes mono/mono#16712

Commit migrated from https://github.com/mono/mono/commit/055818f3449b5176dcf0e4eb07491b2501112701

4 years ago[interp] Let compiler decide clear_resume_state inlining. (mono/mono#16704)
Jay Krell [Mon, 9 Sep 2019 17:31:37 +0000 (10:31 -0700)]
[interp] Let compiler decide clear_resume_state inlining. (mono/mono#16704)

Manual inlining shows no additional stack use any longer.

Commit migrated from https://github.com/mono/mono/commit/83f965eca5cda8dc8bfd01b969a1d1481faa6977

4 years ago[llvm] Mark Vector128/Vector256 types as SIMD.
Zoltan Varga [Thu, 22 Aug 2019 06:01:17 +0000 (02:01 -0400)]
[llvm] Mark Vector128/Vector256 types as SIMD.

These are not currently supported, but marking them as simd helps llvm eliminate dead variables with these types, since
XZERO is easier to eliminate than VZERO.

Commit migrated from https://github.com/mono/mono/commit/798af6613796fcbe11cf20a33a889705483197a7

4 years agoDefault to SAFEARRAY(VARIANT) as CCW argument for object[]. (mono/mono#16673)
Nikolay Sivov [Mon, 9 Sep 2019 17:02:46 +0000 (20:02 +0300)]
Default to SAFEARRAY(VARIANT) as CCW argument for object[]. (mono/mono#16673)

* [cominterop] Add a helper to create default marshal spec for ccw arguments.

* [cominterop] Default to SAFEARRAY(VARIANT) as CCW argument for object[].

* [cominterop] Fix build with --enable-cxx.

Commit migrated from https://github.com/mono/mono/commit/8590a25b301ec08ac688e93df37fe3ef3c2ddb11

4 years ago[interp] Embrace that ip is const guint16* and remove casts to that type, (mono/mono...
Jay Krell [Mon, 9 Sep 2019 15:06:16 +0000 (08:06 -0700)]
[interp] Embrace that ip is const guint16* and remove casts to that type, (mono/mono#16708)

[interp] Embrace that ip is const guint16* and remove casts to that type.

or to gint16*. Or is there a reason for this style?

Maybe could change type but still want to cast for the deref?

Commit migrated from https://github.com/mono/mono/commit/1f76ab9270db6db36481bbfde99a7e90256b70f9

4 years ago[interp] Defer local offset allocation to compacted emit phase (mono/mono#16714)
Vlad Brezae [Mon, 9 Sep 2019 14:10:50 +0000 (17:10 +0300)]
[interp] Defer local offset allocation to compacted emit phase (mono/mono#16714)

Before this commit, the only information associated with a local was just the offset at which it resides and instructions had this offset embedded from the start. This makes it awkward to have data structures indexed on the local, or have additional information per local, which we might care at some point (for example if it is multi basic block local, if the address of the local was taken etc). In addition to this, if we will want to remove some instructions that make some locals dead, it means that we will have to compact the whole locals space and update all the offsets referenced by all instructions. We solve all these problems by resolving (and allocating) the local offset at the latest time, while emitting the instruction in the compacted byte stream. At this point dead locals will remain dead, with no additional work needed to handle them.

For now, IL locals of the current method that we are compiling are immortal. We can address that later if needed.

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

4 years ago[netcore] Tweak inlining heurestic for memcpy
Filip Navara [Sat, 31 Aug 2019 16:30:16 +0000 (18:30 +0200)]
[netcore] Tweak inlining heurestic for memcpy

Commit migrated from https://github.com/mono/mono/commit/320f91129dbc839ccd19154ea687945aa0ce2a77

4 years ago[netcore][x64] Implement lowering of new SIMD OPs into SSE opcodes (mono/mono#16672)
Filip Navara [Sun, 8 Sep 2019 19:57:21 +0000 (21:57 +0200)]
[netcore][x64] Implement lowering of new SIMD OPs into SSE opcodes (mono/mono#16672)

* [netcore][x64] Implement lowering of new SIMD OPs into SSE2 or SSE4.1 opcodes.

* Implement LZCNT/POPCNT in mini JIT

* Fix C++ build

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

4 years ago[interp] Fix debug build. (mono/mono#16720)
Jay Krell [Sun, 8 Sep 2019 06:25:33 +0000 (23:25 -0700)]
[interp] Fix debug build. (mono/mono#16720)

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

4 years ago[interp] Fix recent warnings I added. (mono/mono#16722)
Jay Krell [Sat, 7 Sep 2019 19:30:48 +0000 (12:30 -0700)]
[interp] Fix recent warnings I added. (mono/mono#16722)

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

4 years ago[interp] Assign sp once is enough in leave. (mono/mono#16694)
Jay Krell [Sat, 7 Sep 2019 01:48:15 +0000 (18:48 -0700)]
[interp] Assign sp once is enough in leave. (mono/mono#16694)

Move vt_sp there too.

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

4 years agoRemove accidentally committed debug line
Alexis Christoforides [Fri, 6 Sep 2019 18:27:57 +0000 (14:27 -0400)]
Remove accidentally committed debug line

Commit migrated from https://github.com/mono/mono/commit/18fb728c65b806285454af7ef3da0faa7c7160db

4 years ago[jit][llvm] Track variable nullness separately from array length ranges/index ranges...
imhameed [Fri, 6 Sep 2019 12:55:21 +0000 (05:55 -0700)]
[jit][llvm] Track variable nullness separately from array length ranges/index ranges in abcrem. (mono/mono#16499)

* [jit][llvm] Track variable nullness separately from array length ranges/index ranges in abcrem.

"Nullness" is tracked via a separate field that is stored adjacent
variable/array value ranges; values may be "maybe-null" or "not-null";
the intersection of maybe-null and not-null yields not-null, the union of
maybe-null and not-null yields maybe-null. The existing graph traversal logic
is reused as much as possible, which makes the implementation of this
null value approximation slightly more complicated than it would be
otherwise.

Fixes https://github.com/mono/mono/issues/16310, which was caused by
the use of non-empty array length ranges as a way to encode non-null
values.

This also allows null check elision for zero-sized arrays.

* Fix C++ compatibility. Fix a typo in a comment.

* Add symmetric nullness relations.

* Make ldlen imply that the source register is not-null, similar to CHECK_THIS or any other null check.

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

4 years ago[metadata] Fix leaks when handling a few attributes (mono/mono#16675)
Vlad Brezae [Fri, 6 Sep 2019 07:31:39 +0000 (10:31 +0300)]
[metadata] Fix leaks when handling a few attributes (mono/mono#16675)

Callers of mono_reflection_create_custom_attr_data_args_noalloc were leaking some of the returned information. Accessed attributes are FixedBufferAttribute and UnmanagedFunctionPointerAttribute.

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

4 years ago[debugger][android] It was not initialising seq_points on MonoCompile on Android...
Thays Grazia [Fri, 6 Sep 2019 01:16:50 +0000 (22:16 -0300)]
[debugger][android] It was not initialising seq_points on MonoCompile on Android, so when was compiling dynamic methods, seq_points wasn't created and we got the assert when try to single step. (mono/mono#16691)

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

4 years ago[interp] Kill InterpFrame.ex (mono/mono#16666)
Vlad Brezae [Thu, 5 Sep 2019 20:10:13 +0000 (23:10 +0300)]
[interp] Kill InterpFrame.ex (mono/mono#16666)

* [interp] Reduce unnecessary uses of frame->ex

* [interp] Remove ex from InterpFrame

We save stack space and move the exception where it belongs, in ThreadContext. It was confusing what frame->ex really meant, it was probably not used / initialized properly. We move it now to ThreadContext where it represents the current exception being thrown during EH (when we have a resume state set).

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

4 years ago[netcore] Bump CoreFX, core-setup dependencies (mono/mono#16681)
Filip Navara [Thu, 5 Sep 2019 18:03:47 +0000 (20:03 +0200)]
[netcore] Bump CoreFX, core-setup dependencies (mono/mono#16681)

* [netcore] Bump CoreFX, core-setup dependencies

* Update .deps.json hacks

* Update test exclusions

Commit migrated from https://github.com/mono/mono/commit/673c8835fd90c5aa05a8836fcfcf24711d456fc7

4 years ago[interp] Localize endfinally_ip to leave, and it cannot be null (barring (mono/mono...
Jay Krell [Thu, 5 Sep 2019 17:46:12 +0000 (10:46 -0700)]
[interp] Localize endfinally_ip to leave, and it cannot be null (barring (mono/mono#16676)

[interp] Localize endfinally_ip to leave, and it cannot likely be null (unless offset carefully formed).

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

4 years agoFix distclean (mono/mono#16667)
Jo Shields [Thu, 5 Sep 2019 17:25:48 +0000 (13:25 -0400)]
Fix distclean (mono/mono#16667)

* Disable `subdir-objects` mode in Automake

This forces creation of subdirectories' files (e.g. .deps/*.Plo) in the
parent directory listing the source file. This works around a situation
where two different files specify files in a different parent directory
(i.e. ../../support/adler32.c in mono/metadata/ and adler32.c in
support/) both emit files into the same place (support/.deps), causing
`make distclean` to try and delete support/.deps from two different
places, breaking distclean.

This unfortunately adds a pile of Automake warnings, during autogen.

The "correct" fix is to stop specifying zlib as a pile of flat .c files,
and instead put it in its own subdirectory, conditionally including
its .la files as required.

Partially fixes https://github.com/mono/mono/issues/16605

* Ship netcore/Makefile with an empty distclean rule

We need a netcore/ directory because we write to it during configure,
and we need a netcore/Makefile with a distclean rule, so top-level
recursive distclean doesn't fail. So specify both here.

Partially fixes https://github.com/mono/mono/issues/16605

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

4 years agoRemove redundant function call of EscapeTypeName to make (mono/mono#16425)
Fan Yang [Thu, 5 Sep 2019 16:12:57 +0000 (12:12 -0400)]
Remove redundant function call of EscapeTypeName to make  (mono/mono#16425)

* Remove redundant function call

* Remove commented out line of code

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

4 years ago[interp] Remove unused parameter to ves_pinvoke_method. (mono/mono#16677)
Jay Krell [Thu, 5 Sep 2019 15:30:59 +0000 (08:30 -0700)]
[interp] Remove unused parameter to ves_pinvoke_method. (mono/mono#16677)

[interp] Remove unused parameter to ves_pinvoke_method.

It might actually cause stack pressure (but on its own, this PR does not save stack).

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

4 years ago[netcore] Fix the range checks for Vector.CopyTo(). (mono/mono#16663)
Zoltan Varga [Thu, 5 Sep 2019 11:55:53 +0000 (07:55 -0400)]
[netcore] Fix the range checks for Vector.CopyTo(). (mono/mono#16663)

* [netcore] Fix the range checks for Vector.CopyTo().

* [netcore] Fix Vector.get_Item () for u1/u2, the llvm type is a vector of i1/i2, so we need to zero extend.

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

4 years ago[llvm] Use branch weight metadata in some cases. (mono/mono#16668)
Zoltan Varga [Wed, 4 Sep 2019 22:17:07 +0000 (18:17 -0400)]
[llvm] Use branch weight metadata in some cases. (mono/mono#16668)

* [llvm] Add functions to create weighted branches.

* [llvm] Use weighted branches in GC_SAFE_POINT, some llvm passes doesn't seem to recognize llvm.expect so the LLVM JIT generates the slow inline.

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

4 years agoTake stars out of types where they make more sense.
Jay Krell [Tue, 3 Sep 2019 22:47:18 +0000 (15:47 -0700)]
Take stars out of types where they make more sense.

Co-Authored-By: Larry Ewing <lewing@microsoft.com>
Commit migrated from https://github.com/mono/mono/commit/1f21aae8cb410fb4c6e695489a27eae9d22e265d

4 years agoTake stars out of types where they make more sense.
Jay Krell [Tue, 3 Sep 2019 22:46:35 +0000 (15:46 -0700)]
Take stars out of types where they make more sense.

Co-Authored-By: Larry Ewing <lewing@microsoft.com>
Commit migrated from https://github.com/mono/mono/commit/9fc2ade131f7c2ca7b176854b7891a998065c832

4 years agoTake stars out of types where they make more sense.
Jay Krell [Tue, 3 Sep 2019 22:46:16 +0000 (15:46 -0700)]
Take stars out of types where they make more sense.

Co-Authored-By: Larry Ewing <lewing@microsoft.com>
Commit migrated from https://github.com/mono/mono/commit/4359ad66d0621afc79b4f46174a8a20acb418905

4 years agoTake stars out of types where they make more sense.
Jay Krell [Tue, 3 Sep 2019 22:45:52 +0000 (15:45 -0700)]
Take stars out of types where they make more sense.

Co-Authored-By: Larry Ewing <lewing@microsoft.com>
Commit migrated from https://github.com/mono/mono/commit/e25d2e55360d6b108a51d823c45aaaae766e0923

4 years agoTake stars out of types where they make more sense.
Jay Krell [Tue, 3 Sep 2019 22:45:36 +0000 (15:45 -0700)]
Take stars out of types where they make more sense.

Co-Authored-By: Larry Ewing <lewing@microsoft.com>
Commit migrated from https://github.com/mono/mono/commit/557645fea31c4d58987940711ca3b5ce85c7bcf9

4 years agoTake stars out of types where they make more sense.
Jay Krell [Tue, 3 Sep 2019 22:45:14 +0000 (15:45 -0700)]
Take stars out of types where they make more sense.

Co-Authored-By: Larry Ewing <lewing@microsoft.com>
Commit migrated from https://github.com/mono/mono/commit/b3f996d45d1711e0b6b0b76d15ff78665b113a96

4 years agoTake stars out of types where they make more sense.
Jay Krell [Tue, 3 Sep 2019 22:44:59 +0000 (15:44 -0700)]
Take stars out of types where they make more sense.

Co-Authored-By: Larry Ewing <lewing@microsoft.com>
Commit migrated from https://github.com/mono/mono/commit/8232c85e4c1e0e9d812513cb2221e19fafe41591

4 years agoTake stars out of types where they make more sense.
Jay Krell [Tue, 3 Sep 2019 22:44:43 +0000 (15:44 -0700)]
Take stars out of types where they make more sense.

Co-Authored-By: Larry Ewing <lewing@microsoft.com>
Commit migrated from https://github.com/mono/mono/commit/bd9ae10c7cf657e676e89eba88384e1739de6775

4 years agomore star placement
Jay Krell [Tue, 3 Sep 2019 22:43:44 +0000 (15:43 -0700)]
more star placement

Co-Authored-By: Larry Ewing <lewing@microsoft.com>
Commit migrated from https://github.com/mono/mono/commit/b071aa91925a8d5db5a4648c162b397dde383142

4 years agoMove stars to sometimes but not always onventional and wierd location. C syntax exper...
Jay Krell [Tue, 3 Sep 2019 22:43:13 +0000 (15:43 -0700)]
Move stars to sometimes but not always onventional and wierd location. C syntax experiment takes it toll for decades on.

Co-Authored-By: Larry Ewing <lewing@microsoft.com>
Commit migrated from https://github.com/mono/mono/commit/46ea28c95b5cdd9c573f3eb0c0446050c6ed3eaa

4 years agoMove stars to conventional but wierd place.
Jay Krell [Tue, 3 Sep 2019 22:42:20 +0000 (15:42 -0700)]
Move stars to conventional but wierd place.

Co-Authored-By: Larry Ewing <lewing@microsoft.com>
Commit migrated from https://github.com/mono/mono/commit/90e256352383aa3dca659f8bedf9f12fcb52dc6f

4 years agoUpdate mono/eglib/gmodule-win32.c
Jay Krell [Tue, 3 Sep 2019 22:41:54 +0000 (15:41 -0700)]
Update mono/eglib/gmodule-win32.c

Co-Authored-By: Larry Ewing <lewing@microsoft.com>
Commit migrated from https://github.com/mono/mono/commit/b8313d586aa875bd4c0916b8e52ca960d02a5739

4 years agoUpdate mono/eglib/glib.h
Jay Krell [Tue, 3 Sep 2019 22:41:11 +0000 (15:41 -0700)]
Update mono/eglib/glib.h

Co-Authored-By: Larry Ewing <lewing@microsoft.com>
Commit migrated from https://github.com/mono/mono/commit/d0817ccdc6492665fd57ca678d5fc55a216287fb

4 years agoRemove unnecessary cast.
Jay Krell [Tue, 3 Sep 2019 18:27:00 +0000 (11:27 -0700)]
Remove unnecessary cast.

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

4 years agoAllocate MAX_PATH to start, but it usually wastes memory.
Jay Krell [Tue, 3 Sep 2019 18:26:06 +0000 (11:26 -0700)]
Allocate MAX_PATH to start, but it usually wastes memory.
Double later for clarity.

Commit migrated from https://github.com/mono/mono/commit/595b66c0ebe530054895f2c74bcd4212e77536b9

4 years agoFix C++?
Jay Krell [Fri, 30 Aug 2019 00:35:08 +0000 (17:35 -0700)]
Fix C++?

Commit migrated from https://github.com/mono/mono/commit/8723e49b0efa61d15e2eda74a90ac8a8f7a91b2e

4 years agocleanup
Jay Krell [Thu, 29 Aug 2019 18:47:58 +0000 (11:47 -0700)]
cleanup

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

4 years agoTest invalid module.
Jay Krell [Thu, 29 Aug 2019 18:44:13 +0000 (11:44 -0700)]
Test invalid module.

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

4 years agoSkip psapi.dll and go right to the Windows 7 or newer versions in kernel32.dll.
Jay Krell [Thu, 29 Aug 2019 18:36:13 +0000 (11:36 -0700)]
Skip psapi.dll and go right to the Windows 7 or newer versions in kernel32.dll.

Commit migrated from https://github.com/mono/mono/commit/74f1312cd395dcb37d1123a5be6ea493c52a3053

4 years agoRemove cast.
Jay Krell [Thu, 29 Aug 2019 18:29:11 +0000 (11:29 -0700)]
Remove cast.

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

4 years agocomments
Jay Krell [Thu, 29 Aug 2019 18:03:52 +0000 (11:03 -0700)]
comments

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

4 years agoRemove accident.
Jay Krell [Thu, 29 Aug 2019 16:53:12 +0000 (09:53 -0700)]
Remove accident.

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

4 years agoMAX_PATH reduction.
Jay Krell [Thu, 29 Aug 2019 13:07:16 +0000 (06:07 -0700)]
MAX_PATH reduction.

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

4 years agoTweak names and fix preexisting leak under low memory.
Jay Krell [Sat, 31 Aug 2019 18:46:33 +0000 (11:46 -0700)]
Tweak names and fix preexisting leak under low memory.

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

4 years ago[Coop] GetStackTraces.
Jay Krell [Fri, 30 Aug 2019 03:45:59 +0000 (20:45 -0700)]
[Coop] GetStackTraces.

Commit migrated from https://github.com/mono/mono/commit/14afe79a0ab064ea769025ded95ae961e8df8247

4 years agoImplement more Math LLVM intrinsics (mono/mono#16578)
Egor Bogatov [Wed, 4 Sep 2019 13:54:52 +0000 (16:54 +0300)]
Implement more Math LLVM intrinsics (mono/mono#16578)

* Implement more Math intrinsics

* Test on CI

* Update pipeline-netcore-runtime.yml

* undo "test on CI"

Commit migrated from https://github.com/mono/mono/commit/30625b25df4e3d83f6abb30cea2bd57ff0c49539

4 years ago[Coop] ves_icall_System_IOSelector_Add
Jay Krell [Tue, 3 Sep 2019 23:07:29 +0000 (16:07 -0700)]
[Coop] ves_icall_System_IOSelector_Add

Commit migrated from https://github.com/mono/mono/commit/350dd0e2de44a8ea0cfde38fdd3fb6747481e869

4 years agoThrow NRE if src or dst in Memmove are nulls (mono/mono#16650)
Egor Bogatov [Wed, 4 Sep 2019 09:01:53 +0000 (12:01 +0300)]
Throw NRE if src or dst in Memmove are nulls (mono/mono#16650)

Commit migrated from https://github.com/mono/mono/commit/1558316cecdf7186a3b792b021304c6356079bfe

4 years ago[netcore] Fix the exception thrown by the Vector<T>.CopyTo() intrinsic. (mono/mono...
Zoltan Varga [Wed, 4 Sep 2019 08:57:39 +0000 (04:57 -0400)]
[netcore] Fix the exception thrown by the Vector<T>.CopyTo() intrinsic. (mono/mono#16618)

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

Commit migrated from https://github.com/mono/mono/commit/55ac86fe8bd738a50b2c7c63cb620f535f328dcf

4 years agoFix overly sensitive g_ascii_strncasecmp tests.
Jay Krell [Sat, 20 Jul 2019 07:18:29 +0000 (00:18 -0700)]
Fix overly sensitive g_ascii_strncasecmp tests.

Commit migrated from https://github.com/mono/mono/commit/82d4d8d81d5a5d9eefaec7bac09e9eb9cd2ce32f

4 years agoAdd g_asciiz_equal_caseinsensitive, g_ascii_equal_caseinsensitive, g_asciiz_equal.
Jay Krell [Sat, 20 Jul 2019 07:17:23 +0000 (00:17 -0700)]
Add g_asciiz_equal_caseinsensitive, g_ascii_equal_caseinsensitive, g_asciiz_equal.
The default takes a length.
"z" means zero terminated, the usually slower not preferred.

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

4 years agoCleanup and augment string handling based on https://github.com/mono/mono/pull/15522.
Jay Krell [Wed, 3 Jul 2019 02:55:10 +0000 (19:55 -0700)]
Cleanup and augment string handling based on https://github.com/mono/mono/pull/15522.

1. When comparing strings, check pointer equality.
Faster when they match, slower when they do not.

2. Provide string lowercasing into a provided buffer, which can equal
the input, to avoid extra malloc/free.

3. define G_STRING_CONSTANT_AND_LENGTH(x) (x), G_N_ELEMENTS (x) - 1
e.g. strncmp (foo, G_STRING_CONSTANT_AND_LENGTH ("version"))

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

4 years ago[netcore] Enable Vector<T>.get_Item () intrinsics for floats/doubles.
Zoltan Varga [Tue, 3 Sep 2019 21:14:50 +0000 (17:14 -0400)]
[netcore] Enable Vector<T>.get_Item () intrinsics for floats/doubles.

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

4 years ago[netcore] Disable socket support to fix warnings.
Zoltan Varga [Sun, 1 Sep 2019 11:30:07 +0000 (07:30 -0400)]
[netcore] Disable socket support to fix warnings.

Commit migrated from https://github.com/mono/mono/commit/4107a1538993b75e08f5ed062a27bb76dfd20c5a

4 years agoDebugging
Alexis Christoforides [Sat, 31 Aug 2019 00:42:49 +0000 (20:42 -0400)]
Debugging

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

4 years ago[merp] Fix logic of 'is_managed' attribute
Alexis Christoforides [Sat, 31 Aug 2019 00:41:15 +0000 (20:41 -0400)]
[merp] Fix logic of 'is_managed' attribute

Commit migrated from https://github.com/mono/mono/commit/4840f4161f75d55462234cc07959e354075d4269

4 years agoFix pointing to stack on string && some add tracing
Alexis Christoforides [Fri, 30 Aug 2019 19:57:03 +0000 (15:57 -0400)]
Fix pointing to stack on string && some add tracing

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

4 years agoGuard writing to out_module
Alexis Christoforides [Fri, 30 Aug 2019 13:03:42 +0000 (09:03 -0400)]
Guard writing to out_module

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

4 years agoUpdate MONO_CORLIB_VERSION
Alexis Christoforides [Thu, 29 Aug 2019 16:19:37 +0000 (12:19 -0400)]
Update MONO_CORLIB_VERSION

Commit migrated from https://github.com/mono/mono/commit/1b66666cc7d74a5e416483cbfcf8611df091233e

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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