[GHC] #13714: Guard pages instead of Heap/Stack limit checks in Cmm

#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

#13714: Guard pages instead of Heap/Stack limit checks in Cmm -------------------------------------+------------------------------------- Reporter: varosi | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: duplicate | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #8703 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by dfeuer): * status: new => closed * resolution: => duplicate * related: => #8703 Comment: This is a duplicate of #8703. I am curious as to whether this would be easier under Linux now that we pre-allocate a contiguous heap. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13714#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13714: Guard pages instead of Heap/Stack limit checks in Cmm -------------------------------------+------------------------------------- Reporter: varosi | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: duplicate | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #8703 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by varosi): I'll write to other issue. Thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13714#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13714: Guard pages instead of Heap/Stack limit checks in Cmm -------------------------------------+------------------------------------- Reporter: varosi | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: duplicate | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #8703 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by varosi): We could just try first to realloc to extend memory blocks. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13714#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC