hotspot/src/share/vm/utilities/bitMap.cpp
author stefank
Tue, 03 May 2016 22:45:27 +0200
changeset 38177 b0c9cb06506b
parent 38102 839593075df1
child 40639 83c879c8db57
permissions -rw-r--r--
8141501: Problems with BitMap buffer management Reviewed-by: pliden, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
37264
d9b0f2b53b73 8152188: Allow CMSBitMapYieldQuantum for BitMap::clear_range and clear_large_range
sangheki
parents: 37059
diff changeset
     2
 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3261
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3261
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3261
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#include "memory/allocation.inline.hpp"
23545
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
    27
#include "memory/resourceArea.hpp"
25351
7c198a690050 8044775: Improve usage of umbrella header atomic.inline.hpp.
goetz
parents: 24424
diff changeset
    28
#include "runtime/atomic.inline.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "utilities/bitMap.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "utilities/copy.hpp"
38177
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    31
#include "utilities/debug.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
37058
47faedc8085b 8151439: Inline the BitMap constructor
stefank
parents: 37057
diff changeset
    33
STATIC_ASSERT(sizeof(BitMap::bm_word_t) == BytesPerWord); // "Implementation assumption."
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
38177
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    35
typedef BitMap::bm_word_t bm_word_t;
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    36
typedef BitMap::idx_t     idx_t;
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    37
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    38
class ResourceBitMapAllocator : StackObj {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    39
 public:
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    40
  bm_word_t* allocate(idx_t size_in_words) const {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    41
    return NEW_RESOURCE_ARRAY(bm_word_t, size_in_words);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    42
  }
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    43
  void free(bm_word_t* map, idx_t size_in_words) const {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    44
    // Don't free resource allocated arrays.
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    45
  }
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    46
};
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    47
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    48
class CHeapBitMapAllocator : StackObj {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    49
 public:
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    50
  bm_word_t* allocate(size_t size_in_words) const {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    51
    return ArrayAllocator<bm_word_t, mtInternal>::allocate(size_in_words);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    52
  }
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    53
  void free(bm_word_t* map, idx_t size_in_words) const {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    54
    ArrayAllocator<bm_word_t, mtInternal>::free(map, size_in_words);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    55
  }
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    56
};
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    57
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    58
class ArenaBitMapAllocator : StackObj {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    59
  Arena* _arena;
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    60
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    61
 public:
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    62
  ArenaBitMapAllocator(Arena* arena) : _arena(arena) {}
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    63
  bm_word_t* allocate(idx_t size_in_words) const {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    64
    return (bm_word_t*)_arena->Amalloc(size_in_words * BytesPerWord);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    65
  }
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    66
  void free(bm_word_t* map, idx_t size_in_words) const {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    67
    // ArenaBitMaps currently don't free memory.
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    68
  }
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    69
};
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    70
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    71
template <class Allocator>
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    72
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) {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    73
  size_t old_size_in_words = calc_size_in_words(old_size_in_bits);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    74
  size_t new_size_in_words = calc_size_in_words(new_size_in_bits);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    75
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    76
  bm_word_t* map = NULL;
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    77
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    78
  if (new_size_in_words > 0) {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    79
    map = allocator.allocate(new_size_in_words);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    80
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    81
    Copy::disjoint_words((HeapWord*)old_map, (HeapWord*) map,
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    82
                         MIN2(old_size_in_words, new_size_in_words));
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    83
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    84
    if (new_size_in_words > old_size_in_words) {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    85
      clear_range_of_words(map, old_size_in_words, new_size_in_words);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    86
    }
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    87
  }
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    88
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    89
  if (old_map != NULL) {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    90
    allocator.free(old_map, old_size_in_words);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    91
  }
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    92
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    93
  return map;
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    94
}
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    95
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    96
template <class Allocator>
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    97
bm_word_t* BitMap::allocate(const Allocator& allocator, idx_t size_in_bits) {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    98
  // Reuse reallocate to ensure that the new memory is cleared.
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
    99
  return reallocate(allocator, NULL, 0, size_in_bits);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   100
}
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   101
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   102
template <class Allocator>
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   103
void BitMap::free(const Allocator& allocator, bm_word_t* map, idx_t  size_in_bits) {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   104
  bm_word_t* ret = reallocate(allocator, map, size_in_bits, 0);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   105
  assert(ret == NULL, "Reallocate shouldn't have allocated");
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   106
}
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   107
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   108
template <class Allocator>
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   109
void BitMap::resize(const Allocator& allocator, idx_t new_size_in_bits) {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   110
  bm_word_t* new_map = reallocate(allocator, map(), size(), new_size_in_bits);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   111
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   112
  update(new_map, new_size_in_bits);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   113
}
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   114
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   115
template <class Allocator>
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   116
void BitMap::initialize(const Allocator& allocator, idx_t size_in_bits) {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   117
  assert(map() == NULL, "precondition");
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   118
  assert(size() == 0,   "precondition");
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   119
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   120
  resize(allocator, size_in_bits);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   121
}
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   122
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   123
template <class Allocator>
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   124
void BitMap::reinitialize(const Allocator& allocator, idx_t new_size_in_bits) {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   125
  // Remove previous bits.
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   126
  resize(allocator, 0);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   127
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   128
  initialize(allocator, new_size_in_bits);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   129
}
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   130
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   131
ResourceBitMap::ResourceBitMap(idx_t size_in_bits)
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   132
    : BitMap(allocate(ResourceBitMapAllocator(), size_in_bits), size_in_bits) {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   133
}
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   134
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   135
void ResourceBitMap::resize(idx_t new_size_in_bits) {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   136
  BitMap::resize(ResourceBitMapAllocator(), new_size_in_bits);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   137
}
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   138
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   139
void ResourceBitMap::initialize(idx_t size_in_bits) {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   140
  BitMap::initialize(ResourceBitMapAllocator(), size_in_bits);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   141
}
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   142
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   143
void ResourceBitMap::reinitialize(idx_t size_in_bits) {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   144
  BitMap::reinitialize(ResourceBitMapAllocator(), size_in_bits);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   145
}
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   146
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   147
ArenaBitMap::ArenaBitMap(Arena* arena, idx_t size_in_bits)
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   148
    : BitMap(allocate(ArenaBitMapAllocator(arena), size_in_bits), size_in_bits) {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   149
}
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   150
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   151
CHeapBitMap::CHeapBitMap(idx_t size_in_bits)
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   152
    : BitMap(allocate(CHeapBitMapAllocator(), size_in_bits), size_in_bits) {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   153
}
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   154
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   155
CHeapBitMap::~CHeapBitMap() {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   156
  free(CHeapBitMapAllocator(), map(), size());
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   157
}
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   158
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   159
void CHeapBitMap::resize(idx_t new_size_in_bits) {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   160
  BitMap::resize(CHeapBitMapAllocator(), new_size_in_bits);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   161
}
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   162
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   163
void CHeapBitMap::initialize(idx_t size_in_bits) {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   164
  BitMap::initialize(CHeapBitMapAllocator(), size_in_bits);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   165
}
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   166
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   167
void CHeapBitMap::reinitialize(idx_t size_in_bits) {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   168
  BitMap::reinitialize(CHeapBitMapAllocator(), size_in_bits);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
37059
c482915a21aa 8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents: 37058
diff changeset
   171
#ifdef ASSERT
c482915a21aa 8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents: 37058
diff changeset
   172
void BitMap::verify_index(idx_t index) const {
c482915a21aa 8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents: 37058
diff changeset
   173
  assert(index < _size, "BitMap index out of bounds");
c482915a21aa 8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents: 37058
diff changeset
   174
}
c482915a21aa 8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents: 37058
diff changeset
   175
c482915a21aa 8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents: 37058
diff changeset
   176
void BitMap::verify_range(idx_t beg_index, idx_t end_index) const {
c482915a21aa 8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents: 37058
diff changeset
   177
  assert(beg_index <= end_index, "BitMap range error");
c482915a21aa 8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents: 37058
diff changeset
   178
  // Note that [0,0) and [size,size) are both valid ranges.
c482915a21aa 8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents: 37058
diff changeset
   179
  if (end_index != _size) verify_index(end_index);
c482915a21aa 8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents: 37058
diff changeset
   180
}
c482915a21aa 8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents: 37058
diff changeset
   181
#endif // #ifdef ASSERT
c482915a21aa 8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents: 37058
diff changeset
   182
37413
2f71679d06dd 8077144: Concurrent mark initialization takes too long
tschatzl
parents: 37264
diff changeset
   183
void BitMap::pretouch() {
37414
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37413
diff changeset
   184
  os::pretouch_memory(word_addr(0), word_addr(size()));
37413
2f71679d06dd 8077144: Concurrent mark initialization takes too long
tschatzl
parents: 37264
diff changeset
   185
}
2f71679d06dd 8077144: Concurrent mark initialization takes too long
tschatzl
parents: 37264
diff changeset
   186
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
void BitMap::set_range_within_word(idx_t beg, idx_t end) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  // With a valid range (beg <= end), this test ensures that end != 0, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  // required by inverted_bit_mask_for_range.  Also avoids an unnecessary write.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  if (beg != end) {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   191
    bm_word_t mask = inverted_bit_mask_for_range(beg, end);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
    *word_addr(beg) |= ~mask;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
void BitMap::clear_range_within_word(idx_t beg, idx_t end) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  // With a valid range (beg <= end), this test ensures that end != 0, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  // required by inverted_bit_mask_for_range.  Also avoids an unnecessary write.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  if (beg != end) {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   200
    bm_word_t mask = inverted_bit_mask_for_range(beg, end);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
    *word_addr(beg) &= mask;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
void BitMap::par_put_range_within_word(idx_t beg, idx_t end, bool value) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  assert(value == 0 || value == 1, "0 for clear, 1 for set");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  // With a valid range (beg <= end), this test ensures that end != 0, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  // required by inverted_bit_mask_for_range.  Also avoids an unnecessary write.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  if (beg != end) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
    intptr_t* pw  = (intptr_t*)word_addr(beg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
    intptr_t  w   = *pw;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
    intptr_t  mr  = (intptr_t)inverted_bit_mask_for_range(beg, end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
    intptr_t  nw  = value ? (w | ~mr) : (w & mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
    while (true) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
      intptr_t res = Atomic::cmpxchg_ptr(nw, pw, w);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
      if (res == w) break;
22769
516e9b159656 8033545: Missing volatile specifier in Bitmap::par_put_range_within_word
tschatzl
parents: 22234
diff changeset
   217
      w  = res;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
      nw = value ? (w | ~mr) : (w & mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
void BitMap::set_range(idx_t beg, idx_t end) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  verify_range(beg, end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  idx_t beg_full_word = word_index_round_up(beg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  idx_t end_full_word = word_index(end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  if (beg_full_word < end_full_word) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
    // The range includes at least one full word.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
    set_range_within_word(beg, bit_index(beg_full_word));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
    set_range_of_words(beg_full_word, end_full_word);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
    set_range_within_word(bit_index(end_full_word), end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
    // The range spans at most 2 partial words.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
    idx_t boundary = MIN2(bit_index(beg_full_word), end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
    set_range_within_word(beg, boundary);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
    set_range_within_word(boundary, end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
void BitMap::clear_range(idx_t beg, idx_t end) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  verify_range(beg, end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  idx_t beg_full_word = word_index_round_up(beg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  idx_t end_full_word = word_index(end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
  if (beg_full_word < end_full_word) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
    // The range includes at least one full word.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
    clear_range_within_word(beg, bit_index(beg_full_word));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
    clear_range_of_words(beg_full_word, end_full_word);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
    clear_range_within_word(bit_index(end_full_word), end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
    // The range spans at most 2 partial words.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
    idx_t boundary = MIN2(bit_index(beg_full_word), end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
    clear_range_within_word(beg, boundary);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
    clear_range_within_word(boundary, end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
void BitMap::set_large_range(idx_t beg, idx_t end) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  verify_range(beg, end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
  idx_t beg_full_word = word_index_round_up(beg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
  idx_t end_full_word = word_index(end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  assert(end_full_word - beg_full_word >= 32,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
         "the range must include at least 32 bytes");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  // The range includes at least one full word.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  set_range_within_word(beg, bit_index(beg_full_word));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  set_large_range_of_words(beg_full_word, end_full_word);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
  set_range_within_word(bit_index(end_full_word), end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
void BitMap::clear_large_range(idx_t beg, idx_t end) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
  verify_range(beg, end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
  idx_t beg_full_word = word_index_round_up(beg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
  idx_t end_full_word = word_index(end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
37264
d9b0f2b53b73 8152188: Allow CMSBitMapYieldQuantum for BitMap::clear_range and clear_large_range
sangheki
parents: 37059
diff changeset
   282
  if (end_full_word - beg_full_word < 32) {
d9b0f2b53b73 8152188: Allow CMSBitMapYieldQuantum for BitMap::clear_range and clear_large_range
sangheki
parents: 37059
diff changeset
   283
    clear_range(beg, end);
d9b0f2b53b73 8152188: Allow CMSBitMapYieldQuantum for BitMap::clear_range and clear_large_range
sangheki
parents: 37059
diff changeset
   284
    return;
d9b0f2b53b73 8152188: Allow CMSBitMapYieldQuantum for BitMap::clear_range and clear_large_range
sangheki
parents: 37059
diff changeset
   285
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  // The range includes at least one full word.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  clear_range_within_word(beg, bit_index(beg_full_word));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
  clear_large_range_of_words(beg_full_word, end_full_word);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
  clear_range_within_word(bit_index(end_full_word), end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
void BitMap::at_put(idx_t offset, bool value) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
  if (value) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
    set_bit(offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
    clear_bit(offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
// Return true to indicate that this thread changed
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
// the bit, false to indicate that someone else did.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
// In either case, the requested bit is in the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
// requested state some time during the period that
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
// this thread is executing this call. More importantly,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
// if no other thread is executing an action to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
// change the requested bit to a state other than
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
// the one that this thread is trying to set it to,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
// then the the bit is in the expected state
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
// at exit from this method. However, rather than
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
// make such a strong assertion here, based on
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
// assuming such constrained use (which though true
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
// today, could change in the future to service some
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
// funky parallel algorithm), we encourage callers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
// to do such verification, as and when appropriate.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
bool BitMap::par_at_put(idx_t bit, bool value) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
  return value ? par_set_bit(bit) : par_clear_bit(bit);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
void BitMap::at_put_range(idx_t start_offset, idx_t end_offset, bool value) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
  if (value) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
    set_range(start_offset, end_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
    clear_range(start_offset, end_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
void BitMap::par_at_put_range(idx_t beg, idx_t end, bool value) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
  verify_range(beg, end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
  idx_t beg_full_word = word_index_round_up(beg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
  idx_t end_full_word = word_index(end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
  if (beg_full_word < end_full_word) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
    // The range includes at least one full word.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
    par_put_range_within_word(beg, bit_index(beg_full_word), value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
    if (value) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
      set_range_of_words(beg_full_word, end_full_word);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
      clear_range_of_words(beg_full_word, end_full_word);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
    par_put_range_within_word(bit_index(end_full_word), end, value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
    // The range spans at most 2 partial words.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
    idx_t boundary = MIN2(bit_index(beg_full_word), end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
    par_put_range_within_word(beg, boundary, value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
    par_put_range_within_word(boundary, end, value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
void BitMap::at_put_large_range(idx_t beg, idx_t end, bool value) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
  if (value) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
    set_large_range(beg, end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
    clear_large_range(beg, end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
void BitMap::par_at_put_large_range(idx_t beg, idx_t end, bool value) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
  verify_range(beg, end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
  idx_t beg_full_word = word_index_round_up(beg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
  idx_t end_full_word = word_index(end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
  assert(end_full_word - beg_full_word >= 32,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
         "the range must include at least 32 bytes");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
  // The range includes at least one full word.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
  par_put_range_within_word(beg, bit_index(beg_full_word), value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
  if (value) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
    set_large_range_of_words(beg_full_word, end_full_word);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
    clear_large_range_of_words(beg_full_word, end_full_word);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
  par_put_range_within_word(bit_index(end_full_word), end, value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   379
bool BitMap::contains(const BitMap& other) const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
  assert(size() == other.size(), "must have same size");
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   381
  const bm_word_t* dest_map = map();
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   382
  const bm_word_t* other_map = other.map();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
  idx_t size = size_in_words();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
  for (idx_t index = 0; index < size_in_words(); index++) {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   385
    bm_word_t word_union = dest_map[index] | other_map[index];
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
    // If this has more bits set than dest_map[index], then other is not a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
    // subset.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
    if (word_union != dest_map[index]) return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
  return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   393
bool BitMap::intersects(const BitMap& other) const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
  assert(size() == other.size(), "must have same size");
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   395
  const bm_word_t* dest_map = map();
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   396
  const bm_word_t* other_map = other.map();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
  idx_t size = size_in_words();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
  for (idx_t index = 0; index < size_in_words(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
    if ((dest_map[index] & other_map[index]) != 0) return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
  // Otherwise, no intersection.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
  return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   405
void BitMap::set_union(const BitMap& other) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
  assert(size() == other.size(), "must have same size");
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   407
  bm_word_t* dest_map = map();
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   408
  const bm_word_t* other_map = other.map();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
  idx_t size = size_in_words();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
  for (idx_t index = 0; index < size_in_words(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
    dest_map[index] = dest_map[index] | other_map[index];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   416
void BitMap::set_difference(const BitMap& other) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
  assert(size() == other.size(), "must have same size");
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   418
  bm_word_t* dest_map = map();
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   419
  const bm_word_t* other_map = other.map();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
  idx_t size = size_in_words();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
  for (idx_t index = 0; index < size_in_words(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
    dest_map[index] = dest_map[index] & ~(other_map[index]);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   427
void BitMap::set_intersection(const BitMap& other) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
  assert(size() == other.size(), "must have same size");
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   429
  bm_word_t* dest_map = map();
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   430
  const bm_word_t* other_map = other.map();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
  idx_t size = size_in_words();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
  for (idx_t index = 0; index < size; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
    dest_map[index]  = dest_map[index] & other_map[index];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   438
void BitMap::set_intersection_at_offset(const BitMap& other, idx_t offset) {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   439
  assert(other.size() >= offset, "offset not in range");
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   440
  assert(other.size() - offset >= size(), "other not large enough");
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   441
  // XXX Ideally, we would remove this restriction.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   442
  guarantee((offset % (sizeof(bm_word_t) * BitsPerByte)) == 0,
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   443
            "Only handle aligned cases so far.");
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   444
  bm_word_t* dest_map = map();
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   445
  const bm_word_t* other_map = other.map();
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   446
  idx_t offset_word_ind = word_index(offset);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   447
  idx_t size = size_in_words();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   448
  for (idx_t index = 0; index < size; index++) {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   449
    dest_map[index] = dest_map[index] & other_map[offset_word_ind + index];
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   450
  }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   451
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   452
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   453
bool BitMap::set_union_with_result(const BitMap& other) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
  assert(size() == other.size(), "must have same size");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
  bool changed = false;
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   456
  bm_word_t* dest_map = map();
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   457
  const bm_word_t* other_map = other.map();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
  idx_t size = size_in_words();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
  for (idx_t index = 0; index < size; index++) {
26937
dd2b0f6de283 8059474: Clean up vm/utilities/Bitmap type uses
shade
parents: 25959
diff changeset
   460
    idx_t temp = dest_map[index] | other_map[index];
dd2b0f6de283 8059474: Clean up vm/utilities/Bitmap type uses
shade
parents: 25959
diff changeset
   461
    changed = changed || (temp != dest_map[index]);
dd2b0f6de283 8059474: Clean up vm/utilities/Bitmap type uses
shade
parents: 25959
diff changeset
   462
    dest_map[index] = temp;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   463
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   464
  return changed;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   468
bool BitMap::set_difference_with_result(const BitMap& other) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
  assert(size() == other.size(), "must have same size");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
  bool changed = false;
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   471
  bm_word_t* dest_map = map();
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   472
  const bm_word_t* other_map = other.map();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
  idx_t size = size_in_words();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
  for (idx_t index = 0; index < size; index++) {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   475
    bm_word_t temp = dest_map[index] & ~(other_map[index]);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
    changed = changed || (temp != dest_map[index]);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
    dest_map[index] = temp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
  return changed;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   483
bool BitMap::set_intersection_with_result(const BitMap& other) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
  assert(size() == other.size(), "must have same size");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
  bool changed = false;
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   486
  bm_word_t* dest_map = map();
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   487
  const bm_word_t* other_map = other.map();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
  idx_t size = size_in_words();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
  for (idx_t index = 0; index < size; index++) {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   490
    bm_word_t orig = dest_map[index];
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   491
    bm_word_t temp = orig & other_map[index];
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
    changed = changed || (temp != orig);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
    dest_map[index]  = temp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
  return changed;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   499
void BitMap::set_from(const BitMap& other) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
  assert(size() == other.size(), "must have same size");
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   501
  bm_word_t* dest_map = map();
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   502
  const bm_word_t* other_map = other.map();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
  idx_t size = size_in_words();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
  for (idx_t index = 0; index < size; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
    dest_map[index] = other_map[index];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   510
bool BitMap::is_same(const BitMap& other) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
  assert(size() == other.size(), "must have same size");
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   512
  bm_word_t* dest_map = map();
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   513
  const bm_word_t* other_map = other.map();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
  idx_t size = size_in_words();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   515
  for (idx_t index = 0; index < size; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
    if (dest_map[index] != other_map[index]) return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
  return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   520
489c9b5090e2 Initial load
duke
parents:
diff changeset
   521
bool BitMap::is_full() const {
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   522
  const bm_word_t* word = map();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
  idx_t rest = size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   524
  for (; rest >= (idx_t) BitsPerWord; rest -= BitsPerWord) {
26937
dd2b0f6de283 8059474: Clean up vm/utilities/Bitmap type uses
shade
parents: 25959
diff changeset
   525
    if (*word != ~(bm_word_t)0) return false;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
    word++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
  }
26937
dd2b0f6de283 8059474: Clean up vm/utilities/Bitmap type uses
shade
parents: 25959
diff changeset
   528
  return rest == 0 || (*word | ~right_n_bits((int)rest)) == ~(bm_word_t)0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   530
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
bool BitMap::is_empty() const {
38102
839593075df1 8141496: BitMap set operations copy their other BitMap argument
stefank
parents: 37414
diff changeset
   533
  const bm_word_t* word = map();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
  idx_t rest = size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   535
  for (; rest >= (idx_t) BitsPerWord; rest -= BitsPerWord) {
26937
dd2b0f6de283 8059474: Clean up vm/utilities/Bitmap type uses
shade
parents: 25959
diff changeset
   536
    if (*word != 0) return false;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
    word++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
  }
26937
dd2b0f6de283 8059474: Clean up vm/utilities/Bitmap type uses
shade
parents: 25959
diff changeset
   539
  return rest == 0 || (*word & right_n_bits((int)rest)) == 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   540
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   541
489c9b5090e2 Initial load
duke
parents:
diff changeset
   542
void BitMap::clear_large() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   543
  clear_large_range_of_words(0, size_in_words());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   544
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   545
489c9b5090e2 Initial load
duke
parents:
diff changeset
   546
// Note that if the closure itself modifies the bitmap
489c9b5090e2 Initial load
duke
parents:
diff changeset
   547
// then modifications in and to the left of the _bit_ being
489c9b5090e2 Initial load
duke
parents:
diff changeset
   548
// currently sampled will not be seen. Note also that the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   549
// interval [leftOffset, rightOffset) is right open.
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   550
bool BitMap::iterate(BitMapClosure* blk, idx_t leftOffset, idx_t rightOffset) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   551
  verify_range(leftOffset, rightOffset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   552
489c9b5090e2 Initial load
duke
parents:
diff changeset
   553
  idx_t startIndex = word_index(leftOffset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   554
  idx_t endIndex   = MIN2(word_index(rightOffset) + 1, size_in_words());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   555
  for (idx_t index = startIndex, offset = leftOffset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   556
       offset < rightOffset && index < endIndex;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   557
       offset = (++index) << LogBitsPerWord) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   558
    idx_t rest = map(index) >> (offset & (BitsPerWord - 1));
26937
dd2b0f6de283 8059474: Clean up vm/utilities/Bitmap type uses
shade
parents: 25959
diff changeset
   559
    for (; offset < rightOffset && rest != 0; offset++) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   560
      if (rest & 1) {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   561
        if (!blk->do_bit(offset)) return false;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   562
        //  resample at each closure application
489c9b5090e2 Initial load
duke
parents:
diff changeset
   563
        // (see, for instance, CMS bug 4525989)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   564
        rest = map(index) >> (offset & (BitsPerWord -1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   565
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   566
      rest = rest >> 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   567
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   568
  }
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   569
  return true;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   570
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   571
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   572
BitMap::idx_t* BitMap::_pop_count_table = NULL;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   573
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   574
void BitMap::init_pop_count_table() {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   575
  if (_pop_count_table == NULL) {
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 12272
diff changeset
   576
    BitMap::idx_t *table = NEW_C_HEAP_ARRAY(idx_t, 256, mtInternal);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   577
    for (uint i = 0; i < 256; i++) {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   578
      table[i] = num_set_bits(i);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   579
    }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   580
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   581
    intptr_t res = Atomic::cmpxchg_ptr((intptr_t)  table,
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   582
                                       (intptr_t*) &_pop_count_table,
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   583
                                       (intptr_t)  NULL_WORD);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   584
    if (res != NULL_WORD) {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   585
      guarantee( _pop_count_table == (void*) res, "invariant" );
27880
afb974a04396 8060074: os::free() takes MemoryTrackingLevel but doesn't need it
coleenp
parents: 26937
diff changeset
   586
      FREE_C_HEAP_ARRAY(idx_t, table);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   587
    }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   588
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   589
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   590
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   591
BitMap::idx_t BitMap::num_set_bits(bm_word_t w) {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   592
  idx_t bits = 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   593
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   594
  while (w != 0) {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   595
    while ((w & 1) == 0) {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   596
      w >>= 1;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   597
    }
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   598
    bits++;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   599
    w >>= 1;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   600
  }
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   601
  return bits;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   602
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   603
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   604
BitMap::idx_t BitMap::num_set_bits_from_table(unsigned char c) {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   605
  assert(_pop_count_table != NULL, "precondition");
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   606
  return _pop_count_table[c];
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   607
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   608
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   609
BitMap::idx_t BitMap::count_one_bits() const {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   610
  init_pop_count_table(); // If necessary.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   611
  idx_t sum = 0;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   612
  typedef unsigned char uchar;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   613
  for (idx_t i = 0; i < size_in_words(); i++) {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   614
    bm_word_t w = map()[i];
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   615
    for (size_t j = 0; j < sizeof(bm_word_t); j++) {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   616
      sum += num_set_bits_from_table(uchar(w & 255));
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   617
      w >>= 8;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   618
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   619
  }
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   620
  return sum;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   621
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   622
16685
41c34debcde0 8011872: Include Bit Map addresses in the hs_err files
stefank
parents: 13195
diff changeset
   623
void BitMap::print_on_error(outputStream* st, const char* prefix) const {
41c34debcde0 8011872: Include Bit Map addresses in the hs_err files
stefank
parents: 13195
diff changeset
   624
  st->print_cr("%s[" PTR_FORMAT ", " PTR_FORMAT ")",
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 23545
diff changeset
   625
      prefix, p2i(map()), p2i((char*)map() + (size() >> LogBitsPerByte)));
16685
41c34debcde0 8011872: Include Bit Map addresses in the hs_err files
stefank
parents: 13195
diff changeset
   626
}
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   627
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   628
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   629
489c9b5090e2 Initial load
duke
parents:
diff changeset
   630
void BitMap::print_on(outputStream* st) const {
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 23545
diff changeset
   631
  tty->print("Bitmap(" SIZE_FORMAT "):", size());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   632
  for (idx_t index = 0; index < size(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   633
    tty->print("%c", at(index) ? '1' : '0');
489c9b5090e2 Initial load
duke
parents:
diff changeset
   634
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   635
  tty->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   636
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   637
23545
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   638
class TestBitMap : public AllStatic {
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   639
  const static BitMap::idx_t BITMAP_SIZE = 1024;
38177
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   640
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   641
  template <class ResizableBitMapClass>
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   642
  static void fillBitMap(ResizableBitMapClass& map) {
23545
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   643
    map.set_bit(1);
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   644
    map.set_bit(3);
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   645
    map.set_bit(17);
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   646
    map.set_bit(512);
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   647
  }
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   648
38177
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   649
  template <class ResizableBitMapClass>
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   650
  static void testResize(BitMap::idx_t start_size) {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   651
    ResourceMark rm;
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   652
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   653
    ResizableBitMapClass map(start_size);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   654
    map.resize(BITMAP_SIZE);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   655
    fillBitMap(map);
23545
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   656
38177
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   657
    ResizableBitMapClass map2(BITMAP_SIZE);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   658
    fillBitMap(map2);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   659
    assert(map.is_same(map2), "could be");
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   660
  }
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   661
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   662
  template <class ResizableBitMapClass>
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   663
  static void testResizeGrow() {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   664
    testResize<ResizableBitMapClass>(0);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   665
    testResize<ResizableBitMapClass>(128);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   666
  }
23545
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   667
38177
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   668
  template <class ResizableBitMapClass>
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   669
  static void testResizeSame() {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   670
    testResize<ResizableBitMapClass>(BITMAP_SIZE);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   671
  }
23545
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   672
38177
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   673
  template <class ResizableBitMapClass>
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   674
  static void testResizeShrink() {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   675
    testResize<ResizableBitMapClass>(BITMAP_SIZE * 2);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   676
  }
23545
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   677
38177
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   678
  static void testResizeGrow() {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   679
    testResizeGrow<ResourceBitMap>();
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   680
    testResizeGrow<CHeapBitMap>();
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   681
  }
23545
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   682
38177
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   683
  static void testResizeSame() {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   684
    testResizeSame<ResourceBitMap>();
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   685
    testResizeSame<CHeapBitMap>();
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   686
  }
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   687
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   688
  static void testResizeShrink() {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   689
    testResizeShrink<ResourceBitMap>();
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   690
    testResizeShrink<CHeapBitMap>();
23545
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   691
  }
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   692
38177
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   693
  static void testResize() {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   694
    testResizeGrow();
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   695
    testResizeSame();
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   696
    testResizeShrink();
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   697
  }
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   698
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   699
  template <class InitializableBitMapClass>
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   700
  static void testInitialize() {
23545
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   701
    ResourceMark rm;
38177
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   702
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   703
    InitializableBitMapClass map;
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   704
    map.initialize(BITMAP_SIZE);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   705
    fillBitMap(map);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   706
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   707
    InitializableBitMapClass map2(BITMAP_SIZE);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   708
    fillBitMap(map2);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   709
    assert(map.is_same(map2), "could be");
23545
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   710
  }
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   711
38177
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   712
  static void testInitialize() {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   713
    testInitialize<ResourceBitMap>();
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   714
    testInitialize<CHeapBitMap>();
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   715
  }
23545
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   716
38177
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   717
  template <class ReinitializableBitMapClass>
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   718
  static void testReinitialize(BitMap::idx_t init_size) {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   719
    ResourceMark rm;
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   720
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   721
    ReinitializableBitMapClass map(init_size);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   722
    map.reinitialize(BITMAP_SIZE);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   723
    fillBitMap(map);
23545
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   724
38177
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   725
    ReinitializableBitMapClass map2(BITMAP_SIZE);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   726
    fillBitMap(map2);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   727
    assert(map.is_same(map2), "could be");
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   728
  }
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   729
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   730
  template <class ReinitializableBitMapClass>
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   731
  static void testReinitialize() {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   732
    testReinitialize<ReinitializableBitMapClass>(0);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   733
    testReinitialize<ReinitializableBitMapClass>(128);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   734
    testReinitialize<ReinitializableBitMapClass>(BITMAP_SIZE);
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   735
  }
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   736
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   737
  static void testReinitialize() {
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   738
    testReinitialize<ResourceBitMap>();
23545
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   739
  }
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   740
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   741
 public:
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   742
  static void test() {
38177
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   743
    testResize();
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   744
    testInitialize();
b0c9cb06506b 8141501: Problems with BitMap buffer management
stefank
parents: 38102
diff changeset
   745
    testReinitialize();
23545
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   746
  }
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   747
};
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   748
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   749
void TestBitMap_test() {
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   750
  TestBitMap::test();
2c14fb03a06d 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
mgerdin
parents: 22876
diff changeset
   751
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   752
#endif