src/hotspot/share/runtime/vframe.inline.hpp
author coleenp
Thu, 10 Jan 2019 15:13:51 -0500
changeset 53244 9807daeb47c4
parent 53065 2f41e4935c34
child 55401 32cce302a1fd
permissions -rw-r--r--
8216167: Update include guards to reflect correct directories Summary: Use script and some manual fixup to fix directores names in include guards. Reviewed-by: lfoltan, eosterlund, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 53065
diff changeset
     2
 * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
     4
 *
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
     7
 * published by the Free Software Foundation.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
     8
 *
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    13
 * accompanied this code).
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    14
 *
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    18
 *
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    21
 * questions.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    22
 *
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    23
 */
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 53065
diff changeset
    25
#ifndef SHARE_RUNTIME_VFRAME_INLINE_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 53065
diff changeset
    26
#define SHARE_RUNTIME_VFRAME_INLINE_HPP
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    27
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    28
#include "runtime/frame.inline.hpp"
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    29
#include "runtime/vframe.hpp"
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    30
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    31
inline vframeStreamCommon::vframeStreamCommon(JavaThread* thread) : _reg_map(thread, false) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    32
  _thread = thread;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    33
}
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    34
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    35
inline intptr_t* vframeStreamCommon::frame_id() const        { return _frame.id(); }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    36
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    37
inline bool vframeStreamCommon::is_interpreted_frame() const { return _frame.is_interpreted_frame(); }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    38
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    39
inline bool vframeStreamCommon::is_entry_frame() const       { return _frame.is_entry_frame(); }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    40
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    41
inline void vframeStreamCommon::next() {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    42
  // handle frames with inlining
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    43
  if (_mode == compiled_mode    && fill_in_compiled_inlined_sender()) return;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    44
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    45
  // handle general case
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    46
  do {
53065
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 49480
diff changeset
    47
    _prev_frame = _frame;
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    48
    _frame = _frame.sender(&_reg_map);
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    49
  } while (!fill_from_frame());
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    50
}
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    51
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    52
inline vframeStream::vframeStream(JavaThread* thread, bool stop_at_java_call_stub)
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    53
  : vframeStreamCommon(thread) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    54
  _stop_at_java_call_stub = stop_at_java_call_stub;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    55
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    56
  if (!thread->has_last_Java_frame()) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    57
    _mode = at_end_mode;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    58
    return;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    59
  }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    60
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    61
  _frame = _thread->last_frame();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    62
  while (!fill_from_frame()) {
53065
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 49480
diff changeset
    63
    _prev_frame = _frame;
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    64
    _frame = _frame.sender(&_reg_map);
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    65
  }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    66
}
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    67
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    68
inline bool vframeStreamCommon::fill_in_compiled_inlined_sender() {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    69
  if (_sender_decode_offset == DebugInformationRecorder::serialized_null) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    70
    return false;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    71
  }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    72
  fill_from_compiled_frame(_sender_decode_offset);
53065
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 49480
diff changeset
    73
  ++_vframe_id;
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    74
  return true;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    75
}
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    76
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    77
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    78
inline void vframeStreamCommon::fill_from_compiled_frame(int decode_offset) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    79
  _mode = compiled_mode;
53065
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 49480
diff changeset
    80
  _decode_offset = decode_offset;
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    81
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    82
  // Range check to detect ridiculous offsets.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    83
  if (decode_offset == DebugInformationRecorder::serialized_null ||
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    84
      decode_offset < 0 ||
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    85
      decode_offset >= nm()->scopes_data_size()) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    86
    // 6379830 AsyncGetCallTrace sometimes feeds us wild frames.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    87
    // If we read nmethod::scopes_data at serialized_null (== 0)
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    88
    // or if read some at other invalid offset, invalid values will be decoded.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    89
    // Based on these values, invalid heap locations could be referenced
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    90
    // that could lead to crashes in product mode.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    91
    // Therefore, do not use the decode offset if invalid, but fill the frame
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    92
    // as it were a native compiled frame (no Java-level assumptions).
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    93
#ifdef ASSERT
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    94
    if (WizardMode) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    95
      ttyLocker ttyl;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    96
      tty->print_cr("Error in fill_from_frame: pc_desc for "
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    97
                    INTPTR_FORMAT " not found or invalid at %d",
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    98
                    p2i(_frame.pc()), decode_offset);
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    99
      nm()->print();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   100
      nm()->method()->print_codes();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   101
      nm()->print_code();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   102
      nm()->print_pcs();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   103
    }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   104
    found_bad_method_frame();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   105
