hotspot/src/share/vm/code/vmreg.hpp
author trims
Tue, 05 Apr 2011 14:12:31 -0700
changeset 8921 14bfe81f2a9d
parent 8107 78e5bd944384
child 13294 80131b419f85
permissions -rw-r--r--
7010070: Update all 2010 Oracle-changed OpenJDK files to have the proper copyright dates - second pass Summary: Update the copyright to be 2010 on all changed files in OpenJDK Reviewed-by: ohair
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
8921
14bfe81f2a9d 7010070: Update all 2010 Oracle-changed OpenJDK files to have the proper copyright dates - second pass
trims
parents: 8107
diff changeset
     2
 * Copyright (c) 1998, 2011, 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: 670
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
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: 670
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: 5547
diff changeset
    25
#ifndef SHARE_VM_CODE_VMREG_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_CODE_VMREG_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "memory/allocation.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "utilities/globalDefinitions.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#ifdef TARGET_ARCH_x86
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
# include "register_x86.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    33
#ifdef TARGET_ARCH_sparc
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    34
# include "register_sparc.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    35
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    36
#ifdef TARGET_ARCH_zero
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    37
# include "register_zero.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    38
#endif
8107
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    39
#ifdef TARGET_ARCH_arm
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    40
# include "register_arm.hpp"
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    41
#endif
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    42
#ifdef TARGET_ARCH_ppc
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    43
# include "register_ppc.hpp"
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    44
#endif
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    45
#ifdef COMPILER2
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    46
#include "opto/adlcVMDeps.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    47
#include "utilities/ostream.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    48
#ifdef TARGET_ARCH_MODEL_x86_32
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    49
# include "adfiles/adGlobals_x86_32.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    50
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    51
#ifdef TARGET_ARCH_MODEL_x86_64
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    52
# include "adfiles/adGlobals_x86_64.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    53
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    54
#ifdef TARGET_ARCH_MODEL_sparc
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    55
# include "adfiles/adGlobals_sparc.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    56
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    57
#ifdef TARGET_ARCH_MODEL_zero
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    58
# include "adfiles/adGlobals_zero.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    59
#endif
8107
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    60
#ifdef TARGET_ARCH_MODEL_arm
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    61
# include "adfiles/adGlobals_arm.hpp"
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    62
#endif
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    63
#ifdef TARGET_ARCH_MODEL_ppc
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    64
# include "adfiles/adGlobals_ppc.hpp"
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    65
#endif
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    66
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    67
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
//------------------------------VMReg------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
// The VM uses 'unwarped' stack slots; the compiler uses 'warped' stack slots.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
// Register numbers below VMRegImpl::stack0 are the same for both.  Register
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
// numbers above stack0 are either warped (in the compiler) or unwarped
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
// (in the VM).  Unwarped numbers represent stack indices, offsets from
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
// the current stack pointer.  Warped numbers are required during compilation
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
// when we do not yet know how big the frame will be.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
class VMRegImpl;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
typedef VMRegImpl* VMReg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
class VMRegImpl {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
// friend class OopMap;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
friend class VMStructs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
friend class OptoReg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
// friend class Location;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  enum {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
    BAD = -1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  static VMReg stack0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  // Names for registers
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  static const char *regName[];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  static const int register_count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  static VMReg  as_VMReg(int val, bool bad_ok = false) { assert(val > BAD || bad_ok, "invalid"); return (VMReg) (intptr_t) val; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  const char*  name() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
    if (is_reg()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
      return regName[value()];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
    } else if (!is_valid()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
      return "BAD";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
      // shouldn't really be called with stack
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
      return "STACKED REG";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  static VMReg Bad() { return (VMReg) (intptr_t) BAD; }
198
8601165a33c3 6621094: PrintOptoAssembly is broken for oops information in DebugInfo
kvn
parents: 1
diff changeset
   112
  bool is_valid() const { return ((intptr_t) this) != BAD; }
8601165a33c3 6621094: PrintOptoAssembly is broken for oops information in DebugInfo
kvn
parents: 1
diff changeset
   113
  bool is_stack() const { return (intptr_t) this >= (intptr_t) stack0; }
8601165a33c3 6621094: PrintOptoAssembly is broken for oops information in DebugInfo
kvn
parents: 1
diff changeset
   114
  bool is_reg()   const { return is_valid() && !is_stack(); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  // A concrete register is a value that returns true for is_reg() and is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  // also a register you could use in the assembler. On machines with
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  // 64bit registers only one half of the VMReg (and OptoReg) is considered
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  // concrete.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  bool is_concrete();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  // VMRegs are 4 bytes wide on all platforms
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  static const int stack_slot_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  static const int slots_per_word;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  // This really ought to check that the register is "real" in the sense that
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  // we don't try and get the VMReg number of a physical register that doesn't
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  // have an expressible part. That would be pd specific code
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  VMReg next() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    assert((is_reg() && value() < stack0->value() - 1) || is_stack(), "must be");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
    return (VMReg)(intptr_t)(value() + 1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  VMReg prev() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    assert((is_stack() && value() > stack0->value()) || (is_reg() && value() != 0), "must be");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    return (VMReg)(intptr_t)(value() - 1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  intptr_t value() const         {return (intptr_t) this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 198
diff changeset
   142
  void print_on(outputStream* st) const;
198
8601165a33c3 6621094: PrintOptoAssembly is broken for oops information in DebugInfo
kvn
parents: 1
diff changeset
   143
  void print() const { print_on(tty); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  // bias a stack slot.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  // Typically used to adjust a virtual frame slots by amounts that are offset by
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  // amounts that are part of the native abi. The VMReg must be a stack slot
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  // and the result must be also.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  VMReg bias(int offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
    assert(is_stack(), "must be");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
    // VMReg res = VMRegImpl::as_VMReg(value() + offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
    VMReg res = stack2reg(reg2stack() + offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
    assert(res->is_stack(), "must be");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
    return res;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  // Convert register numbers to stack slots and vice versa
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  static VMReg stack2reg( int idx ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
    return (VMReg) (intptr_t) (stack0->value() + idx);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  uintptr_t reg2stack() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
    assert( is_stack(), "Not a stack-based register" );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
    return value() - stack0->value();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  static void set_regName();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   170
#ifdef TARGET_ARCH_x86
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   171
# include "vmreg_x86.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   172
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   173
#ifdef TARGET_ARCH_sparc
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   174
# include "vmreg_sparc.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   175
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   176
#ifdef TARGET_ARCH_zero
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   177
# include "vmreg_zero.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   178
#endif
8107
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
   179
#ifdef TARGET_ARCH_arm
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
   180
# include "vmreg_arm.hpp"
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
   181
#endif
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
   182
#ifdef TARGET_ARCH_ppc
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
   183
# include "vmreg_ppc.hpp"
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
   184
#endif
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   185
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
//---------------------------VMRegPair-------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
// Pairs of 32-bit registers for arguments.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
// SharedRuntime::java_calling_convention will overwrite the structs with
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
// the calling convention's registers.  VMRegImpl::Bad is returned for any
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
// unused 32-bit register.  This happens for the unused high half of Int
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
// arguments, or for 32-bit pointers or for longs in the 32-bit sparc build
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
// (which are passed to natives in low 32-bits of e.g. O0/O1 and the high
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
// 32-bits of O0/O1 are set to VMRegImpl::Bad).  Longs in one register & doubles
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
// always return a high and a low register, as do 64-bit pointers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
class VMRegPair {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  VMReg _second;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  VMReg _first;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  void set_bad (                   ) { _second=VMRegImpl::Bad(); _first=VMRegImpl::Bad(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  void set1    (         VMReg v  ) { _second=VMRegImpl::Bad(); _first=v; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  void set2    (         VMReg v  ) { _second=v->next();  _first=v; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  void set_pair( VMReg second, VMReg first    ) { _second= second;    _first= first; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  void set_ptr ( VMReg ptr ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
#ifdef _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
    _second = ptr->next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
    _second = VMRegImpl::Bad();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
    _first = ptr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  // Return true if single register, even if the pair is really just adjacent stack slots
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 198
diff changeset
   217
  bool is_single_reg() const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
    return (_first->is_valid()) && (_first->value() + 1 == _second->value());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  // Return true if single stack based "register" where the slot alignment matches input alignment
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 198
diff changeset
   222
  bool is_adjacent_on_stack(int alignment) const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
    return (_first->is_stack() && (_first->value() + 1 == _second->value()) && ((_first->value() & (alignment-1)) == 0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  // Return true if single stack based "register" where the slot alignment matches input alignment
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 198
diff changeset
   227
  bool is_adjacent_aligned_on_stack(int alignment) const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
    return (_first->is_stack() && (_first->value() + 1 == _second->value()) && ((_first->value() & (alignment-1)) == 0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  // Return true if single register but adjacent stack slots do not count
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 198
diff changeset
   232
  bool is_single_phys_reg() const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
    return (_first->is_reg() && (_first->value() + 1 == _second->value()));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  VMReg second() const { return _second; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  VMReg first()  const { return _first; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  VMRegPair(VMReg s, VMReg f) {  _second = s; _first = f; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  VMRegPair(VMReg f) { _second = VMRegImpl::Bad(); _first = f; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  VMRegPair() { _second = VMRegImpl::Bad(); _first = VMRegImpl::Bad(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   242
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   243
#endif // SHARE_VM_CODE_VMREG_HPP