platform/upstream/coreclr.git
8 years agoUpdate buildtools version for test builds
Rahul Kumar [Mon, 1 Feb 2016 21:51:15 +0000 (13:51 -0800)]
Update buildtools version for test builds

8 years agoMerge pull request #2951 from Dmitry-Me/dontAccessDeletedObject
Jan Kotas [Mon, 1 Feb 2016 16:39:26 +0000 (08:39 -0800)]
Merge pull request #2951 from Dmitry-Me/dontAccessDeletedObject

Don't access deleted object, return proper error code

8 years agoDon't access deleted object, return proper error code
Dmitry-Me [Mon, 1 Feb 2016 10:40:05 +0000 (13:40 +0300)]
Don't access deleted object, return proper error code

8 years agoMerge pull request #2949 from Dmitry-Me/castToMostDerivedInterface
Jan Kotas [Mon, 1 Feb 2016 09:59:42 +0000 (01:59 -0800)]
Merge pull request #2949 from Dmitry-Me/castToMostDerivedInterface

Fix cast to interface other than the most derived one

8 years agoMerge pull request #2950 from jkotas/WIN32
Jan Kotas [Mon, 1 Feb 2016 09:58:33 +0000 (01:58 -0800)]
Merge pull request #2950 from jkotas/WIN32

Stop defining WIN32 in Unix builds

8 years agoStop defining WIN32 in Unix builds
Jan Kotas [Mon, 1 Feb 2016 07:42:27 +0000 (23:42 -0800)]
Stop defining WIN32 in Unix builds

WIN32 was defined for 32-bit Unix builds in number of places which is incorrect. It caused build break in lldb header since they use WIN32 define for Windows-specific code.

8 years agoFix cast to interface other than the most derived one
Dmitry-Me [Mon, 1 Feb 2016 07:06:35 +0000 (10:06 +0300)]
Fix cast to interface other than the most derived one

8 years agoMerge pull request #2948 from krytarowski/netbsd-support-22
Jan Kotas [Mon, 1 Feb 2016 05:42:44 +0000 (21:42 -0800)]
Merge pull request #2948 from krytarowski/netbsd-support-22

Fix build on NetBSD, casting pointer to function to pointer to data

8 years agoMerge pull request #2933 from stephentoub/enum_parse
Jan Kotas [Mon, 1 Feb 2016 05:15:27 +0000 (21:15 -0800)]
Merge pull request #2933 from stephentoub/enum_parse

Improve performance of Enum.Parse/TryParse

8 years agoFix build on NetBSD, casting pointer to function to pointer to data
Kamil Rytarowski [Mon, 1 Feb 2016 02:57:17 +0000 (03:57 +0100)]
Fix build on NetBSD, casting pointer to function to pointer to data

/tmp/pkgsrc-tmp/wip/coreclr-git/work/coreclr/src/vm/method.cpp:5196:16: error: cannot initialize return object of type 'LPVOID' (aka 'void *') with an rvalue of type 'FARPROC' (aka 'long (*)()')
        return GetProcAddress(hMod, (LPCSTR)(size_t)((UINT16)ordinal));
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

8 years agoImprove performance of Enum.Parse/TryParse
stephentoub [Sat, 30 Jan 2016 19:43:54 +0000 (11:43 -0800)]
Improve performance of Enum.Parse/TryParse

The allocation profile of Enum.Parse today is fairly poor.  While the design of the method returning an Enum requires at least one allocation for the boxed result (the generic TryParse could be overhauled to avoid this, but still has it), additional allocations shouldn't be necessary in the common cases.  However, for some reason the current code is boxing a 0 on every call.  It's also using string.Trim() to remove whitespace (once for the overall string and then once for each substring), and using String.Split to parse multiple values, which ends up allocating a string[] and an int[] even if there's only one value.

This commit removes all allocations from Enum.Parse other than the boxing of the Enum result and some allocations on the code path where Enum.Parse is handed a string containing a number, in which case additional allocations are involved in using the Convert.ChangeType call.

With an enum like:
```C#
[Flags]
enum Colors
{
    Red = 0x1,
    Orange = 0x2,
    Yellow = 0x4,
    Green = 0x8,
    Blue = 0x10
}
```
using ```Enum.Parse(typeof(Color), "Red")``` repeatedly now results in 5x fewer gen0 GCs and is ~15% faster.  Using ```Enum.Parse(typeof(Color), "Red, Orange, Yellow, Green, Blue")``` repeatedly now results in 23x fewer gen0 GCs is is similarly ~15% faster.

8 years agoMerge pull request #2940 from krytarowski/netbsd-support-18
Jan Kotas [Mon, 1 Feb 2016 01:52:46 +0000 (17:52 -0800)]
Merge pull request #2940 from krytarowski/netbsd-support-18

NetBSD requires <stdarg.h> for variable argument lists in output.inl

8 years agoMerge pull request #2943 from krytarowski/netbsd-support-20
Jan Kotas [Mon, 1 Feb 2016 01:52:25 +0000 (17:52 -0800)]
Merge pull request #2943 from krytarowski/netbsd-support-20

