diff options
author | Simon Marlow <marlowsd@gmail.com> | 2012-11-05 16:06:24 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2012-11-12 15:49:43 +0000 |
commit | 1c160e588706f4ff6b4e391602e38f0a2044ec13 (patch) | |
tree | 992ad0f7ba25f2d3fe8ca3b88699b4139872ed14 /rts/Updates.cmm | |
parent | 2ef95e8fe0df15eb182a480b2d221a827f36ee96 (diff) | |
download | haskell-1c160e588706f4ff6b4e391602e38f0a2044ec13.tar.gz |
ASSERT(HpAlloc==0) in the update code, to catch HpAlloc bugs
Diffstat (limited to 'rts/Updates.cmm')
-rw-r--r-- | rts/Updates.cmm | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/rts/Updates.cmm b/rts/Updates.cmm index 53b2cbaa61..b3b6b20ef3 100644 --- a/rts/Updates.cmm +++ b/rts/Updates.cmm @@ -29,6 +29,8 @@ INFO_TABLE_RET ( stg_upd_frame, UPDATE_FRAME, UPDATE_FRAME_FIELDS(W_,P_,info_ptr,_ccs,_unused,updatee) ) return (P_ ret) /* the closure being returned */ { + ASSERT(HpAlloc == 0); // Note [HpAlloc] + /* ToDo: it might be a PAP, so we should check... */ TICK_UPD_CON_IN_NEW(sizeW_fromITBL(%GET_STD_INFO(updatee))); @@ -47,7 +49,7 @@ INFO_TABLE_RET ( stg_marked_upd_frame, UPDATE_FRAME, { W_ v; - if (HpAlloc != 0) { ccall barf("HpAlloc"); } + ASSERT(HpAlloc == 0); // Note [HpAlloc] // we know the closure is a BLACKHOLE v = StgInd_indirectee(updatee); @@ -87,3 +89,15 @@ INFO_TABLE_RET ( stg_bh_upd_frame, UPDATE_FRAME, ( UPDATE_FRAME_FIELDS(,,info_ptr,ccs,_unused,updatee) ) (ret); } + +/* Note [HpAlloc] + * + * HpAlloc is required to be zero unless we just bumped Hp and failed + * the heap check: see HeapStackCheck.cmm. Failures that result from + * HpAlloc being non-zero are very hard to track down, because they + * manifest as spurious heap corruption that happens only with +RTS + * -N2 or greater (because then we have a lot more + * interruptCapability() calls happening). Hence, we assert + * HpAlloc==0 as often as possible, and in the update code is a good + * place to do that. + */ |