hotspot/src/cpu/s390/vm/frame_s390.cpp
author coleenp
Thu, 01 Dec 2016 14:21:31 -0500
changeset 44738 11431bbc9549
parent 42556 c03d98321ad1
child 46589 f1c04490ded1
permissions -rw-r--r--
8168699: Validate special case invocations Reviewed-by: acorn, kvn, lfoltan, ctornqvi, ahgross, vlivanov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     1
/*
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     3
 * Copyright (c) 2016 SAP SE. All rights reserved.
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"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    29
#include "oops/markOop.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    30
#include "oops/oop.inline.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    31
#include "runtime/frame.inline.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    32
#include "runtime/handles.inline.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    33
#include "runtime/javaCalls.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    34
#include "runtime/monitorChunk.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    35
#include "runtime/signature.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    36
#include "runtime/stubCodeGenerator.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    37
#include "runtime/stubRoutines.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    38
#include "vmreg_s390.inline.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    39
#ifdef COMPILER1
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    40
#include "c1/c1_Runtime1.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    41
#include "runtime/vframeArray.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    42
#endif
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    43
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    44
// Major contributions by Aha, AS.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    45
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    46
#ifdef ASSERT
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    47
void RegisterMap::check_location_valid() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    48
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    49
#endif // ASSERT
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    50
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    51
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    52
// Profiling/safepoint support
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    53
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    54
bool frame::safe_for_sender(JavaThread *thread) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    55
  bool safe = false;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    56
  address cursp = (address)sp();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    57
  address curfp = (address)fp();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    58
  if ((cursp != NULL && curfp != NULL &&
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    59
      (cursp <= thread->stack_base() && cursp >= thread->stack_base() - thread->stack_size())) &&
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    60
      (curfp <= thread->stack_base() && curfp >= thread->stack_base() - thread->stack_size())) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    61
    safe = true;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    62
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    63
  return safe;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    64
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    65
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    66
bool frame::is_interpreted_frame() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    67
  return Interpreter::contains(pc());
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    68
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    69
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    70
// sender_sp
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    71
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    72
intptr_t* frame::interpreter_frame_sender_sp() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    73
  return sender_sp();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    74
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    75
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    76
frame frame::sender_for_entry_frame(RegisterMap *map) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    77
  assert(map != NULL, "map must be set");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    78
  // Java frame called from C. Skip all C frames and return top C
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    79
  // frame of that chunk as the sender.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    80
  JavaFrameAnchor* jfa = entry_frame_call_wrapper()->anchor();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    81
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    82
  assert(!entry_frame_is_first(), "next Java sp must be non zero");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    83
  assert(jfa->last_Java_sp() > _sp, "must be above this frame on stack");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    84
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    85
  map->clear();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    86
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    87
  assert(map->include_argument_oops(), "should be set by clear");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    88
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    89
  if (jfa->last_Java_pc() != NULL) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    90
    frame fr(jfa->last_Java_sp(), jfa->last_Java_pc());
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    91
    return fr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    92
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    93
  // Last_java_pc is not set if we come here from compiled code.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    94
  frame fr(jfa->last_Java_sp());
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    95
  return fr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    96
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    97
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    98
frame frame::sender_for_interpreter_frame(RegisterMap *map) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    99
  // Pass callers sender_sp as unextended_sp.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   100
  return frame(sender_sp(), sender_pc(), (intptr_t*)(ijava_state()->sender_sp));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   101
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   102
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   103
frame frame::sender_for_compiled_frame(RegisterMap *map) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   104
  assert(map != NULL, "map must be set");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   105
  // Frame owned by compiler.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   106
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   107
  address pc = *compiled_sender_pc_addr(_cb);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   108
  frame caller(compiled_sender_sp(_cb), pc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   109
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   110
  // Now adjust the map.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   111
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   112
  // Get the rest.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   113
  if (map->update_map()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   114
    // Tell GC to use argument oopmaps for some runtime stubs that need it.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   115
    map->set_include_argument_oops(_cb->caller_must_gc_arguments(map->thread()));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   116
    if (_cb->oop_maps() != NULL) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   117
      OopMapSet::update_register_map(this, map);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   118
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   119
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   120
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   121
  return caller;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   122
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   123
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   124
intptr_t* frame::compiled_sender_sp(CodeBlob* cb) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   125
  return sender_sp();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   126
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   127
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   128
address* frame::compiled_sender_pc_addr(CodeBlob* cb) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   129
  return sender_pc_addr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   130
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   131
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   132
frame frame::sender(RegisterMap* map) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   133
  // Default is we don't have to follow them. The sender_for_xxx will
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   134
  // update it accordingly.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   135
  map->set_include_argument_oops(false);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   136
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   137
  if (is_entry_frame()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   138
    return sender_for_entry_frame(map);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   139
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   140
  if (is_interpreted_frame()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   141
    return sender_for_interpreter_frame(map);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   142
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   143
  assert(_cb == CodeCache::find_blob(pc()),"Must be the same");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   144
  if (_cb != NULL) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   145
    return sender_for_compiled_frame(map);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   146
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   147
  // Must be native-compiled frame, i.e. the marshaling code for native
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   148
  // methods that exists in the core system.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   149
  return frame(sender_sp(), sender_pc());
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   150
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   151
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   152
void frame::patch_pc(Thread* thread, address pc) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   153
  if (TracePcPatching) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   154
    tty->print_cr("patch_pc at address  " PTR_FORMAT " [" PTR_FORMAT " -> " PTR_FORMAT "] ",
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   155
                  p2i(&((address*) _sp)[-1]), p2i(((address*) _sp)[-1]), p2i(pc));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   156
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   157
  own_abi()->return_pc = (uint64_t)pc;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   158
  _cb = CodeCache::find_blob(pc);
42556
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   159
  address original_pc = CompiledMethod::get_deopt_original_pc(this);
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   160
  if (original_pc != NULL) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   161
    assert(original_pc == _pc, "expected original to be stored before patching");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   162
    _deopt_state = is_deoptimized;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   163
    // Leave _pc as is.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   164
  } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   165
    _deopt_state = not_deoptimized;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   166
    _pc = pc;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   167
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   168
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   169
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   170
bool frame::is_interpreted_frame_valid(JavaThread* thread) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   171
  // Is there anything to do?
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   172
  assert(is_interpreted_frame(), "Not an interpreted frame");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   173
  return true;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   174
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   175
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   176
BasicType frame::interpreter_frame_result(oop* oop_result, jvalue* value_result) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   177
  assert(is_interpreted_frame(), "interpreted frame expected");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   178
  Method* method = interpreter_frame_method();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   179
  BasicType type = method->result_type();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   180
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   181
  if (method->is_native()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   182
    address lresult = (address)&(ijava_state()->lresult);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   183
    address fresult = (address)&(ijava_state()->fresult);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   184
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   185
    switch (type) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   186
      case T_OBJECT:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   187
      case T_ARRAY: {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   188
        *oop_result = (oop) (void*) ijava_state()->oop_tmp;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   189
        break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   190
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   191
      // We use std/stfd to store the values.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   192
      case T_BOOLEAN : value_result->z = (jboolean) *(unsigned long*)lresult; break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   193
      case T_INT     : value_result->i = (jint)     *(long*)lresult;          break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   194
      case T_CHAR    : value_result->c = (jchar)    *(unsigned long*)lresult; break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   195
      case T_SHORT   : value_result->s = (jshort)   *(long*)lresult;          break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   196
      case T_BYTE    : value_result->z = (jbyte)    *(long*)lresult;          break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   197
      case T_LONG    : value_result->j = (jlong)    *(long*)lresult;          break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   198
      case T_FLOAT   : value_result->f = (jfloat)   *(float*)fresult;        break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   199
      case T_DOUBLE  : value_result->d = (jdouble)  *(double*)fresult;        break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   200
      case T_VOID    : break; // Nothing to do.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   201
      default        : ShouldNotReachHere();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   202
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   203
  } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   204
    intptr_t* tos_addr = interpreter_frame_tos_address();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   205
    switch (type) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   206
      case T_OBJECT:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   207
      case T_ARRAY: {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   208
       oop obj = *(oop*)tos_addr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   209
       assert(obj == NULL || Universe::heap()->is_in(obj), "sanity check");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   210
       *oop_result = obj;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   211
       break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   212
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   213
      case T_BOOLEAN : value_result->z = (jboolean) *(jint*)tos_addr; break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   214
      case T_BYTE    : value_result->b = (jbyte) *(jint*)tos_addr; break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   215
      case T_CHAR    : value_result->c = (jchar) *(jint*)tos_addr; break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   216
      case T_SHORT   : value_result->s = (jshort) *(jint*)tos_addr; break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   217
      case T_INT     : value_result->i = *(jint*)tos_addr; break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   218
      case T_LONG    : value_result->j = *(jlong*)tos_addr; break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   219
      case T_FLOAT   : value_result->f = *(jfloat*)tos_addr; break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   220
      case T_DOUBLE  : value_result->d = *(jdouble*)tos_addr; break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   221
      case T_VOID    : break; // Nothing to do.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   222
      default        : ShouldNotReachHere();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   223
    }
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
  return type;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   227
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   228
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   229
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   230
// Dump all frames starting a given C stack-pointer.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   231
// Use max_frames to limit the number of traced frames.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   232
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
   233
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   234
  static char buf[ 150 ];
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   235
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   236
  bool print_outgoing_arguments = flags & 0x1;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   237
  bool print_istate_pointers    = flags & 0x2;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   238
  int num = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   239
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   240
  intptr_t* current_sp = (intptr_t*) start_sp;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   241
  int last_num_jargs = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   242
  int frame_type = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   243
  int last_frame_type = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   244
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   245
  while (current_sp) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   246
    intptr_t* current_fp = (intptr_t*) *current_sp;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   247
    address   current_pc = (num == 0)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   248
                           ? (address) top_pc
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   249
                           : (address) *((intptr_t*)(((address) current_sp) + _z_abi(return_pc)));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   250
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   251
    if ((intptr_t*) current_fp != 0 && (intptr_t*) current_fp <= current_sp) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   252
      st->print_cr("ERROR: corrupt stack");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   253
      return;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   254
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   255
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   256
    st->print("#%-3d ", num);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   257
    const char* type_name = "    ";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   258
    const char* function_name = NULL;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   259
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   260
    // Detect current frame's frame_type, default to 'C frame'.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   261
    frame_type = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   262
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   263
    CodeBlob* blob = NULL;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   264
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   265
    if (Interpreter::contains(current_pc)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   266
      frame_type = 1;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   267
    } else if (StubRoutines::contains(current_pc)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   268
      if (StubRoutines::returns_to_call_stub(current_pc)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   269
        frame_type = 2;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   270
      } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   271
        frame_type = 4;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   272
        type_name = "stu";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   273
        StubCodeDesc* desc = StubCodeDesc::desc_for (current_pc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   274
        if (desc) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   275
          function_name = desc->name();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   276
        } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   277
          function_name = "unknown stub";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   278
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   279
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   280
    } else if (CodeCache::contains(current_pc)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   281
      blob = CodeCache::find_blob_unsafe(current_pc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   282
      if (blob) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   283
        if (blob->is_nmethod()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   284
          frame_type = 3;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   285
        } else if (blob->is_deoptimization_stub()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   286
          frame_type = 4;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   287
          type_name = "deo";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   288
          function_name = "deoptimization blob";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   289
        } else if (blob->is_uncommon_trap_stub()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   290
          frame_type = 4;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   291
          type_name = "uct";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   292
          function_name = "uncommon trap blob";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   293
        } else if (blob->is_exception_stub()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   294
          frame_type = 4;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   295
          type_name = "exc";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   296
          function_name = "exception blob";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   297
        } else if (blob->is_safepoint_stub()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   298
          frame_type = 4;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   299
          type_name = "saf";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   300
          function_name = "safepoint blob";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   301
        } else if (blob->is_runtime_stub()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   302
          frame_type = 4;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   303
          type_name = "run";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   304
          function_name = ((RuntimeStub *)blob)->name();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   305
        } else if (blob->is_method_handles_adapter_blob()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   306
          frame_type = 4;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   307
          type_name = "mha";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   308
          function_name = "method handles adapter blob";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   309
        } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   310
          frame_type = 4;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   311
          type_name = "blo";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   312
          function_name = "unknown code blob";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   313
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   314
      } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   315
        frame_type = 4;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   316
        type_name = "blo";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   317
        function_name = "unknown code blob";
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   318
      }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   319
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   320
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   321
    st->print("sp=" PTR_FORMAT " ", p2i(current_sp));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   322
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   323
    if (frame_type == 0) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   324
      current_pc = (address) *((intptr_t*)(((address) current_sp) + _z_abi(gpr14)));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   325
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   326
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   327
    st->print("pc=" PTR_FORMAT " ", p2i(current_pc));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   328
    st->print(" ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   329
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   330
    switch (frame_type) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   331
      case 0: // C frame:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   332
        {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   333
          st->print("    ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   334
          if (current_pc == 0) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   335
            st->print("? ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   336
          } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   337
             // name
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   338
            int func_offset;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   339
            char demangled_name[256];
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   340
            int demangled_name_len = 256;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   341
            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
   342
              demangled_name[demangled_name_len-1] = '\0';
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   343
              st->print(func_offset == -1 ? "%s " : "%s+0x%x", demangled_name, func_offset);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   344
            } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   345
              st->print("? ");
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
        break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   350
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   351
      case 1: // interpreter frame:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   352
        {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   353
          st->print(" i  ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   354
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   355
          if (last_frame_type != 1) last_num_jargs = 8;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   356
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   357
          // name
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   358
          Method* method = *(Method**)((address)current_fp + _z_ijava_state_neg(method));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   359
          if (method) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   360
            if (method->is_synchronized()) st->print("synchronized ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   361
            if (method->is_static()) st->print("static ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   362
            if (method->is_native()) st->print("native ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   363
            method->name_and_sig_as_C_string(buf, sizeof(buf));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   364
            st->print("%s ", buf);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   365
          }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   366
          else
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   367
            st->print("? ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   368
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   369
          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
   370
          if (print_istate_pointers) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   371
            st->cr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   372
            st->print("     ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   373
            st->print("ts=" PTR_FORMAT " ", p2i(tos));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   374
          }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   375
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   376
          // Dump some Java stack slots.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   377
          if (print_outgoing_arguments) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   378
            if (method->is_native()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   379
#ifdef ASSERT
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   380
              intptr_t* cargs = (intptr_t*) (((address)current_sp) + _z_abi(carg_1));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   381
              for (int i = 0; i < last_num_jargs; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   382
                // Cargs is not prepushed.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   383
                st->cr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   384
                st->print("        ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   385
                st->print(PTR_FORMAT, *(cargs));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   386
                cargs++;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   387
              }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   388
#endif /* ASSERT */
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   389
            }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   390
            else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   391
              if (tos) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   392
                for (int i = 0; i < last_num_jargs; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   393
                  // tos+0 is prepushed, ignore.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   394
                  tos++;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   395
                  if (tos >= (intptr_t *)((address)current_fp + _z_ijava_state_neg(monitors)))
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   396
                    break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   397
                  st->cr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   398
                  st->print("        ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   399
                  st->print(PTR_FORMAT " %+.3e %+.3le", *(tos), *(float*)(tos), *(double*)(tos));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   400
                }
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
            last_num_jargs = method->size_of_parameters();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   404
          }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   405
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   406
        break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   407
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   408
      case 2: // entry frame:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   409
        {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   410
          st->print("v2i ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   411
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   412
          // name
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   413
          st->print("call stub");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   414
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   415
        break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   416
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   417
      case 3: // compiled frame:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   418
        {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   419
          st->print(" c  ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   420
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   421
          // name
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   422
          Method* method = ((nmethod *)blob)->method();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   423
          if (method) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   424
            method->name_and_sig_as_C_string(buf, sizeof(buf));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   425
            st->print("%s ", buf);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   426
          }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   427
          else
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   428
            st->print("? ");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   429
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   430
        break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   431
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   432
      case 4: // named frames
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   433
        {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   434
          st->print("%s ", type_name);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   435
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   436
          // name
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   437
          if (function_name)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   438
            st->print("%s", function_name);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   439
        }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   440
        break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   441
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   442
      default:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   443
        break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   444
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   445
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   446
    st->cr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   447
    st->flush();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   448
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   449
    current_sp = current_fp;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   450
    last_frame_type = frame_type;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   451
    num++;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   452
    // Check for maximum # of frames, and stop when reached.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   453
    if (max_frames > 0 && --max_frames == 0)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   454
      break;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   455
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   456
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   457
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   458
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   459
// Convenience function for calls from the debugger.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   460
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   461
extern "C" void bt(intptr_t* start_sp,intptr_t* top_pc) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   462
  frame::back_trace(tty,start_sp, top_pc, 0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   463
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   464
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   465
extern "C" void bt_full(intptr_t* start_sp,intptr_t* top_pc) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   466
  frame::back_trace(tty,start_sp, top_pc, (unsigned long)(long)-1);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   467
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   468
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   469
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   470
// Function for tracing a limited number of frames.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   471
// Use this one if you only need to see the "top of stack" frames.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   472
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
   473
  frame::back_trace(tty, start_sp, top_pc, 0, max_frames);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   474
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   475
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   476
#if !defined(PRODUCT)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   477
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   478
#define DESCRIBE_ADDRESS(name) \
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   479
  values.describe(frame_no, (intptr_t*)&ijava_state()->name, #name);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   480
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   481
void frame::describe_pd(FrameValues& values, int frame_no) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   482
  if (is_interpreted_frame()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   483
    // Describe z_ijava_state elements.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   484
    DESCRIBE_ADDRESS(method);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   485
    DESCRIBE_ADDRESS(locals);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   486
    DESCRIBE_ADDRESS(monitors);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   487
    DESCRIBE_ADDRESS(cpoolCache);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   488
    DESCRIBE_ADDRESS(bcp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   489
    DESCRIBE_ADDRESS(mdx);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   490
    DESCRIBE_ADDRESS(esp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   491
    DESCRIBE_ADDRESS(sender_sp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   492
    DESCRIBE_ADDRESS(top_frame_sp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   493
    DESCRIBE_ADDRESS(oop_tmp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   494
    DESCRIBE_ADDRESS(lresult);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   495
    DESCRIBE_ADDRESS(fresult);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   496
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   497
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   498
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   499
#endif // !PRODUCT
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   500
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   501
intptr_t *frame::initial_deoptimization_info() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   502
  // Used to reset the saved FP.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   503
  return fp();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   504
}