hotspot/src/cpu/s390/vm/frame_s390.inline.hpp
author stefank
Thu, 13 Apr 2017 09:57:51 +0200
changeset 46620 750c6edff33b
parent 42556 c03d98321ad1
child 46625 edefffab74e2
permissions -rw-r--r--
8178500: Replace usages of round_to and round_down with align_up and align_down Reviewed-by: rehn, tschatzl
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
#ifndef CPU_S390_VM_FRAME_S390_INLINE_HPP
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    27
#define CPU_S390_VM_FRAME_S390_INLINE_HPP
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    28
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    29
#include "code/codeCache.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    30
#include "code/vmreg.inline.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    31
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    32
// Inline functions for z/Architecture frames:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    33
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    34
inline void frame::find_codeblob_and_set_pc_and_deopt_state(address pc) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    35
  assert(pc != NULL, "precondition: must have PC");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    36
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    37
  _cb = CodeCache::find_blob(pc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    38
  _pc = pc;   // Must be set for get_deopt_original_pc().
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    39
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    40
  _fp = (intptr_t *) own_abi()->callers_sp;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    41
42556
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
    42
  address original_pc = CompiledMethod::get_deopt_original_pc(this);
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    43
  if (original_pc != NULL) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    44
    _pc = original_pc;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    45
    _deopt_state = is_deoptimized;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    46
  } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    47
    _deopt_state = not_deoptimized;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    48
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    49
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    50
  assert(((uint64_t)_sp & 0x7) == 0, "SP must be 8-byte aligned");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    51
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    52
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    53
// Constructors
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    54
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    55
// Initialize all fields, _unextended_sp will be adjusted in find_codeblob_and_set_pc_and_deopt_state.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    56
inline frame::frame() : _sp(NULL), _unextended_sp(NULL), _fp(NULL), _cb(NULL), _pc(NULL), _deopt_state(unknown) {}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    57
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    58
inline frame::frame(intptr_t* sp) : _sp(sp), _unextended_sp(sp) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    59
  find_codeblob_and_set_pc_and_deopt_state((address)own_abi()->return_pc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    60
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    61
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    62
inline frame::frame(intptr_t* sp, address pc) : _sp(sp), _unextended_sp(sp) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    63
  find_codeblob_and_set_pc_and_deopt_state(pc); // Also sets _fp and adjusts _unextended_sp.
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
inline frame::frame(intptr_t* sp, address pc, intptr_t* unextended_sp) : _sp(sp), _unextended_sp(unextended_sp) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    67
  find_codeblob_and_set_pc_and_deopt_state(pc); // Also sets _fp and adjusts _unextended_sp.
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
// Generic constructor. Used by pns() in debug.cpp only
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    71
#ifndef PRODUCT
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    72
inline frame::frame(void* sp, void* pc, void* unextended_sp) :
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    73
  _sp((intptr_t*)sp), _unextended_sp((intptr_t*)unextended_sp), _cb(NULL), _pc(NULL) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    74
  find_codeblob_and_set_pc_and_deopt_state((address)pc); // Also sets _fp and adjusts _unextended_sp.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    75
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    76
#endif
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    77
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    78
// template interpreter state
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    79
inline frame::z_ijava_state* frame::ijava_state() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    80
  z_ijava_state* state = (z_ijava_state*) ((uintptr_t)fp() - z_ijava_state_size);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    81
  assert(state->magic == (intptr_t) frame::z_istate_magic_number,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    82
         "wrong z_ijava_state in interpreter frame (no magic found)");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    83
  return state;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    84
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    85
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    86
inline BasicObjectLock** frame::interpreter_frame_monitors_addr() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    87
  return (BasicObjectLock**) &(ijava_state()->monitors);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    88
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    89
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    90
// The next two funcions read and write z_ijava_state.monitors.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    91
inline BasicObjectLock* frame::interpreter_frame_monitors() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    92
  return *interpreter_frame_monitors_addr();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    93
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    94
inline void frame::interpreter_frame_set_monitors(BasicObjectLock* monitors) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    95
  *interpreter_frame_monitors_addr() = monitors;
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
// Accessors
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    99
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   100
// Return unique id for this frame. The id must have a value where we
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   101
// can distinguish identity and younger/older relationship. NULL
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   102
// represents an invalid (incomparable) frame.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   103
inline intptr_t* frame::id(void) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   104
  // Use _fp. _sp or _unextended_sp wouldn't be correct due to resizing.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   105
  return _fp;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   106
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   107
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   108
// Return true if this frame is younger (more recent activation) than
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   109
// the frame represented by id.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   110
inline bool frame::is_younger(intptr_t* id) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   111
  assert(this->id() != NULL && id != NULL, "NULL frame id");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   112
  // Stack grows towards smaller addresses on z/Architecture.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   113
  return this->id() < id;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   114
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   115
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   116
// Return true if this frame is older (less recent activation) than
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   117
// the frame represented by id.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   118
inline bool frame::is_older(intptr_t* id) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   119
  assert(this->id() != NULL && id != NULL, "NULL frame id");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   120
  // Stack grows towards smaller addresses on z/Architecture.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   121
  return this->id() > id;
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
inline int frame::frame_size(RegisterMap* map) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   125
  // Stack grows towards smaller addresses on z/Linux: sender is at a higher address.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   126
  return sender_sp() - sp();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   127
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   128
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   129
// Ignore c2i adapter frames.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   130
inline intptr_t* frame::unextended_sp() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   131
  return _unextended_sp;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   132
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   133
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   134
inline address frame::sender_pc() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   135
  return (address) callers_abi()->return_pc;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   136
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   137
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   138
// Get caller pc, if caller is native from stack slot of gpr14.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   139
inline address frame::native_sender_pc() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   140
  return (address) callers_abi()->gpr14;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   141
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   142
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   143
// Get caller pc from stack slot of gpr10.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   144
inline address frame::callstub_sender_pc() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   145
  return (address) callers_abi()->gpr10;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   146
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   147
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   148
inline address* frame::sender_pc_addr() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   149
  return (address*) &(callers_abi()->return_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
inline intptr_t* frame::sender_sp() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   153
  return (intptr_t*) callers_abi();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   154
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   155
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   156
inline intptr_t* frame::link() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   157
  return (intptr_t*) callers_abi()->callers_sp;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   158
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   159
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   160
inline intptr_t** frame::interpreter_frame_locals_addr() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   161
  return (intptr_t**) &(ijava_state()->locals);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   162
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   163
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   164
inline intptr_t* frame::interpreter_frame_bcp_addr() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   165
  return (intptr_t*) &(ijava_state()->bcp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   166
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   167
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   168
inline intptr_t* frame::interpreter_frame_mdp_addr() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   169
  return (intptr_t*) &(ijava_state()->mdx);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   170
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   171
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   172
// Bottom(base) of the expression stack (highest address).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   173
inline intptr_t* frame::interpreter_frame_expression_stack() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   174
  return (intptr_t*)interpreter_frame_monitor_end() - 1;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   175
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   176
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   177
inline jint frame::interpreter_frame_expression_stack_direction() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   178
  return -1;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   179
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   180
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   181
inline intptr_t* frame::interpreter_frame_tos_at(jint offset) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   182
  return &interpreter_frame_tos_address()[offset];
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   183
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   184
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   185
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   186
// monitor elements
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   187
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   188
// End is lower in memory than begin, and beginning element is oldest element.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   189
// Also begin is one past last monitor.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   190
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   191
inline intptr_t* frame::interpreter_frame_top_frame_sp() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   192
  return (intptr_t*)ijava_state()->top_frame_sp;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   193
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   194
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   195
inline void frame::interpreter_frame_set_top_frame_sp(intptr_t* top_frame_sp) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   196
  ijava_state()->top_frame_sp = (intptr_t) top_frame_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
inline void frame::interpreter_frame_set_sender_sp(intptr_t* sender_sp) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   200
  ijava_state()->sender_sp = (intptr_t) sender_sp;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   201
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   202
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   203
#ifdef ASSERT
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   204
inline void frame::interpreter_frame_set_magic() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   205
  ijava_state()->magic = (intptr_t) frame::z_istate_magic_number;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   206
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   207
#endif
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   208
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   209
// Where z_ijava_state.esp is saved.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   210
inline intptr_t** frame::interpreter_frame_esp_addr() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   211
  return (intptr_t**) &(ijava_state()->esp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   212
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   213
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   214
// top of expression stack (lowest address)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   215
inline intptr_t* frame::interpreter_frame_tos_address() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   216
  return *interpreter_frame_esp_addr() + 1;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   217
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   218
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   219
inline void frame::interpreter_frame_set_tos_address(intptr_t* x) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   220
  *interpreter_frame_esp_addr() = x - 1;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   221
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   222
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   223
// Stack slot needed for native calls and GC.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   224
inline oop * frame::interpreter_frame_temp_oop_addr() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   225
  return (oop *) ((address) _fp + _z_ijava_state_neg(oop_tmp));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   226
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   227
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   228
// In keeping with Intel side: end is lower in memory than begin.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   229
// Beginning element is oldest element. Also begin is one past last monitor.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   230
inline BasicObjectLock * frame::interpreter_frame_monitor_begin() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   231
  return (BasicObjectLock*)ijava_state();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   232
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   233
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   234
inline BasicObjectLock * frame::interpreter_frame_monitor_end() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   235
  return interpreter_frame_monitors();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   236
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   237
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   238
inline void frame::interpreter_frame_set_monitor_end(BasicObjectLock* monitors) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   239
  interpreter_frame_set_monitors((BasicObjectLock *)monitors);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   240
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   241
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   242
inline int frame::interpreter_frame_monitor_size() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   243
  // Number of stack slots for a monitor
46620
750c6edff33b 8178500: Replace usages of round_to and round_down with align_up and align_down
stefank
parents: 42556
diff changeset
   244
  return align_up(BasicObjectLock::size() /* number of stack slots */,
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   245
                  WordsPerLong /* Number of stack slots for a Java long. */);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   246
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   247
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   248
inline int frame::interpreter_frame_monitor_size_in_bytes() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   249
  // Number of bytes for a monitor.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   250
  return frame::interpreter_frame_monitor_size() * wordSize;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   251
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   252
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   253
inline int frame::interpreter_frame_interpreterstate_size_in_bytes() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   254
  return z_ijava_state_size;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   255
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   256
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   257
inline Method** frame::interpreter_frame_method_addr() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   258
  return (Method**)&(ijava_state()->method);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   259
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   260
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   261
inline oop* frame::interpreter_frame_mirror_addr() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   262
  return (oop*)&(ijava_state()->mirror);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   263
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   264
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   265
// Constant pool cache
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   266
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   267
inline ConstantPoolCache** frame::interpreter_frame_cache_addr() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   268
  return (ConstantPoolCache**)&(ijava_state()->cpoolCache);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   269
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   270
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   271
// entry frames
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   272
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   273
inline intptr_t* frame::entry_frame_argument_at(int offset) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   274
  // Since an entry frame always calls the interpreter first,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   275
  // the parameters are on the stack and relative to known register in the
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   276
  // entry frame.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   277
  intptr_t* tos = (intptr_t*) entry_frame_locals()->arguments_tos_address;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   278
  return &tos[offset + 1]; // prepushed tos
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   279
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   280
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   281
inline JavaCallWrapper** frame::entry_frame_call_wrapper_addr() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   282
  return (JavaCallWrapper**) &entry_frame_locals()->call_wrapper_address;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   283
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   284
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   285
inline oop frame::saved_oop_result(RegisterMap* map) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   286
  return *((oop*) map->location(Z_R2->as_VMReg()));  // R2 is return register.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   287
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   288
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   289
inline void frame::set_saved_oop_result(RegisterMap* map, oop obj) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   290
  *((oop*) map->location(Z_R2->as_VMReg())) = obj;  // R2 is return register.
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
inline intptr_t* frame::real_fp() const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   294
  return fp();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   295
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   296
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   297
#endif // CPU_S390_VM_FRAME_S390_INLINE_HPP