comparison src/hotspot/share/gc/shared/weakProcessorPhases.hpp @ 52321:31b159f30fb2

8180193: Make marking bitmap code available to other GCs Reviewed-by: shade, stefank
author rkennke
date Wed, 29 Aug 2018 20:15:09 +0200
parents
children 482109fae02b
comparison
equal deleted inserted replaced
-1:000000000000 0:b66a9d63351e
1 /*
2 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_GC_SHARED_WEAKPROCESSORPHASES_HPP
26 #define SHARE_GC_SHARED_WEAKPROCESSORPHASES_HPP
27
28 #include "memory/allocation.hpp"
29 #include "utilities/globalDefinitions.hpp"
30 #include "utilities/macros.hpp"
31
32 class BoolObjectClosure;
33 class OopClosure;
34 class OopStorage;
35
36 class WeakProcessorPhases : AllStatic {
37 public:
38 typedef void (*Processor)(BoolObjectClosure*, OopClosure*);
39
40 enum Phase {
41 // Serial phases.
42 JVMTI_ONLY(jvmti COMMA)
43 JFR_ONLY(jfr COMMA)
44
45 // OopStorage phases.
46 jni,
47 vm
48 };
49
50 static const uint serial_phase_start = 0;
51 static const uint serial_phase_count = jni;
52 static const uint oop_storage_phase_start = serial_phase_count;
53 static const uint oop_storage_phase_count = (vm + 1) - oop_storage_phase_start;
54 static const uint phase_count = serial_phase_count + oop_storage_phase_count;
55
56 static Phase phase(uint value);
57 static uint index(Phase phase);
58 // Indexes relative to the corresponding phase_start constant.
59 static uint serial_index(Phase phase);
60 static uint oop_storage_index(Phase phase);
61
62 static bool is_serial(Phase phase);
63 static bool is_oop_storage(Phase phase);
64
65 static const char* description(Phase phase);
66 static Processor processor(Phase phase); // Precondition: is_serial(phase)
67 static OopStorage* oop_storage(Phase phase); // Precondition: is_oop_storage(phase)
68 };
69
70 typedef WeakProcessorPhases::Phase WeakProcessorPhase;
71
72 #define FOR_EACH_WEAK_PROCESSOR_PHASE(P) \
73 for (WeakProcessorPhase P = static_cast<WeakProcessorPhase>(0); \
74 static_cast<uint>(P) < WeakProcessorPhases::phase_count; \
75 P = static_cast<WeakProcessorPhase>(static_cast<uint>(P) + 1))
76
77 #define FOR_EACH_WEAK_PROCESSOR_OOP_STORAGE_PHASE(P) \
78 for (WeakProcessorPhase P = static_cast<WeakProcessorPhase>(WeakProcessorPhases::oop_storage_phase_start); \
79 static_cast<uint>(P) < (WeakProcessorPhases::oop_storage_phase_start + \
80 WeakProcessorPhases::oop_storage_phase_count); \
81 P = static_cast<WeakProcessorPhase>(static_cast<uint>(P) + 1))
82
83 #endif // SHARE_GC_SHARED_WEAKPROCESSORPHASES_HPP