Fixing an assert in card stealing. (dotnet/coreclr#27822)
authorVladimir Sadov <vsadov@microsoft.com>
Tue, 12 Nov 2019 15:02:02 +0000 (07:02 -0800)
committerGitHub <noreply@github.com>
Tue, 12 Nov 2019 15:02:02 +0000 (07:02 -0800)
* Fixing an assert in card stealing.

* use ifdef to be consistent with other cases in the file

* PR feedback

Commit migrated from https://github.com/dotnet/coreclr/commit/7aa67a90a682cf885ebab8e450eb845356cd2f1d

src/coreclr/src/gc/gc.cpp

index be21bfd..269f99b 100644 (file)
@@ -30474,8 +30474,13 @@ bool card_marking_enumerator::move_next(heap_segment* seg, uint8_t*& low, uint8_
             {
                 // we found the correct segment, but it's not the segment our caller is in
 
-                // our caller should still be in the previous segment
-                assert(heap_segment_next_in_range(seg) == segment);
+                // our caller should still be in one of the previous segments
+#ifdef _DEBUG
+                for (heap_segment* cur_seg = seg; cur_seg != segment; cur_seg = heap_segment_next_in_range(cur_seg))
+                {                    
+                    assert(cur_seg);
+                }
+#endif //_DEBUG
 
                 // keep the chunk index for later
                 old_chunk_index = chunk_index;