提交 1f9ef932 编写于 作者: Z zgu

7191124: Optimized build is broken due to inconsistent use of DEBUG_ONLY and...

7191124: Optimized build is broken due to inconsistent use of DEBUG_ONLY and NOT_PRODUCT macros in NMT
Summary: Updated all related variables and methods to use NOT_PRODUCT macros
Reviewed-by: coleenp, acorn, kvn
上级 a94be8e0
......@@ -27,7 +27,7 @@
#include "services/memTracker.hpp"
volatile jint SequenceGenerator::_seq_number = 1;
DEBUG_ONLY(jint SequenceGenerator::_max_seq_number = 1;)
NOT_PRODUCT(jint SequenceGenerator::_max_seq_number = 1;)
DEBUG_ONLY(volatile unsigned long SequenceGenerator::_generation = 0;)
jint SequenceGenerator::next() {
......@@ -36,7 +36,7 @@ jint SequenceGenerator::next() {
MemTracker::shutdown(MemTracker::NMT_sequence_overflow);
}
assert(seq > 0, "counter overflow");
DEBUG_ONLY(_max_seq_number = (seq > _max_seq_number) ? seq : _max_seq_number;)
NOT_PRODUCT(_max_seq_number = (seq > _max_seq_number) ? seq : _max_seq_number;)
return seq;
}
......
......@@ -51,11 +51,11 @@ class SequenceGenerator : AllStatic {
};
DEBUG_ONLY(static unsigned long current_generation() { return (unsigned long)_generation; })
DEBUG_ONLY(static jint max_seq_num() { return _max_seq_number; })
NOT_PRODUCT(static jint max_seq_num() { return _max_seq_number; })
private:
static volatile jint _seq_number;
DEBUG_ONLY(static jint _max_seq_number; )
NOT_PRODUCT(static jint _max_seq_number; )
DEBUG_ONLY(static volatile unsigned long _generation; )
};
......
......@@ -59,7 +59,7 @@ class MemPointerArray : public CHeapObj<mtNMT> {
virtual size_t instance_size() const = 0;
virtual bool shrink() = 0;
debug_only(virtual int capacity() const = 0;)
NOT_PRODUCT(virtual int capacity() const = 0;)
};
// Iterator interface
......@@ -205,7 +205,7 @@ template <class E> class MemPointerArrayImpl : public MemPointerArray {
return _size;
}
debug_only(int capacity() const { return _max_size; })
NOT_PRODUCT(int capacity() const { return _max_size; })
void clear() {
assert(_data != NULL, "Just check");
......
......@@ -73,7 +73,7 @@ template <class E, int SIZE> class FixedSizeMemPointerArray :
return sizeof(FixedSizeMemPointerArray<E, SIZE>);
}
debug_only(int capacity() const { return SIZE; })
NOT_PRODUCT(int capacity() const { return SIZE; })
public:
// implementation of public interface
......
......@@ -338,15 +338,13 @@ void MemSnapshot::promote() {
vm_itr.insert_after(cur_vm);
}
} else {
#ifdef ASSERT
// In theory, we should assert without conditions. However, in case of native
// thread stack, NMT explicitly releases the thread stack in Thread's destructor,
// due to platform dependent behaviors. On some platforms, we see uncommit/release
// native thread stack, but some, we don't.
if (!cur_vm->is_uncommit_record() && !cur_vm->is_deallocation_record()) {
fatal(err_msg("Should not reach here, pointer flags = [%x]", cur_vm->flags()));
}
#endif
assert(cur_vm->is_uncommit_record() || cur_vm->is_deallocation_record(),
err_msg("Should not reach here, pointer addr = [" INTPTR_FORMAT "], flags = [%x]",
cur_vm->addr(), cur_vm->flags()));
}
}
} else {
......@@ -406,7 +404,7 @@ void MemSnapshot::promote() {
}
#ifdef ASSERT
#ifndef PRODUCT
void MemSnapshot::print_snapshot_stats(outputStream* st) {
st->print_cr("Snapshot:");
st->print_cr("\tMalloced: %d/%d [%5.2f%%] %dKB", _alloc_ptrs->length(), _alloc_ptrs->capacity(),
......@@ -434,6 +432,20 @@ void MemSnapshot::check_malloc_pointers() {
}
}
bool MemSnapshot::has_allocation_record(address addr) {
MemPointerArrayIteratorImpl itr(_staging_area);
MemPointerRecord* cur = (MemPointerRecord*)itr.current();
while (cur != NULL) {
if (cur->addr() == addr && cur->is_allocation_record()) {
return true;
}
cur = (MemPointerRecord*)itr.next();
}
return false;
}
#endif // PRODUCT
#ifdef ASSERT
void MemSnapshot::check_staging_data() {
MemPointerArrayIteratorImpl itr(_staging_area);
MemPointerRecord* cur = (MemPointerRecord*)itr.current();
......@@ -447,17 +459,5 @@ void MemSnapshot::check_staging_data() {
next = (MemPointerRecord*)itr.next();
}
}
#endif // ASSERT
bool MemSnapshot::has_allocation_record(address addr) {
MemPointerArrayIteratorImpl itr(_staging_area);
MemPointerRecord* cur = (MemPointerRecord*)itr.current();
while (cur != NULL) {
if (cur->addr() == addr && cur->is_allocation_record()) {
return true;
}
cur = (MemPointerRecord*)itr.next();
}
return false;
}
#endif
......@@ -65,7 +65,7 @@ MemTracker::ShutdownReason MemTracker::_reason = NMT_shutdown_none;
int MemTracker::_thread_count = 255;
volatile jint MemTracker::_pooled_recorder_count = 0;
debug_only(intx MemTracker::_main_thread_tid = 0;)
debug_only(volatile jint MemTracker::_pending_recorder_count = 0;)
NOT_PRODUCT(volatile jint MemTracker::_pending_recorder_count = 0;)
void MemTracker::init_tracking_options(const char* option_line) {
_tracking_level = NMT_off;
......@@ -291,7 +291,7 @@ MemRecorder* MemTracker::get_pending_recorders() {
(void*)cur_head)) {
cur_head = const_cast<MemRecorder*>(_merge_pending_queue);
}
debug_only(Atomic::store(0, &_pending_recorder_count));
NOT_PRODUCT(Atomic::store(0, &_pending_recorder_count));
return cur_head;
}
......@@ -420,7 +420,7 @@ void MemTracker::enqueue_pending_recorder(MemRecorder* rec) {
cur_head = const_cast<MemRecorder*>(_merge_pending_queue);
rec->set_next(cur_head);
}
debug_only(Atomic::inc(&_pending_recorder_count);)
NOT_PRODUCT(Atomic::inc(&_pending_recorder_count);)
}
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册