NetBSD doesn't ship with SI_KERNEL

8 years agoMerge pull request #2946 from krytarowski/netbsd-support-21
Jan Kotas [Mon, 1 Feb 2016 01:49:16 +0000 (17:49 -0800)]
Merge pull request #2946 from krytarowski/netbsd-support-21

NetBSD: Disable check for minimal stack size for undefined PTHREAD_ST…

8 years agoNetBSD: Disable check for minimal stack size for undefined PTHREAD_STACK_MIN
Kamil Rytarowski [Mon, 1 Feb 2016 00:10:41 +0000 (01:10 +0100)]
NetBSD: Disable check for minimal stack size for undefined PTHREAD_STACK_MIN

An alternative would be 'sysconf(_SC_THREAD_STACK_MIN)', but it might be no
good reason to prohibit single page stack size (PAGE_SIZE).

8 years agoMerge pull request #2520 from sperling/profiler
Jan Kotas [Sun, 31 Jan 2016 22:23:12 +0000 (14:23 -0800)]
Merge pull request #2520 from sperling/profiler

Enabling profiling on Unix/OS X

8 years agoNetBSD requires <stdarg.h> for variable argument lists in output.inl
Kamil Rytarowski [Sun, 31 Jan 2016 10:17:48 +0000 (11:17 +0100)]
NetBSD requires <stdarg.h> for variable argument lists in output.inl

8 years agoNetBSD doesn't ship with SI_KERNEL
Kamil Rytarowski [Sun, 31 Jan 2016 19:23:08 +0000 (20:23 +0100)]
NetBSD doesn't ship with SI_KERNEL

SI_KERNEL is available in Linux and FreeBSD. It's unspecified what does it mean.

Linux:
  #define SI_KERNEL       0x80            /* sent by the kernel from somewhere */

  -- include/uapi/asm-generic/siginfo.h

FreeBSD:
                    SI_KERNEL            signal generated by miscellaneous
                                         parts of the kernel
  -- siginfo(3)

8 years agoEnabling profiling on Unix/OS X.
Andreas Strid [Mon, 21 Dec 2015 14:33:18 +0000 (15:33 +0100)]
Enabling profiling on Unix/OS X.

8 years agoMerge pull request #2939 from krytarowski/netbsd-support-17
Jan Kotas [Sun, 31 Jan 2016 15:31:07 +0000 (07:31 -0800)]
Merge pull request #2939 from krytarowski/netbsd-support-17

NetBSD doesn't ship with <machine/npx.h>.

8 years agoMerge pull request #2938 from krytarowski/netbsd-support-16
Jan Kotas [Sun, 31 Jan 2016 15:30:24 +0000 (07:30 -0800)]
Merge pull request #2938 from krytarowski/netbsd-support-16

NetBSD defines _lwp_self(2) in <lwp.h>

8 years agoMerge pull request #2935 from jkotas/arm-fixes
Jan Kotas [Sun, 31 Jan 2016 15:22:30 +0000 (07:22 -0800)]
Merge pull request #2935 from jkotas/arm-fixes

Fix build breaks in Linux ARM port

8 years agoNetBSD doesn't ship with <machine/npx.h>.
Kamil Rytarowski [Sun, 31 Jan 2016 09:59:53 +0000 (10:59 +0100)]
NetBSD doesn't ship with <machine/npx.h>.

This is first step towards stopping to assume that HAVE_BSD_REGS_T implies
FreeBSD-style code. This breaks on NetBSD in several places.

Perhaps HAVE_BSD_REGS_T should be renamed to HAVE_FREEBSD_REGS_T.

Check headers with this fashion:
- FreeBSD requires <sys/types.h> for <machine/npx.h>
- FreeBSD requires <sys/cdefs.h> for <machine/reg.h>
- NetBSD doesn't need extra includes for <machine/reg.h>
- NetBSD requires <sys/param.h> before inclusion of <sys/cdefs.h>

8 years agoIntroduce central location for turning FEATURE_EVENT_TRACE on/off
Jan Kotas [Sun, 31 Jan 2016 01:33:29 +0000 (17:33 -0800)]
Introduce central location for turning FEATURE_EVENT_TRACE on/off

Turn FEATURE_EVENT_TRACE on for x64 Linux only. aarch64 and arm do not
have working lttng in their ubuntu/debian repos. We can expand to other
platforms in the future as they become supported.

8 years agoNetBSD defines _lwp_self(2) in <lwp.h>
Kamil Rytarowski [Sun, 31 Jan 2016 09:49:09 +0000 (10:49 +0100)]
NetBSD defines _lwp_self(2) in <lwp.h>

The _lwp_self(2) function prototype is missing in <sys/lwp.h>.

It's not sufficient to include <sys/lwp.h> or <lwp.h> -- as they are not
including one the other. We need to check for both headers and include them
both.

NAME
     _lwp_self - get light-weight process identification

LIBRARY
     Standard C Library (libc, -lc)

