Use check stacking on Windows.
authorTamar Christina <tamar@zhox.com>
Sat, 17 Sep 2016 21:25:00 +0000 (22:25 +0100)
committerTamar Christina <tamar@zhox.com>
Sat, 1 Oct 2016 22:01:35 +0000 (23:01 +0100)
commit1e795a008da8ab2ae88cca04aca01c50967b4397
tree72cc8a6d11d4342c5246a4e472f8dfeeff26e1ef
parentd1b4fec12250e608ca8a863ba4ef911084c468ef
Use check stacking on Windows.

Summary:
#8870 added as a temporary work around a much higher initial reserve
and committed stack space of 2mb. This is causing problems with other windows applications.

The hack was supposed to be temporary untill we could emit `__chkstk` instructions.
But GCC can emit stack checks automatically for us if `-fstack-check` is passed.

This will then emit calls to `___chkstk_ms` before stack allocations.

```
  633de0:       48 83 e0 f0             and    $0xfffffffffffffff0,%rax
  633de4:       e8 07 0c 0d 00          callq  7049f0 <___chkstk_ms>
  633de9:       48 29 c4                sub    %rax,%rsp
```

The hack is now no longer needed.

Test Plan: ./validate

Reviewers: austin, erikd, awson, bgamari

Reviewed By: bgamari

Subscribers: thomie, #ghc_windows_task_force

Differential Revision: https://phabricator.haskell.org/D2535

GHC Trac Issues: #12186
compiler/main/SysTools.hs