src/hotspot/share/runtime/vframe.inline.hpp
author mgronlun
Wed, 30 Oct 2019 19:43:52 +0100
changeset 58863 c16ac7a2eba4
parent 55401 32cce302a1fd
permissions -rw-r--r--
8226511: Implement JFR Event Streaming Reviewed-by: egahlin, mseledtsov, mgronlun Contributed-by: erik.gahlin@oracle.com, mikhailo.seledtsov@oracle.com, markus.gronlund@oracle.com
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"
55401
32cce302a1fd 8226227: Missing include of thread.inline.hpp
rehn
parents: 53244
diff changeset
    29
#include "runtime/thread.inline.hpp"
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    30
#include "runtime/vframe.hpp"
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    31
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    32
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
    33
  _thread = thread;
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
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    36
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
    37
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    38
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
    39
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    40
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
    41
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    42
inline void vframeStreamCommon::next() {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    43
  // handle frames with inlining
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    44
  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
    45
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    46
  // handle general case
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    47
  do {
53065
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 49480
diff changeset
    48
    _prev_frame = _frame;
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    49
    _frame = _frame.sender(&_reg_map);
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    50
  } while (!fill_from_frame());
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
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    53
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
    54
  : vframeStreamCommon(thread) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    55
  _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
    56
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    57
  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
    58
    _mode = at_end_mode;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    59
    return;
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
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    62
  _frame = _thread->last_frame();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    63
  while (!fill_from_frame()) {
53065
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 49480
diff changeset
    64
    _prev_frame = _frame;
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    65
    _frame = _frame.sender(&_reg_map);
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
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    69
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
    70
  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
    71
    return false;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    72
  }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    73
  fill_from_compiled_frame(_sender_decode_offset);
53065
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 49480
diff changeset
    74
  ++_vframe_id;
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    75
  return true;
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
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    79
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
    80
  _mode = compiled_mode;
53065
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 49480
diff changeset
    81
  _decode_offset = decode_offset;
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    82
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    83
  // 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
    84
  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
    85
      decode_offset < 0 ||
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    86
      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
    87
    // 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
    88
    // 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
    89
    // 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
    90
    // 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
    91
    // 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
    92
    // 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
    93
    // 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
    94
#ifdef ASSERT
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    95
    if (WizardMode) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    96
      ttyLocker ttyl;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
    97
      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
    98
                    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
    99
                    p2i(_frame.pc()), decode_offset);
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   100
      nm()->print();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   101
      nm()->method()->print_codes();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   102
      nm()->print_code();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   103
      nm()->print_pcs();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   104
    }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   105
    found_bad_method_frame();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   106
#endif
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   107
    // 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
   108
    fill_from_compiled_native_frame();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   109
    return;
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
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   112
  // Decode first part of scopeDesc
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   113
  DebugInfoReadStream buffer(nm(), decode_offset);
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   114
  _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
   115
  _method               = buffer.read_method();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   116
  _bci                  = buffer.read_bci();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   117
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   118
  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
   119
}
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   120
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   121
// 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
   122
// 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
   123
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
   124
  _mode = compiled_mode;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   125
  _sender_decode_offset = DebugInformationRecorder::serialized_null;
53065
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 49480
diff changeset
   126
  _decode_offset = DebugInformationRecorder::serialized_null;
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 49480
diff changeset
   127
  _vframe_id = 0;
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   128
  _method = nm()->method();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   129
  _bci = 0;
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
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   132
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
   133
  // Interpreted frame
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   134
  if (_frame.is_interpreted_frame()) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   135
    fill_from_interpreter_frame();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   136
    return true;
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
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   139
  // Compiled frame
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   140
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   141
  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
   142
    if (nm()->is_native_method()) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   143
      // 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
   144
      fill_from_compiled_native_frame();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   145
    } else {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   146
      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
   147
      int decode_offset;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   148
      if (pc_desc == NULL) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   149
        // 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
   150
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   151
        // 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
   152
        // 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
   153
        // 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
   154
        // 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
   155
        //
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   156
        // 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
   157
        // 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
   158
        // 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
   159
        // 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
   160
        // 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
   161
        // 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
   162
        // 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
   163
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   164
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   165
        JavaThreadState state = _thread->thread_state();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   166
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   167
        // 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
   168
        // 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
   169
        // 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
   170
        // 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
   171
        // 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
   172
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   173
        if (state == _thread_in_Java ) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   174
          // 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
   175
          // 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
   176
          // 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
   177
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   178
          fill_from_compiled_native_frame();
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   179
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   180
          // 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
   181
          // 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
   182
          // 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
   183
          // 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
   184
          // 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
   185
          // 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
   186
          // 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
   187
          // 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
   188
          // get good data.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   189
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   190
          return true;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   191
        }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   192
        decode_offset = DebugInformationRecorder::serialized_null;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   193
      } else {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   194
        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
   195
      }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   196
      fill_from_compiled_frame(decode_offset);
53065
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 49480
diff changeset
   197
      _vframe_id = 0;
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   198
    }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   199
    return true;
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
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   202
  // End of stack?
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   203
  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
   204
    _mode = at_end_mode;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   205
    return true;
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
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   208
  return false;
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
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   212
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
   213
  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
   214
  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
   215
  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
   216
  // 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
   217
  // 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
   218
  // 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
   219
  // 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
   220
  // 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
   221
  // 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
   222
  // of entering the method.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   223
  if (bci < 0) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   224
    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
   225
    bci = 0;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   226
  }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   227
  _mode   = interpreted_mode;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   228
  _method = method;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   229
  _bci    = bci;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   230
}
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
diff changeset
   231
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 53065
diff changeset
   232
#endif // SHARE_RUNTIME_VFRAME_INLINE_HPP