SYNOPSIS
     #include <lwp.h>

     lwpid_t
     _lwp_self(void);

DESCRIPTION
     _lwp_self() returns the LWP ID of the calling LWP.

8 years agoCleanup top-level defines
Jan Kotas [Sun, 31 Jan 2016 04:54:03 +0000 (20:54 -0800)]
Cleanup top-level defines

- Delete left-over cruft from internal build
- Move Windows-specific defines under WIN32

8 years agoMerge pull request #2936 from dotnet/revert-2931-glob-revert
Jan Kotas [Sun, 31 Jan 2016 05:33:12 +0000 (21:33 -0800)]
Merge pull request #2936 from dotnet/revert-2931-glob-revert

Revert "Revert "Add un-prefixed signatures as temporary workaround""

8 years agoRevert "Revert "Add un-prefixed signatures as temporary workaround""
Jan Kotas [Sun, 31 Jan 2016 05:31:34 +0000 (21:31 -0800)]
Revert "Revert "Add un-prefixed signatures as temporary workaround""

8 years agoAdd missing files for ARM legacy JIT
Jan Kotas [Sun, 31 Jan 2016 01:40:53 +0000 (17:40 -0800)]
Add missing files for ARM legacy JIT

8 years agoMerge pull request #2934 from dotnet-bot/from-tfs
Jan Kotas [Sun, 31 Jan 2016 01:29:57 +0000 (17:29 -0800)]
Merge pull request #2934 from dotnet-bot/from-tfs

Merge changes from TFS

8 years agoFix build break in internal build
Jan Kotas [Sat, 30 Jan 2016 22:59:46 +0000 (14:59 -0800)]
Fix build break in internal build

[tfs-changeset: 1570568]

8 years agoMerge pull request #2931 from jkotas/glob-revert
Jan Kotas [Sat, 30 Jan 2016 19:38:18 +0000 (11:38 -0800)]
Merge pull request #2931 from jkotas/glob-revert

Revert "Add un-prefixed signatures as temporary workaround"

8 years agoMerge pull request #2922 from rahku/updateBuildTools
Jan Kotas [Sat, 30 Jan 2016 16:12:16 +0000 (08:12 -0800)]
Merge pull request #2922 from rahku/updateBuildTools

update version of buildtools

8 years agoRevert "Add un-prefixed signatures as temporary workaround"
Jan Kotas [Sat, 30 Jan 2016 16:10:25 +0000 (08:10 -0800)]
Revert "Add un-prefixed signatures as temporary workaround"

This reverts commit 6b1d2938ec4a5a2c64fd849797ec7800ed3ab575.

8 years agoMerge pull request #2902 from wtgodbe/disableTests
Sergiy Kuryata [Sat, 30 Jan 2016 00:57:21 +0000 (16:57 -0800)]
Merge pull request #2902 from wtgodbe/disableTests

Disable failing pri 1 tests that are unsupported outside of Windows

8 years agoMerge pull request #2928 from BruceForstall/FixArm
Bruce Forstall [Sat, 30 Jan 2016 00:53:36 +0000 (16:53 -0800)]
Merge pull request #2928 from BruceForstall/FixArm

Fix ARM JIT

8 years agoMerge pull request #2923 from briansull/issue_2849
Brian Sullivan [Sat, 30 Jan 2016 00:47:55 +0000 (16:47 -0800)]
Merge pull request #2923 from briansull/issue_2849

Fix for Issue 2849 - Assertion failed 'parent->OperGet() != GT_LDOBJ'

8 years agoFix ARM JIT
Bruce Forstall [Fri, 29 Jan 2016 23:57:48 +0000 (15:57 -0800)]
Fix ARM JIT

During a previous code cleanup, an assert condition was incorrectly inverted.

8 years agoMerge pull request #2924 from wtgodbe/pri1
William Godbe [Fri, 29 Jan 2016 23:46:25 +0000 (15:46 -0800)]
Merge pull request #2924 from wtgodbe/pri1

Switch ubuntu PR tests from Release to Checked, and run Pri 1 tests on each commit

8 years agoSwitch ubuntu PR tests from Release to Checked, and run Pri 1 tests on each commit
William Godbe [Fri, 29 Jan 2016 22:26:13 +0000 (14:26 -0800)]
Switch ubuntu PR tests from Release to Checked, and run Pri 1 tests on each commit

8 years agoMerge pull request #2917 from jkotas/globalization
Jan Kotas [Fri, 29 Jan 2016 23:05:57 +0000 (15:05 -0800)]
Merge pull request #2917 from jkotas/globalization

Unique names for GlobalizationNative exports

8 years agofix for path to buildtools.coreclr package
Rahul Kumar [Fri, 29 Jan 2016 22:00:48 +0000 (14:00 -0800)]
fix for path to buildtools.coreclr package

8 years agoFix for Issue 2849 - Assertion failed 'parent->OperGet() != GT_LDOBJ'
Brian Sullivan [Fri, 29 Jan 2016 21:42:16 +0000 (13:42 -0800)]
Fix for Issue 2849 - Assertion failed 'parent->OperGet() != GT_LDOBJ'

