hotspot/src/share/vm/c1/c1_FrameMap.hpp
author iveresov
Thu, 22 Oct 2015 21:39:25 -0700
changeset 33465 6063f28a6efb
parent 29180 50369728b00e
child 38031 e0b822facc03
permissions -rw-r--r--
8139575: Update for x86 log in the math lib Summary: Add new java.lang.Math() intrinsics from x86 Reviewed-by: kvn, iveresov Contributed-by: vivek.r.deshpande@intel.com
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: 15848
diff changeset
     2
 * Copyright (c) 2000, 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: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
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: 1
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: 6176
diff changeset
    25
#ifndef SHARE_VM_C1_C1_FRAMEMAP_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
    26
#define SHARE_VM_C1_C1_FRAMEMAP_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
    28
#include "asm/assembler.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
    29
#include "c1/c1_Defs.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
    30
#include "c1/c1_LIR.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
    31
#include "code/vmreg.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
    32
#include "memory/allocation.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
    33
#include "runtime/frame.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
    34
#include "runtime/synchronizer.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
    35
#include "utilities/globalDefinitions.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
    36
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
class ciMethod;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
class CallingConvention;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
class BasicTypeArray;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
class BasicTypeList;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
//--------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
//               FrameMap
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
//--------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
//  This class is responsible of mapping items (locals, monitors, spill
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
//  slots and registers to their frame location
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
//  The monitors are specified by a consecutive index, although each monitor entry
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
//  occupies two words. The monitor_index is 0.._num_monitors
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
//  The spill index is similar to local index; it is in range 0..(open)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
//  The CPU registers are mapped using a fixed table; register with number 0
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
//  is the most used one.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
//   stack grow direction -->                                        SP
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
//  +----------+---+----------+-------+------------------------+-----+
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
//  |arguments | x | monitors | spill | reserved argument area | ABI |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
//  +----------+---+----------+-------+------------------------+-----+
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
//  x =  ABI area (SPARC) or  return adress and link (i486)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
//  ABI  = ABI area (SPARC) or nothing (i486)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
class LIR_OprDesc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
typedef LIR_OprDesc* LIR_Opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
class FrameMap : public CompilationResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  enum {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
    nof_cpu_regs = pd_nof_cpu_regs_frame_map,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
    nof_fpu_regs = pd_nof_fpu_regs_frame_map,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    nof_cpu_regs_reg_alloc = pd_nof_cpu_regs_reg_alloc,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    nof_fpu_regs_reg_alloc = pd_nof_fpu_regs_reg_alloc,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
7427
d7b79a367474 6985015: C1 needs to support compressed oops
iveresov
parents: 7397
diff changeset
    79
    max_nof_caller_save_cpu_regs = pd_nof_caller_save_cpu_regs_frame_map,
d7b79a367474 6985015: C1 needs to support compressed oops
iveresov
parents: 7397
diff changeset
    80
    nof_caller_save_fpu_regs     = pd_nof_caller_save_fpu_regs_frame_map,
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
    spill_slot_size_in_bytes = 4
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
    85
#ifdef TARGET_ARCH_x86
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
    86
# include "c1_FrameMap_x86.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
    87
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
    88
#ifdef TARGET_ARCH_sparc
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
    89
# include "c1_FrameMap_sparc.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
    90
#endif
8107
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7427
diff changeset
    91
#ifdef TARGET_ARCH_arm
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7427
diff changeset
    92
# include "c1_FrameMap_arm.hpp"
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7427
diff changeset
    93
#endif
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7427
diff changeset
    94
#ifdef TARGET_ARCH_ppc
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7427
diff changeset
    95
# include "c1_FrameMap_ppc.hpp"
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7427
diff changeset
    96
#endif
29180
50369728b00e 8064611: AARCH64: Changes to HotSpot shared code
aph
parents: 22234
diff changeset
    97
#ifdef TARGET_ARCH_aarch64
50369728b00e 8064611: AARCH64: Changes to HotSpot shared code
aph
parents: 22234
diff changeset
    98
# include "c1_FrameMap_aarch64.hpp"
50369728b00e 8064611: AARCH64: Changes to HotSpot shared code
aph
parents: 22234
diff changeset
    99
#endif
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
   100
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  friend class LIR_OprDesc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  static bool         _init_done;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  static Register     _cpu_rnr2reg [nof_cpu_regs];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  static int          _cpu_reg2rnr [nof_cpu_regs];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
7427
d7b79a367474 6985015: C1 needs to support compressed oops
iveresov
parents: 7397
diff changeset
   109
  static LIR_Opr      _caller_save_cpu_regs [max_nof_caller_save_cpu_regs];
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  static LIR_Opr      _caller_save_fpu_regs [nof_caller_save_fpu_regs];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  int                 _framesize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  int                 _argcount;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  int                 _num_monitors;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  int                 _num_spills;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  int                 _reserved_argument_area_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  int                 _oop_map_arg_count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  CallingConvention*  _incoming_arguments;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  intArray*           _argument_locations;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  void check_spill_index   (int spill_index)   const { assert(spill_index   >= 0, "bad index"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  void check_monitor_index (int monitor_index) const { assert(monitor_index >= 0 &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
                                                              monitor_index < _num_monitors, "bad index"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  static Register cpu_rnr2reg (int rnr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    assert(_init_done, "tables not initialized");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    debug_only(cpu_range_check(rnr);)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
    return _cpu_rnr2reg[rnr];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  static int cpu_reg2rnr (Register reg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
    assert(_init_done, "tables not initialized");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
    debug_only(cpu_range_check(reg->encoding());)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    return _cpu_reg2rnr[reg->encoding()];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  static void map_register(int rnr, Register reg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
    debug_only(cpu_range_check(rnr);)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
    debug_only(cpu_range_check(reg->encoding());)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
    _cpu_rnr2reg[rnr] = reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
    _cpu_reg2rnr[reg->encoding()] = rnr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  void update_reserved_argument_area_size (int size) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
    assert(size >= 0, "check");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
    _reserved_argument_area_size = MAX2(_reserved_argument_area_size, size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
 protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  static void cpu_range_check (int rnr)          { assert(0 <= rnr && rnr < nof_cpu_regs, "cpu register number is too big"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  static void fpu_range_check (int rnr)          { assert(0 <= rnr && rnr < nof_fpu_regs, "fpu register number is too big"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  ByteSize sp_offset_for_monitor_base(const int idx) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  Address make_new_address(ByteSize sp_offset) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  ByteSize sp_offset_for_slot(const int idx) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  ByteSize sp_offset_for_double_slot(const int idx) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  ByteSize sp_offset_for_spill(const int idx) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  ByteSize sp_offset_for_monitor_lock(int monitor_index) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  ByteSize sp_offset_for_monitor_object(int monitor_index) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  VMReg sp_offset2vmreg(ByteSize offset) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  // platform dependent hook used to check that frame is properly
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  // addressable on the platform.  Used by sparc to verify that all
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  // stack addresses are expressable in a simm13.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  bool validate_frame();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  static LIR_Opr map_to_opr(BasicType type, VMRegPair* reg, bool incoming);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  // Opr representing the stack_pointer on this platform
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  static LIR_Opr stack_pointer();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
5687
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1
diff changeset
   180
  // JSR 292
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1
diff changeset
   181
  static LIR_Opr method_handle_invoke_SP_save_opr();
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1
diff changeset
   182
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  static BasicTypeArray*     signature_type_array_for(const ciMethod* method);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  // for outgoing calls, these also update the reserved area to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  // include space for arguments and any ABI area.
13391
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 8921
diff changeset
   187
  CallingConvention* c_calling_convention(const BasicTypeArray* signature);
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 8921
diff changeset
   188
  CallingConvention* java_calling_convention(const BasicTypeArray* signature, bool outgoing);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  // deopt support
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  ByteSize sp_offset_for_orig_pc() { return sp_offset_for_monitor_base(_num_monitors); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  static LIR_Opr as_opr(Register r) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
    return LIR_OprFact::single_cpu(cpu_reg2rnr(r));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  static LIR_Opr as_oop_opr(Register r) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
    return LIR_OprFact::single_cpu_oop(cpu_reg2rnr(r));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
13742
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 13391
diff changeset
   200
  static LIR_Opr as_metadata_opr(Register r) {
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 13391
diff changeset
   201
    return LIR_OprFact::single_cpu_metadata(cpu_reg2rnr(r));
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 13391
diff changeset
   202
  }
9180987e305d 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 13391
diff changeset
   203
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  FrameMap(ciMethod* method, int monitors, int reserved_argument_area_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  bool finalize_frame(int nof_slots);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  int   reserved_argument_area_size () const     { return _reserved_argument_area_size; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  int   framesize                   () const     { assert(_framesize != -1, "hasn't been calculated"); return _framesize; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  ByteSize framesize_in_bytes       () const     { return in_ByteSize(framesize() * 4); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  int   num_monitors                () const     { return _num_monitors; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  int   num_spills                  () const     { assert(_num_spills >= 0, "not set"); return _num_spills; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  int   argcount              () const     { assert(_argcount >= 0, "not set"); return _argcount; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  int oop_map_arg_count() const { return _oop_map_arg_count; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  CallingConvention* incoming_arguments() const  { return _incoming_arguments; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  // convenience routines
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  Address address_for_slot(int index, int sp_adjust = 0) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
    return make_new_address(sp_offset_for_slot(index) + in_ByteSize(sp_adjust));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  Address address_for_double_slot(int index, int sp_adjust = 0) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
    return make_new_address(sp_offset_for_double_slot(index) + in_ByteSize(sp_adjust));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  Address address_for_monitor_lock(int monitor_index) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
    return make_new_address(sp_offset_for_monitor_lock(monitor_index));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  Address address_for_monitor_object(int monitor_index) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
    return make_new_address(sp_offset_for_monitor_object(monitor_index));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  // Creates Location describing desired slot and returns it via pointer
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  // to Location object. Returns true if the stack frame offset was legal
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  // (as defined by Location::legal_offset_in_bytes()), false otherwise.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  // Do not use the returned location if this returns false.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  bool location_for_sp_offset(ByteSize byte_offset_from_sp,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
                              Location::Type loc_type, Location* loc) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  bool location_for_monitor_lock  (int monitor_index, Location* loc) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
    return location_for_sp_offset(sp_offset_for_monitor_lock(monitor_index), Location::normal, loc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  bool location_for_monitor_object(int monitor_index, Location* loc) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
    return location_for_sp_offset(sp_offset_for_monitor_object(monitor_index), Location::oop, loc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  bool locations_for_slot  (int index, Location::Type loc_type,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
                            Location* loc, Location* second = NULL) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
  VMReg slot_regname(int index) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
    return sp_offset2vmreg(sp_offset_for_slot(index));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  VMReg monitor_object_regname(int monitor_index) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
    return sp_offset2vmreg(sp_offset_for_monitor_object(monitor_index));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  VMReg regname(LIR_Opr opr) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  static LIR_Opr caller_save_cpu_reg_at(int i) {
7427
d7b79a367474 6985015: C1 needs to support compressed oops
iveresov
parents: 7397
diff changeset
   257
    assert(i >= 0 && i < max_nof_caller_save_cpu_regs, "out of bounds");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
    return _caller_save_cpu_regs[i];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
  static LIR_Opr caller_save_fpu_reg_at(int i) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
    assert(i >= 0 && i < nof_caller_save_fpu_regs, "out of bounds");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
    return _caller_save_fpu_regs[i];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
5707
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5702
diff changeset
   266
  static void initialize();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
//               CallingConvention
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
//--------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
class CallingConvention: public ResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  LIR_OprList* _args;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
  int          _reserved_stack_slots;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
  CallingConvention (LIR_OprList* args, int reserved_stack_slots)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
    : _args(args)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
    , _reserved_stack_slots(reserved_stack_slots)  {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
  LIR_OprList* args()       { return _args; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
  LIR_Opr at(int i) const   { return _args->at(i); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
  int length() const        { return _args->length(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  // Indicates number of real frame slots used by arguments passed on stack.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  int reserved_stack_slots() const            { return _reserved_stack_slots; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  void print () const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
    for (int i = 0; i < length(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
      at(i)->print();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
   298
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6176
diff changeset
   299
#endif // SHARE_VM_C1_C1_FRAMEMAP_HPP