summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2019-01-12 16:08:24 +0300
committerÖmer Sinan Ağacan <omeragacan@gmail.com>2019-01-13 00:16:50 -0500
commit448f0e7dd78a8d9404f1aa5e8522cc284360c06d (patch)
tree6c700528d3043a7212f3ebcc2837a577ad0f80c0 /rts
parent076f5862a9e46eef762ba19fb7b14e75fa03c2c0 (diff)
downloadhaskell-448f0e7dd78a8d9404f1aa5e8522cc284360c06d.tar.gz
Fix checkPtrInArena
(See comments)
Diffstat (limited to 'rts')
-rw-r--r--rts/Arena.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/rts/Arena.c b/rts/Arena.c
index e0b4ebde30..a4ff11be7d 100644
--- a/rts/Arena.c
+++ b/rts/Arena.c
@@ -121,8 +121,17 @@ arenaBlocks( void )
#if defined(DEBUG)
void checkPtrInArena( StgPtr p, Arena *arena )
{
- for (bdescr *bd = arena->current; bd; bd = bd->link) {
- if (p >= bd->start && p < bd->free) {
+ // We don't update free pointers of arena blocks, so we have to check cached
+ // free pointer for the first block.
+ if (p >= arena->current->start && p < arena->free) {
+ return;
+ }
+
+ // Rest of the blocks should be full (except there may be a little bit of
+ // slop at the end). Again, free pointers are not updated so we can't use
+ // those.
+ for (bdescr *bd = arena->current->link; bd; bd = bd->link) {
+ if (p >= bd->start && p < bd->start + (bd->blocks*BLOCK_SIZE_W)) {
return;
}
}