summaryrefslogtreecommitdiff
path: root/src/gc/gc.cpp
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2018-04-21 13:18:52 -0700
committerGitHub <noreply@github.com>2018-04-21 13:18:52 -0700
commit542be7dabc037a82b65492da05a42130dda5938d (patch)
tree32c5f4f311b4adafc7ceb44d8af7fd81fae9eb34 /src/gc/gc.cpp
parent7483502dfb4f49e4077f5492aa3f0f7a0748b9fc (diff)
downloadcoreclr-542be7dabc037a82b65492da05a42130dda5938d.tar.gz
coreclr-542be7dabc037a82b65492da05a42130dda5938d.tar.bz2
coreclr-542be7dabc037a82b65492da05a42130dda5938d.zip
Use volatile load to read brick table entries (#17717)
Fixes #17716
Diffstat (limited to 'src/gc/gc.cpp')
-rw-r--r--src/gc/gc.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp
index ef9058e6ab..119937d83c 100644
--- a/src/gc/gc.cpp
+++ b/src/gc/gc.cpp
@@ -6594,19 +6594,13 @@ void gc_heap::set_brick (size_t index, ptrdiff_t val)
}
inline
-int gc_heap::brick_entry (size_t index)
+int gc_heap::get_brick_entry (size_t index)
{
- int val = brick_table [index];
- if (val == 0)
- {
- return -32768;
- }
- else if (val < 0)
- {
- return val;
- }
- else
- return val-1;
+#ifdef MULTIPLE_HEAPS
+ return VolatileLoadWithoutBarrier(&brick_table [index]);
+#else
+ return brick_table[index];
+#endif
}
@@ -17155,7 +17149,7 @@ uint8_t* gc_heap::find_object (uint8_t* interior, uint8_t* low)
#endif //MULTIPLE_HEAPS
#endif //FFIND_OBJECT
- int brick_entry = brick_table [brick_of (interior)];
+ int brick_entry = get_brick_entry(brick_of (interior));
if (brick_entry == 0)
{
// this is a pointer to a large object
@@ -27326,7 +27320,7 @@ uint8_t* gc_heap::find_first_object (uint8_t* start, uint8_t* first_object)
{
break;
}
- if ((brick_entry = brick_table [ prev_brick ]) >= 0)
+ if ((brick_entry = get_brick_entry(prev_brick)) >= 0)
{
break;
}