提交 d9a17c83 编写于 作者: B brutisso

8006242: G1: WorkerDataArray<T>::verify() too strict for double calculations

Summary: Also reviewed by vitalyd@gmail.com.
Reviewed-by: johnc, mgerdin
上级 482ef3f8
......@@ -131,17 +131,23 @@ void WorkerDataArray<T>::print(int level, const char* title) {
#ifndef PRODUCT
template <> const int WorkerDataArray<int>::_uninitialized = -1;
template <> const double WorkerDataArray<double>::_uninitialized = -1.0;
template <> const size_t WorkerDataArray<size_t>::_uninitialized = (size_t)-1;
template <class T>
void WorkerDataArray<T>::reset() {
for (uint i = 0; i < _length; i++) {
_data[i] = (T)-1;
_data[i] = (T)_uninitialized;
}
}
template <class T>
void WorkerDataArray<T>::verify() {
for (uint i = 0; i < _length; i++) {
assert(_data[i] >= (T)0, err_msg("Invalid data for worker %d", i));
assert(_data[i] != _uninitialized,
err_msg("Invalid data for worker " UINT32_FORMAT ", data: %lf, uninitialized: %lf",
i, (double)_data[i], (double)_uninitialized));
}
}
......
......@@ -35,6 +35,8 @@ class WorkerDataArray : public CHeapObj<mtGC> {
const char* _print_format;
bool _print_sum;
NOT_PRODUCT(static const T _uninitialized;)
// We are caching the sum and average to only have to calculate them once.
// This is not done in an MT-safe way. It is intetened to allow single
// threaded code to call sum() and average() multiple times in any order
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册