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