Change the ifdef to use FEATURE_MULTIREG_STRUCT_ARGS instead of
FEATURE_UNIX_AMD64_STRUCT_PASSING because the ARM64 target
also uses GT_LDOBJ when passing 16-byte sized structs

8 years agoMerge pull request #2916 from erozenfeld/Checkedx86BuildFix
Eugene Rozenfeld [Fri, 29 Jan 2016 21:34:12 +0000 (13:34 -0800)]
Merge pull request #2916 from erozenfeld/Checkedx86BuildFix

Fix for x86 checked build error.

8 years agoupdate version of buildtools
Rahul Kumar [Fri, 29 Jan 2016 21:29:03 +0000 (13:29 -0800)]
update version of buildtools

8 years agoAdd un-prefixed signatures as temporary workaround
Jan Kotas [Fri, 29 Jan 2016 20:15:57 +0000 (12:15 -0800)]
Add un-prefixed signatures as temporary workaround

8 years agoUnique names for GlobalizationNative exports
Jan Kotas [Fri, 29 Jan 2016 18:25:41 +0000 (10:25 -0800)]
Unique names for GlobalizationNative exports

For consistency and to enable eventual sharing of the same code with CoreRT, I have changed the naming convention for System.Globalization.Native exports to match dotnet/corefx#4818.

8 years agoMerge pull request #2904 from ellismg/add-ubuntu-15.10-to-ci
Matt Ellis [Fri, 29 Jan 2016 21:31:26 +0000 (13:31 -0800)]
Merge pull request #2904 from ellismg/add-ubuntu-15.10-to-ci

Add Ubuntu 15.10 runs

8 years agoMerge pull request #2919 from kyulee1/ver
Kyungwoo Lee [Fri, 29 Jan 2016 21:27:28 +0000 (13:27 -0800)]
Merge pull request #2919 from kyulee1/ver

RyuJit version update

8 years agoMerge pull request #2918 from wtgodbe/serverGC
William Godbe [Fri, 29 Jan 2016 21:01:27 +0000 (13:01 -0800)]
Merge pull request #2918 from wtgodbe/serverGC

This should enable Server GC for ubuntu PR CI builds

8 years agoThis should enable Server GC for ubuntu PR CI builds
William Godbe [Fri, 29 Jan 2016 20:59:19 +0000 (12:59 -0800)]
This should enable Server GC for ubuntu PR CI builds

8 years agoDisable failing pri 1 tests that are unsupported outside of Windows
William Godbe [Thu, 28 Jan 2016 22:52:38 +0000 (14:52 -0800)]
Disable failing pri 1 tests that are unsupported outside of Windows

8 years agoFix for x86 checked build error.
Eugene Rozenfeld [Fri, 29 Jan 2016 19:56:25 +0000 (11:56 -0800)]
Fix for x86 checked build error.

Remove FORCEINLINE from GetUnwindDataBlob so that the compiler
always emits it in codeman.obj. The code in nidump.cpp
(NativeImageDumper::DumpReadyToRunMethod) calls this method so
we were getting link errors if GetUnwindDataBlob wasn't emitted in codeman.obj.
GetUnwindDataBlob is small enough for a compiler to inline it even without FORCEINLINE.

8 years agoMerge pull request #2914 from Dmitry-Me/unifyRefcountAccess
Jan Kotas [Fri, 29 Jan 2016 18:20:17 +0000 (10:20 -0800)]
Merge pull request #2914 from Dmitry-Me/unifyRefcountAccess

Unify reference count access

8 years agoRyuJit version update
Kyungwoo Lee [Fri, 29 Jan 2016 17:30:07 +0000 (09:30 -0800)]
RyuJit version update

8 years agoMerge pull request #2888 from JohnChen0/coremsbuild
John Chen [Fri, 29 Jan 2016 16:11:41 +0000 (08:11 -0800)]
Merge pull request #2888 from JohnChen0/coremsbuild

Build mscorlib with CoreCLR MSBuild on Linux and Mac

8 years agoUnify reference count access
Dmitry-Me [Fri, 29 Jan 2016 14:21:31 +0000 (17:21 +0300)]
Unify reference count access

8 years agoMerge pull request #2900 from BruceForstall/ClrStlUpdate
Bruce Forstall [Fri, 29 Jan 2016 05:05:45 +0000 (21:05 -0800)]
Merge pull request #2900 from BruceForstall/ClrStlUpdate

Fixes and additions to CLR STL functionality

8 years agoMerge pull request #2901 from JohnChen0/r2r-av
Jan Kotas [Fri, 29 Jan 2016 04:08:57 +0000 (20:08 -0800)]
Merge pull request #2901 from JohnChen0/r2r-av

Modify crossgen to always set DLL bit in PE header

8 years agoMerge pull request #2913 from krytarowski/netbsd-support-15
Jan Kotas [Fri, 29 Jan 2016 04:07:26 +0000 (20:07 -0800)]
Merge pull request #2913 from krytarowski/netbsd-support-15

