src/hotspot/cpu/s390/frame_s390.cpp
author stefank
Mon, 19 Aug 2019 11:30:03 +0200
changeset 57811 947252a54b98
parent 54786 ebf733a324d4
permissions -rw-r--r--
8229838: Rename markOop files to markWord Reviewed-by: dholmes, rehn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     1
/*
53807
639a36bc8ef1 8219112: name_and_sig_as_C_string usages in frame_s390 miss ResourceMark
mbaesken
parents: 53590
diff changeset
     2
 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
639a36bc8ef1 8219112: name_and_sig_as_C_string usages in frame_s390 miss ResourceMark
mbaesken
parents: 53590
diff changeset
     3
 * Copyright (c) 2016, 2019, SAP SE. All rights reserved.
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     5
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     8
 * published by the Free Software Foundation.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     9
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    14
 * accompanied this code).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    15
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    19
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    22
 * questions.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    23
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    24
 */
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    25
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    26
#include "precompiled.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    27
#include "interpreter/interpreter.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    28
#include "memory/resourceArea.hpp"
54786
ebf733a324d4 8223624: Cleanup includes of universe.hpp
stefank
parents: 53807
diff changeset
    29
#include "memory/universe.hpp"
57811
947252a54b98 8229838: Rename markOop files to markWord
stefank
parents: 54786
diff changeset
    30
#include "oops/markWord.hpp"
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    31
#include "oops/oop.inline.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    32
#include "runtime/frame.inline.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    33
#include "runtime/handles.inline.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    34
#include "runtime/javaCalls.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    35
#include "runtime/monitorChunk.hpp"
53590
ce36f8180d03 8218140: Build failures after JDK-8218041 (Assorted wrong/missing includes)
shade
parents: 52055
diff changeset
    36
#include "runtime/os.inline.hpp"
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    37
#include "runtime/signature.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    38
#include "runtime/stubCodeGenerator.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    39
#include "runtime/stubRoutines.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    40
#include "vmreg_s390.inline.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    41
#ifdef COMPILER1
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    42
#include "c1/c1_Runtime1.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    43
#include "runtime/vframeArray.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    44
#endif
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    45
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    46
// Major contributions by Aha, AS.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    47
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    48
#ifdef ASSERT
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    49
void RegisterMap::check_location_valid() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    50
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    51
#endif // ASSERT
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    52
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    53
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    54
// Profiling/safepoint support
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    55
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    56
bool frame::safe_for_sender(JavaThread *thread) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    57
  bool safe = false;
52055
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    58
  address sp = (address)_sp;
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    59
  address fp = (address)_fp;
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    60
  address unextended_sp = (address)_unextended_sp;
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    61
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    62
  // Consider stack guards when trying to determine "safe" stack pointers
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    63
  static size_t stack_guard_size = os::uses_stack_guard_pages() ?
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    64
    JavaThread::stack_red_zone_size() + JavaThread::stack_yellow_reserved_zone_size() : 0;
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    65
  size_t usable_stack_size = thread->stack_size() - stack_guard_size;
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    66
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    67
  // sp must be within the usable part of the stack (not in guards)
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    68
  bool sp_safe = (sp < thread->stack_base()) &&
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    69
                 (sp >= thread->stack_base() - usable_stack_size);
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    70
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    71
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    72
  if (!sp_safe) {
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    73
    return false;
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    74
  }
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    75
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    76
  // Unextended sp must be within the stack
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    77
  bool unextended_sp_safe = (unextended_sp < thread->stack_base());
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    78
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    79
  if (!unextended_sp_safe) {
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    80
    return false;
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    81
  }
