author | shade |
Thu, 15 Nov 2018 21:05:47 +0100 | |
changeset 52577 | 5b87d3fc1093 |
parent 51578 | 31b159f30fb2 |
child 54786 | ebf733a324d4 |
permissions | -rw-r--r-- |
51578
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
1 |
/* |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
4 |
* |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
8 |
* |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
13 |
* accompanied this code). |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
14 |
* |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
18 |
* |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
21 |
* questions. |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
22 |
* |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
23 |
*/ |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
24 |
|
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
25 |
#include "precompiled.hpp" |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
26 |
#include "gc/shared/markBitMap.inline.hpp" |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
27 |
#include "memory/virtualspace.hpp" |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
28 |
|
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
29 |
void MarkBitMap::print_on_error(outputStream* st, const char* prefix) const { |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
30 |
_bm.print_on_error(st, prefix); |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
31 |
} |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
32 |
|
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
33 |
size_t MarkBitMap::compute_size(size_t heap_size) { |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
34 |
return ReservedSpace::allocation_align_size_up(heap_size / mark_distance()); |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
35 |
} |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
36 |
|
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
37 |
size_t MarkBitMap::mark_distance() { |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
38 |
return MinObjAlignmentInBytes * BitsPerByte; |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
39 |
} |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
40 |
|
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
41 |
void MarkBitMap::initialize(MemRegion heap, MemRegion storage) { |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
42 |
_covered = heap; |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
43 |
|
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
44 |
_bm = BitMapView((BitMap::bm_word_t*) storage.start(), _covered.word_size() >> _shifter); |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
45 |
} |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
46 |
|
52577 | 47 |
void MarkBitMap::do_clear(MemRegion mr, bool large) { |
51578
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
48 |
MemRegion intersection = mr.intersection(_covered); |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
49 |
assert(!intersection.is_empty(), |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
50 |
"Given range from " PTR_FORMAT " to " PTR_FORMAT " is completely outside the heap", |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
51 |
p2i(mr.start()), p2i(mr.end())); |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
52 |
// convert address range into offset range |
52577 | 53 |
size_t beg = addr_to_offset(intersection.start()); |
54 |
size_t end = addr_to_offset(intersection.end()); |
|
55 |
if (large) { |
|
56 |
_bm.clear_large_range(beg, end); |
|
57 |
} else { |
|
58 |
_bm.clear_range(beg, end); |
|
59 |
} |
|
51578
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
60 |
} |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
61 |
|
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
62 |
#ifdef ASSERT |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
63 |
void MarkBitMap::check_mark(HeapWord* addr) { |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
64 |
assert(Universe::heap()->is_in_reserved(addr), |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
65 |
"Trying to access bitmap " PTR_FORMAT " for address " PTR_FORMAT " not in the heap.", |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
66 |
p2i(this), p2i(addr)); |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
67 |
} |
31b159f30fb2
8180193: Make marking bitmap code available to other GCs
rkennke
parents:
diff
changeset
|
68 |
#endif |