author | stefank |
Fri, 18 Mar 2016 08:59:07 +0100 | |
changeset 37146 | 209e0fe518bb |
parent 35877 | a2a62511d0f8 |
child 46502 | 116a09d8f142 |
permissions | -rw-r--r-- |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
1 |
/* |
35877
a2a62511d0f8
8146987: Improve Parallel GC Full GC by caching results of live_words_in_range()
tschatzl
parents:
35862
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
4 |
* |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
8 |
* |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
13 |
* accompanied this code). |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
14 |
* |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
18 |
* |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
21 |
* questions. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
22 |
* |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
23 |
*/ |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
24 |
|
30764 | 25 |
#ifndef SHARE_VM_GC_PARALLEL_PSPARALLELCOMPACT_INLINE_HPP |
26 |
#define SHARE_VM_GC_PARALLEL_PSPARALLELCOMPACT_INLINE_HPP |
|
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
27 |
|
30764 | 28 |
#include "gc/parallel/parallelScavengeHeap.hpp" |
29 |
#include "gc/parallel/psParallelCompact.hpp" |
|
30 |
#include "gc/shared/collectedHeap.hpp" |
|
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
31 |
#include "oops/klass.hpp" |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
32 |
#include "oops/oop.inline.hpp" |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
33 |
|
35862
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
30764
diff
changeset
|
34 |
inline bool PSParallelCompact::mark_obj(oop obj) { |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
30764
diff
changeset
|
35 |
const int obj_size = obj->size(); |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
30764
diff
changeset
|
36 |
if (mark_bitmap()->mark_obj(obj, obj_size)) { |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
30764
diff
changeset
|
37 |
_summary_data.add_obj(obj, obj_size); |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
30764
diff
changeset
|
38 |
return true; |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
30764
diff
changeset
|
39 |
} else { |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
30764
diff
changeset
|
40 |
return false; |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
30764
diff
changeset
|
41 |
} |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
30764
diff
changeset
|
42 |
} |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
30764
diff
changeset
|
43 |
|
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
44 |
template <class T> |
35877
a2a62511d0f8
8146987: Improve Parallel GC Full GC by caching results of live_words_in_range()
tschatzl
parents:
35862
diff
changeset
|
45 |
inline void PSParallelCompact::adjust_pointer(T* p, ParCompactionManager* cm) { |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
46 |
T heap_oop = oopDesc::load_heap_oop(p); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
47 |
if (!oopDesc::is_null(heap_oop)) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
48 |
oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
49 |
assert(ParallelScavengeHeap::heap()->is_in(obj), "should be in heap"); |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
50 |
|
35877
a2a62511d0f8
8146987: Improve Parallel GC Full GC by caching results of live_words_in_range()
tschatzl
parents:
35862
diff
changeset
|
51 |
oop new_obj = (oop)summary_data().calc_new_pointer(obj, cm); |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
52 |
assert(new_obj != NULL, // is forwarding ptr? |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
53 |
"should be forwarded"); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
54 |
// Just always do the update unconditionally? |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
55 |
if (new_obj != NULL) { |
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
56 |
assert(ParallelScavengeHeap::heap()->is_in_reserved(new_obj), |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
57 |
"should be in object space"); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
58 |
oopDesc::encode_store_heap_oop_not_null(p, new_obj); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
59 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
60 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
61 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
62 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
63 |
template <typename T> |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
64 |
void PSParallelCompact::AdjustPointerClosure::do_oop_nv(T* p) { |
35877
a2a62511d0f8
8146987: Improve Parallel GC Full GC by caching results of live_words_in_range()
tschatzl
parents:
35862
diff
changeset
|
65 |
adjust_pointer(p, _cm); |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
66 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
67 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
68 |
inline void PSParallelCompact::AdjustPointerClosure::do_oop(oop* p) { do_oop_nv(p); } |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
69 |
inline void PSParallelCompact::AdjustPointerClosure::do_oop(narrowOop* p) { do_oop_nv(p); } |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff
changeset
|
70 |
|
30764 | 71 |
#endif // SHARE_VM_GC_PARALLEL_PSPARALLELCOMPACT_INLINE_HPP |