src/hotspot/share/runtime/vframe.hpp
author iklam
Fri, 29 Nov 2019 14:11:50 -0800
changeset 59328 f280911d3427
parent 53244 9807daeb47c4
permissions -rw-r--r--
8230385: [cds] No message is logged when shared image cannot be used due to mismatched configuration Reviewed-by: stuefe, dholmes, ccheung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 53065
diff changeset
     2
 * Copyright (c) 1997, 2019, 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: 3686
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3686
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: 3686
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
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 53065
diff changeset
    25
#ifndef SHARE_RUNTIME_VFRAME_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 53065
diff changeset
    26
#define SHARE_RUNTIME_VFRAME_HPP
7397
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 "code/debugInfo.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "code/debugInfoRec.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "code/location.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "oops/oop.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
#include "runtime/frame.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    33
#include "runtime/stackValue.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    34
#include "runtime/stackValueCollection.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    35
#include "utilities/growableArray.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    36
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
// vframes are virtual stack frames representing source level activations.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
// A single frame may hold several source level activations in the case of
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// optimized code. The debugging stored with the optimized code enables
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
// us to unfold a frame as a stack of vframes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
// A cVFrame represents an activation of a non-java method.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
// The vframe inheritance hierarchy:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
// - vframe
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
//   - javaVFrame
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
//     - interpretedVFrame
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
//     - compiledVFrame     ; (used for both compiled Java methods and native stubs)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
//   - externalVFrame
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
//     - entryVFrame        ; special frame created when calling Java from C
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
// - BasicLock
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
class vframe: public ResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
 protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  frame        _fr;      // Raw frame behind the virtual frame.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  RegisterMap  _reg_map; // Register map for the raw frame (used to handle callee-saved registers).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  JavaThread*  _thread;  // The thread owning the raw frame.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  vframe(const frame* fr, const RegisterMap* reg_map, JavaThread* thread);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  vframe(const frame* fr, JavaThread* thread);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  // Factory method for creating vframes
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  static vframe* new_vframe(const frame* f, const RegisterMap *reg_map, JavaThread* thread);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  // Accessors
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  frame              fr()           const { return _fr;       }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  CodeBlob*          cb()         const { return _fr.cb();  }
38133
78b95467b9f1 8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents: 35542
diff changeset
    68
  CompiledMethod*   nm()         const {
78b95467b9f1 8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents: 35542
diff changeset
    69
      assert( cb() != NULL && cb()->is_compiled(), "usage");
78b95467b9f1 8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents: 35542
diff changeset
    70
      return (CompiledMethod*) cb();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
// ???? Does this need to be a copy?
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  frame*             frame_pointer() { return &_fr;       }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  const RegisterMap* register_map() const { return &_reg_map; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  JavaThread*        thread()       const { return _thread;   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  // Returns the sender vframe
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  virtual vframe* sender() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  // Returns the next javaVFrame on the stack (skipping all other kinds of frame)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  javaVFrame *java_sender() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  // Answers if the this is the top vframe in the frame, i.e., if the sender vframe
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  // is in the caller frame
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  virtual bool is_top() const { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  // Returns top vframe within same frame (see is_top())
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  virtual vframe* top() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  // Type testing operations
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  virtual bool is_entry_frame()       const { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  virtual bool is_java_frame()        const { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  virtual bool is_interpreted_frame() const { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  virtual bool is_compiled_frame()    const { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  // printing operations
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  virtual void print_value() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  virtual void print();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
class javaVFrame: public vframe {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  // JVM state
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   108
  virtual Method*                      method()         const = 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  virtual int                          bci()            const = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  virtual StackValueCollection*        locals()         const = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  virtual StackValueCollection*        expressions()    const = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  // the order returned by monitors() is from oldest -> youngest#4418568
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  virtual GrowableArray<MonitorInfo*>* monitors()       const = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  // Debugging support via JVMTI.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  // NOTE that this is not guaranteed to give correct results for compiled vframes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  // Deoptimize first if necessary.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  virtual void set_locals(StackValueCollection* values) const = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  // Test operation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  bool is_java_frame() const { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
 protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  javaVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread) : vframe(fr, reg_map, thread) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  javaVFrame(const frame* fr, JavaThread* thread) : vframe(fr, thread) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  // casting
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  static javaVFrame* cast(vframe* vf) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
    assert(vf == NULL || vf->is_java_frame(), "must be java frame");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    return (javaVFrame*) vf;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  // Return an array of monitors locked by this frame in the youngest to oldest order
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  GrowableArray<MonitorInfo*>* locked_monitors();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
31782
b23b74f8ae8d 8130448: thread dump improvements, comment additions, new diagnostics inspired by 8077392
dcubed
parents: 30305
diff changeset
   137
  // printing used during stack dumps and diagnostics
b23b74f8ae8d 8130448: thread dump improvements, comment additions, new diagnostics inspired by 8077392
dcubed
parents: 30305
diff changeset
   138
  static void print_locked_object_class_name(outputStream* st, Handle obj, const char* lock_state);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  void print_lock_info_on(outputStream* st, int frame_count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  void print_lock_info(int frame_count) { print_lock_info_on(tty, frame_count); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  // printing operations
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  void print();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  void print_value() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  void print_activation(int index) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  // verify operations
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  virtual void verify() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  // Structural compare
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  bool structural_compare(javaVFrame* other);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  friend class vframe;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
class interpretedVFrame: public javaVFrame {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  // JVM state
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   161
  Method*                      method()         const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  int                          bci()            const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  StackValueCollection*        locals()         const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  StackValueCollection*        expressions()    const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  GrowableArray<MonitorInfo*>* monitors()       const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  void set_locals(StackValueCollection* values) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  // Test operation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  bool is_interpreted_frame() const { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
 protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  interpretedVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread) : javaVFrame(fr, reg_map, thread) {};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  // Accessors for Byte Code Pointer
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  u_char* bcp() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  void set_bcp(u_char* bcp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  // casting
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  static interpretedVFrame* cast(vframe* vf) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
    assert(vf == NULL || vf->is_interpreted_frame(), "must be interpreted frame");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
    return (interpretedVFrame*) vf;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  static const int bcp_offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  intptr_t* locals_addr_at(int offset) const;
25473
185aff4215a4 8039905: heapdump/OnOOMToFile and heapdump/OnOOMToPath fail with "assert(fr().interpreter_frame_expression_stack_size() >= length) failed: error in expression stack!"
mgronlun
parents: 24424
diff changeset
   189
  StackValueCollection* stack_data(bool expressions) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  // returns where the parameters starts relative to the frame pointer
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  int start_of_parameters() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  // verify operations
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  void verify() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  friend class vframe;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
class externalVFrame: public vframe {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
 protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  externalVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread) : vframe(fr, reg_map, thread) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  // printing operations
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  void print_value() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  void print();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  friend class vframe;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
class entryVFrame: public externalVFrame {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  bool is_entry_frame() const { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
 protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  entryVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  // casting
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  static entryVFrame* cast(vframe* vf) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
    assert(vf == NULL || vf->is_entry_frame(), "must be entry frame");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
    return (entryVFrame*) vf;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  // printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  void print_value() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  void print();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  friend class vframe;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
// A MonitorInfo is a ResourceObject that describes a the pair:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
// 1) the owner of the monitor
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
// 2) the monitor lock
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
class MonitorInfo : public ResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  oop        _owner; // the object owning the monitor
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  BasicLock* _lock;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   246
  oop        _owner_klass; // klass (mirror) if owner was scalar replaced
256
70fdc3927a4e 6681646: Relocking of a scalar replaced object during deoptimization is broken
kvn
parents: 1
diff changeset
   247
  bool       _eliminated;
3171
aa289b22b577 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 670
diff changeset
   248
  bool       _owner_is_scalar_replaced;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  // Constructor
3171
aa289b22b577 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 670
diff changeset
   251
  MonitorInfo(oop owner, BasicLock* lock, bool eliminated, bool owner_is_scalar_replaced) {
aa289b22b577 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 670
diff changeset
   252
    if (!owner_is_scalar_replaced) {
aa289b22b577 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 670
diff changeset
   253
      _owner = owner;
aa289b22b577 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 670
diff changeset
   254
      _owner_klass = NULL;
aa289b22b577 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 670
diff changeset
   255
    } else {
aa289b22b577 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 670
diff changeset
   256
      assert(eliminated, "monitor should be eliminated for scalar replaced object");
aa289b22b577 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 670
diff changeset
   257
      _owner = NULL;
aa289b22b577 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 670
diff changeset
   258
      _owner_klass = owner;
aa289b22b577 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 670
diff changeset
   259
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
    _lock  = lock;
256
70fdc3927a4e 6681646: Relocking of a scalar replaced object during deoptimization is broken
kvn
parents: 1
diff changeset
   261
    _eliminated = eliminated;
3171
aa289b22b577 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 670
diff changeset
   262
    _owner_is_scalar_replaced = owner_is_scalar_replaced;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
  // Accessors
3171
aa289b22b577 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 670
diff changeset
   265
  oop        owner() const {
aa289b22b577 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 670
diff changeset
   266
    assert(!_owner_is_scalar_replaced, "should not be called for scalar replaced object");
aa289b22b577 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 670
diff changeset
   267
    return _owner;
aa289b22b577 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 670
diff changeset
   268
  }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   269
  oop   owner_klass() const {
3171
aa289b22b577 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 670
diff changeset
   270
    assert(_owner_is_scalar_replaced, "should not be called for not scalar replaced object");
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   271
    return _owner_klass;
3171
aa289b22b577 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 670
diff changeset
   272
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
  BasicLock* lock()  const { return _lock;  }
256
70fdc3927a4e 6681646: Relocking of a scalar replaced object during deoptimization is broken
kvn
parents: 1
diff changeset
   274
  bool eliminated()  const { return _eliminated; }
3171
aa289b22b577 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 670
diff changeset
   275
  bool owner_is_scalar_replaced()  const { return _owner_is_scalar_replaced; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
class vframeStreamCommon : StackObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
 protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
  // common
53065
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 49480
diff changeset
   281
  frame        _prev_frame;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
  frame        _frame;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
  JavaThread*  _thread;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
  RegisterMap  _reg_map;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
  enum { interpreted_mode, compiled_mode, at_end_mode } _mode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
53065
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 49480
diff changeset
   287
  // For compiled_mode
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 49480
diff changeset
   288
  int _decode_offset;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
  int _sender_decode_offset;
53065
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 49480
diff changeset
   290
  int _vframe_id;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
  // Cached information
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   293
  Method* _method;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
  int       _bci;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
  // Should VM activations be ignored or not
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
  bool _stop_at_java_call_stub;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
  bool fill_in_compiled_inlined_sender();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
  void fill_from_compiled_frame(int decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
  void fill_from_compiled_native_frame();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
  void fill_from_interpreter_frame();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
  bool fill_from_frame();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
  // Helper routine for security_get_caller_frame
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
  void skip_prefixed_method_and_wrappers();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
43980
792a70d867f4 8175178: Stack traversal during OSR migration asserts with invalid bci or invalid scope desc on x86
mgronlun
parents: 38213
diff changeset
   309
  DEBUG_ONLY(void found_bad_method_frame() const;)
792a70d867f4 8175178: Stack traversal during OSR migration asserts with invalid bci or invalid scope desc on x86
mgronlun
parents: 38213
diff changeset
   310
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
  // Constructor
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 47216
diff changeset
   313
  inline vframeStreamCommon(JavaThread* thread);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
  // Accessors
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   316
  Method* method() const { return _method; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
  int bci() const { return _bci; }
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 47216
diff changeset
   318
  inline intptr_t* frame_id() const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
  address frame_pc() const { return _frame.pc(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
  CodeBlob*          cb()         const { return _frame.cb();  }
38133
78b95467b9f1 8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents: 35542
diff changeset
   322
  CompiledMethod*   nm()         const {
78b95467b9f1 8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents: 35542
diff changeset
   323
      assert( cb() != NULL && cb()->is_compiled(), "usage");
78b95467b9f1 8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents: 35542
diff changeset
   324
      return (CompiledMethod*) cb();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
53065
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 49480
diff changeset
   327
  javaVFrame* asJavaVFrame();
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 49480
diff changeset
   328
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
  // Frame type
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 47216
diff changeset
   330
  inline bool is_interpreted_frame() const;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 47216
diff changeset
   331
  inline bool is_entry_frame() const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
  // Iteration
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 47216
diff changeset
   334
  inline void next();
16617
6235d2c7549f 7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents: 13728
diff changeset
   335
  void security_next();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
  bool at_end() const { return _mode == at_end_mode; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
  // Implements security traversal. Skips depth no. of frame including
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
  // special security frames and prefixed native methods
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
  void security_get_caller_frame(int depth);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
  // Helper routine for JVM_LatestUserDefinedLoader -- needed for 1.4
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
  // reflection implementation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
  void skip_reflection_related_frames();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
class vframeStream : public vframeStreamCommon {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
  // Constructors
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 47216
diff changeset
   351
  vframeStream(JavaThread* thread, bool stop_at_java_call_stub = false);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
  // top_frame may not be at safepoint, start with sender
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
  vframeStream(JavaThread* thread, frame top_frame, bool stop_at_java_call_stub = false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 53065
diff changeset
   357
#endif // SHARE_RUNTIME_VFRAME_HPP