29
30 public class BasicType {
31 public static final int tBoolean = 4;
32 public static final int tChar = 5;
33 public static final int tFloat = 6;
34 public static final int tDouble = 7;
35 public static final int tByte = 8;
36 public static final int tShort = 9;
37 public static final int tInt = 10;
38 public static final int tLong = 11;
39 public static final int tObject = 12;
40 public static final int tArray = 13;
41 public static final int tVoid = 14;
42 public static final int tAddress = 15;
43 public static final int tNarrowOop = 16;
44 public static final int tMetadata = 17;
45 public static final int tNarrowKlass = 18;
46 public static final int tConflict = 19;
47 public static final int tIllegal = 99;
48
49 public static final BasicType T_BOOLEAN = new BasicType(tBoolean);
50 public static final BasicType T_CHAR = new BasicType(tChar);
51 public static final BasicType T_FLOAT = new BasicType(tFloat);
52 public static final BasicType T_DOUBLE = new BasicType(tDouble);
53 public static final BasicType T_BYTE = new BasicType(tByte);
54 public static final BasicType T_SHORT = new BasicType(tShort);
55 public static final BasicType T_INT = new BasicType(tInt);
56 public static final BasicType T_LONG = new BasicType(tLong);
57 public static final BasicType T_OBJECT = new BasicType(tObject);
58 public static final BasicType T_ARRAY = new BasicType(tArray);
59 public static final BasicType T_VOID = new BasicType(tVoid);
60 public static final BasicType T_ADDRESS = new BasicType(tAddress);
61 public static final BasicType T_NARROWOOP = new BasicType(tNarrowOop);
62 public static final BasicType T_METADATA = new BasicType(tMetadata);
63 public static final BasicType T_NARROWKLASS = new BasicType(tNarrowKlass);
64 public static final BasicType T_CONFLICT = new BasicType(tConflict);
65 public static final BasicType T_ILLEGAL = new BasicType(tIllegal);
66
67 public static int getTBoolean() {
68 return tBoolean;
69 }
70
71 public static int getTChar() {
72 return tChar;
73 }
74
75 public static int getTFloat() {
76 return tFloat;
77 }
78
79 public static int getTDouble() {
80 return tDouble;
81 }
82
83 public static int getTByte() {
84 return tByte;
85 }
116 return tNarrowOop;
117 }
118
119 public static int getTMetadata() {
120 return tMetadata;
121 }
122
123 public static int getTNarrowKlass() {
124 return tNarrowKlass;
125 }
126
127 /** For stack value type with conflicting contents */
128 public static int getTConflict() {
129 return tConflict;
130 }
131
132 public static int getTIllegal() {
133 return tIllegal;
134 }
135
136 public static BasicType charToBasicType(char c) {
137 switch( c ) {
138 case 'B': return T_BYTE;
139 case 'C': return T_CHAR;
140 case 'D': return T_DOUBLE;
141 case 'F': return T_FLOAT;
142 case 'I': return T_INT;
143 case 'J': return T_LONG;
144 case 'S': return T_SHORT;
145 case 'Z': return T_BOOLEAN;
146 case 'V': return T_VOID;
147 case 'L': return T_OBJECT;
148 case '[': return T_ARRAY;
149 }
150 return T_ILLEGAL;
151 }
152
153 public static int charToType(char c) {
154 return charToBasicType(c).getType();
155 }
156
157 public int getType() {
158 return type;
159 }
160
161 //-- Internals only below this point
162 private BasicType(int type) {
163 this.type = type;
164 }
165
166 private int type;
167 }
|
29
30 public class BasicType {
31 public static final int tBoolean = 4;
32 public static final int tChar = 5;
33 public static final int tFloat = 6;
34 public static final int tDouble = 7;
35 public static final int tByte = 8;
36 public static final int tShort = 9;
37 public static final int tInt = 10;
38 public static final int tLong = 11;
39 public static final int tObject = 12;
40 public static final int tArray = 13;
41 public static final int tVoid = 14;
42 public static final int tAddress = 15;
43 public static final int tNarrowOop = 16;
44 public static final int tMetadata = 17;
45 public static final int tNarrowKlass = 18;
46 public static final int tConflict = 19;
47 public static final int tIllegal = 99;
48
49 public static final BasicType T_BOOLEAN = new BasicType(tBoolean, "boolean");
50 public static final BasicType T_CHAR = new BasicType(tChar, "char");
51 public static final BasicType T_FLOAT = new BasicType(tFloat, "float");
52 public static final BasicType T_DOUBLE = new BasicType(tDouble, "double");
53 public static final BasicType T_BYTE = new BasicType(tByte, "byte");
54 public static final BasicType T_SHORT = new BasicType(tShort, "short");
55 public static final BasicType T_INT = new BasicType(tInt, "int");
56 public static final BasicType T_LONG = new BasicType(tLong, "long");
57 public static final BasicType T_OBJECT = new BasicType(tObject, "object");
58 public static final BasicType T_ARRAY = new BasicType(tArray, "array");
59 public static final BasicType T_VOID = new BasicType(tVoid, "void");
60 public static final BasicType T_ADDRESS = new BasicType(tAddress, "address");
61 public static final BasicType T_NARROWOOP = new BasicType(tNarrowOop, "narrow oop");
62 public static final BasicType T_METADATA = new BasicType(tMetadata, "metadata");
63 public static final BasicType T_NARROWKLASS = new BasicType(tNarrowKlass, "narrow klass");
64 public static final BasicType T_CONFLICT = new BasicType(tConflict, "conflict");
65 public static final BasicType T_ILLEGAL = new BasicType(tIllegal, "ILLEGAL TYPE");
66
67 public static int getTBoolean() {
68 return tBoolean;
69 }
70
71 public static int getTChar() {
72 return tChar;
73 }
74
75 public static int getTFloat() {
76 return tFloat;
77 }
78
79 public static int getTDouble() {
80 return tDouble;
81 }
82
83 public static int getTByte() {
84 return tByte;
85 }
116 return tNarrowOop;
117 }
118
119 public static int getTMetadata() {
120 return tMetadata;
121 }
122
123 public static int getTNarrowKlass() {
124 return tNarrowKlass;
125 }
126
127 /** For stack value type with conflicting contents */
128 public static int getTConflict() {
129 return tConflict;
130 }
131
132 public static int getTIllegal() {
133 return tIllegal;
134 }
135
136 public static BasicType intToBasicType(int i) {
137 switch(i) {
138 case tBoolean: return T_BOOLEAN;
139 case tChar: return T_CHAR;
140 case tFloat: return T_FLOAT;
141 case tDouble: return T_DOUBLE;
142 case tByte: return T_BYTE;
143 case tShort: return T_SHORT;
144 case tInt: return T_INT;
145 case tLong: return T_LONG;
146 case tObject: return T_OBJECT;
147 case tArray: return T_ARRAY;
148 case tVoid: return T_VOID;
149 case tAddress: return T_ADDRESS;
150 case tNarrowOop: return T_NARROWOOP;
151 case tMetadata: return T_METADATA;
152 case tNarrowKlass: return T_NARROWKLASS;
153 }
154
155 return T_ILLEGAL;
156 }
157
158 public static BasicType charToBasicType(char c) {
159 switch( c ) {
160 case 'B': return T_BYTE;
161 case 'C': return T_CHAR;
162 case 'D': return T_DOUBLE;
163 case 'F': return T_FLOAT;
164 case 'I': return T_INT;
165 case 'J': return T_LONG;
166 case 'S': return T_SHORT;
167 case 'Z': return T_BOOLEAN;
168 case 'V': return T_VOID;
169 case 'L': return T_OBJECT;
170 case '[': return T_ARRAY;
171 }
172 return T_ILLEGAL;
173 }
174
175 public static int charToType(char c) {
176 return charToBasicType(c).getType();
177 }
178
179 public int getType() {
180 return type;
181 }
182
183 public String getName() {
184 return name;
185 }
186
187 //-- Internals only below this point
188 private BasicType(int type, String name) {
189 this.type = type;
190 this.name = name;
191 }
192
193 private int type;
194 private String name;
195 }
|