src/hotspot/share/prims/jvmtiThreadState.hpp
author vromero
Mon, 08 Oct 2018 06:52:41 -0700
changeset 52038 957de5be48bc
parent 50578 e2a7f431f65c
child 53244 9807daeb47c4
permissions -rw-r--r--
8209407: VerifyError is thrown for inner class with lambda Reviewed-by: mcimadamore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
50578
e2a7f431f65c 8203394: Implementation of JEP 331: Low-Overhead Heap Profiling
jcbeyler
parents: 48157
diff changeset
     2
 * Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4761
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4761
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4761
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef SHARE_VM_PRIMS_JVMTITHREADSTATE_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_PRIMS_JVMTITHREADSTATE_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "jvmtifiles/jvmti.h"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "memory/allocation.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "prims/jvmtiEventController.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "runtime/thread.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
#include "utilities/growableArray.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
// Forward Declarations
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
class JvmtiEnvBase;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
class JvmtiEnvThreadState;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
class JvmtiDynamicCodeEventCollector;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
enum JvmtiClassLoadKind {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  jvmti_class_load_kind_load = 100,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  jvmti_class_load_kind_retransform,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  jvmti_class_load_kind_redefine
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
///////////////////////////////////////////////////////////////
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
// class JvmtiEnvThreadStateIterator
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
// The only safe means of iterating through the JvmtiEnvThreadStates
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
// in a JvmtiThreadState.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
// Note that this iteratation includes invalid environments pending
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
// deallocation -- in fact, some uses depend on this behavior.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
class JvmtiEnvThreadStateIterator : public StackObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  JvmtiThreadState* state;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  JvmtiEnvThreadStateIterator(JvmtiThreadState* thread_state);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  ~JvmtiEnvThreadStateIterator();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  JvmtiEnvThreadState* first();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  JvmtiEnvThreadState* next(JvmtiEnvThreadState* ets);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
///////////////////////////////////////////////////////////////
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
// class JvmtiThreadState
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
// The Jvmti state for each thread (across all JvmtiEnv):
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
// 1. Local table of enabled events.
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 11588
diff changeset
    74
class JvmtiThreadState : public CHeapObj<mtInternal> {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  friend class JvmtiEnv;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  JavaThread        *_thread;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  bool              _hide_single_stepping;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  bool              _pending_step_for_popframe;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  bool              _pending_step_for_earlyret;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  int               _hide_level;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
42895
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
    83
 public:
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
    84
  enum ExceptionState {
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
    85
    ES_CLEARED,
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
    86
    ES_DETECTED,
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
    87
    ES_CAUGHT
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
    88
  };
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
    89
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
    90
 private:
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
    91
  ExceptionState _exception_state;
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
    92
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  // Used to send class being redefined/retransformed and kind of transform
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  // info to the class file load hook event handler.
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 46271
diff changeset
    95
  Klass*                _class_being_redefined;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  JvmtiClassLoadKind    _class_load_kind;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  // This is only valid when is_interp_only_mode() returns true
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  int               _cur_stack_depth;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  JvmtiThreadEventEnable _thread_event_enable;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  // for support of JvmtiEnvThreadState
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  JvmtiEnvThreadState*   _head_env_thread_state;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  // doubly-linked linear list of active thread state
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  // needed in order to iterate the list without holding Threads_lock
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  static JvmtiThreadState *_head;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  JvmtiThreadState *_next;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  JvmtiThreadState *_prev;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  // holds the current dynamic code event collector, NULL if no event collector in use
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  JvmtiDynamicCodeEventCollector* _dynamic_code_event_collector;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  // holds the current vm object alloc event collector, NULL if no event collector in use
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  JvmtiVMObjectAllocEventCollector* _vm_object_alloc_event_collector;
50578
e2a7f431f65c 8203394: Implementation of JEP 331: Low-Overhead Heap Profiling
jcbeyler
parents: 48157
diff changeset
   116
  // holds the current sampled object alloc event collector, NULL if no event collector in use
e2a7f431f65c 8203394: Implementation of JEP 331: Low-Overhead Heap Profiling
jcbeyler
parents: 48157
diff changeset
   117
  JvmtiSampledObjectAllocEventCollector* _sampled_object_alloc_event_collector;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  // Should only be created by factory methods
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  JvmtiThreadState(JavaThread *thread);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  friend class JvmtiEnvThreadStateIterator;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  inline JvmtiEnvThreadState* head_env_thread_state();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  inline void set_head_env_thread_state(JvmtiEnvThreadState* ets);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  ~JvmtiThreadState();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  // is event_type enabled and usable for this thread in any enviroments?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  bool is_enabled(jvmtiEvent event_type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    return _thread_event_enable.is_enabled(event_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  JvmtiThreadEventEnable *thread_event_enable() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    return &_thread_event_enable;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  // Must only be called in situations where the state is for the current thread and
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  // the environment can not go away.  To be safe, the returned JvmtiEnvThreadState
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  // must be used in such a way as there can be no intervening safepoints.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  inline JvmtiEnvThreadState* env_thread_state(JvmtiEnvBase *env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  static void periodic_clean_up();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  void add_env(JvmtiEnvBase *env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  // Used by the interpreter for fullspeed debugging support
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  bool is_interp_only_mode()                { return _thread->is_interp_only_mode(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  void enter_interp_only_mode();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  void leave_interp_only_mode();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  // access to the linked list of all JVMTI thread states
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  static JvmtiThreadState *first() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
    assert(Threads::number_of_threads() == 0 || JvmtiThreadState_lock->is_locked(), "sanity check");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
    return _head;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  JvmtiThreadState *next()                  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
    return _next;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  // Current stack depth is only valid when is_interp_only_mode() returns true.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  // These functions should only be called at a safepoint - usually called from same thread.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  // Returns the number of Java activations on the stack.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  int cur_stack_depth();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  void invalidate_cur_stack_depth();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  void incr_cur_stack_depth();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  void decr_cur_stack_depth();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  int count_frames();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  inline JavaThread *get_thread()      { return _thread;              }
42895
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
   173
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
   174
  inline bool is_exception_detected()  { return _exception_state == ES_DETECTED;  }
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
   175
  inline bool is_exception_caught()    { return _exception_state == ES_CAUGHT;  }
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
   176
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
   177
  inline void set_exception_detected() { _exception_state = ES_DETECTED; }
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
   178
  inline void set_exception_caught()   { _exception_state = ES_CAUGHT; }
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
   179
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
   180
  inline void clear_exception_state() { _exception_state = ES_CLEARED; }
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
   181
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
   182
  // We need to save and restore exception state inside JvmtiEventMark
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
   183
  inline ExceptionState get_exception_state() { return _exception_state; }
c97cd79636ec 8165496: assert(_exception_caught == false) failed: _exception_caught is out of phase
dsamersoff
parents: 13975
diff changeset
   184
  inline void restore_exception_state(ExceptionState state) { _exception_state = state; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  inline void clear_hide_single_stepping() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
    if (_hide_level > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
      _hide_level--;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
      assert(_hide_single_stepping, "hide_single_stepping is out of phase");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
      _hide_single_stepping = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  inline bool hide_single_stepping() { return _hide_single_stepping; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  inline void set_hide_single_stepping() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
    if (_hide_single_stepping) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
      _hide_level++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
      assert(_hide_level == 0, "hide_level is out of phase");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
      _hide_single_stepping = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  // Step pending flag is set when PopFrame is called and it is cleared
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  // when step for the Pop Frame is completed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  // This logic is used to distinguish b/w step for pop frame and repeat step.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  void set_pending_step_for_popframe() { _pending_step_for_popframe = true;  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  void clr_pending_step_for_popframe() { _pending_step_for_popframe = false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  bool is_pending_step_for_popframe()  { return _pending_step_for_popframe;  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  void process_pending_step_for_popframe();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  // Step pending flag is set when ForceEarlyReturn is called and it is cleared
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  // when step for the ForceEarlyReturn is completed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  // This logic is used to distinguish b/w step for early return and repeat step.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  void set_pending_step_for_earlyret() { _pending_step_for_earlyret = true;  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  void clr_pending_step_for_earlyret() { _pending_step_for_earlyret = false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  bool is_pending_step_for_earlyret()  { return _pending_step_for_earlyret;  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  void process_pending_step_for_earlyret();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  // Setter and getter method is used to send redefined class info
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  // when class file load hook event is posted.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  // It is set while loading redefined class and cleared before the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  // class file load hook event is posted.
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 46271
diff changeset
   224
  inline void set_class_being_redefined(Klass* k, JvmtiClassLoadKind kind) {
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 46271
diff changeset
   225
    _class_being_redefined = k;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
    _class_load_kind = kind;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  inline void clear_class_being_redefined() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
    _class_being_redefined = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
    _class_load_kind = jvmti_class_load_kind_load;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 46271
diff changeset
   234
  inline Klass* get_class_being_redefined() {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
    return _class_being_redefined;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  inline JvmtiClassLoadKind get_class_load_kind() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
    return _class_load_kind;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  // RedefineClasses support
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  // The bug 6214132 caused the verification to fail.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  // Below is the detailed description of the fix approach taken:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  // 1. What's done in RedefineClasses() before verification:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  //  a) A reference to the class being redefined (_the_class) and a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
  //     reference to new version of the class (_scratch_class) are
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  //     saved here for use during the bytecode verification phase of
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  //     RedefineClasses. See RedefineVerifyMark for how these fields
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  //     are managed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
  //   b) The _java_mirror field from _the_class is copied to the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  //     _java_mirror field in _scratch_class. This means that a jclass
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  //     returned for _the_class or _scratch_class will refer to the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  //     same Java mirror. The verifier will see the "one true mirror"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  //     for the class being verified.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  // 2. What is done at verification:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
  //   When the verifier makes calls into the VM to ask questions about
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
  //   the class being verified, it will pass the jclass to JVM_* functions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  //   The jclass is always pointing to the mirror of _the_class.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
  //   ~28 JVM_* functions called by the verifier for the information
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  //   about CP entries and klass structure should check the jvmtiThreadState
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
   263
  //   info about equivalent klass versions and use it to replace a Klass*
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
   264
  //   of _the_class with a Klass* of _scratch_class. The function
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
  //   class_to_verify_considering_redefinition() must be called for it.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  //   Note again, that this redirection happens only for the verifier thread.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
  //   Other threads have very small overhead by checking the existence
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
  //   of the jvmtiThreadSate and the information about klasses equivalence.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  //   No JNI functions need to be changed, they don't reference the klass guts.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  //   The JavaThread pointer is already available in all JVM_* functions
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  //   used by the verifier, so there is no extra performance issue with it.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
 private:
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 46271
diff changeset
   275
  Klass* _the_class_for_redefinition_verification;
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 46271
diff changeset
   276
  Klass* _scratch_class_for_redefinition_verification;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
 public:
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 46271
diff changeset
   279
  inline void set_class_versions_map(Klass* the_class,
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 46271
diff changeset
   280
                                     Klass* scratch_class) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
    _the_class_for_redefinition_verification = the_class;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
    _scratch_class_for_redefinition_verification = scratch_class;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
  inline void clear_class_versions_map() { set_class_versions_map(NULL, NULL); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  static inline
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
   288
  Klass* class_to_verify_considering_redefinition(Klass* klass,
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
                                                    JavaThread *thread) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
    JvmtiThreadState *state = thread->jvmti_thread_state();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
    if (state != NULL && state->_the_class_for_redefinition_verification != NULL) {
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 46271
diff changeset
   292
      if (state->_the_class_for_redefinition_verification == klass) {
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 46271
diff changeset
   293
        klass = state->_scratch_class_for_redefinition_verification;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
    return klass;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
  // Todo: get rid of this!
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
  bool _debuggable;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
  // Should the thread be enumerated by jvmtiInternal::GetAllThreads?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
  bool is_debuggable()                 { return _debuggable; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
  // If a thread cannot be suspended (has no valid last_java_frame) then it gets marked !debuggable
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
  void set_debuggable(bool debuggable) { _debuggable = debuggable; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
  bool may_be_walked();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
  // Thread local event collector setter and getter methods.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
  JvmtiDynamicCodeEventCollector* get_dynamic_code_event_collector() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
    return _dynamic_code_event_collector;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
  JvmtiVMObjectAllocEventCollector* get_vm_object_alloc_event_collector() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
    return _vm_object_alloc_event_collector;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
  }
50578
e2a7f431f65c 8203394: Implementation of JEP 331: Low-Overhead Heap Profiling
jcbeyler
parents: 48157
diff changeset
   319
  JvmtiSampledObjectAllocEventCollector* get_sampled_object_alloc_event_collector() {
e2a7f431f65c 8203394: Implementation of JEP 331: Low-Overhead Heap Profiling
jcbeyler
parents: 48157
diff changeset
   320
    return _sampled_object_alloc_event_collector;
e2a7f431f65c 8203394: Implementation of JEP 331: Low-Overhead Heap Profiling
jcbeyler
parents: 48157
diff changeset
   321
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
  void set_dynamic_code_event_collector(JvmtiDynamicCodeEventCollector* collector) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
    _dynamic_code_event_collector = collector;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
  void set_vm_object_alloc_event_collector(JvmtiVMObjectAllocEventCollector* collector) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
    _vm_object_alloc_event_collector = collector;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
  }
50578
e2a7f431f65c 8203394: Implementation of JEP 331: Low-Overhead Heap Profiling
jcbeyler
parents: 48157
diff changeset
   328
  void set_sampled_object_alloc_event_collector(JvmtiSampledObjectAllocEventCollector* collector) {
e2a7f431f65c 8203394: Implementation of JEP 331: Low-Overhead Heap Profiling
jcbeyler
parents: 48157
diff changeset
   329
    _sampled_object_alloc_event_collector = collector;
e2a7f431f65c 8203394: Implementation of JEP 331: Low-Overhead Heap Profiling
jcbeyler
parents: 48157
diff changeset
   330
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
  // Frame routines
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
  //  true when the thread was suspended with a pointer to the last Java frame.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
  bool has_last_frame()                     { return _thread->has_last_Java_frame(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
  void update_for_pop_top_frame();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
  // already holding JvmtiThreadState_lock - retrieve or create JvmtiThreadState
2135
f82c3012ec86 6800721: 3/4 JavaThread::jvmti_thread_state() and JvmtiThreadState::state_for() robustness
dcubed
parents: 2134
diff changeset
   345
  // Can return NULL if JavaThread is exiting.
48105
8d15b1369c7a 8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents: 47580
diff changeset
   346
  static JvmtiThreadState *state_for_while_locked(JavaThread *thread);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
  // retrieve or create JvmtiThreadState
2135
f82c3012ec86 6800721: 3/4 JavaThread::jvmti_thread_state() and JvmtiThreadState::state_for() robustness
dcubed
parents: 2134
diff changeset
   348
  // Can return NULL if JavaThread is exiting.
48105
8d15b1369c7a 8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents: 47580
diff changeset
   349
  static JvmtiThreadState *state_for(JavaThread *thread);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
  // JVMTI ForceEarlyReturn support
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
  // This is set to earlyret_pending to signal that top Java frame
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
  // should be returned immediately
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
  int           _earlyret_state;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
  TosState      _earlyret_tos;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
  jvalue        _earlyret_value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
  oop           _earlyret_oop;         // Used to return an oop result into Java code from
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
                                       // ForceEarlyReturnObject, GC-preserved
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
  // Setting and clearing earlyret_state
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
  // earlyret_pending indicates that a ForceEarlyReturn() has been
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
  // requested and not yet been completed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
  enum EarlyretState {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
    earlyret_inactive = 0,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
    earlyret_pending  = 1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
  void set_earlyret_pending(void) { _earlyret_state = earlyret_pending;  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
  void clr_earlyret_pending(void) { _earlyret_state = earlyret_inactive; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
  bool is_earlyret_pending(void)  { return (_earlyret_state == earlyret_pending);  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
  TosState earlyret_tos()                            { return _earlyret_tos; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
  oop  earlyret_oop() const                          { return _earlyret_oop; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
  void set_earlyret_oop (oop x)                      { _earlyret_oop = x;    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
  jvalue earlyret_value()                            { return _earlyret_value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
  void set_earlyret_value(jvalue val, TosState tos)  { _earlyret_tos = tos;  _earlyret_value = val;  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
  void clr_earlyret_value()                          { _earlyret_tos = ilgl; _earlyret_value.j = 0L; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
  static ByteSize earlyret_state_offset() { return byte_offset_of(JvmtiThreadState, _earlyret_state); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
  static ByteSize earlyret_tos_offset()   { return byte_offset_of(JvmtiThreadState, _earlyret_tos); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
  static ByteSize earlyret_oop_offset()   { return byte_offset_of(JvmtiThreadState, _earlyret_oop); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
  static ByteSize earlyret_value_offset() { return byte_offset_of(JvmtiThreadState, _earlyret_value); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
13975
2f7431485cfa 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 13728
diff changeset
   387
  void oops_do(OopClosure* f) NOT_JVMTI_RETURN; // GC support
4761
bdb7375a1fee 6902182: 4/4 Starting with jdwp agent should not incur performance penalty
dcubed
parents: 2135
diff changeset
   388
bdb7375a1fee 6902182: 4/4 Starting with jdwp agent should not incur performance penalty
dcubed
parents: 2135
diff changeset
   389
public:
bdb7375a1fee 6902182: 4/4 Starting with jdwp agent should not incur performance penalty
dcubed
parents: 2135
diff changeset
   390
  void set_should_post_on_exceptions(bool val) { _thread->set_should_post_on_exceptions_flag(val ? JNI_TRUE : JNI_FALSE); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
class RedefineVerifyMark : public StackObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
 private:
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 46271
diff changeset
   395
  JvmtiThreadState* _state;
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 46271
diff changeset
   396
  Klass*            _scratch_class;
47580
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   397
  OopHandle         _scratch_mirror;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
 public:
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 46271
diff changeset
   400
  RedefineVerifyMark(Klass* the_class, Klass* scratch_class,
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 46271
diff changeset
   401
                     JvmtiThreadState *state) : _state(state), _scratch_class(scratch_class)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
    _state->set_class_versions_map(the_class, scratch_class);
47580
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   404
    _scratch_mirror = _scratch_class->java_mirror_handle();
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   405
    _scratch_class->set_java_mirror_handle(the_class->java_mirror_handle());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
  ~RedefineVerifyMark() {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
   409
    // Restore the scratch class's mirror, so when scratch_class is removed
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
   410
    // the correct mirror pointing to it can be cleared.
47580
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   411
    _scratch_class->set_java_mirror_handle(_scratch_mirror);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
    _state->clear_class_versions_map();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   416
#endif // SHARE_VM_PRIMS_JVMTITHREADSTATE_HPP