提交 c2cf7d8e 编写于 作者: J jcoomes

6849716: BitMap - performance regression introduced with G1

Summary: make verification code visible only in debug builds
Reviewed-by: iveresov, ysr, johnc, apetrusenko, tonyp
上级 64db7360
......@@ -387,7 +387,7 @@ c1_ValueMap.hpp c1_ValueSet.hpp
c1_ValueSet.cpp c1_ValueSet.hpp
c1_ValueSet.hpp allocation.hpp
c1_ValueSet.hpp bitMap.hpp
c1_ValueSet.hpp bitMap.inline.hpp
c1_ValueSet.hpp c1_Instruction.hpp
c1_ValueStack.cpp c1_IR.hpp
......
......@@ -41,19 +41,6 @@ BitMap::BitMap(idx_t size_in_bits, bool in_resource_area) :
resize(size_in_bits, in_resource_area);
}
void BitMap::verify_index(idx_t index) const {
assert(index < _size, "BitMap index out of bounds");
}
void BitMap::verify_range(idx_t beg_index, idx_t end_index) const {
#ifdef ASSERT
assert(beg_index <= end_index, "BitMap range error");
// Note that [0,0) and [size,size) are both valid ranges.
if (end_index != _size) verify_index(end_index);
#endif
}
void BitMap::resize(idx_t size_in_bits, bool in_resource_area) {
assert(size_in_bits >= 0, "just checking");
idx_t old_size_in_words = size_in_words();
......
......@@ -93,10 +93,12 @@ class BitMap VALUE_OBJ_CLASS_SPEC {
// The index of the first full word in a range.
idx_t word_index_round_up(idx_t bit) const;
// Verification, statistics.
void verify_index(idx_t index) const;
void verify_range(idx_t beg_index, idx_t end_index) const;
// Verification.
inline void verify_index(idx_t index) const NOT_DEBUG_RETURN;
inline void verify_range(idx_t beg_index, idx_t end_index) const
NOT_DEBUG_RETURN;
// Statistics.
static idx_t* _pop_count_table;
static void init_pop_count_table();
static idx_t num_set_bits(bm_word_t w);
......@@ -287,7 +289,6 @@ class BitMap VALUE_OBJ_CLASS_SPEC {
#endif
};
// Convenience class wrapping BitMap which provides multiple bits per slot.
class BitMap2D VALUE_OBJ_CLASS_SPEC {
public:
......
......@@ -22,6 +22,17 @@
*
*/
#ifdef ASSERT
inline void BitMap::verify_index(idx_t index) const {
assert(index < _size, "BitMap index out of bounds");
}
inline void BitMap::verify_range(idx_t beg_index, idx_t end_index) const {
assert(beg_index <= end_index, "BitMap range error");
// Note that [0,0) and [size,size) are both valid ranges.
if (end_index != _size) verify_index(end_index);
}
#endif // #ifdef ASSERT
inline void BitMap::set_bit(idx_t bit) {
verify_index(bit);
......
......@@ -106,11 +106,13 @@
#ifdef ASSERT
#define DEBUG_ONLY(code) code
#define NOT_DEBUG(code)
#define NOT_DEBUG_RETURN /*next token must be ;*/
// Historical.
#define debug_only(code) code
#else // ASSERT
#define DEBUG_ONLY(code)
#define NOT_DEBUG(code) code
#define NOT_DEBUG_RETURN {}
#define debug_only(code)
#endif // ASSERT
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册