8156207: Resource allocated BitMaps are often cleared unnecessarily
Summary: Removed unnecessary clearing of BitMap.
Reviewed-by: kbarrett, kvn, thartmann
Contributed-by: Christian Hagedorn <christian.hagedorn@oracle.com>
--- a/src/hotspot/share/compiler/methodLiveness.cpp Mon Jul 29 09:34:07 2019 +0200
+++ b/src/hotspot/share/compiler/methodLiveness.cpp Mon Jul 29 09:40:02 2019 +0200
@@ -830,8 +830,8 @@
#ifdef ASSERT
ResourceMark rm;
- ResourceBitMap g(_gen.size()); g.set_from(_gen);
- ResourceBitMap k(_kill.size()); k.set_from(_kill);
+ ResourceBitMap g(_gen.size(), false); g.set_from(_gen);
+ ResourceBitMap k(_kill.size(), false); k.set_from(_kill);
#endif
if (_last_bci != bci || trueInDebug) {
ciBytecodeStream bytes(method);
--- a/src/hotspot/share/utilities/bitMap.cpp Mon Jul 29 09:34:07 2019 +0200
+++ b/src/hotspot/share/utilities/bitMap.cpp Mon Jul 29 09:40:02 2019 +0200
@@ -133,8 +133,8 @@
initialize(allocator, new_size_in_bits, clear);
}
-ResourceBitMap::ResourceBitMap(idx_t size_in_bits)
- : BitMap(allocate(ResourceBitMapAllocator(), size_in_bits), size_in_bits) {
+ResourceBitMap::ResourceBitMap(idx_t size_in_bits, bool clear)
+ : BitMap(allocate(ResourceBitMapAllocator(), size_in_bits, clear), size_in_bits) {
}
void ResourceBitMap::resize(idx_t new_size_in_bits) {
--- a/src/hotspot/share/utilities/bitMap.hpp Mon Jul 29 09:34:07 2019 +0200
+++ b/src/hotspot/share/utilities/bitMap.hpp Mon Jul 29 09:40:02 2019 +0200
@@ -329,8 +329,8 @@
public:
ResourceBitMap() : BitMap(NULL, 0) {}
- // Clears the bitmap memory.
- ResourceBitMap(idx_t size_in_bits);
+ // Conditionally clears the bitmap memory.
+ ResourceBitMap(idx_t size_in_bits, bool clear = true);
// Resize the backing bitmap memory.
//