#endif
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   106
    // Provide a cheap fallback in product mode.  (See comment above.)
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   107
    fill_from_compiled_native_frame();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   108
    return;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   109
  }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   110
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   111
  // Decode first part of scopeDesc
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   112
  DebugInfoReadStream buffer(nm(), decode_offset);
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   113
  _sender_decode_offset = buffer.read_int();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   114
  _method               = buffer.read_method();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   115
  _bci                  = buffer.read_bci();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   116
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   117
  assert(_method->is_method(), "checking type of decoded method");
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   118
}
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   119
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   120
// The native frames are handled specially. We do not rely on ScopeDesc info
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   121
// since the pc might not be exact due to the _last_native_pc trick.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   122
inline void vframeStreamCommon::fill_from_compiled_native_frame() {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   123
  _mode = compiled_mode;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   124
  _sender_decode_offset = DebugInformationRecorder::serialized_null;
53065
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 49480
diff changeset
   125
  _decode_offset = DebugInformationRecorder::serialized_null;
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 49480
diff changeset
   126
  _vframe_id = 0;
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   127
  _method = nm()->method();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   128
  _bci = 0;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   129
}
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   130
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   131
inline bool vframeStreamCommon::fill_from_frame() {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   132
  // Interpreted frame
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   133
  if (_frame.is_interpreted_frame()) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   134
    fill_from_interpreter_frame();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   135
    return true;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   136
  }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   137
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   138
  // Compiled frame
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   139
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   140
  if (cb() != NULL && cb()->is_compiled()) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   141
    if (nm()->is_native_method()) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   142
      // Do not rely on scopeDesc since the pc might be unprecise due to the _last_native_pc trick.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   143
      fill_from_compiled_native_frame();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   144
    } else {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   145
      PcDesc* pc_desc = nm()->pc_desc_at(_frame.pc());
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   146
      int decode_offset;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   147
      if (pc_desc == NULL) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   148
        // Should not happen, but let fill_from_compiled_frame handle it.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   149
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   150
        // If we are trying to walk the stack of a thread that is not
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   151
        // at a safepoint (like AsyncGetCallTrace would do) then this is an
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   152
        // acceptable result. [ This is assuming that safe_for_sender
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   153
        // is so bullet proof that we can trust the frames it produced. ]
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   154
        //
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   155
        // So if we see that the thread is not safepoint safe
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   156
        // then simply produce the method and a bci of zero
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   157
        // and skip the possibility of decoding any inlining that
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   158
        // may be present. That is far better than simply stopping (or
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   159
        // asserting. If however the thread is safepoint safe this
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   160
        // is the sign of a compiler bug  and we'll let
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   161
        // fill_from_compiled_frame handle it.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   162
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   163
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   164
        JavaThreadState state = _thread->thread_state();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   165
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   166
        // in_Java should be good enough to test safepoint safety
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   167
        // if state were say in_Java_trans then we'd expect that
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   168
        // the pc would have already been slightly adjusted to
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   169
        // one that would produce a pcDesc since the trans state
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   170
        // would be one that might in fact anticipate a safepoint
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   171
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   172
        if (state == _thread_in_Java ) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   173
          // This will get a method a zero bci and no inlining.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   174
          // Might be nice to have a unique bci to signify this
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   175
          // particular case but for now zero will do.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   176
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   177
          fill_from_compiled_native_frame();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   178
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   179
          // There is something to be said for setting the mode to
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   180
          // at_end_mode to prevent trying to walk further up the
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   181
          // stack. There is evidence that if we walk any further
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   182
          // that we could produce a bad stack chain. However until
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   183
          // we see evidence that allowing this causes us to find
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   184
          // frames bad enough to cause segv's or assertion failures
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   185
          // we don't do it as while we may get a bad call chain the
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   186
          // probability is much higher (several magnitudes) that we
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   187
          // get good data.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   188
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   189
          return true;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   190
        }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   191
        decode_offset = DebugInformationRecorder::serialized_null;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   192
      } else {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   193
        decode_offset = pc_desc->scope_decode_offset();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   194
      }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   195
      fill_from_compiled_frame(decode_offset);
53065
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 49480
diff changeset
   196
      _vframe_id = 0;
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   197
    }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   198
    return true;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   199
  }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   200
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   201
  // End of stack?
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   202
  if (_frame.is_first_frame() || (_stop_at_java_call_stub && _frame.is_entry_frame())) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   203
    _mode = at_end_mode;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   204
    return true;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   205
  }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   206
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   207
  return false;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   208
}
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   209
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   210
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   211
inline void vframeStreamCommon::fill_from_interpreter_frame() {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   212
  Method* method = _frame.interpreter_frame_method();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   213
  address   bcp    = _frame.interpreter_frame_bcp();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   214
  int       bci    = method->validate_bci_from_bcp(bcp);
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   215
  // 6379830 AsyncGetCallTrace sometimes feeds us wild frames.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   216
  // AsyncGetCallTrace interrupts the VM asynchronously. As a result
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   217
  // it is possible to access an interpreter frame for which
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   218
  // no Java-level information is yet available (e.g., becasue
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   219
  // the frame was being created when the VM interrupted it).
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   220
  // In this scenario, pretend that the interpreter is at the point
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   221
  // of entering the method.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   222
  if (bci < 0) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   223
    DEBUG_ONLY(found_bad_method_frame();)
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   224
    bci = 0;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   225
  }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   226
  _mode   = interpreted_mode;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   227
  _method = method;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   228
  _bci    = bci;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   229
}
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   230
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 53065
diff changeset
   231
#endif // SHARE_RUNTIME_VFRAME_INLINE_HPP