annotate agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86Registers.java @ 1913:3b2dea75431e

6984311: JSR 292 needs optional bootstrap method parameters Summary: Allow CONSTANT_InvokeDynamic nodes to have any number of extra operands. Reviewed-by: twisti
author jrose
date Sat, 30 Oct 2010 13:08:23 -0700
parents c18cbe5936b8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
2 * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 package sun.jvm.hotspot.asm.x86;
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 import sun.jvm.hotspot.utilities.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
28
a61af66fc99e Initial load
duke
parents:
diff changeset
29 public class X86Registers {
a61af66fc99e Initial load
duke
parents:
diff changeset
30 public static final int NUM_REGISTERS = 8;
a61af66fc99e Initial load
duke
parents:
diff changeset
31
a61af66fc99e Initial load
duke
parents:
diff changeset
32 public static final X86Register EAX;
a61af66fc99e Initial load
duke
parents:
diff changeset
33 public static final X86Register ECX;
a61af66fc99e Initial load
duke
parents:
diff changeset
34 public static final X86Register EDX;
a61af66fc99e Initial load
duke
parents:
diff changeset
35 public static final X86Register EBX;
a61af66fc99e Initial load
duke
parents:
diff changeset
36 public static final X86Register ESP;
a61af66fc99e Initial load
duke
parents:
diff changeset
37 public static final X86Register EBP;
a61af66fc99e Initial load
duke
parents:
diff changeset
38 public static final X86Register ESI;
a61af66fc99e Initial load
duke
parents:
diff changeset
39 public static final X86Register EDI;
a61af66fc99e Initial load
duke
parents:
diff changeset
40
a61af66fc99e Initial load
duke
parents:
diff changeset
41 public static final X86Register AX;
a61af66fc99e Initial load
duke
parents:
diff changeset
42 public static final X86Register CX;
a61af66fc99e Initial load
duke
parents:
diff changeset
43 public static final X86Register DX;
a61af66fc99e Initial load
duke
parents:
diff changeset
44 public static final X86Register BX;
a61af66fc99e Initial load
duke
parents:
diff changeset
45 public static final X86Register SP;
a61af66fc99e Initial load
duke
parents:
diff changeset
46 public static final X86Register BP;
a61af66fc99e Initial load
duke
parents:
diff changeset
47 public static final X86Register SI;
a61af66fc99e Initial load
duke
parents:
diff changeset
48 public static final X86Register DI;
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 public static final X86Register AL;
a61af66fc99e Initial load
duke
parents:
diff changeset
51 public static final X86Register CL;
a61af66fc99e Initial load
duke
parents:
diff changeset
52 public static final X86Register DL;
a61af66fc99e Initial load
duke
parents:
diff changeset
53 public static final X86Register BL;
a61af66fc99e Initial load
duke
parents:
diff changeset
54 public static final X86Register AH;
a61af66fc99e Initial load
duke
parents:
diff changeset
55 public static final X86Register CH;
a61af66fc99e Initial load
duke
parents:
diff changeset
56 public static final X86Register DH;
a61af66fc99e Initial load
duke
parents:
diff changeset
57 public static final X86Register BH;
a61af66fc99e Initial load
duke
parents:
diff changeset
58
a61af66fc99e Initial load
duke
parents:
diff changeset
59 private static X86Register registers8[];
a61af66fc99e Initial load
duke
parents:
diff changeset
60 private static X86Register registers16[];
a61af66fc99e Initial load
duke
parents:
diff changeset
61 private static X86Register registers32[];
a61af66fc99e Initial load
duke
parents:
diff changeset
62
a61af66fc99e Initial load
duke
parents:
diff changeset
63 static {
a61af66fc99e Initial load
duke
parents:
diff changeset
64 EAX = new X86RegisterPart(0, "%eax", 0, 32);
a61af66fc99e Initial load
duke
parents:
diff changeset
65 ECX = new X86RegisterPart(1, "%ecx", 0, 32);
a61af66fc99e Initial load
duke
parents:
diff changeset
66 EDX = new X86RegisterPart(2, "%edx", 0, 32);
a61af66fc99e Initial load
duke
parents:
diff changeset
67 EBX = new X86RegisterPart(3, "%ebx", 0, 32);
a61af66fc99e Initial load
duke
parents:
diff changeset
68 ESP = new X86RegisterPart(4, "%esp", 0, 32);
a61af66fc99e Initial load
duke
parents:
diff changeset
69 EBP = new X86RegisterPart(5, "%ebp", 0, 32);
a61af66fc99e Initial load
duke
parents:
diff changeset
70 ESI = new X86RegisterPart(6, "%esi", 0, 32);
a61af66fc99e Initial load
duke
parents:
diff changeset
71 EDI = new X86RegisterPart(7, "%edi", 0, 32);
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73 AX = new X86RegisterPart(0, "%ax", 0, 16);
a61af66fc99e Initial load
duke
parents:
diff changeset
74 CX = new X86RegisterPart(1, "%cx", 0, 16);
a61af66fc99e Initial load
duke
parents:
diff changeset
75 DX = new X86RegisterPart(2, "%dx", 0, 16);
a61af66fc99e Initial load
duke
parents:
diff changeset
76 BX = new X86RegisterPart(3, "%bx", 0, 16);
a61af66fc99e Initial load
duke
parents:
diff changeset
77 SP = new X86RegisterPart(4, "%sp", 0, 16);
a61af66fc99e Initial load
duke
parents:
diff changeset
78 BP = new X86RegisterPart(5, "%bp", 0, 16);
a61af66fc99e Initial load
duke
parents:
diff changeset
79 SI = new X86RegisterPart(6, "%si", 0, 16);
a61af66fc99e Initial load
duke
parents:
diff changeset
80 DI = new X86RegisterPart(7, "%di", 0, 16);
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 AL = new X86RegisterPart(0, "%al", 0, 8);
a61af66fc99e Initial load
duke
parents:
diff changeset
83 CL = new X86RegisterPart(1, "%cl", 0, 8);
a61af66fc99e Initial load
duke
parents:
diff changeset
84 DL = new X86RegisterPart(2, "%dl", 0, 8);
a61af66fc99e Initial load
duke
parents:
diff changeset
85 BL = new X86RegisterPart(3, "%bl", 0, 8);
a61af66fc99e Initial load
duke
parents:
diff changeset
86 AH = new X86RegisterPart(0, "%ah", 8, 8);
a61af66fc99e Initial load
duke
parents:
diff changeset
87 CH = new X86RegisterPart(1, "%ch", 8, 8);
a61af66fc99e Initial load
duke
parents:
diff changeset
88 DH = new X86RegisterPart(2, "%dh", 8, 8);
a61af66fc99e Initial load
duke
parents:
diff changeset
89 BH = new X86RegisterPart(3, "%bh", 8, 8);
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91 registers32 = (new X86Register[] {
a61af66fc99e Initial load
duke
parents:
diff changeset
92 EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI
a61af66fc99e Initial load
duke
parents:
diff changeset
93 });
a61af66fc99e Initial load
duke
parents:
diff changeset
94 registers16 = (new X86Register[] {
a61af66fc99e Initial load
duke
parents:
diff changeset
95 AX, CX, DX, BX, SP, BP, SI, DI
a61af66fc99e Initial load
duke
parents:
diff changeset
96 });
a61af66fc99e Initial load
duke
parents:
diff changeset
97 registers8 = (new X86Register[] {
a61af66fc99e Initial load
duke
parents:
diff changeset
98 AL, CL, DL, BL, AH, CH, DH, BH
a61af66fc99e Initial load
duke
parents:
diff changeset
99 });
a61af66fc99e Initial load
duke
parents:
diff changeset
100 }
a61af66fc99e Initial load
duke
parents:
diff changeset
101
a61af66fc99e Initial load
duke
parents:
diff changeset
102 public static int getNumberOfRegisters() {
a61af66fc99e Initial load
duke
parents:
diff changeset
103 return NUM_REGISTERS;
a61af66fc99e Initial load
duke
parents:
diff changeset
104 }
a61af66fc99e Initial load
duke
parents:
diff changeset
105
a61af66fc99e Initial load
duke
parents:
diff changeset
106 public static X86Register getRegister8(int regNum) {
a61af66fc99e Initial load
duke
parents:
diff changeset
107 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
108 Assert.that(regNum > -1 && regNum < NUM_REGISTERS, "invalid integer register number!");
a61af66fc99e Initial load
duke
parents:
diff changeset
109 }
a61af66fc99e Initial load
duke
parents:
diff changeset
110 return registers8[regNum];
a61af66fc99e Initial load
duke
parents:
diff changeset
111 }
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 public static X86Register getRegister16(int regNum) {
a61af66fc99e Initial load
duke
parents:
diff changeset
114 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
115 Assert.that(regNum > -1 && regNum < NUM_REGISTERS, "invalid integer register number!");
a61af66fc99e Initial load
duke
parents:
diff changeset
116 }
a61af66fc99e Initial load
duke
parents:
diff changeset
117 return registers16[regNum];
a61af66fc99e Initial load
duke
parents:
diff changeset
118 }
a61af66fc99e Initial load
duke
parents:
diff changeset
119
a61af66fc99e Initial load
duke
parents:
diff changeset
120 public static X86Register getRegister32(int regNum) {
a61af66fc99e Initial load
duke
parents:
diff changeset
121 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
122 Assert.that(regNum > -1 && regNum < NUM_REGISTERS, "invalid integer register number!");
a61af66fc99e Initial load
duke
parents:
diff changeset
123 }
a61af66fc99e Initial load
duke
parents:
diff changeset
124 return registers32[regNum];
a61af66fc99e Initial load
duke
parents:
diff changeset
125 }
a61af66fc99e Initial load
duke
parents:
diff changeset
126
a61af66fc99e Initial load
duke
parents:
diff changeset
127 //Return the 32bit register name
a61af66fc99e Initial load
duke
parents:
diff changeset
128 public static String getRegisterName(int regNum) {
a61af66fc99e Initial load
duke
parents:
diff changeset
129 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
130 Assert.that(regNum > -1 && regNum < NUM_REGISTERS, "invalid integer register number!");
a61af66fc99e Initial load
duke
parents:
diff changeset
131 }
a61af66fc99e Initial load
duke
parents:
diff changeset
132 return registers32[regNum].toString();
a61af66fc99e Initial load
duke
parents:
diff changeset
133 }
a61af66fc99e Initial load
duke
parents:
diff changeset
134 }