Skip to content
  • Simon Marlow's avatar
    threadStackOverflow: check whether stack squeezing released some stack (#3677) · d2c874dc
    Simon Marlow authored
    In a stack overflow situation, stack squeezing may reduce the stack
    size, but we don't know whether it has been reduced enough for the
    stack check to succeed if we try again.  Fortunately stack squeezing
    is idempotent, so all we need to do is record whether *any* squeezing
    happened.  If we are at the stack's absolute -K limit, and stack
    squeezing happened, then we try running the thread again.
    
    We also want to avoid enlarging the stack if squeezing has already
    released some of it.  However, we don't want to get into a
    pathalogical situation where a thread has a nearly full stack (near
    its current limit, but not near the absolute -K limit), keeps
    allocating a little bit, squeezing removes a little bit, and then it
    runs again.  So to avoid this, if we squeezed *and* there is still
    less than BLOCK_SIZE_W words free, then we enlarge the stack anyway.
    d2c874dc