[GHC] #13714: Guard pages instead of Heap/Stack limit checks in Cmm
GHC
ghc-devs at haskell.org
Wed May 17 21:19:55 UTC 2017
#13714: Guard pages instead of Heap/Stack limit checks in Cmm
-------------------------------------+-------------------------------------
Reporter: varosi | Owner: (none)
Type: feature | Status: new
request |
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.2
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Recently I have debugged a small program and I saw that there are a lot of
Heap/Stack limit checks on function entrances
([https://ghc.haskell.org/trac/ghc/browser/ghc/rts/HeapStackCheck.cmm]).
This is not cheap and introduce more branch mispredictions and
instructions.
What you think if we use guard OS pages (that trigger exceptions when
someone try to read/write on them) around Stack and Heap? Stack and Heap
sizes should be aligned on page size (usually 4K) and with sizes that fits
4K pages. We could handle such exceptions so we could do GC if needed.
This trick is usually found in some memory managers for finding out-of-
bounds bugs.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13714>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list