platform/upstream/coreclr.git
7 years agoIncorporate changes from Jan's #8437, plus review feedback.
Andy Ayers [Mon, 5 Dec 2016 20:24:56 +0000 (12:24 -0800)]
Incorporate changes from Jan's #8437, plus review feedback.

Still honoring windows exception interop restrictions on all platforms
and runtimes. Will revisit when addressing #8459.

7 years agoJIT: enable inline pinvoke in more cases
Andy Ayers [Mon, 21 Nov 2016 23:44:21 +0000 (15:44 -0800)]
JIT: enable inline pinvoke in more cases

An inline pinvoke is a pinvoke where the managed/native transition
overhead is reduced by inlining parts of the transition bookkeeping
around the call site. A normal pinvoke does this bookkeeping in
a stub method that interposes between the managed caller and the
native callee.

Previously the jit would not allow pinvoke calls that came from inlines
to be optimized via inline pinvoke. This sometimes caused performance
surprises for users who wrap DLL imports with managed methods. See for
instance #2373.

This change lifts this limitation. Pinvokes from inlined method bodies
are now given the same treatment as pinvokes in the root method. The
legality check for inline pinvokes has been streamlined slightly to
remove a redundant check. Inline pinvokes introduced by inlining are
handled by accumulating the unmanaged method count with the value from
inlinees, and deferring insertion of the special basic blocks until after
inlining, so that if the only inline pinvokes come from inline instances
they are still properly processed.

Inline pinvokes are still disallowed in try and handler regions
(catches, filters, and finallies).

X87 liveness tracking was updated to handle the implicit inline frame
var references. This was a pre-existing issue that now can show up more
frequently. Added a test case that fails with the stock legacy jit
(and also with the new enhancements to pinvoke). Now both the original
failing case and this case pass.

Inline pinvokes are also now suppressed in rarely executed blocks,
for instance blocks leading up to throws or similar.

The inliner is now also changed to preferentially report inline
reasons as forced instead of always when both are applicable.

This change adds a new test case that shows the variety of
situations that can occur with pinvoke, inlining, and EH.