NetBSD: Fix portability of isspace(3) usage

8 years agoMerge pull request #2911 from krytarowski/netbsd-support-13
Jan Kotas [Fri, 29 Jan 2016 04:06:46 +0000 (20:06 -0800)]
Merge pull request #2911 from krytarowski/netbsd-support-13

NetBSD: Stop assuming that __hppa__ is HP-UX

8 years agoMerge pull request #2906 from krytarowski/netbsd-support-12
Jan Kotas [Fri, 29 Jan 2016 04:04:19 +0000 (20:04 -0800)]
Merge pull request #2906 from krytarowski/netbsd-support-12

Stop setting for NetBSD -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L

8 years agoMerge pull request #2912 from krytarowski/netbsd-support-14
Jan Kotas [Fri, 29 Jan 2016 04:02:57 +0000 (20:02 -0800)]
Merge pull request #2912 from krytarowski/netbsd-support-14

NetBSD defines VM_MAXUSER_ADDRESS in <machine/vmparam.h>

8 years agoMerge pull request #2703 from AndyAyersMS/InlineRefactor
Andy Ayers [Fri, 29 Jan 2016 01:59:42 +0000 (17:59 -0800)]
Merge pull request #2703 from AndyAyersMS/InlineRefactor

Initial round of jit inliner refactoring

8 years agoNetBSD: Fix portability of isspace(3) usage
Kamil Rytarowski [Fri, 29 Jan 2016 01:42:53 +0000 (02:42 +0100)]
NetBSD: Fix portability of isspace(3) usage

NAME
     isspace - white-space character test

LIBRARY
     Standard C Library (libc, -lc)

SYNOPSIS
     #include <ctype.h>

     int
     isspace(int c);

STANDARDS
     The isspace() function conforms to ANSI X3.159-1989 (``ANSI C89'').

CAVEATS
     The argument to isspace() must be EOF or representable as an unsigned
     char; otherwise, the behavior is undefined.

-- NetBSD man-page

This behavior is POSIX and Standard C:

The c argument is an int, the value of which the application shall ensure is a
character representable as an unsigned char or equal to the value of the macro
EOF. If the argument has any other value, the behavior is undefined.

-- The Open Group Base Specifications Issue 6
   IEEE Std 1003.1, 2004 Edition

C11 standard:
The header declares several functions useful for classifying and mapping
characters In all cases the argument is an int, the value of which shall be
representable as an unsigned char or shall equal the value of the macro EOF. If
the argument has any other value, the behavior is undefined.

-- 7.4 Character handling <ctype.h> paragraph 1

8 years agoNetBSD defines VM_MAXUSER_ADDRESS in <machine/vmparam.h>
Kamil Rytarowski [Fri, 29 Jan 2016 01:30:07 +0000 (02:30 +0100)]
NetBSD defines VM_MAXUSER_ADDRESS in <machine/vmparam.h>

/*
 * USRSTACK is the top (end) of the user stack. Immediately above the
 * user stack resides the user structure, which is UPAGES long and contains
 * the kernel stack.
 *
 * Immediately after the user structure is the page table map, and then
 * kernel address space.
 */

-- /usr/include/machine/vmparam.h

8 years agoNetBSD: Stop assuming that __hppa__ is HP-UX
Kamil Rytarowski [Fri, 29 Jan 2016 01:23:21 +0000 (02:23 +0100)]
NetBSD: Stop assuming that __hppa__ is HP-UX

HPPA is one of the NetBSD ports.

8 years agoInitial round of jit inliner refactoring
Andy Ayers [Thu, 14 Jan 2016 23:33:01 +0000 (15:33 -0800)]
Initial round of jit inliner refactoring

In the jit, a particular inline decision is the aggregate result of checks
in many different parts of the code. The primary goal of this refactoring
is to establity a single object instance that will accumulate the necessary
information, and to ensure there are a small number of places in the code
where the final outcome is known.

That object is the `JitInlineResult`. I've updated it so it is no longer
copyable or assignable. Instead each root instance is passed down stack
by reference to helper methods that update the instance as the inline decision
making process evolves. Methods on the JitInlineResult can be used to advance
the state of what's known. The allowable state transitions are limited and the
code verifies that (when appropriate) a decision was actually made.

There are 4 such root instances:
* the main check done in the inlining pass.
* the candidate identification pass done in the importer.
* a pre-jit viability scan also done in the importer.
* another pre-jit viability scan done in the importer.

