Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 6d767d4

Browse files
committed
fix spurious crashes/freezes caused by #2430
1 parent 01daddf commit 6d767d4

File tree

1 file changed

+15
-11
lines changed
  • src/gc/impl/conservative

1 file changed

+15
-11
lines changed

src/gc/impl/conservative/gc.d

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ class ConservativeGC : GC
687687
debug(PRINTF) printFreeInfo(pool);
688688
memset(&lpool.pagetable[pagenum + psz], B_PAGEPLUS, newPages);
689689
lpool.bPageOffsets[pagenum] = cast(uint) newsz;
690-
for (auto offset = psz + 1; offset < newsz; offset++)
690+
for (auto offset = psz; offset < newsz; offset++)
691691
lpool.bPageOffsets[pagenum + offset] = cast(uint) offset;
692692
if (freesz > newPages)
693693
lpool.setFreePageOffsets(pagenum + newsz, freesz - newPages);
@@ -1427,6 +1427,10 @@ struct Gcx
14271427
//printf("Gcx.invariant(): this = %p\n", &this);
14281428
pooltable.Invariant();
14291429

1430+
for (size_t p = 0; p < pooltable.length; p++)
1431+
if (pooltable.pools[p].isLargeObject)
1432+
(cast(LargeObjectPool*)(pooltable.pools[p])).Invariant();
1433+
14301434
if (!inCollection)
14311435
(cast()rangesLock).lock();
14321436
foreach (range; ranges)
@@ -2521,7 +2525,7 @@ struct Gcx
25212525
LogArray prev;
25222526

25232527

2524-
void log_init()
2528+
private void log_init()
25252529
{
25262530
//debug(PRINTF) printf("+log_init()\n");
25272531
current.reserve(1000);
@@ -2530,7 +2534,7 @@ struct Gcx
25302534
}
25312535

25322536

2533-
void log_malloc(void *p, size_t size) nothrow
2537+
private void log_malloc(void *p, size_t size) nothrow
25342538
{
25352539
//debug(PRINTF) printf("+log_malloc(p = %p, size = %zd)\n", p, size);
25362540
Log log;
@@ -2549,7 +2553,7 @@ struct Gcx
25492553
}
25502554

25512555

2552-
void log_free(void *p) nothrow @nogc
2556+
private void log_free(void *p) nothrow @nogc
25532557
{
25542558
//debug(PRINTF) printf("+log_free(%p)\n", p);
25552559
auto i = current.find(p);
@@ -2563,7 +2567,7 @@ struct Gcx
25632567
}
25642568

25652569

2566-
void log_collect() nothrow
2570+
private void log_collect() nothrow
25672571
{
25682572
//debug(PRINTF) printf("+log_collect()\n");
25692573
// Print everything in current that is not in prev
@@ -2598,7 +2602,7 @@ struct Gcx
25982602
}
25992603

26002604

2601-
void log_parent(void *p, void *parent) nothrow
2605+
private void log_parent(void *p, void *parent) nothrow
26022606
{
26032607
//debug(PRINTF) printf("+log_parent()\n");
26042608
auto i = current.find(p);
@@ -2625,11 +2629,11 @@ struct Gcx
26252629
}
26262630
else
26272631
{
2628-
void log_init() nothrow { }
2629-
void log_malloc(void *p, size_t size) nothrow { }
2630-
void log_free(void *p) nothrow @nogc { }
2631-
void log_collect() nothrow { }
2632-
void log_parent(void *p, void *parent) nothrow { }
2632+
private void log_init() nothrow { }
2633+
private void log_malloc(void *p, size_t size) nothrow { }
2634+
private void log_free(void *p) nothrow @nogc { }
2635+
private void log_collect() nothrow { }
2636+
private void log_parent(void *p, void *parent) nothrow { }
26332637
}
26342638
}
26352639

0 commit comments

Comments
 (0)