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