(These latter two identify un-inlinable methods at pre-jit time, so
subsequent jit invocations don't expend any cycles considering them).

I've updated various APIs to try and avoid introducing aliased copies or
projections of the inline result, for instance passing it via argument to
a helper that already has access to it via a member variable, or returning
a bool result from one of the various 'canInline' methods. More work is possible
here -- for example the compiler instance probably doesn't need an inline
result member of its own, since whenever it is inlining it has an inline
instance that has an inline result. I've added a few asserts in places to ensure
that if there is more than one plausible path to the result that they all refer
to the same object.

I've also started streamlining a bit of the goto-heavy case analysis in favor
of early returns, which I find more readable. The reporting obligation
is now held by the JitInlineResult destructor. Future work may go further in this
direction, and make the JitInlineResult responsible for never attribute flagging,
logging and dump messages, and perhaps even responsibility for undoing some of
the speculative state modification done when preparing for inlining (eg cleaning up
the locals in `fgMorphCallInlineHelper`).

At this stage the various candidate and failure reasons are still strings.
I added some new strings for in-progress checks so the dumps now show the
"success reason" for an inline. This is an area that will undergo
further refinement. Success reasons and failures and failure reasons
are still not captured in the inline tree; that too is forthcoming.

This change has minor codegen diffs. In cases where the callee has pinned locals
and returns a bool, we'll now identify the callee as a "never" candidate and so
some calls to it will never get the anticipatory wrapping that inline candidates
get. While this wrapping is undone later when inlining fails, it leaves a type
conversion behind and that conversion impacts the generated code slightly: I see
`test eax, eax` to query the return value rather than `test al, al`.

While I was striving for a no-diff change I think taking this one change is
reasonable: it's preferable to identify never candidates rather than repeatedly try
inlining them and fail each time.

8 years agoStop setting for NetBSD -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L
Kamil Rytarowski [Thu, 28 Jan 2016 23:59:48 +0000 (00:59 +0100)]
Stop setting for NetBSD -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L

This makes ucontext.h related discovery functions work.

8 years agoAdd Ubuntu 15.10 runs
Matt Ellis [Thu, 28 Jan 2016 23:35:58 +0000 (15:35 -0800)]
Add Ubuntu 15.10 runs

Part of dotnet/corefx#5349

8 years agoMerge pull request #2893 from swaroop-sridhar/redirect
Jan Kotas [Thu, 28 Jan 2016 22:51:35 +0000 (14:51 -0800)]
Merge pull request #2893 from swaroop-sridhar/redirect

Fix an assert failure in GCStress testing

8 years agoMerge pull request #2899 from dotnet-bot/from-tfs
Andy Ayers [Thu, 28 Jan 2016 22:49:42 +0000 (14:49 -0800)]
Merge pull request #2899 from dotnet-bot/from-tfs

Merge changes from TFS

8 years agoMerge pull request #2868 from kyulee1/cfi
Kyungwoo Lee [Thu, 28 Jan 2016 22:24:39 +0000 (14:24 -0800)]
Merge pull request #2868 from kyulee1/cfi

Support for CFI unwind info

8 years agoFixes and additions to CLR STL functionality
Bruce Forstall [Thu, 28 Jan 2016 22:00:05 +0000 (14:00 -0800)]
Fixes and additions to CLR STL functionality

vector:
Added some const qualifiers.
Added cbegin(), cend(), and data() members.

algorithm:
Added transform()

string:
Implemented a simple subset of std::string. This was implemented for use by a component that will be checked in later. It is currently unused.

Removed ownership tags.

Added "magic" comments to help VIM editor properly handle these files without filename extensions.

8 years agoModify crossgen to always set DLL bit in PE header
John Chen (CLR) [Thu, 28 Jan 2016 21:26:46 +0000 (13:26 -0800)]
Modify crossgen to always set DLL bit in PE header

8 years agoThe jit may try to inline in cases where there are serious mismatches between the...
Andy Ayers [Thu, 28 Jan 2016 21:22:20 +0000 (13:22 -0800)]
The jit may try to inline in cases where there are serious mismatches between the type the caller is passing and the type the callee expects. This can cause the jit to issue malformed queries through the jit interface.

The fix is to take an existing assertion check which detects mismatches the jit is not prepared to handle and make the check active in retail builds. If a bad type mismatch is detected, inlining at that call site is aborted.

[tfs-changeset: 1569969]

8 years agoSupport for CFI unwind info
Kyungwoo Lee [Sat, 23 Jan 2016 14:13:58 +0000 (06:13 -0800)]
Support for CFI unwind info

For Unix targeting CoreRT, this will provide platform specific unwind
info which is a dwarf format.
Unlike window’s UNWIND_INFO, we won’t encode the format within RyuJit
since it is not only complex/error-prone but also needs to be adjusted
depending on platforms.
Instead, CFI (call frame information) pseudo instructions are encoded,
which will be passed to CoreRT/ObjectWriter which will translate
them to directly emit CFI directives to LLVM MC stream to establish
frames and layout eh_frame section.
A jit flag is used to dynamically dispatch either Windows’s unwind
blob or this CFI instruction table. No JIT/EE interface change is needed
since the API already expects an opaque blob.
Initially when I looked at what Clang does, the prologue and the
sequence of CFI emissions are a bit different than Windows.
Since we will emit the same sequence of code with the same runtime that
we define, I assume this is unnecessary – I’ve verified the CFI sequence
here can work correctly with libunwind.
Basically we need only 3 operations – push reg is a combination of 1 and
2 below.
 1. Allocation – increase stack frame. Normally subtract esp in x64.
 2. Store – Copy a (callee save) register to stack (memory)
 3. SaveFP – Set frame pointer register

Since Windows operation is based on the relative value (all offsets,
etc are computed from the current point), I also use the similar form of
CFI instructions.
So, mostly one window’s code corresponds to two CFIs – we might optimize
this by aggregating allocation, but I’d like to keep the current
syntax/semantic same as Windows.
This results in a very simple transformation on par with Windows.

8 years agoFix an assert failure in GCStress testing
Swaroop Sridhar [Thu, 28 Jan 2016 02:49:14 +0000 (18:49 -0800)]
Fix an assert failure in GCStress testing

When GCStress uses redirection, it pushes a
RedirectedThreadFrame (Windows) or
ResumableFrame(Unix) on the stack.

The stack walker, when checking for consistency of frame chain
makes a special case for this redirection when running under
GCStress -- but compares only against `RedirectedThreadFrame'.
This caused the StackWalker to think that certain invoke-s were
not redirected, resulting in the failures in some GCStress tests
on Linux.

This change fixes the problem.
Fixes #2848

8 years agoMerge pull request #2894 from stephentoub/fix_dtparsing
Stephen Toub [Thu, 28 Jan 2016 18:10:36 +0000 (10:10 -0800)]
Merge pull request #2894 from stephentoub/fix_dtparsing

Fix DateTimeFormat.FormatCustomized optimization bug

8 years agoMerge pull request #2882 from gkhanna79/FixRace
Gaurav Khanna [Thu, 28 Jan 2016 17:46:36 +0000 (09:46 -0800)]
Merge pull request #2882 from gkhanna79/FixRace

Fix for CoreCLR issue 2881 - Fix race in Default ALC initialization.

8 years agoFix for CoreCLR issue 2881 - Fix race in Default ALC initialization.
Gaurav Khanna (CLR) [Wed, 27 Jan 2016 16:54:21 +0000 (08:54 -0800)]
Fix for CoreCLR issue 2881 - Fix race in Default ALC initialization.

 https://github.com/dotnet/coreclr/issues/2881

Incorporate PR feedback

8 years agoMerge pull request #2880 from janvorli/fix-python-script
Jan Vorlicek [Thu, 28 Jan 2016 12:37:16 +0000 (13:37 +0100)]
Merge pull request #2880 from janvorli/fix-python-script

Fix missing format specifier in Utilities.py

8 years agoMerge pull request #2890 from sivarv/master
Sivarv [Thu, 28 Jan 2016 05:56:23 +0000 (21:56 -0800)]
Merge pull request #2890 from sivarv/master

Fix gc-hole while emitting CORINFO_HELP_ASSIGN_BYREF helper call on Unix

8 years agoFix DateTimeFormat.FormatCustomized optimization bug
stephentoub [Thu, 28 Jan 2016 04:33:02 +0000 (20:33 -0800)]
Fix DateTimeFormat.FormatCustomized optimization bug

After reverting https://github.com/dotnet/coreclr/pull/2617, which resulted in backslash escapes being included incorrectly, replaces it with a simpler fix that avoids the same allocations and copies by simply passing in the overarching StringBuilder.  The call sites throw away the StringBuilder if an exception occurs, so we can simply write to it directly rather than first writing to a temporary and then dumping that temporary into the overarching result.

8 years agoRevert "Remove StringBuilder allocation/usage from DateTimeFormat"
stephentoub [Thu, 28 Jan 2016 04:13:01 +0000 (20:13 -0800)]
Revert "Remove StringBuilder allocation/usage from DateTimeFormat"

This reverts commit 3a8f9cb3c9412f896fd4be808564fe26afc54fc4.

8 years agoMerge pull request #2885 from dotnet-bot/from-tfs
Jan Kotas [Thu, 28 Jan 2016 00:05:21 +0000 (16:05 -0800)]
Merge pull request #2885 from dotnet-bot/from-tfs

Merge changes from TFS

8 years agoMerge pull request #2884 from wtgodbe/pathFix
William Godbe [Thu, 28 Jan 2016 00:05:08 +0000 (16:05 -0800)]
Merge pull request #2884 from wtgodbe/pathFix

This fixes the change that shortens path names of output Pri 1 tests in CI

8 years agoFix gc-hole while emitting CORINFO_HELP_ASSIGN_BYREF helper call.
sivarv [Wed, 27 Jan 2016 23:20:57 +0000 (15:20 -0800)]
Fix gc-hole while emitting CORINFO_HELP_ASSIGN_BYREF helper call.
This is a no-gc helper takes its parameters RSI and RDI and doesn't trash
them.

Emit.cpp!emitNoGCHelper() is used by emitter to compute the registers
that are trashed by a helper call to update gc-info state maintained by
emitter (see emitxarch.cpp!emitins_call()).  emitNoGCHelper() on Windows
is modeled to return RBM_CALLEE_TRASH_NOGC (which is same as RBM_CALLEE_TRAHS)
and it happens to work fine because RSI and RDI are not part of
RBM_CALLEE_TRASH set.  But on Unix Amd64, RSI and RDI are part of
RBM_CALLEE_TRASH and hence gets reported as killed by ASSIGN_BYREF
helper and hence the gc-hole.

Fix: exclude RSI and RDI in set of registers killed by ASSIGN_BYREF
helper.

8 years agoMerge pull request #2887 from stephentoub/license_headers
Jan Kotas [Wed, 27 Jan 2016 23:19:38 +0000 (15:19 -0800)]
Merge pull request #2887 from stephentoub/license_headers

Update licensing headers

8 years agoMerge pull request #2883 from stephentoub/cts_size
Stephen Toub [Wed, 27 Jan 2016 22:55:29 +0000 (14:55 -0800)]
Merge pull request #2883 from stephentoub/cts_size

Reduce size of CancellationCallbackInfo

8 years agoUpdate license headers
dotnet-bot [Wed, 27 Jan 2016 19:41:24 +0000 (11:41 -0800)]
Update license headers

8 years agoDon't run finalizers on shutdown, provide Unloading event
dotnet-bot [Wed, 27 Jan 2016 20:48:28 +0000 (12:48 -0800)]
Don't run finalizers on shutdown, provide Unloading event

API review: https://github.com/dotnet/corefx/issues/5205

This change implements the proposal in the API review above:
- Don't block threads for shutdown
- Don't run finalizers on shutdown (for both reachable and unreachable objects)
- Provide a public AssemblyLoadContext.Unloading event that can be handled to clean up global resources in an assembly
  - As unloading an AssemblyLoadContext is not yet implemented, the event will for the time being be raised shortly prior to shutdown

[tfs-changeset: 1569451]

8 years agoThis fixes the change that shortens path names of output Pri 1 tests in CI
William Godbe [Wed, 27 Jan 2016 19:11:20 +0000 (11:11 -0800)]
This fixes the change that shortens path names of output Pri 1 tests in CI

8 years agoReduce size of CancellationCallbackInfo
stephentoub [Wed, 27 Jan 2016 18:41:27 +0000 (10:41 -0800)]
Reduce size of CancellationCallbackInfo

Each registration with a cancelable CancellationToken results in allocating a CancellationCallbackInfo instance to store the relevant state, e.g. the action to invoke, the associated CTS, etc.  CancellationToken.Register has a little-known and very-little-used feature that enables the callback to be automatically sent to a captured SynchronizationContext, and as such the CancellationCallbackInfo has a field to store the SynchronizationContext, too.  But this field is almost always null.

This change reduces the size of CancellationCallbackInfo from 56 to 48 bytes on 64-bit by moving the TargetSynchronizationContext field to a derived type.  The derived instance with the extra field is only allocated when there is a SynchronizationContext captured.

8 years agoFix missing format specifier in Utilities.py
Jan Vorlicek [Wed, 27 Jan 2016 16:08:40 +0000 (17:08 +0100)]
Fix missing format specifier in Utilities.py

The Utilities.py script was missing the `%s` format specifier in
one of the prints and it was causing a build failure for me.

8 years agoMerge pull request #2879 from janvorli/fix-exception-in-prestub-using-holder-pass1
Jan Vorlicek [Wed, 27 Jan 2016 15:11:19 +0000 (16:11 +0100)]
Merge pull request #2879 from janvorli/fix-exception-in-prestub-using-holder-pass1

Fix exception in PreStubWorker call chain - update

8 years agoFix exception in PreStubWorker call chain - update
Jan Vorlicek [Wed, 27 Jan 2016 11:20:38 +0000 (12:20 +0100)]
Fix exception in PreStubWorker call chain - update

This change fixes one case that the previous fix was missing. This is a case when
the exception in the PreStubWorker call chain is thrown by native code, for example
during jitting the target managed method. In this case, the DispatchManagedException
is called in the first pass, so we need to do the same change as in the previous
fix for the first pass as well.
Since we now have the first managed frame context available in the
DispatchManagedException for the first pass too, I have modified the
UnwindManagedExceptionPass1 to get it as a parameter so that it doesn't
need to do the unwinding to that frame again.

8 years agoMerge pull request #2866 from LLITCHEV/x86-assert-fix
Lubomir Litchev [Wed, 27 Jan 2016 08:13:23 +0000 (00:13 -0800)]
Merge pull request #2866 from LLITCHEV/x86-assert-fix

Disable initialization of _lvArgReg and _lvOtherArgReg on x86.

8 years agoMerge pull request #2864 from richlander/rich-header
Jan Kotas [Wed, 27 Jan 2016 04:21:18 +0000 (20:21 -0800)]
Merge pull request #2864 from richlander/rich-header

Update copyright and file header guidance for .NET Core

8 years agoUpdate copyright for .NET Core and update file header guidance
Richard Lander [Sun, 24 Jan 2016 00:44:25 +0000 (16:44 -0800)]
Update copyright for .NET Core and update file header guidance