hotspot/src/cpu/x86/vm/c1_FrameMap_x86.hpp
author twisti
Wed, 17 Mar 2010 10:22:41 +0100
changeset 5052 c6c9ff8ad36a
parent 1217 5eb97f366a6a
child 5687 b862d1f189bd
child 5547 f4b087cbb361
permissions -rw-r--r--
6934966: JSR 292 add C1 logic for saved SP over MethodHandle calls Summary: The logic for x86 C1 to save the SP over MH calls is pretty straight forward but SPARC handles that differently. Reviewed-by: never, jrose
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
5052
c6c9ff8ad36a 6934966: JSR 292 add C1 logic for saved SP over MethodHandle calls
twisti
parents: 1217
diff changeset
     2
 * Copyright 1999-2010 Sun Microsystems, Inc.  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
 *
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
//  On i486 the frame looks as follows:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
//  +-----------------------------+---------+----------------------------------------+----------------+-----------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
//  | size_arguments-nof_reg_args | 2 words | size_locals-size_arguments+numreg_args | _size_monitors | spilling .
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
//  +-----------------------------+---------+----------------------------------------+----------------+-----------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
//  The FPU registers are mapped with their offset from TOS; therefore the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
//  status of FPU stack must be updated during code emission.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  static const int pd_c_runtime_reserved_arg_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  enum {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
    nof_xmm_regs = pd_nof_xmm_regs_frame_map,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
    nof_caller_save_xmm_regs = pd_nof_caller_save_xmm_regs_frame_map,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
    first_available_sp_in_frame = 0,
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    41
#ifndef _LP64
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
    frame_pad_in_bytes = 8,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
    nof_reg_args = 2
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    44
#else
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    45
    frame_pad_in_bytes = 16,
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    46
    nof_reg_args = 6
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    47
#endif // _LP64
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  static LIR_Opr      _caller_save_xmm_regs [nof_caller_save_xmm_regs];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  static XMMRegister _xmm_regs[nof_xmm_regs];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  static LIR_Opr receiver_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  static LIR_Opr rsi_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  static LIR_Opr rdi_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  static LIR_Opr rbx_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  static LIR_Opr rax_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  static LIR_Opr rdx_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  static LIR_Opr rcx_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  static LIR_Opr rsp_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  static LIR_Opr rbp_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  static LIR_Opr rsi_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  static LIR_Opr rdi_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  static LIR_Opr rbx_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  static LIR_Opr rax_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  static LIR_Opr rdx_oop_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  static LIR_Opr rcx_oop_opr;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    73
#ifdef _LP64
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    75
  static LIR_Opr  r8_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    76
  static LIR_Opr  r9_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    77
  static LIR_Opr r10_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    78
  static LIR_Opr r11_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    79
  static LIR_Opr r12_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    80
  static LIR_Opr r13_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    81
  static LIR_Opr r14_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    82
  static LIR_Opr r15_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    83
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    84
  static LIR_Opr  r8_oop_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    85
  static LIR_Opr  r9_oop_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    86
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    87
  static LIR_Opr r11_oop_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    88
  static LIR_Opr r12_oop_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    89
  static LIR_Opr r13_oop_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    90
  static LIR_Opr r14_oop_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    91
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    92
#endif // _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    93
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    94
  static LIR_Opr long0_opr;
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    95
  static LIR_Opr long1_opr;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  static LIR_Opr fpu0_float_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  static LIR_Opr fpu0_double_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  static LIR_Opr xmm0_float_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  static LIR_Opr xmm0_double_opr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   101
#ifdef _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   102
  static LIR_Opr as_long_opr(Register r) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   103
    return LIR_OprFact::double_cpu(cpu_reg2rnr(r), cpu_reg2rnr(r));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   104
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   105
  static LIR_Opr as_pointer_opr(Register r) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   106
    return LIR_OprFact::double_cpu(cpu_reg2rnr(r), cpu_reg2rnr(r));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   107
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   108
#else
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  static LIR_Opr as_long_opr(Register r, Register r2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
    return LIR_OprFact::double_cpu(cpu_reg2rnr(r), cpu_reg2rnr(r2));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  }
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   112
  static LIR_Opr as_pointer_opr(Register r) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   113
    return LIR_OprFact::single_cpu(cpu_reg2rnr(r));
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   114
  }
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   115
#endif // _LP64
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  // VMReg name for spilled physical FPU stack slot n
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  static VMReg fpu_regname (int n);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  static XMMRegister nr2xmmreg(int rnr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  static bool is_caller_save_register (LIR_Opr opr) { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  static bool is_caller_save_register (Register r) { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  static LIR_Opr caller_save_xmm_reg_at(int i) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    assert(i >= 0 && i < nof_caller_save_xmm_regs, "out of bounds");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    return _caller_save_xmm_regs[i];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  }
5052
c6c9ff8ad36a 6934966: JSR 292 add C1 logic for saved SP over MethodHandle calls
twisti
parents: 1217
diff changeset
   129
c6c9ff8ad36a 6934966: JSR 292 add C1 logic for saved SP over MethodHandle calls
twisti
parents: 1217
diff changeset
   130
  // JSR 292
c6c9ff8ad36a 6934966: JSR 292 add C1 logic for saved SP over MethodHandle calls
twisti
parents: 1217
diff changeset
   131
  static LIR_Opr& method_handle_invoke_SP_save_opr() { return rbp_opr; }