Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 76cfdbc

Browse files
authored
Merge pull request #5742 from jkotas/write-barrier-fix-port
Release/1.0.0 port: Undo StompWriteBarrierResize reordering
2 parents d6f9ee7 + 0bfbaf0 commit 76cfdbc

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/gc/gc.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7258,17 +7258,6 @@ int gc_heap::grow_brick_card_tables (uint8_t* start,
72587258
g_card_table = translated_ct;
72597259
}
72607260

7261-
// We need to make sure that other threads executing checked write barriers
7262-
// will see the g_card_table update before g_lowest/highest_address updates.
7263-
// Otherwise, the checked write barrier may AV accessing the old card table
7264-
// with address that it does not cover. Write barriers access card table
7265-
// without memory barriers for performance reasons, so we need to flush
7266-
// the store buffers here.
7267-
GCToOSInterface::FlushProcessWriteBuffers();
7268-
7269-
g_lowest_address = saved_g_lowest_address;
7270-
VolatileStore(&g_highest_address, saved_g_highest_address);
7271-
72727261
if (!write_barrier_updated)
72737262
{
72747263
// This passes a bool telling whether we need to switch to the post
@@ -7282,6 +7271,17 @@ int gc_heap::grow_brick_card_tables (uint8_t* start,
72827271
StompWriteBarrierResize(!!IsSuspendEEThread(), la != saved_g_lowest_address);
72837272
}
72847273

7274+
// We need to make sure that other threads executing checked write barriers
7275+
// will see the g_card_table update before g_lowest/highest_address updates.
7276+
// Otherwise, the checked write barrier may AV accessing the old card table
7277+
// with address that it does not cover. Write barriers access card table
7278+
// without memory barriers for performance reasons, so we need to flush
7279+
// the store buffers here.
7280+
GCToOSInterface::FlushProcessWriteBuffers();
7281+
7282+
g_lowest_address = saved_g_lowest_address;
7283+
VolatileStore(&g_highest_address, saved_g_highest_address);
7284+
72857285
return 0;
72867286

72877287
fail:

0 commit comments

Comments
 (0)