< prev index next >
src/share/vm/gc/g1/g1CardCounts.hpp
Print this page
rev 10742 : Make fields used in lock-free algorithms volatile
@@ -62,11 +62,11 @@
// Max capacity of the reserved space for the counts table
size_t _reserved_max_card_num;
// CardTable bottom.
- const jbyte* _ct_bot;
+ const volatile jbyte* _ct_bot;
// Barrier set
CardTableModRefBS* _ct_bs;
// Returns true if the card counts table has been reserved.
@@ -75,26 +75,26 @@
// Returns true if the card counts table has been reserved and committed.
bool has_count_table() {
return has_reserved_count_table();
}
- size_t ptr_2_card_num(const jbyte* card_ptr) {
+ size_t ptr_2_card_num(const volatile jbyte* card_ptr) {
assert(card_ptr >= _ct_bot,
"Invalid card pointer: "
"card_ptr: " PTR_FORMAT ", "
"_ct_bot: " PTR_FORMAT,
- p2i(card_ptr), p2i(_ct_bot));
- size_t card_num = pointer_delta(card_ptr, _ct_bot, sizeof(jbyte));
+ p2i((jbyte*)card_ptr), p2i((jbyte*)_ct_bot));
+ size_t card_num = pointer_delta((void*)card_ptr, (jbyte*)_ct_bot, sizeof(jbyte));
assert(card_num < _reserved_max_card_num,
- "card pointer out of range: " PTR_FORMAT, p2i(card_ptr));
+ "card pointer out of range: " PTR_FORMAT, p2i((jbyte*)card_ptr));
return card_num;
}
- jbyte* card_num_2_ptr(size_t card_num) {
+ volatile jbyte* card_num_2_ptr(size_t card_num) {
assert(card_num < _reserved_max_card_num,
"card num out of range: " SIZE_FORMAT, card_num);
- return (jbyte*) (_ct_bot + card_num);
+ return (volatile jbyte*) (_ct_bot + card_num);
}
// Clear the counts table for the given (exclusive) index range.
void clear_range(size_t from_card_num, size_t to_card_num);
@@ -111,11 +111,11 @@
void initialize(G1RegionToSpaceMapper* mapper);
// Increments the refinement count for the given card.
// Returns the pre-increment count value.
- uint add_card_count(jbyte* card_ptr);
+ uint add_card_count(volatile jbyte* card_ptr);
// Returns true if the given count is high enough to be considered
// 'hot'; false otherwise.
bool is_hot(uint count);
< prev index next >