提交 2756411f 编写于 作者: S shade

8024671: G1 generates assert error messages in product builds

Reviewed-by: brutisso, tschatzl
上级 9eb79ab2
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
void G1CardCounts::clear_range(size_t from_card_num, size_t to_card_num) { void G1CardCounts::clear_range(size_t from_card_num, size_t to_card_num) {
if (has_count_table()) { if (has_count_table()) {
check_card_num(from_card_num, assert(from_card_num >= 0 && from_card_num < _committed_max_card_num,
err_msg("from card num out of range: "SIZE_FORMAT, from_card_num)); err_msg("from card num out of range: "SIZE_FORMAT, from_card_num));
assert(from_card_num < to_card_num, assert(from_card_num < to_card_num,
err_msg("Wrong order? from: " SIZE_FORMAT ", to: "SIZE_FORMAT, err_msg("Wrong order? from: " SIZE_FORMAT ", to: "SIZE_FORMAT,
from_card_num, to_card_num)); from_card_num, to_card_num));
......
...@@ -72,25 +72,21 @@ class G1CardCounts: public CHeapObj<mtGC> { ...@@ -72,25 +72,21 @@ class G1CardCounts: public CHeapObj<mtGC> {
return has_reserved_count_table() && _committed_max_card_num > 0; return has_reserved_count_table() && _committed_max_card_num > 0;
} }
void check_card_num(size_t card_num, const char* msg) {
assert(card_num >= 0 && card_num < _committed_max_card_num, msg);
}
size_t ptr_2_card_num(const jbyte* card_ptr) { size_t ptr_2_card_num(const jbyte* card_ptr) {
assert(card_ptr >= _ct_bot, assert(card_ptr >= _ct_bot,
err_msg("Inavalied card pointer: " err_msg("Invalid card pointer: "
"card_ptr: " PTR_FORMAT ", " "card_ptr: " PTR_FORMAT ", "
"_ct_bot: " PTR_FORMAT, "_ct_bot: " PTR_FORMAT,
card_ptr, _ct_bot)); card_ptr, _ct_bot));
size_t card_num = pointer_delta(card_ptr, _ct_bot, sizeof(jbyte)); size_t card_num = pointer_delta(card_ptr, _ct_bot, sizeof(jbyte));
check_card_num(card_num, assert(card_num >= 0 && card_num < _committed_max_card_num,
err_msg("card pointer out of range: " PTR_FORMAT, card_ptr)); err_msg("card pointer out of range: " PTR_FORMAT, card_ptr));
return card_num; return card_num;
} }
jbyte* card_num_2_ptr(size_t card_num) { jbyte* card_num_2_ptr(size_t card_num) {
check_card_num(card_num, assert(card_num >= 0 && card_num < _committed_max_card_num,
err_msg("card num out of range: "SIZE_FORMAT, card_num)); err_msg("card num out of range: "SIZE_FORMAT, card_num));
return (jbyte*) (_ct_bot + card_num); return (jbyte*) (_ct_bot + card_num);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册