[project @ 2001-02-06 12:00:17 by sewardj]
authorsewardj <unknown>
Tue, 6 Feb 2001 12:00:17 +0000 (12:00 +0000)
committersewardj <unknown>
Tue, 6 Feb 2001 12:00:17 +0000 (12:00 +0000)
commit3a8cc90c45bea721ff9aceba4b4954bd42662ac8
tree35e6150dbcec07d223f863dca12ac42d9234c128
parent86cce08753c8e973486e824c4b5ba47c8f7812b8
[project @ 2001-02-06 12:00:17 by sewardj]
Support stack overflow checks in interpreted code.  The deal is:
* If a BCO is reckoned to need less than iNTERP_STACK_CHECK_THRESH
  words of stack, no stack check insn is added.
* If a BCO needs >= iNTERP_STACK_CHECK_THRESH words, an explicit
  check insn is added.

The interpreter ensures at least iNTERP_STACK_CHECK_THRESH words of
stack are available before running each BCO, regardless of whether or
not the BCO contains an explicit check insn too.

By setting iNTERP_STACK_CHECK_THRESH to a suitably large level
(currently 50), most BCOs only require the implicit stack check, which
avoids the overhead of decoding one extra insn per BCO.  BCOs which do
have a stack check insn then do 2 stack checks rather than 1
(implicit, then explicit), but this is rare enough that we don't care.
ghc/compiler/ghci/ByteCodeGen.lhs
ghc/compiler/ghci/ByteCodeInstr.lhs
ghc/compiler/ghci/ByteCodeLink.lhs