summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonmar <unknown>2002-08-16 13:28:22 +0000
committersimonmar <unknown>2002-08-16 13:28:22 +0000
commit3dfd50c38c25da76fc9d09da1ac02541eb2feaaa (patch)
treee006f876cd9437a3252daee81d2de185dabaed6f
parentb2421c0cbb75a9dfeabd7030cd0dcb8af7f7ee73 (diff)
downloadhaskell-3dfd50c38c25da76fc9d09da1ac02541eb2feaaa.tar.gz
[project @ 2002-08-16 13:28:22 by simonmar]
Re-order the checks in HP_STK_CHK and HP_STK_CHK_NP: if the stack check failed before the heap check, then we would get bogus allocation results.
-rw-r--r--ghc/includes/StgMacros.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/ghc/includes/StgMacros.h b/ghc/includes/StgMacros.h
index 86d99da5ef..2a72013498 100644
--- a/ghc/includes/StgMacros.h
+++ b/ghc/includes/StgMacros.h
@@ -1,5 +1,5 @@
/* -----------------------------------------------------------------------------
- * $Id: StgMacros.h,v 1.47 2002/07/16 14:56:08 simonmar Exp $
+ * $Id: StgMacros.h,v 1.48 2002/08/16 13:28:22 simonmar Exp $
*
* (c) The GHC Team, 1998-1999
*
@@ -148,7 +148,7 @@ static inline int IS_ARG_TAG( StgWord p ) { return p <= ARGTAG_MAX; }
#define HP_STK_CHK(stk_headroom,hp_headroom,ret,r,layout,tag_assts) \
DO_GRAN_ALLOCATE(hp_headroom) \
- if (Sp - stk_headroom < SpLim || (Hp += hp_headroom) > HpLim) { \
+ if ((Hp += hp_headroom) > HpLim || Sp - stk_headroom < SpLim) { \
HpAlloc = (hp_headroom); \
tag_assts \
(r) = (P_)ret; \
@@ -198,7 +198,7 @@ static inline int IS_ARG_TAG( StgWord p ) { return p <= ARGTAG_MAX; }
#define HP_STK_CHK_NP(stk_headroom, hp_headroom, ptrs, tag_assts) \
DO_GRAN_ALLOCATE(hp_headroom) \
- if ((Sp - (stk_headroom)) < SpLim || (Hp += (hp_headroom)) > HpLim) { \
+ if ((Hp += (hp_headroom)) > HpLim || (Sp - (stk_headroom)) < SpLim) { \
HpAlloc = (hp_headroom); \
tag_assts \
JMP_(stg_gc_enter_##ptrs); \