hotspot/src/cpu/s390/vm/c1_FrameMap_s390.cpp
author kvn
Fri, 12 May 2017 13:14:25 -0700
changeset 46458 3c12af929e7d
parent 42065 6032b31e3719
permissions -rw-r--r--
Merge
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 "c1/c1_FrameMap.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    28
#include "c1/c1_LIR.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    29
#include "runtime/sharedRuntime.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    30
#include "vmreg_s390.inline.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    31
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    32
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    33
const int FrameMap::pd_c_runtime_reserved_arg_size = 7;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    34
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    35
LIR_Opr FrameMap::map_to_opr(BasicType type, VMRegPair* reg, bool outgoing) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    36
  LIR_Opr opr = LIR_OprFact::illegalOpr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    37
  VMReg r_1 = reg->first();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    38
  VMReg r_2 = reg->second();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    39
  if (r_1->is_stack()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    40
    // Convert stack slot to an SP offset.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    41
    // The calling convention does not count the SharedRuntime::out_preserve_stack_slots() value
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    42
    // so we must add it in here.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    43
    int st_off = (r_1->reg2stack() + SharedRuntime::out_preserve_stack_slots()) * VMRegImpl::stack_slot_size;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    44
    opr = LIR_OprFact::address(new LIR_Address(Z_SP_opr, st_off, type));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    45
  } else if (r_1->is_Register()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    46
    Register reg = r_1->as_Register();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    47
    if (r_2->is_Register() && (type == T_LONG || type == T_DOUBLE)) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    48
      opr = as_long_opr(reg);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    49
    } else if (type == T_OBJECT || type == T_ARRAY) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    50
      opr = as_oop_opr(reg);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    51
    } else if (type == T_METADATA) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    52
      opr = as_metadata_opr(reg);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    53
    } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    54
      opr = as_opr(reg);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    55
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    56
  } else if (r_1->is_FloatRegister()) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    57
    assert(type == T_DOUBLE || type == T_FLOAT, "wrong type");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    58
    FloatRegister f = r_1->as_FloatRegister();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    59
    if (type == T_FLOAT) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    60
      opr = as_float_opr(f);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    61
    } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    62
      opr = as_double_opr(f);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    63
    }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    64
  } else {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    65
    ShouldNotReachHere();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    66
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    67
  return opr;
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
//               FrameMap
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    71
//--------------------------------------------------------
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    72
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    73
FloatRegister FrameMap::_fpu_rnr2reg [FrameMap::nof_fpu_regs]; // mapping c1 regnr. -> FloatRegister
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    74
int           FrameMap::_fpu_reg2rnr [FrameMap::nof_fpu_regs]; // mapping assembler encoding -> c1 regnr.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    75
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    76
// Some useful constant RInfo's:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    77
LIR_Opr FrameMap::Z_R0_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    78
LIR_Opr FrameMap::Z_R1_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    79
LIR_Opr FrameMap::Z_R2_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    80
LIR_Opr FrameMap::Z_R3_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    81
LIR_Opr FrameMap::Z_R4_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    82
LIR_Opr FrameMap::Z_R5_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    83
LIR_Opr FrameMap::Z_R6_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    84
LIR_Opr FrameMap::Z_R7_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    85
LIR_Opr FrameMap::Z_R8_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    86
LIR_Opr FrameMap::Z_R9_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    87
LIR_Opr FrameMap::Z_R10_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    88
LIR_Opr FrameMap::Z_R11_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    89
LIR_Opr FrameMap::Z_R12_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    90
LIR_Opr FrameMap::Z_R13_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    91
LIR_Opr FrameMap::Z_R14_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    92
LIR_Opr FrameMap::Z_R15_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    93
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    94
LIR_Opr FrameMap::Z_R0_oop_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    95
LIR_Opr FrameMap::Z_R1_oop_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    96
LIR_Opr FrameMap::Z_R2_oop_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    97
LIR_Opr FrameMap::Z_R3_oop_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    98
LIR_Opr FrameMap::Z_R4_oop_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    99
LIR_Opr FrameMap::Z_R5_oop_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   100
LIR_Opr FrameMap::Z_R6_oop_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   101
LIR_Opr FrameMap::Z_R7_oop_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   102
LIR_Opr FrameMap::Z_R8_oop_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   103
LIR_Opr FrameMap::Z_R9_oop_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   104
LIR_Opr FrameMap::Z_R10_oop_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   105
LIR_Opr FrameMap::Z_R11_oop_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   106
LIR_Opr FrameMap::Z_R12_oop_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   107
LIR_Opr FrameMap::Z_R13_oop_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   108
LIR_Opr FrameMap::Z_R14_oop_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   109
LIR_Opr FrameMap::Z_R15_oop_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   110
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   111
LIR_Opr FrameMap::Z_R0_metadata_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   112
LIR_Opr FrameMap::Z_R1_metadata_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   113
LIR_Opr FrameMap::Z_R2_metadata_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   114
LIR_Opr FrameMap::Z_R3_metadata_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   115
LIR_Opr FrameMap::Z_R4_metadata_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   116
LIR_Opr FrameMap::Z_R5_metadata_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   117
LIR_Opr FrameMap::Z_R6_metadata_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   118
LIR_Opr FrameMap::Z_R7_metadata_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   119
LIR_Opr FrameMap::Z_R8_metadata_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   120
LIR_Opr FrameMap::Z_R9_metadata_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   121
LIR_Opr FrameMap::Z_R10_metadata_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   122
LIR_Opr FrameMap::Z_R11_metadata_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   123
LIR_Opr FrameMap::Z_R12_metadata_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   124
LIR_Opr FrameMap::Z_R13_metadata_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   125
LIR_Opr FrameMap::Z_R14_metadata_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   126
LIR_Opr FrameMap::Z_R15_metadata_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   127
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   128
LIR_Opr FrameMap::Z_SP_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   129
LIR_Opr FrameMap::Z_FP_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   130
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   131
LIR_Opr FrameMap::Z_R2_long_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   132
LIR_Opr FrameMap::Z_R10_long_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   133
LIR_Opr FrameMap::Z_R11_long_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   134
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   135
LIR_Opr FrameMap::Z_F0_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   136
LIR_Opr FrameMap::Z_F0_double_opr;
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
LIR_Opr FrameMap::_caller_save_cpu_regs[] = { 0, };
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   140
LIR_Opr FrameMap::_caller_save_fpu_regs[] = { 0, };
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
// c1 rnr -> FloatRegister
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   144
FloatRegister FrameMap::nr2floatreg (int rnr) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   145
  assert(_init_done, "tables not initialized");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   146
  debug_only(fpu_range_check(rnr);)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   147
  return _fpu_rnr2reg[rnr];
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   148
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   149
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   150
void FrameMap::map_float_register(int rnr, FloatRegister reg) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   151
  debug_only(fpu_range_check(rnr);)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   152
  debug_only(fpu_range_check(reg->encoding());)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   153
  _fpu_rnr2reg[rnr] = reg;              // mapping c1 regnr. -> FloatRegister
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   154
  _fpu_reg2rnr[reg->encoding()] = rnr;  // mapping assembler encoding -> c1 regnr.
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
void FrameMap::initialize() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   158
  assert(!_init_done, "once");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   159
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   160
  DEBUG_ONLY(int allocated   = 0;)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   161
  DEBUG_ONLY(int unallocated = 0;)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   162
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   163
  // Register usage:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   164
  // Z_thread (Z_R8)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   165
  // Z_fp     (Z_R9)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   166
  // Z_SP     (Z_R15)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   167
  DEBUG_ONLY(allocated++); map_register(0, Z_R2);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   168
  DEBUG_ONLY(allocated++); map_register(1, Z_R3);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   169
  DEBUG_ONLY(allocated++); map_register(2, Z_R4);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   170
  DEBUG_ONLY(allocated++); map_register(3, Z_R5);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   171
  DEBUG_ONLY(allocated++); map_register(4, Z_R6);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   172
  DEBUG_ONLY(allocated++); map_register(5, Z_R7);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   173
  DEBUG_ONLY(allocated++); map_register(6, Z_R10);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   174
  DEBUG_ONLY(allocated++); map_register(7, Z_R11);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   175
  DEBUG_ONLY(allocated++); map_register(8, Z_R12);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   176
  DEBUG_ONLY(allocated++); map_register(9, Z_R13);     // <- last register visible in RegAlloc
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   177
  DEBUG_ONLY(unallocated++); map_register(11, Z_R0);   // Z_R0_scratch
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   178
  DEBUG_ONLY(unallocated++); map_register(12, Z_R1);   // Z_R1_scratch
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   179
  DEBUG_ONLY(unallocated++); map_register(10, Z_R14);  // return pc; TODO: Try to let c1/c2 allocate R14.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   180
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   181
  // The following registers are usually unavailable.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   182
  DEBUG_ONLY(unallocated++); map_register(13, Z_R8);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   183
  DEBUG_ONLY(unallocated++); map_register(14, Z_R9);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   184
  DEBUG_ONLY(unallocated++); map_register(15, Z_R15);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   185
  assert(allocated-1 == pd_last_cpu_reg, "wrong number/mapping of allocated CPU registers");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   186
  assert(unallocated == pd_nof_cpu_regs_unallocated, "wrong number of unallocated CPU registers");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   187
  assert(nof_cpu_regs == allocated+unallocated, "wrong number of CPU registers");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   188
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   189
  int j = 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   190
  for (int i = 0; i < nof_fpu_regs; i++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   191
    if (as_FloatRegister(i) == Z_fscratch_1) continue; // unallocated
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   192
    map_float_register(j++, as_FloatRegister(i));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   193
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   194
  assert(j == nof_fpu_regs-1, "missed one fpu reg?");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   195
  map_float_register(j++, Z_fscratch_1);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   196
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   197
  _init_done = true;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   198
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   199
  Z_R0_opr = as_opr(Z_R0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   200
  Z_R1_opr = as_opr(Z_R1);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   201
  Z_R2_opr = as_opr(Z_R2);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   202
  Z_R3_opr = as_opr(Z_R3);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   203
  Z_R4_opr = as_opr(Z_R4);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   204
  Z_R5_opr = as_opr(Z_R5);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   205
  Z_R6_opr = as_opr(Z_R6);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   206
  Z_R7_opr = as_opr(Z_R7);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   207
  Z_R8_opr = as_opr(Z_R8);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   208
  Z_R9_opr = as_opr(Z_R9);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   209
  Z_R10_opr = as_opr(Z_R10);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   210
  Z_R11_opr = as_opr(Z_R11);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   211
  Z_R12_opr = as_opr(Z_R12);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   212
  Z_R13_opr = as_opr(Z_R13);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   213
  Z_R14_opr = as_opr(Z_R14);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   214
  Z_R15_opr = as_opr(Z_R15);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   215
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   216
  Z_R0_oop_opr = as_oop_opr(Z_R0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   217
  Z_R1_oop_opr = as_oop_opr(Z_R1);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   218
  Z_R2_oop_opr = as_oop_opr(Z_R2);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   219
  Z_R3_oop_opr = as_oop_opr(Z_R3);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   220
  Z_R4_oop_opr = as_oop_opr(Z_R4);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   221
  Z_R5_oop_opr = as_oop_opr(Z_R5);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   222
  Z_R6_oop_opr = as_oop_opr(Z_R6);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   223
  Z_R7_oop_opr = as_oop_opr(Z_R7);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   224
  Z_R8_oop_opr = as_oop_opr(Z_R8);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   225
  Z_R9_oop_opr = as_oop_opr(Z_R9);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   226
  Z_R10_oop_opr = as_oop_opr(Z_R10);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   227
  Z_R11_oop_opr = as_oop_opr(Z_R11);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   228
  Z_R12_oop_opr = as_oop_opr(Z_R12);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   229
  Z_R13_oop_opr = as_oop_opr(Z_R13);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   230
  Z_R14_oop_opr = as_oop_opr(Z_R14);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   231
  Z_R15_oop_opr = as_oop_opr(Z_R15);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   232
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   233
  Z_R0_metadata_opr = as_metadata_opr(Z_R0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   234
  Z_R1_metadata_opr = as_metadata_opr(Z_R1);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   235
  Z_R2_metadata_opr = as_metadata_opr(Z_R2);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   236
  Z_R3_metadata_opr = as_metadata_opr(Z_R3);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   237
  Z_R4_metadata_opr = as_metadata_opr(Z_R4);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   238
  Z_R5_metadata_opr = as_metadata_opr(Z_R5);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   239
  Z_R6_metadata_opr = as_metadata_opr(Z_R6);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   240
  Z_R7_metadata_opr = as_metadata_opr(Z_R7);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   241
  Z_R8_metadata_opr = as_metadata_opr(Z_R8);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   242
  Z_R9_metadata_opr = as_metadata_opr(Z_R9);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   243
  Z_R10_metadata_opr = as_metadata_opr(Z_R10);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   244
  Z_R11_metadata_opr = as_metadata_opr(Z_R11);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   245
  Z_R12_metadata_opr = as_metadata_opr(Z_R12);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   246
  Z_R13_metadata_opr = as_metadata_opr(Z_R13);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   247
  Z_R14_metadata_opr = as_metadata_opr(Z_R14);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   248
  Z_R15_metadata_opr = as_metadata_opr(Z_R15);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   249
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   250
  // TODO: needed? Or can we make Z_R9 available for linear scan allocation.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   251
  Z_FP_opr = as_pointer_opr(Z_fp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   252
  Z_SP_opr = as_pointer_opr(Z_SP);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   253
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   254
  Z_R2_long_opr = LIR_OprFact::double_cpu(cpu_reg2rnr(Z_R2), cpu_reg2rnr(Z_R2));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   255
  Z_R10_long_opr = LIR_OprFact::double_cpu(cpu_reg2rnr(Z_R10), cpu_reg2rnr(Z_R10));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   256
  Z_R11_long_opr = LIR_OprFact::double_cpu(cpu_reg2rnr(Z_R11), cpu_reg2rnr(Z_R11));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   257
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   258
  Z_F0_opr = as_float_opr(Z_F0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   259
  Z_F0_double_opr = as_double_opr(Z_F0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   260
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   261
  // All allocated cpu regs are caller saved.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   262
  for (int c1rnr = 0; c1rnr < max_nof_caller_save_cpu_regs; c1rnr++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   263
    _caller_save_cpu_regs[c1rnr] = as_opr(cpu_rnr2reg(c1rnr));
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
  // All allocated fpu regs are caller saved.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   267
  for (int c1rnr = 0; c1rnr < nof_caller_save_fpu_regs; c1rnr++) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   268
    _caller_save_fpu_regs[c1rnr] = as_float_opr(nr2floatreg(c1rnr));
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
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   272
Address FrameMap::make_new_address(ByteSize sp_offset) const {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   273
  return Address(Z_SP, sp_offset);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   274
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   275
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   276
VMReg FrameMap::fpu_regname (int n) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   277
  return nr2floatreg(n)->as_VMReg();
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
LIR_Opr FrameMap::stack_pointer() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   281
  return Z_SP_opr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   282
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   283
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   284
// JSR 292
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   285
// On ZARCH_64, there is no need to save the SP, because neither
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   286
// method handle intrinsics nor compiled lambda forms modify it.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   287
LIR_Opr FrameMap::method_handle_invoke_SP_save_opr() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   288
  return LIR_OprFact::illegalOpr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   289
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   290
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   291
bool FrameMap::validate_frame() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   292
  return true;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   293
}