52055
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    82
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    83
  // An fp must be within the stack and above (but not equal) sp.
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    84
  bool fp_safe = (fp <= thread->stack_base()) &&  (fp > sp);
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    85
  // An interpreter fp must be within the stack and above (but not equal) sp.
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    86
  // Moreover, it must be at least the size of the z_ijava_state structure.
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    87
  bool fp_interp_safe = (fp <= thread->stack_base()) && (fp > sp) &&
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    88
    ((fp - sp) >= z_ijava_state_size);
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    89
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    90
  // We know sp/unextended_sp are safe, only fp is questionable here
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    91
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    92
  // If the current frame is known to the code cache then we can attempt to
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    93
  // to construct the sender and do some validation of it. This goes a long way
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    94
  // toward eliminating issues when we get in frame construction code
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    95
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    96
  if (_cb != NULL ) {
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    97
    // Entry frame checks
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    98
    if (is_entry_frame()) {
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
    99
      // An entry frame must have a valid fp.
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   100
      return fp_safe && is_entry_frame_valid(thread);
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   101
    }
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   102
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   103
    // Now check if the frame is complete and the test is
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   104
    // reliable. Unfortunately we can only check frame completeness for
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   105
    // runtime stubs. Other generic buffer blobs are more
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   106
    // problematic so we just assume they are OK. Adapter blobs never have a
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   107
    // complete frame and are never OK. nmethods should be OK on s390.
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   108
    if (!_cb->is_frame_complete_at(_pc)) {
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   109
      if (_cb->is_adapter_blob() || _cb->is_runtime_stub()) {
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   110
        return false;
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   111
      }
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   112
    }
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   113
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   114
    // Could just be some random pointer within the codeBlob.
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   115
    if (!_cb->code_contains(_pc)) {
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   116
      return false;
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   117
    }
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   118
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   119
    if (is_interpreted_frame() && !fp_interp_safe) {
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   120
      return false;
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   121
    }
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   122
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   123
    z_abi_160* sender_abi = (z_abi_160*) fp;
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   124
    intptr_t* sender_sp = (intptr_t*) sender_abi->callers_sp;
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   125
    address   sender_pc = (address) sender_abi->return_pc;
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   126
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   127
    // We must always be able to find a recognizable pc.
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   128
    CodeBlob* sender_blob = CodeCache::find_blob_unsafe(sender_pc);
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   129
    if (sender_blob == NULL) {
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   130
      return false;
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   131
    }
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   132
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   133
    // Could be a zombie method
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   134
    if (sender_blob->is_zombie() || sender_blob->is_unloaded()) {
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   135
      return false;
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   136
    }
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   137
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   138
    // It should be safe to construct the sender though it might not be valid.
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   139
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   140
    frame sender(sender_sp, sender_pc);
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   141
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   142
    // Do we have a valid fp?
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   143
    address sender_fp = (address) sender.fp();
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   144
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   145
    // sender_fp must be within the stack and above (but not
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   146
    // equal) current frame's fp.
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   147
    if (sender_fp > thread->stack_base() || sender_fp <= fp) {
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   148
        return false;
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   149
    }
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   150
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   151
    // If the potential sender is the interpreter then we can do some more checking.
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   152
    if (Interpreter::contains(sender_pc)) {
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   153
      return sender.is_interpreted_frame_valid(thread);
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   154
    }
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   155
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   156
    // Could just be some random pointer within the codeBlob.
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   157
    if (!sender.cb()->code_contains(sender_pc)) {
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   158
      return false;
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   159
    }
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   160
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   161
    // We should never be able to see an adapter if the current frame is something from code cache.
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   162
    if (sender_blob->is_adapter_blob()) {
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   163
      return false;
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   164
    }
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   165
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   166
    if (sender.is_entry_frame()) {
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   167
      return sender.is_entry_frame_valid(thread);
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   168
    }
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   169
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   170
    // Frame size is always greater than zero. If the sender frame size is zero or less,
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   171
    // something is really weird and we better give up.
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   172
    if (sender_blob->frame_size() <= 0) {
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   173
      return false;
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   174
    }
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   175
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   176
    return true;
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   177
  }
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   178
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   179
  // Must be native-compiled frame. Since sender will try and use fp to find
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   180
  // linkages it must be safe
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   181
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   182
  if (!fp_safe) {
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   183
    return false;
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   184
  }
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   185
9f154d0a59f6 8211768: [s390] Implement JFR profiling
ghaug
parents: 47216
diff changeset
   186
  return true;
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   187
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   188
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   189
bool frame::is_interpreted_frame() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   190
  return Interpreter::contains(pc());
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   191
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   192
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   193
// sender_sp
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   194
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   195
intptr_t* frame::interpreter_frame_sender_sp() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   196
  return sender_sp();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   197
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   198
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   199
frame frame::sender_for_entry_frame(RegisterMap *map) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   200
  assert(map != NULL, "map must be set");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   201
  // Java frame called from C. Skip all C frames and return top C
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   202
  // frame of that chunk as the sender.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   203
  JavaFrameAnchor* jfa = entry_frame_call_wrapper()->anchor();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   204
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   205
  assert(!entry_frame_is_first(), "next Java sp must be non zero");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   206
  assert(jfa->last_Java_sp() > _sp, "must be above this frame on stack");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   207
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   208
  map->clear();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   209
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   210
  assert(map->include_argument_oops(), "should be set by clear");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   211
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   212
  if (jfa->last_Java_pc() != NULL) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   213
    frame fr(jfa->last_Java_sp(), jfa->last_Java_pc());
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   214
    return fr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   215
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   216
  // Last_java_pc is not set if we come here from compiled code.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   217
  frame fr(jfa->last_Java_sp());
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   218
  return fr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   219
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   220
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   221
frame frame::sender_for_interpreter_frame(RegisterMap *map) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   222
  // Pass callers sender_sp as unextended_sp.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   223
  return frame(sender_sp(), sender_pc(), (intptr_t*)(ijava_state()->sender_sp));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   224
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   225
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   226
frame frame::sender_for_compiled_frame(RegisterMap *map) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   227
  assert(map != NULL, "map must be set");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   228
  // Frame owned by compiler.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   229
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   230
  address pc = *compiled_sender_pc_addr(_cb);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   231
  frame caller(compiled_sender_sp(_cb), pc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   232
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   233
  // Now adjust the map.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   234
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   235
  // Get the rest.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   236
  if (map->update_map()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   237
    // Tell GC to use argument oopmaps for some runtime stubs that need it.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   238
    map->set_include_argument_oops(_cb->caller_must_gc_arguments(map->thread()));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   239
    if (_cb->oop_maps() != NULL) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   240
      OopMapSet::update_register_map(this, map);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   241
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   242
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   243
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   244
  return caller;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   245
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   246
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   247
intptr_t* frame::compiled_sender_sp(CodeBlob* cb) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   248
  return sender_sp();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   249
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   250
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   251
address* frame::compiled_sender_pc_addr(CodeBlob* cb) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   252
  return sender_pc_addr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   253
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   254
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   255
frame frame::sender(RegisterMap* map) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   256
  // Default is we don't have to follow them. The sender_for_xxx will
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   257
  // update it accordingly.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   258
  map->set_include_argument_oops(false);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   259
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   260
  if (is_entry_frame()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   261
    return sender_for_entry_frame(map);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   262
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   263
  if (is_interpreted_frame()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   264
    return sender_for_interpreter_frame(map);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   265
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   266
  assert(_cb == CodeCache::find_blob(pc()),"Must be the same");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   267
  if (_cb != NULL) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   268
    return sender_for_compiled_frame(map);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   269
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   270
  // Must be native-compiled frame, i.e. the marshaling code for native
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   271
  // methods that exists in the core system.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   272
  return frame(sender_sp(), sender_pc());
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   273
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   274
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   275
void frame::patch_pc(Thread* thread, address pc) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   276
  if (TracePcPatching) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   277
    tty->print_cr("patch_pc at address  " PTR_FORMAT " [" PTR_FORMAT " -> " PTR_FORMAT "] ",
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   278
                  p2i(&((address*) _sp)[-1]), p2i(((address*) _sp)[-1]), p2i(pc));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   279
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   280
  own_abi()->return_pc = (uint64_t)pc;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   281
  _cb = CodeCache::find_blob(pc);
42556
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   282
  address original_pc = CompiledMethod::get_deopt_original_pc(this);
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   283
  if (original_pc != NULL) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   284
    assert(original_pc == _pc, "expected original to be stored before patching");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   285
    _deopt_state = is_deoptimized;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   286
    // Leave _pc as is.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   287
  } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   288
    _deopt_state = not_deoptimized;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   289
    _pc = pc;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   290
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   291
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   292
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   293
bool frame::is_interpreted_frame_valid(JavaThread* thread) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   294
  // Is there anything to do?
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   295
  assert(is_interpreted_frame(), "Not an interpreted frame");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   296
  return true;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   297
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   298
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   299
BasicType frame::interpreter_frame_result(oop* oop_result, jvalue* value_result) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   300
  assert(is_interpreted_frame(), "interpreted frame expected");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   301
  Method* method = interpreter_frame_method();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   302
  BasicType type = method->result_type();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   303
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   304
  if (method->is_native()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   305
    address lresult = (address)&(ijava_state()->lresult);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   306
    address fresult = (address)&(ijava_state()->fresult);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   307
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   308
    switch (type) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   309
      case T_OBJECT:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   310
      case T_ARRAY: {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   311
        *oop_result = (oop) (void*) ijava_state()->oop_tmp;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   312
        break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   313
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   314
      // We use std/stfd to store the values.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   315
      case T_BOOLEAN : value_result->z = (jboolean) *(unsigned long*)lresult; break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   316
      case T_INT     : value_result->i = (jint)     *(long*)lresult;          break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   317
      case T_CHAR    : value_result->c = (jchar)    *(unsigned long*)lresult; break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   318
      case T_SHORT   : value_result->s = (jshort)   *(long*)lresult;          break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   319
      case T_BYTE    : value_result->z = (jbyte)    *(long*)lresult;          break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   320
      case T_LONG    : value_result->j = (jlong)    *(long*)lresult;          break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   321
      case T_FLOAT   : value_result->f = (jfloat)   *(float*)fresult;        break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   322
      case T_DOUBLE  : value_result->d = (jdouble)  *(double*)fresult;        break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   323
      case T_VOID    : break; // Nothing to do.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   324
      default        : ShouldNotReachHere();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   325
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   326
  } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   327
    intptr_t* tos_addr = interpreter_frame_tos_address();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   328
    switch (type) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   329
      case T_OBJECT:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   330
      case T_ARRAY: {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   331
       oop obj = *(oop*)tos_addr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   332
       assert(obj == NULL || Universe::heap()->is_in(obj), "sanity check");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   333
       *oop_result = obj;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   334
       break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   335
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   336
      case T_BOOLEAN : value_result->z = (jboolean) *(jint*)tos_addr; break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   337
      case T_BYTE    : value_result->b = (jbyte) *(jint*)tos_addr; break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   338
      case T_CHAR    : value_result->c = (jchar) *(jint*)tos_addr; break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   339
      case T_SHORT   : value_result->s = (jshort) *(jint*)tos_addr; break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   340
      case T_INT     : value_result->i = *(jint*)tos_addr; break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   341
      case T_LONG    : value_result->j = *(jlong*)tos_addr; break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   342
      case T_FLOAT   : value_result->f = *(jfloat*)tos_addr; break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   343
      case T_DOUBLE  : value_result->d = *(jdouble*)tos_addr; break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   344
      case T_VOID    : break; // Nothing to do.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   345
      default        : ShouldNotReachHere();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   346
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   347
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   348
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   349
  return type;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   350
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   351
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   352
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   353
// Dump all frames starting a given C stack-pointer.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   354
// Use max_frames to limit the number of traced frames.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   355
void frame::back_trace(outputStream* st, intptr_t* start_sp, intptr_t* top_pc, unsigned long flags, int max_frames) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   356
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   357
  static char buf[ 150 ];
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   358
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   359
  bool print_outgoing_arguments = flags & 0x1;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   360
  bool print_istate_pointers    = flags & 0x2;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   361
  int num = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   362
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   363
  intptr_t* current_sp = (intptr_t*) start_sp;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   364
  int last_num_jargs = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   365
  int frame_type = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   366
  int last_frame_type = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   367
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   368
  while (current_sp) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   369
    intptr_t* current_fp = (intptr_t*) *current_sp;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   370
    address   current_pc = (num == 0)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   371
                           ? (address) top_pc
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   372
                           : (address) *((intptr_t*)(((address) current_sp) + _z_abi(return_pc)));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   373
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   374
    if ((intptr_t*) current_fp != 0 && (intptr_t*) current_fp <= current_sp) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   375
      st->print_cr("ERROR: corrupt stack");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   376
      return;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   377
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   378
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   379
    st->print("#%-3d ", num);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   380
    const char* type_name = "    ";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   381
    const char* function_name = NULL;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   382
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   383
    // Detect current frame's frame_type, default to 'C frame'.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   384
    frame_type = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   385
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   386
    CodeBlob* blob = NULL;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   387
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   388
    if (Interpreter::contains(current_pc)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   389
      frame_type = 1;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   390
    } else if (StubRoutines::contains(current_pc)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   391
      if (StubRoutines::returns_to_call_stub(current_pc)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   392
        frame_type = 2;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   393
      } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   394
        frame_type = 4;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   395
        type_name = "stu";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   396
        StubCodeDesc* desc = StubCodeDesc::desc_for (current_pc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   397
        if (desc) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   398
          function_name = desc->name();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   399
        } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   400
          function_name = "unknown stub";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   401
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   402
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   403
    } else if (CodeCache::contains(current_pc)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   404
      blob = CodeCache::find_blob_unsafe(current_pc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   405
      if (blob) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   406
        if (blob->is_nmethod()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   407
          frame_type = 3;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   408
        } else if (blob->is_deoptimization_stub()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   409
          frame_type = 4;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   410
          type_name = "deo";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   411
          function_name = "deoptimization blob";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   412
        } else if (blob->is_uncommon_trap_stub()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   413
          frame_type = 4;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   414
          type_name = "uct";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   415
          function_name = "uncommon trap blob";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   416
        } else if (blob->is_exception_stub()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   417
          frame_type = 4;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   418
          type_name = "exc";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   419
          function_name = "exception blob";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   420
        } else if (blob->is_safepoint_stub()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   421
          frame_type = 4;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   422
          type_name = "saf";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   423
          function_name = "safepoint blob";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   424
        } else if (blob->is_runtime_stub()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   425
          frame_type = 4;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   426
          type_name = "run";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   427
          function_name = ((RuntimeStub *)blob)->name();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   428
        } else if (blob->is_method_handles_adapter_blob()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   429
          frame_type = 4;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   430
          type_name = "mha";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   431
          function_name = "method handles adapter blob";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   432
        } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   433
          frame_type = 4;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   434
          type_name = "blo";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   435
          function_name = "unknown code blob";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   436
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   437
      } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   438
        frame_type = 4;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   439
        type_name = "blo";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   440
        function_name = "unknown code blob";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   441
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   442
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   443
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   444
    st->print("sp=" PTR_FORMAT " ", p2i(current_sp));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   445
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   446
    if (frame_type == 0) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   447
      current_pc = (address) *((intptr_t*)(((address) current_sp) + _z_abi(gpr14)));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   448
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   449
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   450
    st->print("pc=" PTR_FORMAT " ", p2i(current_pc));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   451
    st->print(" ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   452
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   453
    switch (frame_type) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   454
      case 0: // C frame:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   455
        {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   456
          st->print("    ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   457
          if (current_pc == 0) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   458
            st->print("? ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   459
          } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   460
             // name
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   461
            int func_offset;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   462
            char demangled_name[256];
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   463
            int demangled_name_len = 256;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   464
            if (os::dll_address_to_function_name(current_pc, demangled_name, demangled_name_len, &func_offset)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   465
              demangled_name[demangled_name_len-1] = '\0';
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   466
              st->print(func_offset == -1 ? "%s " : "%s+0x%x", demangled_name, func_offset);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   467
            } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   468
              st->print("? ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   469
            }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   470
          }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   471
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   472
        break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   473
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   474
      case 1: // interpreter frame:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   475
        {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   476
          st->print(" i  ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   477
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   478
          if (last_frame_type != 1) last_num_jargs = 8;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   479
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   480
          // name
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   481
          Method* method = *(Method**)((address)current_fp + _z_ijava_state_neg(method));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   482
          if (method) {
53807
639a36bc8ef1 8219112: name_and_sig_as_C_string usages in frame_s390 miss ResourceMark
mbaesken
parents: 53590
diff changeset
   483
            ResourceMark rm;
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   484
            if (method->is_synchronized()) st->print("synchronized ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   485
            if (method->is_static()) st->print("static ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   486
            if (method->is_native()) st->print("native ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   487
            method->name_and_sig_as_C_string(buf, sizeof(buf));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   488
            st->print("%s ", buf);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   489
          }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   490
          else
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   491
            st->print("? ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   492
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   493
          intptr_t* tos = (intptr_t*) *(intptr_t*)((address)current_fp + _z_ijava_state_neg(esp));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   494
          if (print_istate_pointers) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   495
            st->cr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   496
            st->print("     ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   497
            st->print("ts=" PTR_FORMAT " ", p2i(tos));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   498
          }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   499
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   500
          // Dump some Java stack slots.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   501
          if (print_outgoing_arguments) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   502
            if (method->is_native()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   503
#ifdef ASSERT
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   504
              intptr_t* cargs = (intptr_t*) (((address)current_sp) + _z_abi(carg_1));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   505
              for (int i = 0; i < last_num_jargs; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   506
                // Cargs is not prepushed.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   507
                st->cr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   508
                st->print("        ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   509
                st->print(PTR_FORMAT, *(cargs));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   510
                cargs++;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   511
              }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   512
#endif /* ASSERT */
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   513
            }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   514
            else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   515
              if (tos) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   516
                for (int i = 0; i < last_num_jargs; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   517
                  // tos+0 is prepushed, ignore.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   518
                  tos++;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   519
                  if (tos >= (intptr_t *)((address)current_fp + _z_ijava_state_neg(monitors)))
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   520
                    break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   521
                  st->cr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   522
                  st->print("        ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   523
                  st->print(PTR_FORMAT " %+.3e %+.3le", *(tos), *(float*)(tos), *(double*)(tos));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   524
                }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   525
              }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   526
            }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   527
            last_num_jargs = method->size_of_parameters();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   528
          }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   529
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   530
        break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   531
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   532
      case 2: // entry frame:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   533
        {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   534
          st->print("v2i ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   535
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   536
          // name
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   537
          st->print("call stub");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   538
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   539
        break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   540
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   541
      case 3: // compiled frame:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   542
        {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   543
          st->print(" c  ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   544
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   545
          // name
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   546
          Method* method = ((nmethod *)blob)->method();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   547
          if (method) {
53807
639a36bc8ef1 8219112: name_and_sig_as_C_string usages in frame_s390 miss ResourceMark
mbaesken
parents: 53590
diff changeset
   548
            ResourceMark rm;
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   549
            method->name_and_sig_as_C_string(buf, sizeof(buf));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   550
            st->print("%s ", buf);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   551
          }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   552
          else
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   553
            st->print("? ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   554
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   555
        break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   556
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   557
      case 4: // named frames
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   558
        {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   559
          st->print("%s ", type_name);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   560
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   561
          // name
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   562
          if (function_name)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   563
            st->print("%s", function_name);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   564
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   565
        break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   566
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   567
      default:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   568
        break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   569
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   570
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   571
    st->cr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   572
    st->flush();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   573
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   574
    current_sp = current_fp;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   575
    last_frame_type = frame_type;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   576
    num++;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   577
    // Check for maximum # of frames, and stop when reached.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   578
    if (max_frames > 0 && --max_frames == 0)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   579
      break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   580
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   581
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   582
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   583
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   584
// Convenience function for calls from the debugger.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   585
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   586
extern "C" void bt(intptr_t* start_sp,intptr_t* top_pc) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   587
  frame::back_trace(tty,start_sp, top_pc, 0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   588
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   589
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   590
extern "C" void bt_full(intptr_t* start_sp,intptr_t* top_pc) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   591
  frame::back_trace(tty,start_sp, top_pc, (unsigned long)(long)-1);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   592
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   593
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   594
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   595
// Function for tracing a limited number of frames.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   596
// Use this one if you only need to see the "top of stack" frames.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   597
extern "C" void bt_max(intptr_t *start_sp, intptr_t *top_pc, int max_frames) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   598
  frame::back_trace(tty, start_sp, top_pc, 0, max_frames);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   599
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   600
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   601
#if !defined(PRODUCT)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   602
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   603
#define DESCRIBE_ADDRESS(name) \
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   604
  values.describe(frame_no, (intptr_t*)&ijava_state()->name, #name);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   605
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   606
void frame::describe_pd(FrameValues& values, int frame_no) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   607
  if (is_interpreted_frame()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   608
    // Describe z_ijava_state elements.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   609
    DESCRIBE_ADDRESS(method);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   610
    DESCRIBE_ADDRESS(locals);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   611
    DESCRIBE_ADDRESS(monitors);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   612
    DESCRIBE_ADDRESS(cpoolCache);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   613
    DESCRIBE_ADDRESS(bcp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   614
    DESCRIBE_ADDRESS(mdx);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   615
    DESCRIBE_ADDRESS(esp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   616
    DESCRIBE_ADDRESS(sender_sp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   617
    DESCRIBE_ADDRESS(top_frame_sp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   618
    DESCRIBE_ADDRESS(oop_tmp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   619
    DESCRIBE_ADDRESS(lresult);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   620
    DESCRIBE_ADDRESS(fresult);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   621
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   622
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   623
46589
f1c04490ded1 8182848: Some functions misplaced in debug.hpp
coleenp
parents: 42556
diff changeset
   624
f1c04490ded1 8182848: Some functions misplaced in debug.hpp
coleenp
parents: 42556
diff changeset
   625
void frame::pd_ps() {}
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   626
#endif // !PRODUCT
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   627
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   628
intptr_t *frame::initial_deoptimization_info() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   629
  // Used to reset the saved FP.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   630
  return fp();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   631
}