hotspot/src/cpu/x86/vm/c1_FrameMap_x86.cpp
author duke
Wed, 05 Jul 2017 20:10:48 +0200
changeset 27963 88d7c7c376e9
parent 22234 da823d78ad65
child 30305 b92a97e1e9cb
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
22234
da823d78ad65 8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents: 21102
diff changeset
     2
 * Copyright (c) 1999, 2013, 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: 1217
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1217
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: 1217
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
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    26
#include "c1/c1_FrameMap.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    27
#include "c1/c1_LIR.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    28
#include "runtime/sharedRuntime.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    29
#include "vmreg_x86.inline.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
const int FrameMap::pd_c_runtime_reserved_arg_size = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
LIR_Opr FrameMap::map_to_opr(BasicType type, VMRegPair* reg, bool) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
  LIR_Opr opr = LIR_OprFact::illegalOpr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  VMReg r_1 = reg->first();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  VMReg r_2 = reg->second();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  if (r_1->is_stack()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
    // Convert stack slot to an SP offset
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
    // The calling convention does not count the SharedRuntime::out_preserve_stack_slots() value
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
    // so we must add it in here.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
    int st_off = (r_1->reg2stack() + SharedRuntime::out_preserve_stack_slots()) * VMRegImpl::stack_slot_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
    opr = LIR_OprFact::address(new LIR_Address(rsp_opr, st_off, type));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  } else if (r_1->is_Register()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
    Register reg = r_1->as_Register();
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    45
    if (r_2->is_Register() && (type == T_LONG || type == T_DOUBLE)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
      Register reg2 = r_2->as_Register();
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    47
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    48
      assert(reg2 == reg, "must be same register");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    49
      opr = as_long_opr(reg);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    50
#else
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
      opr = as_long_opr(reg2, reg);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    52
#endif // _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    53
    } else if (type == T_OBJECT || type == T_ARRAY) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
      opr = as_oop_opr(reg);
21102
1dd11ccfe9da 8026495: JVM Crashes when started with -XX:+DTraceMethodProbes on Solaris x86_64
iveresov
parents: 13963
diff changeset
    55
    } else if (type == T_METADATA) {
1dd11ccfe9da 8026495: JVM Crashes when started with -XX:+DTraceMethodProbes on Solaris x86_64
iveresov
parents: 13963
diff changeset
    56
      opr = as_metadata_opr(reg);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
      opr = as_opr(reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  } else if (r_1->is_FloatRegister()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
    assert(type == T_DOUBLE || type == T_FLOAT, "wrong type");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
    int num = r_1->as_FloatRegister()->encoding();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
    if (type == T_FLOAT) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
      opr = LIR_OprFact::single_fpu(num);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
      opr = LIR_OprFact::double_fpu(num);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  } else if (r_1->is_XMMRegister()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
    assert(type == T_DOUBLE || type == T_FLOAT, "wrong type");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
    int num = r_1->as_XMMRegister()->encoding();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
    if (type == T_FLOAT) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
      opr = LIR_OprFact::single_xmm(num);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
      opr = LIR_OprFact::double_xmm(num);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  return opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
LIR_Opr FrameMap::rsi_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
LIR_Opr FrameMap::rdi_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
LIR_Opr FrameMap::rbx_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
LIR_Opr FrameMap::rax_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
LIR_Opr FrameMap::rdx_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
LIR_Opr FrameMap::rcx_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
LIR_Opr FrameMap::rsp_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
LIR_Opr FrameMap::rbp_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
LIR_Opr FrameMap::receiver_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
LIR_Opr FrameMap::rsi_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
LIR_Opr FrameMap::rdi_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
LIR_Opr FrameMap::rbx_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
LIR_Opr FrameMap::rax_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
LIR_Opr FrameMap::rdx_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
LIR_Opr FrameMap::rcx_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
13742
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   101
LIR_Opr FrameMap::rsi_metadata_opr;
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   102
LIR_Opr FrameMap::rdi_metadata_opr;
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   103
LIR_Opr FrameMap::rbx_metadata_opr;
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   104
LIR_Opr FrameMap::rax_metadata_opr;
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   105
LIR_Opr FrameMap::rdx_metadata_opr;
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   106
LIR_Opr FrameMap::rcx_metadata_opr;
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   107
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   108
LIR_Opr FrameMap::long0_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   109
LIR_Opr FrameMap::long1_opr;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
LIR_Opr FrameMap::fpu0_float_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
LIR_Opr FrameMap::fpu0_double_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
LIR_Opr FrameMap::xmm0_float_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
LIR_Opr FrameMap::xmm0_double_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   115
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   116
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   117
LIR_Opr  FrameMap::r8_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   118
LIR_Opr  FrameMap::r9_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   119
LIR_Opr FrameMap::r10_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   120
LIR_Opr FrameMap::r11_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   121
LIR_Opr FrameMap::r12_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   122
LIR_Opr FrameMap::r13_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   123
LIR_Opr FrameMap::r14_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   124
LIR_Opr FrameMap::r15_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   125
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   126
// r10 and r15 can never contain oops since they aren't available to
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   127
// the allocator
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   128
LIR_Opr  FrameMap::r8_oop_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   129
LIR_Opr  FrameMap::r9_oop_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   130
LIR_Opr FrameMap::r11_oop_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   131
LIR_Opr FrameMap::r12_oop_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   132
LIR_Opr FrameMap::r13_oop_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   133
LIR_Opr FrameMap::r14_oop_opr;
13742
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   134
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   135
LIR_Opr  FrameMap::r8_metadata_opr;
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   136
LIR_Opr  FrameMap::r9_metadata_opr;
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   137
LIR_Opr FrameMap::r11_metadata_opr;
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   138
LIR_Opr FrameMap::r12_metadata_opr;
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   139
LIR_Opr FrameMap::r13_metadata_opr;
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   140
LIR_Opr FrameMap::r14_metadata_opr;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   141
#endif // _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   142
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
LIR_Opr FrameMap::_caller_save_cpu_regs[] = { 0, };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
LIR_Opr FrameMap::_caller_save_fpu_regs[] = { 0, };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
LIR_Opr FrameMap::_caller_save_xmm_regs[] = { 0, };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   147
XMMRegister FrameMap::_xmm_regs [] = { 0, };
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
XMMRegister FrameMap::nr2xmmreg(int rnr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  assert(_init_done, "tables not initialized");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  return _xmm_regs[rnr];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
//--------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
//               FrameMap
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
//--------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
5707
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5702
diff changeset
   158
void FrameMap::initialize() {
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5702
diff changeset
   159
  assert(!_init_done, "once");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   161
  assert(nof_cpu_regs == LP64_ONLY(16) NOT_LP64(8), "wrong number of CPU registers");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   162
  map_register(0, rsi);  rsi_opr = LIR_OprFact::single_cpu(0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   163
  map_register(1, rdi);  rdi_opr = LIR_OprFact::single_cpu(1);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   164
  map_register(2, rbx);  rbx_opr = LIR_OprFact::single_cpu(2);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   165
  map_register(3, rax);  rax_opr = LIR_OprFact::single_cpu(3);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   166
  map_register(4, rdx);  rdx_opr = LIR_OprFact::single_cpu(4);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   167
  map_register(5, rcx);  rcx_opr = LIR_OprFact::single_cpu(5);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   169
#ifndef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   170
  // The unallocatable registers are at the end
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   171
  map_register(6, rsp);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   172
  map_register(7, rbp);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   173
#else
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   174
  map_register( 6, r8);    r8_opr = LIR_OprFact::single_cpu(6);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   175
  map_register( 7, r9);    r9_opr = LIR_OprFact::single_cpu(7);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   176
  map_register( 8, r11);  r11_opr = LIR_OprFact::single_cpu(8);
7427
d7b79a367474 6985015: C1 needs to support compressed oops
iveresov
parents: 7397
diff changeset
   177
  map_register( 9, r13);  r13_opr = LIR_OprFact::single_cpu(9);
d7b79a367474 6985015: C1 needs to support compressed oops
iveresov
parents: 7397
diff changeset
   178
  map_register(10, r14);  r14_opr = LIR_OprFact::single_cpu(10);
d7b79a367474 6985015: C1 needs to support compressed oops
iveresov
parents: 7397
diff changeset
   179
  // r12 is allocated conditionally. With compressed oops it holds
d7b79a367474 6985015: C1 needs to support compressed oops
iveresov
parents: 7397
diff changeset
   180
  // the heapbase value and is not visible to the allocator.
d7b79a367474 6985015: C1 needs to support compressed oops
iveresov
parents: 7397
diff changeset
   181
  map_register(11, r12);  r12_opr = LIR_OprFact::single_cpu(11);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   182
  // The unallocatable registers are at the end
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   183
  map_register(12, r10);  r10_opr = LIR_OprFact::single_cpu(12);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   184
  map_register(13, r15);  r15_opr = LIR_OprFact::single_cpu(13);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   185
  map_register(14, rsp);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   186
  map_register(15, rbp);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   187
#endif // _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   188
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   189
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   190
  long0_opr = LIR_OprFact::double_cpu(3 /*eax*/, 3 /*eax*/);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   191
  long1_opr = LIR_OprFact::double_cpu(2 /*ebx*/, 2 /*ebx*/);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   192
#else
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   193
  long0_opr = LIR_OprFact::double_cpu(3 /*eax*/, 4 /*edx*/);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   194
  long1_opr = LIR_OprFact::double_cpu(2 /*ebx*/, 5 /*ecx*/);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   195
#endif // _LP64
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  fpu0_float_opr   = LIR_OprFact::single_fpu(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  fpu0_double_opr  = LIR_OprFact::double_fpu(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  xmm0_float_opr   = LIR_OprFact::single_xmm(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  xmm0_double_opr  = LIR_OprFact::double_xmm(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  _caller_save_cpu_regs[0] = rsi_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  _caller_save_cpu_regs[1] = rdi_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  _caller_save_cpu_regs[2] = rbx_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  _caller_save_cpu_regs[3] = rax_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  _caller_save_cpu_regs[4] = rdx_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  _caller_save_cpu_regs[5] = rcx_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   208
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   209
  _caller_save_cpu_regs[6]  = r8_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   210
  _caller_save_cpu_regs[7]  = r9_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   211
  _caller_save_cpu_regs[8]  = r11_opr;
7427
d7b79a367474 6985015: C1 needs to support compressed oops
iveresov
parents: 7397
diff changeset
   212
  _caller_save_cpu_regs[9]  = r13_opr;
d7b79a367474 6985015: C1 needs to support compressed oops
iveresov
parents: 7397
diff changeset
   213
  _caller_save_cpu_regs[10] = r14_opr;
d7b79a367474 6985015: C1 needs to support compressed oops
iveresov
parents: 7397
diff changeset
   214
  _caller_save_cpu_regs[11] = r12_opr;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   215
#endif // _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   216
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  _xmm_regs[0] = xmm0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  _xmm_regs[1] = xmm1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  _xmm_regs[2] = xmm2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  _xmm_regs[3] = xmm3;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  _xmm_regs[4] = xmm4;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  _xmm_regs[5] = xmm5;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  _xmm_regs[6] = xmm6;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  _xmm_regs[7] = xmm7;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   227
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   228
  _xmm_regs[8]   = xmm8;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   229
  _xmm_regs[9]   = xmm9;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   230
  _xmm_regs[10]  = xmm10;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   231
  _xmm_regs[11]  = xmm11;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   232
  _xmm_regs[12]  = xmm12;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   233
  _xmm_regs[13]  = xmm13;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   234
  _xmm_regs[14]  = xmm14;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   235
  _xmm_regs[15]  = xmm15;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   236
#endif // _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   237
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  for (int i = 0; i < 8; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
    _caller_save_fpu_regs[i] = LIR_OprFact::single_fpu(i);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   240
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   241
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   242
  for (int i = 0; i < nof_caller_save_xmm_regs ; i++) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
    _caller_save_xmm_regs[i] = LIR_OprFact::single_xmm(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  _init_done = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   248
  rsi_oop_opr = as_oop_opr(rsi);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   249
  rdi_oop_opr = as_oop_opr(rdi);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   250
  rbx_oop_opr = as_oop_opr(rbx);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   251
  rax_oop_opr = as_oop_opr(rax);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   252
  rdx_oop_opr = as_oop_opr(rdx);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   253
  rcx_oop_opr = as_oop_opr(rcx);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   254
13742
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   255
  rsi_metadata_opr = as_metadata_opr(rsi);
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   256
  rdi_metadata_opr = as_metadata_opr(rdi);
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   257
  rbx_metadata_opr = as_metadata_opr(rbx);
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   258
  rax_metadata_opr = as_metadata_opr(rax);
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   259
  rdx_metadata_opr = as_metadata_opr(rdx);
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   260
  rcx_metadata_opr = as_metadata_opr(rcx);
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   261
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   262
  rsp_opr = as_pointer_opr(rsp);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   263
  rbp_opr = as_pointer_opr(rbp);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   264
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   265
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   266
  r8_oop_opr = as_oop_opr(r8);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   267
  r9_oop_opr = as_oop_opr(r9);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   268
  r11_oop_opr = as_oop_opr(r11);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   269
  r12_oop_opr = as_oop_opr(r12);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   270
  r13_oop_opr = as_oop_opr(r13);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   271
  r14_oop_opr = as_oop_opr(r14);
13742
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   272
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   273
  r8_metadata_opr = as_metadata_opr(r8);
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   274
  r9_metadata_opr = as_metadata_opr(r9);
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   275
  r11_metadata_opr = as_metadata_opr(r11);
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   276
  r12_metadata_opr = as_metadata_opr(r12);
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   277
  r13_metadata_opr = as_metadata_opr(r13);
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 7427
diff changeset
   278
  r14_metadata_opr = as_metadata_opr(r14);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   279
#endif // _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   280
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
  VMRegPair regs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
  BasicType sig_bt = T_OBJECT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
  SharedRuntime::java_calling_convention(&sig_bt, &regs, 1, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
  receiver_opr = as_oop_opr(regs.first()->as_Register());
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   285
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
Address FrameMap::make_new_address(ByteSize sp_offset) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
  // for rbp, based address use this:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  // return Address(rbp, in_bytes(sp_offset) - (framesize() - 2) * 4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
  return Address(rsp, in_bytes(sp_offset));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
// ----------------mapping-----------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
// all mapping is based on rbp, addressing, except for simple leaf methods where we access
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
// the locals rsp based (and no frame is built)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
// Frame for simple leaf methods (quick entries)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
//   +----------+
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
//   | ret addr |   <- TOS
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
//   +----------+
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
//   | args     |
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
//   | ......   |
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
// Frame for standard methods
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
//   | .........|  <- TOS
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
//   | locals   |
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
//   +----------+
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
//   | old rbp,  |  <- EBP
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
//   +----------+
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
//   | ret addr |
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
//   +----------+
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
//   |  args    |
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
//   | .........|
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
// For OopMaps, map a local variable or spill index to an VMRegImpl name.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
// This is the offset from sp() in the frame of the slot for the index,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
// skewed by VMRegImpl::stack0 to indicate a stack location (vs.a register.)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
//           framesize +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
//           stack0         stack0          0  <- VMReg
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
//             |              | <registers> |
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
//  ...........|..............|.............|
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
//      0 1 2 3 x x 4 5 6 ... |                <- local indices
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
//      ^           ^        sp()                 ( x x indicate link
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
//      |           |                               and return addr)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
//  arguments   non-argument locals
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
VMReg FrameMap::fpu_regname (int n) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
  // Return the OptoReg name for the fpu stack slot "n"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
  // A spilled fpu stack slot comprises to two single-word OptoReg's.
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
LIR_Opr FrameMap::stack_pointer() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
  return FrameMap::rsp_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
5687
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1217
diff changeset
   347
// JSR 292
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1217
diff changeset
   348
LIR_Opr FrameMap::method_handle_invoke_SP_save_opr() {
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1217
diff changeset
   349
  assert(rbp == rbp_mh_SP_save, "must be same register");
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1217
diff changeset
   350
  return rbp_opr;
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1217
diff changeset
   351
}
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1217
diff changeset
   352
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1217
diff changeset
   353
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
bool FrameMap::validate_frame() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
  return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
}