changeset 13441:b69f277b24f4

8176571: Fine bitmaps should be allocated as belonging to mtGC, not mtInternal Summary: Specify map allocation mflags when constructing CHeapBitMap. Reviewed-by: tschatzl, kbarrett Contributed-by: milan.mimica@gmail.com
author kbarrett
date Sat, 22 Jul 2017 15:54:27 -0400
parents 190dd9cd1882
children 731370f39fcd
files src/share/vm/gc/g1/g1PageBasedVirtualSpace.cpp src/share/vm/gc/g1/g1RegionToSpaceMapper.cpp src/share/vm/gc/g1/heapRegionManager.hpp src/share/vm/gc/g1/heapRegionRemSet.cpp src/share/vm/utilities/bitMap.cpp src/share/vm/utilities/bitMap.hpp
diffstat 6 files changed, 24 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc/g1/g1PageBasedVirtualSpace.cpp	Wed Aug 02 15:59:33 2017 +0000
+++ b/src/share/vm/gc/g1/g1PageBasedVirtualSpace.cpp	Sat Jul 22 15:54:27 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, 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
@@ -34,8 +34,8 @@
 #include "utilities/bitMap.inline.hpp"
 
 G1PageBasedVirtualSpace::G1PageBasedVirtualSpace(ReservedSpace rs, size_t used_size, size_t page_size) :
-  _low_boundary(NULL), _high_boundary(NULL), _committed(), _page_size(0), _special(false),
-  _dirty(), _executable(false) {
+  _low_boundary(NULL), _high_boundary(NULL), _committed(mtGC), _page_size(0), _special(false),
+  _dirty(mtGC), _executable(false) {
   initialize_with_page_size(rs, used_size, page_size);
 }
 
--- a/src/share/vm/gc/g1/g1RegionToSpaceMapper.cpp	Wed Aug 02 15:59:33 2017 +0000
+++ b/src/share/vm/gc/g1/g1RegionToSpaceMapper.cpp	Sat Jul 22 15:54:27 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, 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
@@ -40,7 +40,7 @@
   _storage(rs, used_size, page_size),
   _region_granularity(region_granularity),
   _listener(NULL),
-  _commit_map(rs.size() * commit_factor / region_granularity) {
+  _commit_map(rs.size() * commit_factor / region_granularity, mtGC) {
   guarantee(is_power_of_2(page_size), "must be");
   guarantee(is_power_of_2(region_granularity), "must be");
 
--- a/src/share/vm/gc/g1/heapRegionManager.hpp	Wed Aug 02 15:59:33 2017 +0000
+++ b/src/share/vm/gc/g1/heapRegionManager.hpp	Sat Jul 22 15:54:27 2017 -0400
@@ -130,7 +130,7 @@
   // Empty constructor, we'll initialize it with the initialize() method.
   HeapRegionManager() : _regions(), _heap_mapper(NULL), _num_committed(0),
                     _next_bitmap_mapper(NULL), _prev_bitmap_mapper(NULL), _bot_mapper(NULL),
-                    _allocated_heapregions_length(0), _available_map(),
+                    _allocated_heapregions_length(0), _available_map(mtGC),
                     _free_list("Free list", new MasterFreeRegionListMtSafeChecker())
   { }
 
--- a/src/share/vm/gc/g1/heapRegionRemSet.cpp	Wed Aug 02 15:59:33 2017 +0000
+++ b/src/share/vm/gc/g1/heapRegionRemSet.cpp	Sat Jul 22 15:54:27 2017 -0400
@@ -71,7 +71,7 @@
   PerRegionTable(HeapRegion* hr) :
     _hr(hr),
     _occupied(0),
-    _bm(HeapRegion::CardsPerRegion),
+    _bm(HeapRegion::CardsPerRegion, mtGC),
     _collision_list_next(NULL), _next(NULL), _prev(NULL)
   {}
 
@@ -261,7 +261,7 @@
 OtherRegionsTable::OtherRegionsTable(HeapRegion* hr, Mutex* m) :
   _g1h(G1CollectedHeap::heap()),
   _hr(hr), _m(m),
-  _coarse_map(G1CollectedHeap::heap()->max_regions()),
+  _coarse_map(G1CollectedHeap::heap()->max_regions(), mtGC),
   _fine_grain_regions(NULL),
   _first_all_fine_prts(NULL), _last_all_fine_prts(NULL),
   _n_fine_entries(0), _n_coarse_entries(0),
--- a/src/share/vm/utilities/bitMap.cpp	Wed Aug 02 15:59:33 2017 +0000
+++ b/src/share/vm/utilities/bitMap.cpp	Sat Jul 22 15:54:27 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -46,9 +46,12 @@
 };
 
 class CHeapBitMapAllocator : StackObj {
+  MEMFLAGS _flags;
+
  public:
+  CHeapBitMapAllocator(MEMFLAGS flags) : _flags(flags) {}
   bm_word_t* allocate(size_t size_in_words) const {
-    return ArrayAllocator<bm_word_t>::allocate(size_in_words, mtInternal);
+    return ArrayAllocator<bm_word_t>::allocate(size_in_words, _flags);
   }
   void free(bm_word_t* map, idx_t size_in_words) const {
     ArrayAllocator<bm_word_t>::free(map, size_in_words);
@@ -148,24 +151,24 @@
     : BitMap(allocate(ArenaBitMapAllocator(arena), size_in_bits), size_in_bits) {
 }
 
-CHeapBitMap::CHeapBitMap(idx_t size_in_bits)
-    : BitMap(allocate(CHeapBitMapAllocator(), 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() {
-  free(CHeapBitMapAllocator(), map(), size());
+  free(CHeapBitMapAllocator(_flags), map(), size());
 }
 
 void CHeapBitMap::resize(idx_t new_size_in_bits) {
-  BitMap::resize(CHeapBitMapAllocator(), new_size_in_bits);
+  BitMap::resize(CHeapBitMapAllocator(_flags), new_size_in_bits);
 }
 
 void CHeapBitMap::initialize(idx_t size_in_bits) {
-  BitMap::initialize(CHeapBitMapAllocator(), size_in_bits);
+  BitMap::initialize(CHeapBitMapAllocator(_flags), size_in_bits);
 }
 
 void CHeapBitMap::reinitialize(idx_t size_in_bits) {
-  BitMap::reinitialize(CHeapBitMapAllocator(), size_in_bits);
+  BitMap::reinitialize(CHeapBitMapAllocator(_flags), size_in_bits);
 }
 
 #ifdef ASSERT
--- a/src/share/vm/utilities/bitMap.hpp	Wed Aug 02 15:59:33 2017 +0000
+++ b/src/share/vm/utilities/bitMap.hpp	Sat Jul 22 15:54:27 2017 -0400
@@ -353,10 +353,13 @@
   CHeapBitMap(const CHeapBitMap&);
   CHeapBitMap& operator=(const CHeapBitMap&);
 
+  // NMT memory type
+  MEMFLAGS _flags;
+
  public:
-  CHeapBitMap() : BitMap(NULL, 0) {}
+  CHeapBitMap(MEMFLAGS flags = mtInternal) : BitMap(NULL, 0), _flags(flags) {}
   // Clears the bitmap memory.
-  CHeapBitMap(idx_t size_in_bits);
+  CHeapBitMap(idx_t size_in_bits, MEMFLAGS flags = mtInternal);
   ~CHeapBitMap();
 
   // Resize the backing bitmap memory.