hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.cpp
author iveresov
Fri, 04 Jun 2010 11:18:04 -0700
changeset 5707 6c66849ed24e
parent 5702 201c5cde25bb
child 6453 970dc585ab63
permissions -rw-r--r--
6958292: C1: Enable parallel compilation Summary: Enable parallel compilation in C1 Reviewed-by: never, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
5702
jrose
parents: 5547 5687
diff changeset
     2
 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3683
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3683
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3683
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
# include "incls/_precompiled.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
# include "incls/_c1_FrameMap_sparc.cpp.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
const int FrameMap::pd_c_runtime_reserved_arg_size = 7;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
LIR_Opr FrameMap::map_to_opr(BasicType type, VMRegPair* reg, bool outgoing) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
  LIR_Opr opr = LIR_OprFact::illegalOpr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
  VMReg r_1 = reg->first();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  VMReg r_2 = reg->second();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  if (r_1->is_stack()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
    // Convert stack slot to an SP offset
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
    // The calling convention does not count the SharedRuntime::out_preserve_stack_slots() value
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
    // so we must add it in here.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
    int st_off = (r_1->reg2stack() + SharedRuntime::out_preserve_stack_slots()) * VMRegImpl::stack_slot_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
    opr = LIR_OprFact::address(new LIR_Address(SP_opr, st_off + STACK_BIAS, type));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  } else if (r_1->is_Register()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
    Register reg = r_1->as_Register();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
    if (outgoing) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
      assert(!reg->is_in(), "should be using I regs");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
      assert(!reg->is_out(), "should be using O regs");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
    if (r_2->is_Register() && (type == T_LONG || type == T_DOUBLE)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
      opr = as_long_opr(reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
    } else if (type == T_OBJECT || type == T_ARRAY) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
      opr = as_oop_opr(reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
      opr = as_opr(reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  } else if (r_1->is_FloatRegister()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
    assert(type == T_DOUBLE || type == T_FLOAT, "wrong type");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
    FloatRegister f = r_1->as_FloatRegister();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
    if (type == T_DOUBLE) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
      opr = as_double_opr(f);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
      opr = as_float_opr(f);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  return opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
//               FrameMap
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
//--------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
FloatRegister FrameMap::_fpu_regs [FrameMap::nof_fpu_regs];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
// some useful constant RInfo's:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
LIR_Opr FrameMap::in_long_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
LIR_Opr FrameMap::out_long_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
LIR_Opr FrameMap::F0_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
LIR_Opr FrameMap::F0_double_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
LIR_Opr FrameMap::G0_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
LIR_Opr FrameMap::G1_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
LIR_Opr FrameMap::G2_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
LIR_Opr FrameMap::G3_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
LIR_Opr FrameMap::G4_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
LIR_Opr FrameMap::G5_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
LIR_Opr FrameMap::G6_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
LIR_Opr FrameMap::G7_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
LIR_Opr FrameMap::O0_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
LIR_Opr FrameMap::O1_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
LIR_Opr FrameMap::O2_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
LIR_Opr FrameMap::O3_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
LIR_Opr FrameMap::O4_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
LIR_Opr FrameMap::O5_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
LIR_Opr FrameMap::O6_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
LIR_Opr FrameMap::O7_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
LIR_Opr FrameMap::L0_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
LIR_Opr FrameMap::L1_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
LIR_Opr FrameMap::L2_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
LIR_Opr FrameMap::L3_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
LIR_Opr FrameMap::L4_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
LIR_Opr FrameMap::L5_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
LIR_Opr FrameMap::L6_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
LIR_Opr FrameMap::L7_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
LIR_Opr FrameMap::I0_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
LIR_Opr FrameMap::I1_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
LIR_Opr FrameMap::I2_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
LIR_Opr FrameMap::I3_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
LIR_Opr FrameMap::I4_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
LIR_Opr FrameMap::I5_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
LIR_Opr FrameMap::I6_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
LIR_Opr FrameMap::I7_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
LIR_Opr FrameMap::G0_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
LIR_Opr FrameMap::G1_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
LIR_Opr FrameMap::G2_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
LIR_Opr FrameMap::G3_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
LIR_Opr FrameMap::G4_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
LIR_Opr FrameMap::G5_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
LIR_Opr FrameMap::G6_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
LIR_Opr FrameMap::G7_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
LIR_Opr FrameMap::O0_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
LIR_Opr FrameMap::O1_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
LIR_Opr FrameMap::O2_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
LIR_Opr FrameMap::O3_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
LIR_Opr FrameMap::O4_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
LIR_Opr FrameMap::O5_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
LIR_Opr FrameMap::O6_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
LIR_Opr FrameMap::O7_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
LIR_Opr FrameMap::L0_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
LIR_Opr FrameMap::L1_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
LIR_Opr FrameMap::L2_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
LIR_Opr FrameMap::L3_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
LIR_Opr FrameMap::L4_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
LIR_Opr FrameMap::L5_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
LIR_Opr FrameMap::L6_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
LIR_Opr FrameMap::L7_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
LIR_Opr FrameMap::I0_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
LIR_Opr FrameMap::I1_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
LIR_Opr FrameMap::I2_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
LIR_Opr FrameMap::I3_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
LIR_Opr FrameMap::I4_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
LIR_Opr FrameMap::I5_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
LIR_Opr FrameMap::I6_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
LIR_Opr FrameMap::I7_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
LIR_Opr FrameMap::SP_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
LIR_Opr FrameMap::FP_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
LIR_Opr FrameMap::Oexception_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
LIR_Opr FrameMap::Oissuing_pc_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
LIR_Opr FrameMap::_caller_save_cpu_regs[] = { 0, };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
LIR_Opr FrameMap::_caller_save_fpu_regs[] = { 0, };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
FloatRegister FrameMap::nr2floatreg (int rnr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  assert(_init_done, "tables not initialized");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  debug_only(fpu_range_check(rnr);)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  return _fpu_regs[rnr];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
// returns true if reg could be smashed by a callee.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
bool FrameMap::is_caller_save_register (LIR_Opr reg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  if (reg->is_single_fpu() || reg->is_double_fpu()) { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  if (reg->is_double_cpu()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
    return is_caller_save_register(reg->as_register_lo()) ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
           is_caller_save_register(reg->as_register_hi());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  return is_caller_save_register(reg->as_register());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
NEEDS_CLEANUP   // once the new calling convention is enabled, we no
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
                // longer need to treat I5, I4 and L0 specially
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
// Because the interpreter destroys caller's I5, I4 and L0,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
// we must spill them before doing a Java call as we may land in
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
// interpreter.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
bool FrameMap::is_caller_save_register (Register r) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  return (r->is_global() && (r != G0)) || r->is_out();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
5707
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5702
diff changeset
   184
void FrameMap::initialize() {
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5702
diff changeset
   185
  assert(!_init_done, "once");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  int i=0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  // Register usage:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  //  O6: sp
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  //  I6: fp
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  //  I7: return address
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  //  G0: zero
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  //  G2: thread
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  //  G7: not available
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  //  G6: not available
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  /*  0 */ map_register(i++, L0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  /*  1 */ map_register(i++, L1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  /*  2 */ map_register(i++, L2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  /*  3 */ map_register(i++, L3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  /*  4 */ map_register(i++, L4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  /*  5 */ map_register(i++, L5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  /*  6 */ map_register(i++, L6);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  /*  7 */ map_register(i++, L7);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  /*  8 */ map_register(i++, I0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  /*  9 */ map_register(i++, I1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  /* 10 */ map_register(i++, I2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  /* 11 */ map_register(i++, I3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  /* 12 */ map_register(i++, I4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  /* 13 */ map_register(i++, I5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  /* 14 */ map_register(i++, O0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  /* 15 */ map_register(i++, O1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  /* 16 */ map_register(i++, O2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  /* 17 */ map_register(i++, O3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  /* 18 */ map_register(i++, O4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  /* 19 */ map_register(i++, O5); // <- last register visible in RegAlloc (RegAlloc::nof+cpu_regs)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  /* 20 */ map_register(i++, G1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  /* 21 */ map_register(i++, G3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  /* 22 */ map_register(i++, G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  /* 23 */ map_register(i++, G5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  /* 24 */ map_register(i++, G0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  // the following registers are not normally available
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  /* 25 */ map_register(i++, O7);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  /* 26 */ map_register(i++, G2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  /* 27 */ map_register(i++, O6);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  /* 28 */ map_register(i++, I6);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  /* 29 */ map_register(i++, I7);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  /* 30 */ map_register(i++, G6);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  /* 31 */ map_register(i++, G7);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  assert(i == nof_cpu_regs, "number of CPU registers");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  for (i = 0; i < nof_fpu_regs; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
    _fpu_regs[i] = as_FloatRegister(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  _init_done = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  in_long_opr    = as_long_opr(I0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  out_long_opr   = as_long_opr(O0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  G0_opr = as_opr(G0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  G1_opr = as_opr(G1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  G2_opr = as_opr(G2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  G3_opr = as_opr(G3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  G4_opr = as_opr(G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  G5_opr = as_opr(G5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
  G6_opr = as_opr(G6);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  G7_opr = as_opr(G7);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  O0_opr = as_opr(O0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  O1_opr = as_opr(O1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
  O2_opr = as_opr(O2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  O3_opr = as_opr(O3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  O4_opr = as_opr(O4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  O5_opr = as_opr(O5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  O6_opr = as_opr(O6);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  O7_opr = as_opr(O7);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
  L0_opr = as_opr(L0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
  L1_opr = as_opr(L1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  L2_opr = as_opr(L2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
  L3_opr = as_opr(L3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  L4_opr = as_opr(L4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  L5_opr = as_opr(L5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
  L6_opr = as_opr(L6);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
  L7_opr = as_opr(L7);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  I0_opr = as_opr(I0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  I1_opr = as_opr(I1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
  I2_opr = as_opr(I2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
  I3_opr = as_opr(I3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  I4_opr = as_opr(I4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  I5_opr = as_opr(I5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  I6_opr = as_opr(I6);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
  I7_opr = as_opr(I7);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
  G0_oop_opr = as_oop_opr(G0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
  G1_oop_opr = as_oop_opr(G1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
  G2_oop_opr = as_oop_opr(G2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
  G3_oop_opr = as_oop_opr(G3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
  G4_oop_opr = as_oop_opr(G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
  G5_oop_opr = as_oop_opr(G5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
  G6_oop_opr = as_oop_opr(G6);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
  G7_oop_opr = as_oop_opr(G7);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
  O0_oop_opr = as_oop_opr(O0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
  O1_oop_opr = as_oop_opr(O1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
  O2_oop_opr = as_oop_opr(O2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
  O3_oop_opr = as_oop_opr(O3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  O4_oop_opr = as_oop_opr(O4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  O5_oop_opr = as_oop_opr(O5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
  O6_oop_opr = as_oop_opr(O6);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
  O7_oop_opr = as_oop_opr(O7);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  L0_oop_opr = as_oop_opr(L0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
  L1_oop_opr = as_oop_opr(L1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
  L2_oop_opr = as_oop_opr(L2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
  L3_oop_opr = as_oop_opr(L3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
  L4_oop_opr = as_oop_opr(L4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
  L5_oop_opr = as_oop_opr(L5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
  L6_oop_opr = as_oop_opr(L6);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
  L7_oop_opr = as_oop_opr(L7);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
  I0_oop_opr = as_oop_opr(I0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
  I1_oop_opr = as_oop_opr(I1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
  I2_oop_opr = as_oop_opr(I2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
  I3_oop_opr = as_oop_opr(I3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
  I4_oop_opr = as_oop_opr(I4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
  I5_oop_opr = as_oop_opr(I5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
  I6_oop_opr = as_oop_opr(I6);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
  I7_oop_opr = as_oop_opr(I7);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
  FP_opr = as_pointer_opr(FP);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
  SP_opr = as_pointer_opr(SP);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
  F0_opr = as_float_opr(F0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
  F0_double_opr = as_double_opr(F0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
  Oexception_opr = as_oop_opr(Oexception);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
  Oissuing_pc_opr = as_opr(Oissuing_pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
  _caller_save_cpu_regs[0] = FrameMap::O0_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
  _caller_save_cpu_regs[1] = FrameMap::O1_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
  _caller_save_cpu_regs[2] = FrameMap::O2_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
  _caller_save_cpu_regs[3] = FrameMap::O3_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
  _caller_save_cpu_regs[4] = FrameMap::O4_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
  _caller_save_cpu_regs[5] = FrameMap::O5_opr;
3683
bbf665be687c 6795465: Crash in assembler_sparc.cpp with client compiler on solaris-sparc
never
parents: 2571
diff changeset
   323
  _caller_save_cpu_regs[6] = FrameMap::G1_opr;
bbf665be687c 6795465: Crash in assembler_sparc.cpp with client compiler on solaris-sparc
never
parents: 2571
diff changeset
   324
  _caller_save_cpu_regs[7] = FrameMap::G3_opr;
bbf665be687c 6795465: Crash in assembler_sparc.cpp with client compiler on solaris-sparc
never
parents: 2571
diff changeset
   325
  _caller_save_cpu_regs[8] = FrameMap::G4_opr;
bbf665be687c 6795465: Crash in assembler_sparc.cpp with client compiler on solaris-sparc
never
parents: 2571
diff changeset
   326
  _caller_save_cpu_regs[9] = FrameMap::G5_opr;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
  for (int i = 0; i < nof_caller_save_fpu_regs; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
    _caller_save_fpu_regs[i] = LIR_OprFact::single_fpu(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
Address FrameMap::make_new_address(ByteSize sp_offset) const {
2571
d602ad6538bd 6822110: Add AddressLiteral class on SPARC
twisti
parents: 1
diff changeset
   334
  return Address(SP, STACK_BIAS + in_bytes(sp_offset));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
VMReg FrameMap::fpu_regname (int n) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
  return as_FloatRegister(n)->as_VMReg();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
LIR_Opr FrameMap::stack_pointer() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
  return SP_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
5687
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 3683
diff changeset
   348
// JSR 292
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 3683
diff changeset
   349
LIR_Opr FrameMap::method_handle_invoke_SP_save_opr() {
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 3683
diff changeset
   350
  assert(L7 == L7_mh_SP_save, "must be same register");
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 3683
diff changeset
   351
  return L7_opr;
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 3683
diff changeset
   352
}
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 3683
diff changeset
   353
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 3683
diff changeset
   354
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
bool FrameMap::validate_frame() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
  int max_offset = in_bytes(framesize_in_bytes());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
  int java_index = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
  for (int i = 0; i < _incoming_arguments->length(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
    LIR_Opr opr = _incoming_arguments->at(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
    if (opr->is_stack()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
      max_offset = MAX2(_argument_locations->at(java_index), max_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
    java_index += type2size[opr->type()];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
  return Assembler::is_simm13(max_offset + STACK_BIAS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
}