annotate src/share/vm/prims/jvmtiEventController.hpp @ 13526:f5dd157e3889

8186439: [MVT] ClassFileParser should ignore JVM_ACC_VALUE for class file version < 53.1 Reviewed-by: dsimms
author thartmann
date Mon, 21 Aug 2017 12:26:21 +0200
parents c18cbe5936b8
children
rev   line source
duke@0 1 /*
stefank@1879 2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
duke@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 *
duke@0 5 * This code is free software; you can redistribute it and/or modify it
duke@0 6 * under the terms of the GNU General Public License version 2 only, as
duke@0 7 * published by the Free Software Foundation.
duke@0 8 *
duke@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 * accompanied this code).
duke@0 14 *
duke@0 15 * You should have received a copy of the GNU General Public License version
duke@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 *
trims@1472 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1472 20 * or visit www.oracle.com if you need additional information or have any
trims@1472 21 * questions.
duke@0 22 *
duke@0 23 */
duke@0 24
stefank@1879 25 #ifndef SHARE_VM_PRIMS_JVMTIEVENTCONTROLLER_HPP
stefank@1879 26 #define SHARE_VM_PRIMS_JVMTIEVENTCONTROLLER_HPP
stefank@1879 27
stefank@1879 28 #include "jvmtifiles/jvmti.h"
stefank@1879 29 #include "memory/allocation.hpp"
stefank@1879 30 #include "memory/allocation.inline.hpp"
stefank@1879 31 #include "utilities/globalDefinitions.hpp"
duke@0 32
duke@0 33 // forward declaration
duke@0 34 class JvmtiEventControllerPrivate;
duke@0 35 class JvmtiEventController;
duke@0 36 class JvmtiEnvThreadState;
duke@0 37 class JvmtiFramePop;
duke@0 38 class JvmtiEnvBase;
duke@0 39
duke@0 40
duke@0 41 // Extension event support
duke@0 42 //
duke@0 43 // jvmtiExtEvent is the extensions equivalent of jvmtiEvent
duke@0 44 // jvmtiExtCallbacks is the extensions equivalent of jvmtiEventCallbacks
duke@0 45
duke@0 46 // Extension events start JVMTI_MIN_EVENT_TYPE_VAL-1 and work towards 0.
duke@0 47 typedef enum {
duke@0 48 EXT_EVENT_CLASS_UNLOAD = JVMTI_MIN_EVENT_TYPE_VAL-1,
duke@0 49 EXT_MIN_EVENT_TYPE_VAL = EXT_EVENT_CLASS_UNLOAD,
duke@0 50 EXT_MAX_EVENT_TYPE_VAL = EXT_EVENT_CLASS_UNLOAD
duke@0 51 } jvmtiExtEvent;
duke@0 52
duke@0 53 typedef struct {
duke@0 54 jvmtiExtensionEvent ClassUnload;
duke@0 55 } jvmtiExtEventCallbacks;
duke@0 56
duke@0 57
duke@0 58 // The complete range of events is EXT_MIN_EVENT_TYPE_VAL to
duke@0 59 // JVMTI_MAX_EVENT_TYPE_VAL (inclusive and contiguous).
duke@0 60 const int TOTAL_MIN_EVENT_TYPE_VAL = EXT_MIN_EVENT_TYPE_VAL;
duke@0 61 const int TOTAL_MAX_EVENT_TYPE_VAL = JVMTI_MAX_EVENT_TYPE_VAL;
duke@0 62
duke@0 63
duke@0 64 ///////////////////////////////////////////////////////////////
duke@0 65 //
duke@0 66 // JvmtiEventEnabled
duke@0 67 //
duke@0 68 // Utility class
duke@0 69 //
duke@0 70 // A boolean array indexed by event_type, used as an internal
duke@0 71 // data structure to track what JVMTI event types are enabled.
duke@0 72 // Used for user set enabling and disabling (globally and on a
duke@0 73 // per thread basis), and for computed merges across environments,
duke@0 74 // threads and the VM as a whole.
duke@0 75 //
duke@0 76 // for inlines see jvmtiEventController_inline.hpp
duke@0 77 //
duke@0 78
duke@0 79 class JvmtiEventEnabled VALUE_OBJ_CLASS_SPEC {
duke@0 80 private:
duke@0 81 friend class JvmtiEventControllerPrivate;
duke@0 82 jlong _enabled_bits;
duke@0 83 #ifndef PRODUCT
duke@0 84 enum {
duke@0 85 JEE_INIT_GUARD = 0xEAD0
duke@0 86 } _init_guard;
duke@0 87 #endif
duke@0 88 static jlong bit_for(jvmtiEvent event_type);
duke@0 89 jlong get_bits();
duke@0 90 void set_bits(jlong bits);
duke@0 91 public:
duke@0 92 JvmtiEventEnabled();
duke@0 93 void clear();
duke@0 94 bool is_enabled(jvmtiEvent event_type);
duke@0 95 void set_enabled(jvmtiEvent event_type, bool enabled);
duke@0 96 };
duke@0 97
duke@0 98
duke@0 99 ///////////////////////////////////////////////////////////////
duke@0 100 //
duke@0 101 // JvmtiEnvThreadEventEnable
duke@0 102 //
duke@0 103 // JvmtiEventController data specific to a particular environment and thread.
duke@0 104 //
duke@0 105 // for inlines see jvmtiEventController_inline.hpp
duke@0 106 //
duke@0 107
duke@0 108 class JvmtiEnvThreadEventEnable VALUE_OBJ_CLASS_SPEC {
duke@0 109 private:
duke@0 110 friend class JvmtiEventControllerPrivate;
duke@0 111 JvmtiEventEnabled _event_user_enabled;
duke@0 112 JvmtiEventEnabled _event_enabled;
duke@0 113
duke@0 114 public:
duke@0 115 JvmtiEnvThreadEventEnable();
duke@0 116 ~JvmtiEnvThreadEventEnable();
duke@0 117 bool is_enabled(jvmtiEvent event_type);
duke@0 118 void set_user_enabled(jvmtiEvent event_type, bool enabled);
duke@0 119 };
duke@0 120
duke@0 121
duke@0 122 ///////////////////////////////////////////////////////////////
duke@0 123 //
duke@0 124 // JvmtiThreadEventEnable
duke@0 125 //
duke@0 126 // JvmtiEventController data specific to a particular thread.
duke@0 127 //
duke@0 128 // for inlines see jvmtiEventController_inline.hpp
duke@0 129 //
duke@0 130
duke@0 131 class JvmtiThreadEventEnable VALUE_OBJ_CLASS_SPEC {
duke@0 132 private:
duke@0 133 friend class JvmtiEventControllerPrivate;
duke@0 134 JvmtiEventEnabled _event_enabled;
duke@0 135
duke@0 136 public:
duke@0 137 JvmtiThreadEventEnable();
duke@0 138 ~JvmtiThreadEventEnable();
duke@0 139 bool is_enabled(jvmtiEvent event_type);
duke@0 140 };
duke@0 141
duke@0 142
duke@0 143 ///////////////////////////////////////////////////////////////
duke@0 144 //
duke@0 145 // JvmtiEnvEventEnable
duke@0 146 //
duke@0 147 // JvmtiEventController data specific to a particular environment.
duke@0 148 //
duke@0 149 // for inlines see jvmtiEventController_inline.hpp
duke@0 150 //
duke@0 151
duke@0 152 class JvmtiEnvEventEnable VALUE_OBJ_CLASS_SPEC {
duke@0 153 private:
duke@0 154 friend class JvmtiEventControllerPrivate;
duke@0 155
duke@0 156 // user set global event enablement indexed by jvmtiEvent
duke@0 157 JvmtiEventEnabled _event_user_enabled;
duke@0 158
duke@0 159 // this flag indicates the presence (true) or absence (false) of event callbacks
duke@0 160 // it is indexed by jvmtiEvent
duke@0 161 JvmtiEventEnabled _event_callback_enabled;
duke@0 162
duke@0 163 // indexed by jvmtiEvent true if enabled globally or on any thread.
duke@0 164 // True only if there is a callback for it.
duke@0 165 JvmtiEventEnabled _event_enabled;
duke@0 166
duke@0 167 public:
duke@0 168 JvmtiEnvEventEnable();
duke@0 169 ~JvmtiEnvEventEnable();
duke@0 170 bool is_enabled(jvmtiEvent event_type);
duke@0 171 void set_user_enabled(jvmtiEvent event_type, bool enabled);
duke@0 172 };
duke@0 173
duke@0 174
duke@0 175 ///////////////////////////////////////////////////////////////
duke@0 176 //
duke@0 177 // JvmtiEventController
duke@0 178 //
duke@0 179 // The class is the access point for all actions that change
duke@0 180 // which events are active, this include:
duke@0 181 // enabling and disabling events
duke@0 182 // changing the callbacks/eventhook (they may be null)
duke@0 183 // setting and clearing field watchpoints
duke@0 184 // setting frame pops
duke@0 185 // encountering frame pops
duke@0 186 //
duke@0 187 // for inlines see jvmtiEventController_inline.hpp
duke@0 188 //
duke@0 189
duke@0 190 class JvmtiEventController : AllStatic {
duke@0 191 private:
duke@0 192 friend class JvmtiEventControllerPrivate;
duke@0 193
duke@0 194 // for all environments, global array indexed by jvmtiEvent
duke@0 195 static JvmtiEventEnabled _universal_global_event_enabled;
duke@0 196
duke@0 197 public:
duke@0 198 static bool is_enabled(jvmtiEvent event_type);
duke@0 199
duke@0 200 // events that can ONLY be enabled/disabled globally (can't toggle on individual threads).
duke@0 201 static bool is_global_event(jvmtiEvent event_type);
duke@0 202
duke@0 203 // is the event_type valid?
duke@0 204 // to do: check against valid event array
duke@0 205 static bool is_valid_event_type(jvmtiEvent event_type) {
duke@0 206 return ((int)event_type >= TOTAL_MIN_EVENT_TYPE_VAL)
duke@0 207 && ((int)event_type <= TOTAL_MAX_EVENT_TYPE_VAL);
duke@0 208 }
duke@0 209
duke@0 210 // Use (thread == NULL) to enable/disable an event globally.
duke@0 211 // Use (thread != NULL) to enable/disable an event for a particular thread.
duke@0 212 // thread is ignored for events that can only be specified globally
duke@0 213 static void set_user_enabled(JvmtiEnvBase *env, JavaThread *thread,
duke@0 214 jvmtiEvent event_type, bool enabled);
duke@0 215
duke@0 216 // Setting callbacks changes computed enablement and must be done
duke@0 217 // at a safepoint otherwise a NULL callback could be attempted
duke@0 218 static void set_event_callbacks(JvmtiEnvBase *env,
duke@0 219 const jvmtiEventCallbacks* callbacks,
duke@0 220 jint size_of_callbacks);
duke@0 221
duke@0 222 // Sets the callback function for a single extension event and enables
duke@0 223 // (or disables it).
duke@0 224 static void set_extension_event_callback(JvmtiEnvBase* env,
duke@0 225 jint extension_event_index,
duke@0 226 jvmtiExtensionEvent callback);
duke@0 227
duke@0 228 static void set_frame_pop(JvmtiEnvThreadState *env_thread, JvmtiFramePop fpop);
duke@0 229 static void clear_frame_pop(JvmtiEnvThreadState *env_thread, JvmtiFramePop fpop);
duke@0 230 static void clear_to_frame_pop(JvmtiEnvThreadState *env_thread, JvmtiFramePop fpop);
duke@0 231
duke@0 232 static void change_field_watch(jvmtiEvent event_type, bool added);
duke@0 233
duke@0 234 static void thread_started(JavaThread *thread);
duke@0 235 static void thread_ended(JavaThread *thread);
duke@0 236
duke@0 237 static void env_initialize(JvmtiEnvBase *env);
duke@0 238 static void env_dispose(JvmtiEnvBase *env);
duke@0 239
duke@0 240 static void vm_start();
duke@0 241 static void vm_init();
duke@0 242 static void vm_death();
duke@0 243 };
duke@0 244
stefank@1879 245 #endif // SHARE_VM_PRIMS_JVMTIEVENTCONTROLLER_HPP