< prev index next >

src/hotspot/share/prims/jvmtiThreadState.hpp

Print this page
rev 50392 : JEP 331
   1 /*
   2  * Copyright (c) 2003, 2017, 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  *


  96   JvmtiClassLoadKind    _class_load_kind;
  97 
  98   // This is only valid when is_interp_only_mode() returns true
  99   int               _cur_stack_depth;
 100 
 101   JvmtiThreadEventEnable _thread_event_enable;
 102 
 103   // for support of JvmtiEnvThreadState
 104   JvmtiEnvThreadState*   _head_env_thread_state;
 105 
 106   // doubly-linked linear list of active thread state
 107   // needed in order to iterate the list without holding Threads_lock
 108   static JvmtiThreadState *_head;
 109   JvmtiThreadState *_next;
 110   JvmtiThreadState *_prev;
 111 
 112   // holds the current dynamic code event collector, NULL if no event collector in use
 113   JvmtiDynamicCodeEventCollector* _dynamic_code_event_collector;
 114   // holds the current vm object alloc event collector, NULL if no event collector in use
 115   JvmtiVMObjectAllocEventCollector* _vm_object_alloc_event_collector;


 116 
 117   // Should only be created by factory methods
 118   JvmtiThreadState(JavaThread *thread);
 119 
 120   friend class JvmtiEnvThreadStateIterator;
 121   inline JvmtiEnvThreadState* head_env_thread_state();
 122   inline void set_head_env_thread_state(JvmtiEnvThreadState* ets);
 123 
 124  public:
 125   ~JvmtiThreadState();
 126 
 127   // is event_type enabled and usable for this thread in any enviroments?
 128   bool is_enabled(jvmtiEvent event_type) {
 129     return _thread_event_enable.is_enabled(event_type);
 130   }
 131 
 132   JvmtiThreadEventEnable *thread_event_enable() {
 133     return &_thread_event_enable;
 134   }
 135 


 297   // Todo: get rid of this!
 298  private:
 299   bool _debuggable;
 300  public:
 301   // Should the thread be enumerated by jvmtiInternal::GetAllThreads?
 302   bool is_debuggable()                 { return _debuggable; }
 303   // If a thread cannot be suspended (has no valid last_java_frame) then it gets marked !debuggable
 304   void set_debuggable(bool debuggable) { _debuggable = debuggable; }
 305 
 306  public:
 307 
 308   bool may_be_walked();
 309 
 310   // Thread local event collector setter and getter methods.
 311   JvmtiDynamicCodeEventCollector* get_dynamic_code_event_collector() {
 312     return _dynamic_code_event_collector;
 313   }
 314   JvmtiVMObjectAllocEventCollector* get_vm_object_alloc_event_collector() {
 315     return _vm_object_alloc_event_collector;
 316   }



 317   void set_dynamic_code_event_collector(JvmtiDynamicCodeEventCollector* collector) {
 318     _dynamic_code_event_collector = collector;
 319   }
 320   void set_vm_object_alloc_event_collector(JvmtiVMObjectAllocEventCollector* collector) {
 321     _vm_object_alloc_event_collector = collector;



 322   }
 323 
 324 
 325   //
 326   // Frame routines
 327   //
 328 
 329  public:
 330 
 331   //  true when the thread was suspended with a pointer to the last Java frame.
 332   bool has_last_frame()                     { return _thread->has_last_Java_frame(); }
 333 
 334   void update_for_pop_top_frame();
 335 
 336   // already holding JvmtiThreadState_lock - retrieve or create JvmtiThreadState
 337   // Can return NULL if JavaThread is exiting.
 338   static JvmtiThreadState *state_for_while_locked(JavaThread *thread);
 339   // retrieve or create JvmtiThreadState
 340   // Can return NULL if JavaThread is exiting.
 341   static JvmtiThreadState *state_for(JavaThread *thread);


   1 /*
   2  * Copyright (c) 2003, 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  *


  96   JvmtiClassLoadKind    _class_load_kind;
  97 
  98   // This is only valid when is_interp_only_mode() returns true
  99   int               _cur_stack_depth;
 100 
 101   JvmtiThreadEventEnable _thread_event_enable;
 102 
 103   // for support of JvmtiEnvThreadState
 104   JvmtiEnvThreadState*   _head_env_thread_state;
 105 
 106   // doubly-linked linear list of active thread state
 107   // needed in order to iterate the list without holding Threads_lock
 108   static JvmtiThreadState *_head;
 109   JvmtiThreadState *_next;
 110   JvmtiThreadState *_prev;
 111 
 112   // holds the current dynamic code event collector, NULL if no event collector in use
 113   JvmtiDynamicCodeEventCollector* _dynamic_code_event_collector;
 114   // holds the current vm object alloc event collector, NULL if no event collector in use
 115   JvmtiVMObjectAllocEventCollector* _vm_object_alloc_event_collector;
 116   // holds the current sampled object alloc event collector, NULL if no event collector in use
 117   JvmtiSampledObjectAllocEventCollector* _sampled_object_alloc_event_collector;
 118 
 119   // Should only be created by factory methods
 120   JvmtiThreadState(JavaThread *thread);
 121 
 122   friend class JvmtiEnvThreadStateIterator;
 123   inline JvmtiEnvThreadState* head_env_thread_state();
 124   inline void set_head_env_thread_state(JvmtiEnvThreadState* ets);
 125 
 126  public:
 127   ~JvmtiThreadState();
 128 
 129   // is event_type enabled and usable for this thread in any enviroments?
 130   bool is_enabled(jvmtiEvent event_type) {
 131     return _thread_event_enable.is_enabled(event_type);
 132   }
 133 
 134   JvmtiThreadEventEnable *thread_event_enable() {
 135     return &_thread_event_enable;
 136   }
 137 


 299   // Todo: get rid of this!
 300  private:
 301   bool _debuggable;
 302  public:
 303   // Should the thread be enumerated by jvmtiInternal::GetAllThreads?
 304   bool is_debuggable()                 { return _debuggable; }
 305   // If a thread cannot be suspended (has no valid last_java_frame) then it gets marked !debuggable
 306   void set_debuggable(bool debuggable) { _debuggable = debuggable; }
 307 
 308  public:
 309 
 310   bool may_be_walked();
 311 
 312   // Thread local event collector setter and getter methods.
 313   JvmtiDynamicCodeEventCollector* get_dynamic_code_event_collector() {
 314     return _dynamic_code_event_collector;
 315   }
 316   JvmtiVMObjectAllocEventCollector* get_vm_object_alloc_event_collector() {
 317     return _vm_object_alloc_event_collector;
 318   }
 319   JvmtiSampledObjectAllocEventCollector* get_sampled_object_alloc_event_collector() {
 320     return _sampled_object_alloc_event_collector;
 321   }
 322   void set_dynamic_code_event_collector(JvmtiDynamicCodeEventCollector* collector) {
 323     _dynamic_code_event_collector = collector;
 324   }
 325   void set_vm_object_alloc_event_collector(JvmtiVMObjectAllocEventCollector* collector) {
 326     _vm_object_alloc_event_collector = collector;
 327   }
 328   void set_sampled_object_alloc_event_collector(JvmtiSampledObjectAllocEventCollector* collector) {
 329     _sampled_object_alloc_event_collector = collector;
 330   }
 331 
 332 
 333   //
 334   // Frame routines
 335   //
 336 
 337  public:
 338 
 339   //  true when the thread was suspended with a pointer to the last Java frame.
 340   bool has_last_frame()                     { return _thread->has_last_Java_frame(); }
 341 
 342   void update_for_pop_top_frame();
 343 
 344   // already holding JvmtiThreadState_lock - retrieve or create JvmtiThreadState
 345   // Can return NULL if JavaThread is exiting.
 346   static JvmtiThreadState *state_for_while_locked(JavaThread *thread);
 347   // retrieve or create JvmtiThreadState
 348   // Can return NULL if JavaThread is exiting.
 349   static JvmtiThreadState *state_for(JavaThread *thread);


< prev index next >