hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.hpp
author twisti
Fri, 13 Feb 2009 09:09:35 -0800
changeset 2031 24e034f56dcb
parent 1 489c9b5090e2
child 5052 c6c9ff8ad36a
permissions -rw-r--r--
6800154: Add comments to long_by_long_mulhi() for better understandability Summary: This patch adds a comment pointing to the Hacker's Delight version of the algorithm plus a verbatim copy of it. Furthermore it adds inline comments. Reviewed-by: kvn, jrose
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
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
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
  enum {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
    nof_reg_args = 6,   // registers o0-o5 are available for parameter passing
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
    first_available_sp_in_frame = frame::memory_parameter_word_sp_offset * BytesPerWord,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
    frame_pad_in_bytes = 0
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
  static const int pd_c_runtime_reserved_arg_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  static LIR_Opr G0_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  static LIR_Opr G1_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  static LIR_Opr G2_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  static LIR_Opr G3_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  static LIR_Opr G4_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  static LIR_Opr G5_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  static LIR_Opr G6_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  static LIR_Opr G7_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  static LIR_Opr O0_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  static LIR_Opr O1_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  static LIR_Opr O2_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  static LIR_Opr O3_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  static LIR_Opr O4_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  static LIR_Opr O5_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  static LIR_Opr O6_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  static LIR_Opr O7_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  static LIR_Opr L0_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  static LIR_Opr L1_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  static LIR_Opr L2_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  static LIR_Opr L3_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  static LIR_Opr L4_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  static LIR_Opr L5_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  static LIR_Opr L6_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  static LIR_Opr L7_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  static LIR_Opr I0_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  static LIR_Opr I1_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  static LIR_Opr I2_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  static LIR_Opr I3_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  static LIR_Opr I4_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  static LIR_Opr I5_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  static LIR_Opr I6_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  static LIR_Opr I7_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  static LIR_Opr SP_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  static LIR_Opr FP_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  static LIR_Opr G0_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  static LIR_Opr G1_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  static LIR_Opr G2_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  static LIR_Opr G3_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  static LIR_Opr G4_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  static LIR_Opr G5_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  static LIR_Opr G6_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  static LIR_Opr G7_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  static LIR_Opr O0_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  static LIR_Opr O1_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  static LIR_Opr O2_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  static LIR_Opr O3_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  static LIR_Opr O4_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  static LIR_Opr O5_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  static LIR_Opr O6_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  static LIR_Opr O7_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  static LIR_Opr L0_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  static LIR_Opr L1_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  static LIR_Opr L2_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  static LIR_Opr L3_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  static LIR_Opr L4_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  static LIR_Opr L5_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  static LIR_Opr L6_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  static LIR_Opr L7_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  static LIR_Opr I0_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  static LIR_Opr I1_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  static LIR_Opr I2_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  static LIR_Opr I3_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  static LIR_Opr I4_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  static LIR_Opr I5_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  static LIR_Opr I6_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  static LIR_Opr I7_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  static LIR_Opr in_long_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  static LIR_Opr out_long_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  static LIR_Opr F0_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  static LIR_Opr F0_double_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  static LIR_Opr Oexception_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  static LIR_Opr Oissuing_pc_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  static FloatRegister  _fpu_regs [nof_fpu_regs];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
#ifdef _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  static LIR_Opr as_long_opr(Register r) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
    return LIR_OprFact::double_cpu(cpu_reg2rnr(r), cpu_reg2rnr(r));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  static LIR_Opr as_pointer_opr(Register r) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    return LIR_OprFact::double_cpu(cpu_reg2rnr(r), cpu_reg2rnr(r));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  static LIR_Opr as_long_opr(Register r) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    return LIR_OprFact::double_cpu(cpu_reg2rnr(r->successor()), cpu_reg2rnr(r));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  static LIR_Opr as_pointer_opr(Register r) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
    return as_opr(r);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  static LIR_Opr as_float_opr(FloatRegister r) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
    return LIR_OprFact::single_fpu(r->encoding());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  static LIR_Opr as_double_opr(FloatRegister r) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
    return LIR_OprFact::double_fpu(r->successor()->encoding(), r->encoding());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  static FloatRegister nr2floatreg (int rnr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  static VMReg fpu_regname (int n);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  static bool is_caller_save_register (LIR_Opr  reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  static bool is_caller_save_register (Register r);