7 years ago[x86/Linux] Mark LeaveCatch as NYI (#8384)
Jonghyun Park [Mon, 5 Dec 2016 12:20:32 +0000 (21:20 +0900)]
[x86/Linux] Mark LeaveCatch as NYI (#8384)

* Disable LeaveCatch for non-Windows platforms

* Mark LeaveCatch as NYI

* Use #ifndef as before

7 years ago[x86/Linux] Fix all paths through this function will call itself (#8451)
SaeHie Park [Mon, 5 Dec 2016 08:04:41 +0000 (17:04 +0900)]
[x86/Linux] Fix all paths through this function will call itself (#8451)

Fix compile error for x86/Linux
- disable "infinite-recursion" for "recursiveFtn" function
- only for clang

7 years ago[x86/Linux] Use Portable LMul JIT Helper (#8449)
Jonghyun Park [Mon, 5 Dec 2016 08:02:25 +0000 (17:02 +0900)]
[x86/Linux] Use Portable LMul JIT Helper (#8449)

7 years ago[x86/Linux] Fix indirection of non-volatile null pointer will be deleted (#8452)
SaeHie Park [Mon, 5 Dec 2016 07:45:38 +0000 (16:45 +0900)]
[x86/Linux] Fix indirection of non-volatile null pointer will be deleted (#8452)

Fix compile error for x86/Linux
- fix error "indirection of non-volatile null pointer will be deleted, not trap [-Werror,-Wnull-dereference]"
- using clang 3.8

7 years agoUse Portable Floating-point Arithmetic Helpers (#8447)
Jonghyun Park [Mon, 5 Dec 2016 07:37:17 +0000 (16:37 +0900)]
Use Portable Floating-point Arithmetic Helpers (#8447)

This commit enables portable floating-point arithmetic helpers for
x86/Linux build.

7 years ago[x86/Linux] Fix dangling DoubleToNumber and NumberToDouble (#8446)
Jonghyun Park [Mon, 5 Dec 2016 07:35:52 +0000 (16:35 +0900)]
[x86/Linux] Fix dangling DoubleToNumber and NumberToDouble (#8446)

This commit enables portable DoubleToNumber and NumberToDouble for
x86/Linux.

7 years agoFix several misspellings of exception and "a exception". (#8442)
Jon Hanna [Mon, 5 Dec 2016 07:22:10 +0000 (07:22 +0000)]
Fix several misspellings of exception and "a exception". (#8442)

7 years ago[x86/Linux] Revert UMThkCallFrame-related changes (#8434)
Jonghyun Park [Mon, 5 Dec 2016 07:19:41 +0000 (16:19 +0900)]
[x86/Linux] Revert UMThkCallFrame-related changes (#8434)

* [x86/Linux] Revert UMThkCallFrame-related code

* [x86/Linux] Fix dangling 'TheUMEntryPrestub' reference

This commit re-enables GenerateUMThunkPrestub and its related code in
order to remove TheUMEntryPrestub reference.

* [x86/Linux] Re-enable several methods in StubLinkerCPU

This commit re-enables the following methods for x86/Linux:
 - StubLinkerCPU::EmitSetup
 - StubLinkerCPU::EmitComMethodStubProlog
 - StubLinkerCPU::EmitComMethodStubEpilog

In addtion, EmitComMethodStubEpilog is marked as NYI.

7 years ago[x86/Linux] Fix unused function warning (#8429)
Jonghyun Park [Mon, 5 Dec 2016 07:15:41 +0000 (16:15 +0900)]
[x86/Linux] Fix unused function warning (#8429)

* Delete the unused code

7 years agoEnsure MSBuild properties get persisted to child MSBuild tasks, fixes a race conditio...
Sean Gillespie [Mon, 5 Dec 2016 04:02:21 +0000 (20:02 -0800)]
Ensure MSBuild properties get persisted to child MSBuild tasks, fixes a race condition in the build (#8404)

7 years ago[x86/Linux] fix several parentheses compile warnings (#8428)
Jonghyun Park [Fri, 2 Dec 2016 11:14:24 +0000 (20:14 +0900)]
[x86/Linux] fix several parentheses compile warnings (#8428)

7 years agoIntroduce CORINFO_EH_CLAUSE_SAMETRY flag for CoreRT ABI (#8422)
Jan Kotas [Fri, 2 Dec 2016 11:06:55 +0000 (03:06 -0800)]
Introduce CORINFO_EH_CLAUSE_SAMETRY flag for CoreRT ABI (#8422)

CORINFO_EH_CLAUSE_SAMEBLOCK flag is returned on mutually protecting EH clauses for CoreRT ABI. It is set on EH clauses that cover same try block as the previous one. The runtime cannot reliably infer this information from native code offsets without full description of duplicate clauses because of different try blocks can have same offsets. Alternative solution to this problem would be inserting extra nops to ensure that different try blocks have different offsets.

7 years agoMerge pull request #8419 from jkotas/master-UpdateDependencies
Jan Kotas [Fri, 2 Dec 2016 04:54:11 +0000 (20:54 -0800)]
Merge pull request #8419 from jkotas/master-UpdateDependencies

Update CoreClr, CoreFx to beta-24801-03, beta-24721-02, respectively

7 years agoDisable test against #8418 to unblock corefx updates
Jan Kotas [Thu, 1 Dec 2016 21:34:08 +0000 (13:34 -0800)]
Disable test against #8418 to unblock corefx updates

7 years ago[x86/Linux] Use portable JIT helpers (#8392)
Jonghyun Park [Fri, 2 Dec 2016 02:48:52 +0000 (11:48 +0900)]
[x86/Linux] Use portable JIT helpers (#8392)

7 years ago[x86/Linux] Disable Watson-related code for non-Windows platforms (#8410)
Jonghyun Park [Fri, 2 Dec 2016 01:01:29 +0000 (10:01 +0900)]
[x86/Linux] Disable Watson-related code for non-Windows platforms (#8410)

7 years ago[x86/Linux] Add Portable PopSEHRecords as NYI (#8412)
Jonghyun Park [Fri, 2 Dec 2016 00:58:37 +0000 (09:58 +0900)]
[x86/Linux] Add Portable PopSEHRecords as NYI (#8412)

7 years agoResolve duplicated functions (#8413)
Jonghyun Park [Fri, 2 Dec 2016 00:57:46 +0000 (09:57 +0900)]
Resolve duplicated functions (#8413)

Several functions are implemented in both cgenx86.cpp and unixstubs.cpp,
which results in linking errors.

This commit disables functions in cgenx86.cpp to resolve linking errors.

7 years ago[x86/Linux] Adjust the definition of FnStaticBaseHelper for x86 (#8390)
Jonghyun Park [Fri, 2 Dec 2016 00:55:18 +0000 (09:55 +0900)]
[x86/Linux] Adjust the definition of FnStaticBaseHelper for x86 (#8390)

7 years agoMerge pull request #8414 from BruceForstall/FixSimdRegressions
Bruce Forstall [Thu, 1 Dec 2016 19:04:55 +0000 (11:04 -0800)]
Merge pull request #8414 from BruceForstall/FixSimdRegressions

Fix recent x86 SIMD regressions

7 years agoUpdate CoreClr, CoreFx to beta-24801-03, beta-24721-02, respectively
dotnet-bot [Thu, 1 Dec 2016 17:36:24 +0000 (17:36 +0000)]
Update CoreClr, CoreFx to beta-24801-03, beta-24721-02, respectively

7 years agofix permissive C++ code (MSVC /permissive-) (#8337)
Phil Christensen [Thu, 1 Dec 2016 11:53:23 +0000 (03:53 -0800)]
fix permissive C++ code (MSVC /permissive-) (#8337)

* fix permissive C++ code (MSVC /permissive-)

These were found by the C++ compiler group when doing "Real world code"
build tests using /permissive-.  We are sharing these with you to help you clean up
your code before the new version of the compiler comes out.  For more information on /permissive-
see https://blogs.msdn.microsoft.com/vcblog/2016/11/16/permissive-switch/.

----------------------------
Under /permissive-, skipping the initialization of a variable is not allowed.
As an extension the compiler allowed this when there was no destructor for the type.

    void func(bool b)
    {
        if(b) goto END;

        int value = 0; //error C2362: initialization of 'value' is skipped by 'goto END'
     int array[10]; //Okay, not initialized.
        //... value used here

    END:
        return;
    }

Fix 1) Limit the scope of value:

    {
      int value = 0;
      //... value used here
    }
    END:

Fix 2) Initialize/declare value before the 'goto'

    int value = 0;
    if(b) goto END;
    //... value used here
    END:

Fix 3) Don't initialize value in the variable declaration.

    int value;
    value = 0
    //... value used here
    END:

-------------------
Alternative token representations.
The following are reserved as alternative representations for operators:
  and and_eq bitand bitor compl not not_eq or or_eq xor xor_eq

    //Can't use reserved names for variables:
    static int and = 0; // Change name (possibly to 'and_')

    void func()
    {
        _asm {
            xor     edx,edx // xor is reserved, change to uppercase XOR
            or      eax,eax // or is reserved, change to uppercase OR
        }
    }

* Apply formatting patch.

* fixes from code review.

I addressed @janvorli requests from the pull request code review.

7 years agoRe-enable UMThkCallFrame and fix compile errors (#8411)
Jonghyun Park [Thu, 1 Dec 2016 10:57:07 +0000 (19:57 +0900)]
Re-enable UMThkCallFrame and fix compile errors (#8411)

7 years agoFix build error in ARM64 code (#8407)
Jonghyun Park [Thu, 1 Dec 2016 10:52:25 +0000 (19:52 +0900)]
Fix build error in ARM64 code (#8407)

CONTEXT struct for ARM64 does not contain X29 field.

7 years agoAdd EXCEPTION_REGISTRATION_RECORD for x86/Linux (#8408)
Jonghyun Park [Thu, 1 Dec 2016 09:24:32 +0000 (18:24 +0900)]
Add EXCEPTION_REGISTRATION_RECORD for x86/Linux (#8408)

7 years agoFix recent x86 SIMD regressions
Bruce Forstall [Thu, 1 Dec 2016 08:15:53 +0000 (00:15 -0800)]
Fix recent x86 SIMD regressions

1. Recent PUTARG_STK work didn't consider SIMD arguments.
2. SSE3_4 work caused underestimation of instruction sizes for SSE4
instructions (e.g., pmulld).

7 years agoRemove the BinaryCompatibility class as it is not useful on .NET Core… (#8396)
Alex Ghiondea [Thu, 1 Dec 2016 07:52:29 +0000 (23:52 -0800)]
Remove the BinaryCompatibility class as it is not useful on .NET Core… (#8396)

* Remove the BinaryCompatibility class as it is not useful on .NET Core and creates issues on Debug builds when the TFM on the AppDomain is not recognized.
* Update the code for DateTimeFormatInfo to not use BinaryCompatibility
* Remove initialization of preferExistingTokens now that we removed its usage

7 years agoAdd printing managed assert message to console (#8399)
Jan Vorlicek [Thu, 1 Dec 2016 07:51:52 +0000 (08:51 +0100)]
Add printing managed assert message to console (#8399)

I have discovered that when GUI assertion dialogs are disabled, the assert
message is not shown anywhere and the app just silently exits.
This change adds printing the message and stack trace to console in such case.

7 years agoSkip emitting duplicate clauses for CoreRT (#8400)
Jan Kotas [Thu, 1 Dec 2016 05:52:35 +0000 (21:52 -0800)]
Skip emitting duplicate clauses for CoreRT (#8400)

Fixes https://github.com/dotnet/corert/issues/2262

7 years agoAdd parentheses aroung logical operations (#8406)
Jonghyun Park [Thu, 1 Dec 2016 02:26:08 +0000 (11:26 +0900)]
Add parentheses aroung logical operations (#8406)

This commit fixes logical-op-parentheses compile error for x86/Linux build.

7 years agoMerge pull request #8209 from stephentoub/arraypool_perf
Jan Kotas [Thu, 1 Dec 2016 01:16:45 +0000 (17:16 -0800)]
Merge pull request #8209 from stephentoub/arraypool_perf

Improve ArrayPool implementation and performance

7 years agoMerge pull request #8382 from BruceForstall/FixShift
Bruce Forstall [Thu, 1 Dec 2016 00:47:24 +0000 (16:47 -0800)]
Merge pull request #8382 from BruceForstall/FixShift

Fix x86 encoder to use 64-bit type to accumulate opcode/prefix bits

7 years agoExclude jithelp.asm for x86/Linux (#8393)
Jonghyun Park [Wed, 30 Nov 2016 23:39:55 +0000 (08:39 +0900)]
Exclude jithelp.asm for x86/Linux (#8393)

7 years agoFix x86 encoder to use 64-bit type to accumulate opcode/prefix bits
Bruce Forstall [Wed, 30 Nov 2016 02:57:18 +0000 (18:57 -0800)]
Fix x86 encoder to use 64-bit type to accumulate opcode/prefix bits

The encoder was using size_t, a 32-bit type on x86, to accumulate opcode
and prefix bits to emit. AVX support uses 3 bytes for prefixes that are
higher than the 32-bit type can handle. So, change all code byte related types
from size_t to a new code_t, defined as "unsigned __int64" on RyuJIT x86
(there is precedence for this type on the ARM architectures).

Fixes #8331

7 years agoMerge pull request #8395 from BruceForstall/FixNYI
Bruce Forstall [Wed, 30 Nov 2016 21:31:42 +0000 (13:31 -0800)]
Merge pull request #8395 from BruceForstall/FixNYI

Change NYI to be a noway_assert if ALT_JIT is not defined

7 years agoDisable PrintSEHChain for non-Windows platforms (#8379)
Jonghyun Park [Wed, 30 Nov 2016 20:23:58 +0000 (05:23 +0900)]
Disable PrintSEHChain for non-Windows platforms (#8379)

PrintSEHChain uses 'EXCEPTION_REGISTRATION_RECORD' which is not
available for non-Windows platforms.

This commit disables PrintSEHChain for non-Windows platforms to fix
build error in x86/Linux.

7 years agoDeclare CtorFtnType only when it is used (#8378)
Jonghyun Park [Wed, 30 Nov 2016 20:19:36 +0000 (05:19 +0900)]
Declare CtorFtnType only when it is used (#8378)

7 years agoDisable EHWatsonBucketTracker for non-window platforms (#8373)
Jonghyun Park [Wed, 30 Nov 2016 20:09:36 +0000 (05:09 +0900)]
Disable EHWatsonBucketTracker for non-window platforms (#8373)

7 years agoDisable Windows-specific code for x86/Linux (#8371)
Jonghyun Park [Wed, 30 Nov 2016 20:08:20 +0000 (05:08 +0900)]
Disable Windows-specific code for x86/Linux (#8371)

7 years agoFix mismatch between longfilepathwrappers.cpp and longfilepathwrappers.h (#8370)
Jonghyun Park [Wed, 30 Nov 2016 20:07:16 +0000 (05:07 +0900)]
Fix mismatch between longfilepathwrappers.cpp and longfilepathwrappers.h (#8370)

'longfilepathwrappers.h' declares several functions without WINAPI
attribute, but 'longfilepathwrappers.cpp' implements them with WINAPI
attributes.

This commit makes the declarations in 'longfilepathwrappers.h'
consistent with the implementations in 'longfilepathwrappers.cpp'.

7 years agoFix mismatch between sortversioning.h and sortversioning.cpp (#8366)
Jonghyun Park [Wed, 30 Nov 2016 20:06:13 +0000 (05:06 +0900)]
Fix mismatch between sortversioning.h and sortversioning.cpp (#8366)

7 years agoFix to avoid stalling the process when ETW is doing a rundown (#8357)
Vance Morrison [Wed, 30 Nov 2016 19:45:17 +0000 (11:45 -0800)]
Fix to avoid stalling the process when ETW is doing a rundown (#8357)

This only matters when there are MANY JIT compiled methods, but Bing operates
in exactly this mode, and thus it stalls for several seconds while rundown completes.

This fix does not fix the problem completely, but it makes it MUCH less likely, and is
a trivial, safe fix. The problem is that as part of a GC, we do cleanup of any removed
JIT code. To do this we take a JIT code manager lock, but this is also a lock that the
JIT code iterator takes and is used during ETW rundown. Thus rundown blocks GCs.

Almost all the time, we DON'T have JIT code manager cleanup to do, so we just avoid
taking the lock in that case, and this makes the stall MUCH less likely.

7 years ago[x86/Linux] Fix mismatch over LPOVERLAPPED_COMPLETION_ROUTINE (#8364)
Jonghyun Park [Wed, 30 Nov 2016 19:42:31 +0000 (04:42 +0900)]
[x86/Linux] Fix mismatch over LPOVERLAPPED_COMPLETION_ROUTINE (#8364)

* Fix the mismatch over LPOVERLAPPED_COMPLETION_ROUTINE

Those functions are compared with Function variable of
LPOVERLAPPED_COMPLETION_ROUTINE type, but has inconsistent type,
 - WaitIOCompletionCallback,
 - CallbackForInitiateDrainageOfCompletionPortQueue
 - CallbackForContinueDrainageOfCompletionPortQueue
This inconsistency results in compile error for x86/Linux build.

This commit fixes such inconsistency.

* Revises 'CallbackForContinueDrainageOfCompletionPortQueue'

7 years agoEmits compile error on portability issue only when PORTABILITY_CHECK is specified...
Jonghyun Park [Wed, 30 Nov 2016 19:41:10 +0000 (04:41 +0900)]
Emits compile error on portability issue only when PORTABILITY_CHECK is specified (#8340)

7 years ago[x86/Linux] Disable FEATURE_AVX_SUPPORT (#8335)
Jonghyun Park [Wed, 30 Nov 2016 19:40:17 +0000 (04:40 +0900)]
[x86/Linux] Disable FEATURE_AVX_SUPPORT (#8335)

* Disable FEATURE_AVX_SUPPORT for x86/Linux

This commit disables FEATURE_AVX_SUPPORT for x86/Linux to fix #8331.

* Disable FEATURE_AVX_SUPPORT only for x86/Linux

* Disable FEATURE_SIMD for x86/Linux

* Simplify nested if in CMakeList.txt

7 years ago[x86/Linux] Add missing files in x86/Linux PAL (#8318)
Jonghyun Park [Wed, 30 Nov 2016 19:39:53 +0000 (04:39 +0900)]
[x86/Linux] Add missing files in x86/Linux PAL (#8318)

* (Partially) Enable x86/Linux PAL

* Fix personality routine address encoding

* Fix build warnings

7 years agoUses portable ROTATE_LEFT for x86/Linux (#8367)
Jonghyun Park [Wed, 30 Nov 2016 19:39:21 +0000 (04:39 +0900)]
Uses portable ROTATE_LEFT for x86/Linux (#8367)

7 years agoMerge pull request #8401 from svick/task-action-delegate
Stephen Toub [Wed, 30 Nov 2016 19:33:11 +0000 (14:33 -0500)]
Merge pull request #8401 from svick/task-action-delegate

Change the type of Task.m_action to Delegate

7 years agoFix mismatch between signature and implementation of ActivationFunctions (#8394)
Jonghyun Park [Wed, 30 Nov 2016 14:23:29 +0000 (23:23 +0900)]
Fix mismatch between signature and implementation of ActivationFunctions (#8394)

7 years ago[x86/Linux] Fix prototype for GCThreadStub (#8397)
SaeHie Park [Wed, 30 Nov 2016 14:21:04 +0000 (23:21 +0900)]
[x86/Linux] Fix prototype for GCThreadStub (#8397)

Fix compile error for x86/Linux
- fix "cannot initialize a parameter of type 'LPTHREAD_START_ROUTINE'"
- add __stdcall GCThreadStub as it's Windows/Linux common code

7 years agoAdding missing ctor - 'public Span(T[] array, int start)' (#8354)
Matt Warren [Wed, 30 Nov 2016 07:45:21 +0000 (07:45 +0000)]
Adding missing ctor - 'public Span(T[] array, int start)' (#8354)

7 years agoUpdates m_LastRedirectIP and m_SpinCount only for non-Unix platforms (#8386)
Jonghyun Park [Wed, 30 Nov 2016 07:44:11 +0000 (16:44 +0900)]
Updates m_LastRedirectIP and m_SpinCount only for non-Unix platforms (#8386)

Both variables are available only for non-Unix platforms.

7 years ago[x86/Linux] Fix extraneous parentheses (#8388)
SaeHie Park [Wed, 30 Nov 2016 07:42:25 +0000 (16:42 +0900)]
[x86/Linux] Fix extraneous parentheses (#8388)

Fix compile error for x86/Linux
- fix "equality comparison with extraneous parentheses" for LEGACY_BACKEND

7 years ago[x86/Linux] Fix error: '&&' within '||' (#8391)
SaeHie Park [Wed, 30 Nov 2016 07:41:44 +0000 (16:41 +0900)]
[x86/Linux] Fix error: '&&' within '||' (#8391)

Fix compile error for x86/Linux
- place parentheses around the '&&' expression to silence this

7 years agoChange NYI to be a noway_assert if ALT_JIT is not defined
Bruce Forstall [Wed, 30 Nov 2016 06:43:26 +0000 (22:43 -0800)]
Change NYI to be a noway_assert if ALT_JIT is not defined

We recently changed RyuJIT/x86 to be the default JIT. However, there
are still a few NYI that can happen, such as when enabling SIMD,
which is not enabled yet. However, there is no "fallback" JIT anymore.
So just treat all NYI as asserts.

7 years agoCapture YMM registers on OSX (#8365)
John Chen [Wed, 30 Nov 2016 03:50:09 +0000 (19:50 -0800)]
Capture YMM registers on OSX (#8365)

Also fixed checking of context flags on OSX (issue #8116)

7 years ago[x86/Linux] Add virtual dtor for ArrayStubCache class (#8339)
Jonghyun Park [Wed, 30 Nov 2016 03:08:19 +0000 (12:08 +0900)]
[x86/Linux] Add virtual dtor for ArrayStubCache class (#8339)

* Adds virtual dtor for ArrayStubCache class

* Remove unnecessary default destructor

7 years agoRemove one virtual call from StreamHelpers.ValidateCopyToArgs (#8361)
Andy Ayers [Wed, 30 Nov 2016 03:00:26 +0000 (19:00 -0800)]
Remove one virtual call from StreamHelpers.ValidateCopyToArgs (#8361)

Check CanWrite on the destination stream first.

In the common case CanWrite is true, and CanRead is only needed to
determine which kind of exception to throw when CanWrite is false.

7 years agoFix inconsistency between the signatures of GetAppDomain (#8368)
Jonghyun Park [Wed, 30 Nov 2016 02:57:27 +0000 (11:57 +0900)]
Fix inconsistency between the signatures of GetAppDomain (#8368)

7 years ago[x86/Linux] Disable WIN64EXECPTION and fix related changes (#8375)
SaeHie Park [Wed, 30 Nov 2016 02:55:33 +0000 (11:55 +0900)]
[x86/Linux] Disable WIN64EXECPTION and fix related changes (#8375)

Fix compile error for x86/Linux
- undo some changes to disable WIN64EXCEPTION so the x86/Linux builds

7 years agoMerge pull request #8315 from mikedn/disasm
Pat Gavlin [Wed, 30 Nov 2016 00:24:22 +0000 (16:24 -0800)]
Merge pull request #8315 from mikedn/disasm

Fix various disassembly issues

7 years agoMerge pull request #8355 from adiaaida/formattingFix
Michelle McDaniel [Tue, 29 Nov 2016 21:49:49 +0000 (13:49 -0800)]
Merge pull request #8355 from adiaaida/formattingFix

Fix formatting in files

7 years agoMerge pull request #8291 from sivarv/sse34
Sivarv [Tue, 29 Nov 2016 20:12:50 +0000 (12:12 -0800)]
Merge pull request #8291 from sivarv/sse34

Enable use of SSE3_4 instruction set for SIMD codegen.

7 years agoFix formatting in files
Michelle McDaniel [Tue, 29 Nov 2016 19:02:20 +0000 (11:02 -0800)]
Fix formatting in files

In morph and flowgraph, we had an instance where an opening/closing
brace was inside a #if when it should not have been, which broke our
formatting on these files. This change fixes that error and reformats
the files.

7 years agoMerge pull request #8330 from BruceForstall/FixSSE2Assert
Bruce Forstall [Tue, 29 Nov 2016 18:39:11 +0000 (10:39 -0800)]
Merge pull request #8330 from BruceForstall/FixSSE2Assert

Force enable SSE2 on RyuJIT/x86 on desktop

7 years agoMerge pull request #8351 from dotnet-bot/from-tfs
Jan Kotas [Tue, 29 Nov 2016 18:09:54 +0000 (10:09 -0800)]
Merge pull request #8351 from dotnet-bot/from-tfs

Merge changes from TFS

7 years agoFix shared library dependencies verification on some platforms (#8349)
Jan Vorlicek [Tue, 29 Nov 2016 18:09:35 +0000 (19:09 +0100)]
Fix shared library dependencies verification on some platforms (#8349)

The existing way of verifying shared library dependencies, used for
System.Globalization.Native.so, doesn't work on platforms that don't
have ldd or where ldd doesn't support the `-r` option.
This change makes the check happen on non-Alpine Linux only for now.
It also refactors the way the check is performed. Instead of doing it
post build in the build.sh, it is now performed as a postbuild phase
of the System.Globalization.Native target and it is also generalized
so that we can easily add such verification to other build targets.
The new verify-so.sh script is also used in corefx.

7 years agoDisable CER feature as it is not used (#8218)
John Chen [Tue, 29 Nov 2016 17:10:40 +0000 (09:10 -0800)]
Disable CER feature as it is not used (#8218)

Use FEATURE_CER to scope CER code,
and disable CER feature in CoreCLR.

7 years agoUse invariant culture in test (#8327)
Petr Onderka [Tue, 29 Nov 2016 17:06:16 +0000 (18:06 +0100)]
Use invariant culture in test (#8327)

This makes sure the test passes on machines
where the decimal separator of the default culture is comma.

7 years agoFix AMD64 CTP build break
Bruce Forstall [Tue, 29 Nov 2016 16:56:19 +0000 (08:56 -0800)]
Fix AMD64 CTP build break

[tfs-changeset: 1639770]

7 years agoFix phantom TEXTREL in libcoreclr.so (#8347)
Jan Vorlicek [Tue, 29 Nov 2016 14:12:02 +0000 (15:12 +0100)]
Fix phantom TEXTREL in libcoreclr.so (#8347)

This change fixes the problem where scanelf tool reported that libcoreclr.s
contains TEXTRELs, however it was unable to find any.
It turns out there actually were TEXTRELs, but not in the program code or
program data, but rather in the DWARF tables. The NESTED_ENTRY macro for
ARM64 and AMD64 uses .cfi_personality with encoding 0, which means
absolute address. This is the source of the TEXTREL.
Changing the encoding to 0x1b - DW_EH_PE_pcrel | DW_EH_PE_sdata4 fixes the
problem - the scanelf tool no longer reports any TEXTRELs in libcoreclr.so.

7 years agoUses 'W' to fix build error (#8345)
Jonghyun Park [Tue, 29 Nov 2016 12:58:07 +0000 (21:58 +0900)]
Uses 'W' to fix build error (#8345)

7 years agoFix the mistmatch between gc_thread_stub and GCThreadFunction (#8336)
Jonghyun Park [Tue, 29 Nov 2016 11:24:51 +0000 (20:24 +0900)]
Fix the mistmatch between gc_thread_stub and GCThreadFunction (#8336)

7 years agoFix ignored attribute warning for x86/Linux build (#8334)
Jonghyun Park [Tue, 29 Nov 2016 11:14:22 +0000 (20:14 +0900)]
Fix ignored attribute warning for x86/Linux build (#8334)

7 years agoFix various disassembly issues
Mike Danes [Fri, 25 Nov 2016 08:00:58 +0000 (10:00 +0200)]
Fix various disassembly issues

- (null) being displayed instead of ymmword ptr
- lack of a space between some instructions and their first operand
- incorrect display of pmovmskb's first operand (was something like yrax)
- displaying ymm registers in cases where xmm registers were actually used
- displaying mm instead of xmm/ymm (e.g. cmpps mm1, mm2)

7 years agoForce enable SSE2 on RyuJIT/x86 on desktop
Bruce Forstall [Tue, 29 Nov 2016 02:19:07 +0000 (18:19 -0800)]
Force enable SSE2 on RyuJIT/x86 on desktop

SSE2 is required for RyuJIT/x86; there is no x87 code path.
The .NET Core VM sets the JIT flag enabling this, and we assert
it does. On desktop, however, especially under NGEN, it does not.
We ignore that, and generate SSE2 code anyway.

7 years agoDisable PSPSym and LocAllocSPvar for CoreRT (#8319)
Jan Kotas [Tue, 29 Nov 2016 02:00:57 +0000 (18:00 -0800)]
Disable PSPSym and LocAllocSPvar for CoreRT (#8319)

The establisher frame definition differs between CoreRT ABI and CoreCLR ABI. In CoreRT ABI created by @russellhadley and @smosier while back, the establisher frame is always the SP value at the point that control left the frame in which execution would resume after a catch handler completes. This mismatch leads to crashes when PSPSym is recomputed in funclets of methods with localloc.

Fixed by disabling PSPSym for CoreRT since it does not need it. Also disabled LocAllocSPvar while I was on it since it is not needed for CoreRT either.

Fixes https://github.com/dotnet/corert/issues/2255

7 years agoMerge pull request #8325 from pgavlin/gh8285
Pat Gavlin [Tue, 29 Nov 2016 00:58:04 +0000 (16:58 -0800)]
Merge pull request #8325 from pgavlin/gh8285

Do not rewrite `(t + cns_a) << cns_s)` during CSE.

7 years agoEnable using SSE3_4 instruction set for SIMD codegen.
sivarv [Thu, 24 Nov 2016 03:30:36 +0000 (19:30 -0800)]
Enable using SSE3_4 instruction set for SIMD codegen.

7 years ago[x86/Linux] Fix constructor missing in UnmanagedToManagedFrame (#8275)
SaeHie Park [Mon, 28 Nov 2016 23:10:14 +0000 (08:10 +0900)]
[x86/Linux] Fix constructor missing in UnmanagedToManagedFrame (#8275)

Fix compile error for x86/Linux
- full error string: constructor for 'UMThkCallFrame' must explicitly
  initialize the base class 'UnmanagedToManagedFrame' which does not
  have a default constructor
- wrap UMThkCallFrame with also !FEATURE_PAL

7 years ago[x86/Linux] Fix error variable 'td' is uninitialized (#8299)
SaeHie Park [Mon, 28 Nov 2016 22:36:39 +0000 (07:36 +0900)]
[x86/Linux] Fix error variable 'td' is uninitialized (#8299)

Fix compile error for x86/Linux
- make compiler happy with initialize variable 'td' with 0.0

7 years agoDo not rewrite `(t + cns_a) << cns_s)` during CSE.
Pat Gavlin [Mon, 28 Nov 2016 21:33:26 +0000 (13:33 -0800)]
Do not rewrite `(t + cns_a) << cns_s)` during CSE.

Morph normally rewrites trees of the form `(t + cns_a) << cns_s` to
`(t << cns_s + cns_a << cns_s)`. This transformation is not safe to run
during CSE, as it may invalidate CSE candidates.

Fixes #8285.

7 years agoMerge pull request #8314 from BruceForstall/RefactorEmit
Bruce Forstall [Mon, 28 Nov 2016 19:48:18 +0000 (11:48 -0800)]
Merge pull request #8314 from BruceForstall/RefactorEmit

Factor out common stack adjustment code

7 years agoChange the type of Task.m_action to Delegate
Petr Onderka [Mon, 28 Nov 2016 18:18:00 +0000 (19:18 +0100)]
Change the type of Task.m_action to Delegate

This makes the code more strongly typed and avoids some casts.

7 years agoFactor out common stack adjustment code
Bruce Forstall [Sun, 27 Nov 2016 04:40:13 +0000 (20:40 -0800)]
Factor out common stack adjustment code

7 years agoMake GetCurrentProcessorNumber an FCall
Stephen Toub [Fri, 25 Nov 2016 04:39:15 +0000 (23:39 -0500)]
Make GetCurrentProcessorNumber an FCall

7 years ago[x86/Linux] Fix compile error in zapcode (#8294)
SaeHie Park [Mon, 28 Nov 2016 14:03:29 +0000 (23:03 +0900)]
[x86/Linux] Fix compile error in zapcode (#8294)

Fix compile error for x86/Linux
- Remove ZapUnwindInfo WIN64EXCEPTIONS codes for x86/Linux
- fix "use of undeclared identifier 'NEED_TO_PORT_THIS_ONE'"
- fix "unknown type name 'UNWIND_INFO'"
- fix "use of undeclared identifier 'READYTORUN_HELPER_PersonalityRoutineFilterFunclet'"

7 years ago[x86/Linux] Fix 'stdcall' here was previously declared without (#8320)
SaeHie Park [Mon, 28 Nov 2016 14:02:25 +0000 (23:02 +0900)]
[x86/Linux] Fix 'stdcall' here was previously declared without (#8320)

Fix compile error for x86/Linux
- add __stdcall in header
- fix "function declared 'stdcall' here was previously declared without"

7 years ago[x86/Linux] Fix unknown type name 'PTR_RUNTIME_FUNCTION' (#8272)
SaeHie Park [Mon, 28 Nov 2016 11:38:36 +0000 (20:38 +0900)]
[x86/Linux] Fix unknown type name 'PTR_RUNTIME_FUNCTION' (#8272)

Fix compile error for x86/Linux
- wrap only RUNTIME_FUNCTION in corcompile.h with !FEATURE_PAL

7 years agoMerge pull request #8199 from Maoni0/local_gc
Maoni Stephens [Mon, 28 Nov 2016 04:57:21 +0000 (20:57 -0800)]
Merge pull request #8199 from Maoni0/local_gc

move profiling and profiling/ETW shared diagnostics code out of gc.cpp, gcee.cpp and objecthandle.cpp

7 years agoMerge pull request #8312 from BruceForstall/FixLegacyBuild
Bruce Forstall [Sun, 27 Nov 2016 04:42:05 +0000 (20:42 -0800)]
Merge pull request #8312 from BruceForstall/FixLegacyBuild

Set FEATURE_READYTORUN_COMPILER for legacyjit and compatjit

7 years agoFix building CoreCLR with Clang 3.9 (#8311)
Jan Vorlicek [Sun, 27 Nov 2016 04:34:03 +0000 (05:34 +0100)]
Fix building CoreCLR with Clang 3.9 (#8311)

There were few constructs that Clang 3.9 didn't like due to its strict
C++ standard conformance rules.

7 years agoExclude superpmi test from legacyjit and compatjit runs
Bruce Forstall [Sat, 26 Nov 2016 02:34:05 +0000 (18:34 -0800)]
Exclude superpmi test from legacyjit and compatjit runs

The superpmi test depends on setting COMPlus_AltJit to do the
collection, which is incompatible with setting the variables
required to do these test runs.

7 years agoSet FEATURE_READYTORUN_COMPILER for legacyjit and compatjit
Bruce Forstall [Fri, 25 Nov 2016 21:38:50 +0000 (13:38 -0800)]
Set FEATURE_READYTORUN_COMPILER for legacyjit and compatjit

7 years agoFix subtle bug in new string.Join implementation. (#8310)
James Ko [Fri, 25 Nov 2016 19:28:15 +0000 (14:28 -0500)]
Fix subtle bug in new string.Join implementation. (#8310)

7 years agoConfigures tests even when configureonly is provided (#8308)
Jonghyun Park [Fri, 25 Nov 2016 15:07:39 +0000 (00:07 +0900)]
Configures tests even when configureonly is provided (#8308)

The current script does not configure tests when configureonly is
provided.

This commit revises 'build.sh' to configure tests even when configureonly
is provided.

This commit makes it possible to build tests (including related components)
via configuring the whole projects and running make inside that directory.

7 years ago[x86/Linux] Renames i386 as amd64 in arch (PAL) (#8307)
Jonghyun Park [Fri, 25 Nov 2016 15:07:16 +0000 (00:07 +0900)]
[x86/Linux] Renames i386 as amd64 in arch (PAL) (#8307)

The files in src/pal/src/arch/i386 are actually for amd64 (not x86).
This commit renames the directory name as the first step towards
enabling PAL in x86/Linux.

7 years agoEnable field EndAddress only for AMD64 in PAL of RUNTIME_FUNCTION (#8305)
SaeHie Park [Fri, 25 Nov 2016 09:34:25 +0000 (18:34 +0900)]
Enable field EndAddress only for AMD64 in PAL of RUNTIME_FUNCTION (#8305)