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

Commit

Permalink
Use volatile load to read brick table entries (#17718)
Browse files Browse the repository at this point in the history
Fixes #17716
  • Loading branch information
jkotas authored Apr 21, 2018
1 parent bdfdfeb commit 6b0830a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
22 changes: 8 additions & 14 deletions src/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/gc/gcpriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1733,7 +1733,7 @@ class gc_heap
PER_HEAP
void set_brick (size_t index, ptrdiff_t val);
PER_HEAP
int brick_entry (size_t index);
int get_brick_entry (size_t index);
#ifdef MARK_ARRAY
PER_HEAP
unsigned int mark_array_marked (uint8_t* add);
Expand Down

0 comments on commit 6b0830a

Please sign in to comment.