--- a/src/hotspot/share/utilities/bitMap.cpp Thu Apr 19 07:54:50 2018 +0200
+++ b/src/hotspot/share/utilities/bitMap.cpp Thu Apr 19 07:54:50 2018 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -72,7 +72,7 @@
};
template <class Allocator>
-BitMap::bm_word_t* BitMap::reallocate(const Allocator& allocator, bm_word_t* old_map, idx_t old_size_in_bits, idx_t new_size_in_bits) {
+BitMap::bm_word_t* BitMap::reallocate(const Allocator& allocator, bm_word_t* old_map, idx_t old_size_in_bits, idx_t new_size_in_bits, bool clear) {
size_t old_size_in_words = calc_size_in_words(old_size_in_bits);
size_t new_size_in_words = calc_size_in_words(new_size_in_bits);
@@ -86,7 +86,7 @@
MIN2(old_size_in_words, new_size_in_words));
}
- if (new_size_in_words > old_size_in_words) {
+ if (clear && new_size_in_words > old_size_in_words) {
clear_range_of_words(map, old_size_in_words, new_size_in_words);
}
}
@@ -99,9 +99,9 @@
}
template <class Allocator>
-bm_word_t* BitMap::allocate(const Allocator& allocator, idx_t size_in_bits) {
+bm_word_t* BitMap::allocate(const Allocator& allocator, idx_t size_in_bits, bool clear) {
// Reuse reallocate to ensure that the new memory is cleared.
- return reallocate(allocator, NULL, 0, size_in_bits);
+ return reallocate(allocator, NULL, 0, size_in_bits, clear);
}
template <class Allocator>
@@ -153,8 +153,8 @@
: BitMap(allocate(ArenaBitMapAllocator(arena), size_in_bits), size_in_bits) {
}
-CHeapBitMap::CHeapBitMap(idx_t size_in_bits, MEMFLAGS flags)
- : BitMap(allocate(CHeapBitMapAllocator(flags), size_in_bits), size_in_bits), _flags(flags) {
+CHeapBitMap::CHeapBitMap(idx_t size_in_bits, MEMFLAGS flags, bool clear)
+ : BitMap(allocate(CHeapBitMapAllocator(flags), size_in_bits, clear), size_in_bits), _flags(flags) {
}
CHeapBitMap::~CHeapBitMap() {