Tue, 02 Jun 2020 14:29:43 +0800
8246310: Clean commented-out code about ModuleEntry andPackageEntry in JFR
Reviewed-by: adinn
apetushkov@9858 | 1 | /* |
apetushkov@9858 | 2 | * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. |
apetushkov@9858 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
apetushkov@9858 | 4 | * |
apetushkov@9858 | 5 | * This code is free software; you can redistribute it and/or modify it |
apetushkov@9858 | 6 | * under the terms of the GNU General Public License version 2 only, as |
apetushkov@9858 | 7 | * published by the Free Software Foundation. |
apetushkov@9858 | 8 | * |
apetushkov@9858 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
apetushkov@9858 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
apetushkov@9858 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
apetushkov@9858 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
apetushkov@9858 | 13 | * accompanied this code). |
apetushkov@9858 | 14 | * |
apetushkov@9858 | 15 | * You should have received a copy of the GNU General Public License version |
apetushkov@9858 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
apetushkov@9858 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
apetushkov@9858 | 18 | * |
apetushkov@9858 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
apetushkov@9858 | 20 | * or visit www.oracle.com if you need additional information or have any |
apetushkov@9858 | 21 | * questions. |
apetushkov@9858 | 22 | * |
apetushkov@9858 | 23 | */ |
apetushkov@9858 | 24 | |
apetushkov@9858 | 25 | #ifndef SHARE_VM_JFR_CHECKPOINT_TYPES_TRACEID_JFRTYPEIDS_INLINE_HPP |
apetushkov@9858 | 26 | #define SHARE_VM_JFR_CHECKPOINT_TYPES_TRACEID_JFRTYPEIDS_INLINE_HPP |
apetushkov@9858 | 27 | |
apetushkov@9858 | 28 | #include "classfile/classLoaderData.hpp" |
apetushkov@9858 | 29 | #include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp" |
apetushkov@9858 | 30 | #include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.hpp" |
apetushkov@9858 | 31 | #include "oops/arrayKlass.hpp" |
apetushkov@9858 | 32 | #include "oops/klass.hpp" |
apetushkov@9858 | 33 | #include "oops/instanceKlass.hpp" |
apetushkov@9858 | 34 | #include "oops/method.hpp" |
apetushkov@9858 | 35 | #include "runtime/thread.inline.hpp" |
apetushkov@9858 | 36 | #include "utilities/debug.hpp" |
apetushkov@9858 | 37 | |
apetushkov@9858 | 38 | template <typename T> |
apetushkov@9858 | 39 | inline traceid set_used_and_get(const T* type, bool leakp) { |
apetushkov@9858 | 40 | assert(type != NULL, "invariant"); |
apetushkov@9858 | 41 | if (leakp) { |
apetushkov@9858 | 42 | SET_LEAKP_USED_THIS_EPOCH(type); |
apetushkov@9858 | 43 | assert(LEAKP_USED_THIS_EPOCH(type), "invariant"); |
apetushkov@9858 | 44 | } |
apetushkov@9858 | 45 | SET_USED_THIS_EPOCH(type); |
apetushkov@9858 | 46 | assert(USED_THIS_EPOCH(type), "invariant"); |
apetushkov@9858 | 47 | return TRACE_ID_MASKED_PTR(type); |
apetushkov@9858 | 48 | } |
apetushkov@9858 | 49 | |
apetushkov@9858 | 50 | template <typename T> |
apetushkov@9858 | 51 | inline traceid set_used_and_get_shifted(const T* type, bool leakp) { |
apetushkov@9858 | 52 | assert(type != NULL, "invariant"); |
apetushkov@9858 | 53 | return set_used_and_get(type, leakp) >> TRACE_ID_SHIFT; |
apetushkov@9858 | 54 | } |
apetushkov@9858 | 55 | |
apetushkov@9858 | 56 | inline traceid JfrTraceId::get(const Klass* klass) { |
apetushkov@9858 | 57 | assert(klass != NULL, "invariant"); |
apetushkov@9858 | 58 | return TRACE_ID(klass); |
apetushkov@9858 | 59 | } |
apetushkov@9858 | 60 | |
apetushkov@9858 | 61 | inline traceid JfrTraceId::get(const Thread* t) { |
apetushkov@9858 | 62 | assert(t != NULL, "invariant"); |
apetushkov@9858 | 63 | return TRACE_ID_RAW(t->jfr_thread_local()); |
apetushkov@9858 | 64 | } |
apetushkov@9858 | 65 | |
apetushkov@9858 | 66 | inline traceid JfrTraceId::use(const Klass* klass, bool leakp /* false */) { |
apetushkov@9858 | 67 | assert(klass != NULL, "invariant"); |
apetushkov@9858 | 68 | return set_used_and_get_shifted(klass, leakp); |
apetushkov@9858 | 69 | } |
apetushkov@9858 | 70 | |
apetushkov@9858 | 71 | inline traceid JfrTraceId::use(const Method* method, bool leakp /* false */) { |
apetushkov@9858 | 72 | assert(method != NULL, "invariant"); |
apetushkov@9858 | 73 | SET_METHOD_FLAG_USED_THIS_EPOCH(method); |
apetushkov@9858 | 74 | const Klass* const klass = method->method_holder(); |
apetushkov@9858 | 75 | assert(klass != NULL, "invariant"); |
apetushkov@9858 | 76 | if (leakp) { |
apetushkov@9858 | 77 | SET_LEAKP_USED_THIS_EPOCH(klass); |
apetushkov@9858 | 78 | assert(LEAKP_USED_THIS_EPOCH(klass), "invariant"); |
apetushkov@9858 | 79 | } |
apetushkov@9858 | 80 | SET_METHOD_AND_CLASS_USED_THIS_EPOCH(klass); |
apetushkov@9858 | 81 | assert(METHOD_AND_CLASS_USED_THIS_EPOCH(klass), "invariant"); |
apetushkov@9858 | 82 | return (METHOD_ID(klass, method)); |
apetushkov@9858 | 83 | } |
apetushkov@9858 | 84 | |
apetushkov@9858 | 85 | inline traceid JfrTraceId::use(const ClassLoaderData* cld, bool leakp /* false */) { |
apetushkov@9858 | 86 | assert(cld != NULL, "invariant"); |
apetushkov@9858 | 87 | return cld->is_anonymous() ? 0 : set_used_and_get_shifted(cld, leakp); |
apetushkov@9858 | 88 | } |
apetushkov@9858 | 89 | |
apetushkov@9858 | 90 | inline bool JfrTraceId::in_visible_set(const Klass* klass) { |
apetushkov@9858 | 91 | assert(klass != NULL, "invariant"); |
apetushkov@9858 | 92 | assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_vm, "invariant"); |
apetushkov@9858 | 93 | return (IS_JDK_JFR_EVENT_SUBKLASS(klass) && !klass->is_abstract()) || IS_EVENT_HOST_KLASS(klass); |
apetushkov@9858 | 94 | } |
apetushkov@9858 | 95 | |
apetushkov@9858 | 96 | inline bool JfrTraceId::is_jdk_jfr_event(const Klass* k) { |
apetushkov@9858 | 97 | assert(k != NULL, "invariant"); |
apetushkov@9858 | 98 | return IS_JDK_JFR_EVENT_KLASS(k); |
apetushkov@9858 | 99 | } |
apetushkov@9858 | 100 | |
apetushkov@9858 | 101 | inline void JfrTraceId::tag_as_jdk_jfr_event(const Klass* klass) { |
apetushkov@9858 | 102 | assert(klass != NULL, "invariant"); |
apetushkov@9858 | 103 | assert(IS_NOT_AN_EVENT_KLASS(klass), "invariant"); |
apetushkov@9858 | 104 | SET_TAG(klass, JDK_JFR_EVENT_KLASS); |
apetushkov@9858 | 105 | assert(IS_JDK_JFR_EVENT_KLASS(klass), "invariant"); |
apetushkov@9858 | 106 | assert(IS_NOT_AN_EVENT_SUB_KLASS(klass), "invariant"); |
apetushkov@9858 | 107 | } |
apetushkov@9858 | 108 | |
apetushkov@9858 | 109 | inline bool JfrTraceId::is_jdk_jfr_event_sub(const Klass* k) { |
apetushkov@9858 | 110 | assert(k != NULL, "invariant"); |
apetushkov@9858 | 111 | return IS_JDK_JFR_EVENT_SUBKLASS(k); |
apetushkov@9858 | 112 | } |
apetushkov@9858 | 113 | |
apetushkov@9858 | 114 | inline void JfrTraceId::tag_as_jdk_jfr_event_sub(const Klass* k) { |
apetushkov@9858 | 115 | assert(k != NULL, "invariant"); |
apetushkov@9858 | 116 | if (IS_NOT_AN_EVENT_KLASS(k)) { |
apetushkov@9858 | 117 | SET_TAG(k, JDK_JFR_EVENT_SUBKLASS); |
apetushkov@9858 | 118 | } |
apetushkov@9858 | 119 | assert(IS_JDK_JFR_EVENT_SUBKLASS(k), "invariant"); |
apetushkov@9858 | 120 | } |
apetushkov@9858 | 121 | |
apetushkov@9858 | 122 | inline bool JfrTraceId::in_jdk_jfr_event_hierarchy(const Klass* klass) { |
apetushkov@9858 | 123 | assert(klass != NULL, "invariant"); |
apetushkov@9858 | 124 | if (is_jdk_jfr_event(klass)) { |
apetushkov@9858 | 125 | return true; |
apetushkov@9858 | 126 | } |
apetushkov@9858 | 127 | const Klass* const super = klass->super(); |
apetushkov@9858 | 128 | return super != NULL ? IS_EVENT_KLASS(super) : false; |
apetushkov@9858 | 129 | } |
apetushkov@9858 | 130 | |
apetushkov@9858 | 131 | inline bool JfrTraceId::is_event_host(const Klass* k) { |
apetushkov@9858 | 132 | assert(k != NULL, "invariant"); |
apetushkov@9858 | 133 | return IS_EVENT_HOST_KLASS(k); |
apetushkov@9858 | 134 | } |
apetushkov@9858 | 135 | |
apetushkov@9858 | 136 | inline void JfrTraceId::tag_as_event_host(const Klass* k) { |
apetushkov@9858 | 137 | assert(k != NULL, "invariant"); |
apetushkov@9858 | 138 | SET_TAG(k, EVENT_HOST_KLASS); |
apetushkov@9858 | 139 | assert(IS_EVENT_HOST_KLASS(k), "invariant"); |
apetushkov@9858 | 140 | } |
apetushkov@9858 | 141 | |
apetushkov@9858 | 142 | #endif // SHARE_VM_JFR_CHECKPOINT_TYPES_TRACEID_JFRTYPEIDS_INLINE_HPP |