annotate graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java @ 6328:6e66d97a16ae

Clean up Kind class.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 07 Sep 2012 12:12:47 +0200
parents 7ac010ae8c97
children 8f820c815cc2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
2 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5504
diff changeset
23 package com.oracle.graal.api.meta;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
5363
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
25 import java.lang.reflect.*;
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
26
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
27 import sun.misc.*;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
29 /**
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
30 * Denotes the basic kinds of types in CRI, including the all the Java primitive types, for example, {@link Kind#Int}
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
31 * for {@code int} and {@link Kind#Object} for all object types. A kind has a single character short name, a Java name,
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
32 * and a set of flags further describing its behavior.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33 */
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
34 public enum Kind {
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
35 /** The primitive boolean kind, represented as an int on the stack. */
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
36 Boolean('z', "boolean", true, true),
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
37
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
38 /** The primitive byte kind, represented as an int on the stack. */
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
39 Byte('b', "byte", true, true),
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
40
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
41 /** The primitive short kind, represented as an int on the stack. */
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
42 Short('s', "short", true, true),
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
43
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
44 /** The primitive char kind, represented as an int on the stack. */
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
45 Char('c', "char", true, true),
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
46
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
47 /** The primitive int kind, represented as an int on the stack. */
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
48 Int('i', "int", true, true),
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
49
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
50 /** The primitive float kind. */
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
51 Float('f', "float", true, false),
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
52
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
53 /** The primitive long kind. */
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
54 Long('j', "long", true, false),
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
55
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
56 /** The primitive double kind. */
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
57 Double('d', "double", true, false),
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
58
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
59 /** The Object kind, also used for arrays. */
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
60 Object('a', "Object", false, false),
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
61
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
62 /** The void float kind. */
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
63 Void('v', "void", false, false),
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
64
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
65 /** Denote a bytecode address in a {@code JSR} bytecode. */
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
66 Jsr('r', "jsr", false, false),
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
67
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
68 /** The non-type. */
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
69 Illegal('-', "illegal", false, false);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
70
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
71 private Kind(char ch, String name, boolean isPrimitive, boolean isStackInt) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
72 this.typeChar = ch;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
73 this.javaName = name;
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
74 this.isPrimitive = isPrimitive;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
75 this.isStackInt = isStackInt;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
76 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
77
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
78 private final boolean isStackInt;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
79 private final boolean isPrimitive;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
80
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
81 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
82 * The name of the kind as a single character.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
83 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
84 public final char typeChar;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
85
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
86 /**
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
87 * The name of this kind which will also be it Java programming language name if it is {@linkplain #isPrimitive()
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
88 * primitive} or {@code void}.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
89 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
90 public final String javaName;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
91
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
92 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
93 * Checks whether this type is valid as an {@code int} on the Java operand stack.
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
94 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
95 * @return {@code true} if this type is represented by an {@code int} on the operand stack
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
96 */
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
97 public boolean isStackInt() {
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
98 return this.isStackInt;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
99 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
100
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
101 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
102 * Checks whether this type is a Java primitive type.
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
103 *
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
104 * @return {@code true} if this is {@link #Boolean}, {@link #Byte}, {@link #Char}, {@link #Short}, {@link #Int},
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
105 * {@link #Long}, {@link #Float} or {@link #Double}.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
106 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
107 public boolean isPrimitive() {
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
108 return this.isPrimitive;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
109 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
110
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
111 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
112 * Gets the kind that represents this kind when on the Java operand stack.
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
113 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
114 * @return the kind used on the operand stack
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
115 */
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
116 public Kind stackKind() {
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
117 if (isStackInt()) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
118 return Int;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
119 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
120 return this;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
121 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
122
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
123 /**
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
124 * Returns the kind corresponding to the Java type string.
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
125 *
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
126 * @param typeString the Java type string
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
127 * @return the kind
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
128 */
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
129 public static Kind fromTypeString(String typeString) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
130 assert typeString.length() > 0;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
131 final char first = typeString.charAt(0);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
132 if (first == '[' || first == 'L') {
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
133 return Kind.Object;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
134 }
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
135 return Kind.fromPrimitiveOrVoidTypeChar(first);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
136 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
137
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
138 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
139 * Gets the kind from the character describing a primitive or void.
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
140 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
141 * @param ch the character
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
142 * @return the kind
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
143 */
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
144 public static Kind fromPrimitiveOrVoidTypeChar(char ch) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
145 switch (ch) {
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
146 case 'Z':
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
147 return Boolean;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
148 case 'C':
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
149 return Char;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
150 case 'F':
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
151 return Float;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
152 case 'D':
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
153 return Double;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
154 case 'B':
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
155 return Byte;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
156 case 'S':
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
157 return Short;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
158 case 'I':
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
159 return Int;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
160 case 'J':
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
161 return Long;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
162 case 'V':
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
163 return Void;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
164 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
165 throw new IllegalArgumentException("unknown primitive or void type character: " + ch);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
166 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
167
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
168 /**
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
169 * Returns the Java class representing this kind.
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
170 *
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
171 * @return the Java class
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
172 */
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
173 public Class< ? > toJavaClass() {
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
174 switch (this) {
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
175 case Void:
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
176 return java.lang.Void.TYPE;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
177 case Long:
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
178 return java.lang.Long.TYPE;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
179 case Int:
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
180 return java.lang.Integer.TYPE;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
181 case Byte:
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
182 return java.lang.Byte.TYPE;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
183 case Char:
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
184 return java.lang.Character.TYPE;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
185 case Double:
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
186 return java.lang.Double.TYPE;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
187 case Float:
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
188 return java.lang.Float.TYPE;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
189 case Short:
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
190 return java.lang.Short.TYPE;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
191 case Boolean:
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
192 return java.lang.Boolean.TYPE;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
193 default:
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
194 return null;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
195 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
196 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
197
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
198 /**
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
199 * Returns the Java class for instances of boxed values of this kind.
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
200 *
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
201 * @return the Java class
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
202 */
5349
077ec9468516 rename CiKind.toUnboxedJavaClass to toBoxedJavaClass
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4468
diff changeset
203 public Class< ? > toBoxedJavaClass() {
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
204 switch (this) {
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
205 case Void:
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
206 return java.lang.Void.class;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
207 case Long:
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
208 return java.lang.Long.class;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
209 case Int:
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
210 return java.lang.Integer.class;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
211 case Byte:
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
212 return java.lang.Byte.class;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
213 case Char:
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
214 return java.lang.Character.class;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
215 case Double:
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
216 return java.lang.Double.class;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
217 case Float:
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
218 return java.lang.Float.class;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
219 case Short:
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
220 return java.lang.Short.class;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
221 case Boolean:
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
222 return java.lang.Boolean.class;
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
223 default:
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
224 return null;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
225 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
226 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
227
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
228 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
229 * Checks whether this value type is void.
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
230 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
231 * @return {@code true} if this type is void
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
232 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
233 public final boolean isVoid() {
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
234 return this == Kind.Void;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
235 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
236
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
237 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
238 * Checks whether this value type is long.
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
239 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
240 * @return {@code true} if this type is long
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
241 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
242 public final boolean isLong() {
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
243 return this == Kind.Long;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
244 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
245
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
246 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
247 * Checks whether this value type is float.
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
248 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
249 * @return {@code true} if this type is float
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
250 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
251 public final boolean isFloat() {
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
252 return this == Kind.Float;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
253 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
254
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
255 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
256 * Checks whether this value type is double.
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
257 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
258 * @return {@code true} if this type is double
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
259 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
260 public final boolean isDouble() {
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
261 return this == Kind.Double;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
262 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
263
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
264 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
265 * Checks whether this value type is float or double.
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
266 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
267 * @return {@code true} if this type is float or double
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
268 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
269 public final boolean isFloatOrDouble() {
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
270 return this == Kind.Double || this == Kind.Float;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
271 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
272
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
273 /**
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
274 * Checks whether this value type is an object type.
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
275 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
276 * @return {@code true} if this type is an object
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
277 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
278 public final boolean isObject() {
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
279 return this == Kind.Object;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
280 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
281
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
282 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
283 * Checks whether this value type is an address type.
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
284 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
285 * @return {@code true} if this type is an address
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
286 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
287 public boolean isJsr() {
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
288 return this == Kind.Jsr;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
289 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
290
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
291 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
292 * Converts this value type to a string.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
293 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
294 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
295 public String toString() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
296 return javaName;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
297 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
298
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
299 /**
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
300 * Marker interface for types that should be {@linkplain Kind#format(Object) formatted} with their
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
301 * {@link Object#toString()} value.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
302 */
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
303 public interface FormatWithToString {
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
304 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
305
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
306 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
307 * Gets a formatted string for a given value of this kind.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
308 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
309 * @param value a value of this kind
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
310 * @return a formatted string for {@code value} based on this kind
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
311 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
312 public String format(Object value) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
313 if (isObject()) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
314 if (value == null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
315 return "null";
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
316 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
317 if (value instanceof String) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
318 String s = (String) value;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
319 if (s.length() > 50) {
5793
6c80d73cf81a added prefix to formatted object Constants to denote the type of the constant
Doug Simon <doug.simon@oracle.com>
parents: 5545
diff changeset
320 return "String:\"" + s.substring(0, 30) + "...\"";
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
321 } else {
5793
6c80d73cf81a added prefix to formatted object Constants to denote the type of the constant
Doug Simon <doug.simon@oracle.com>
parents: 5545
diff changeset
322 return "String:\"" + s + '"';
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
323 }
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
324 } else if (value instanceof JavaType) {
5793
6c80d73cf81a added prefix to formatted object Constants to denote the type of the constant
Doug Simon <doug.simon@oracle.com>
parents: 5545
diff changeset
325 return "JavaType:" + MetaUtil.toJavaName((JavaType) value);
6c80d73cf81a added prefix to formatted object Constants to denote the type of the constant
Doug Simon <doug.simon@oracle.com>
parents: 5545
diff changeset
326 } else if (value instanceof Enum || value instanceof FormatWithToString || value instanceof Number) {
6c80d73cf81a added prefix to formatted object Constants to denote the type of the constant
Doug Simon <doug.simon@oracle.com>
parents: 5545
diff changeset
327 return MetaUtil.getSimpleName(value.getClass(), true) + ":" + String.valueOf(value);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
328 } else if (value instanceof Class< ? >) {
5793
6c80d73cf81a added prefix to formatted object Constants to denote the type of the constant
Doug Simon <doug.simon@oracle.com>
parents: 5545
diff changeset
329 return "Class:" + ((Class< ? >) value).getName();
5363
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
330 } else if (value.getClass().isArray()) {
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
331 return formatArray(value);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
332 } else {
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
333 return MetaUtil.getSimpleName(value.getClass(), true) + "@" + System.identityHashCode(value);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
334 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
335 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
336 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
337 return value.toString();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
338 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
339 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
340
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
341 private static final int MAX_FORMAT_ARRAY_LENGTH = 5;
5363
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
342
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
343 private static String formatArray(Object array) {
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
344 Class< ? > componentType = array.getClass().getComponentType();
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
345 assert componentType != null;
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
346 int arrayLength = Array.getLength(array);
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
347 StringBuilder buf = new StringBuilder(MetaUtil.getSimpleName(componentType, true)).append('[').append(arrayLength).append("]{");
5363
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
348 int length = Math.min(MAX_FORMAT_ARRAY_LENGTH, arrayLength);
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
349 boolean primitive = componentType.isPrimitive();
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
350 for (int i = 0; i < length; i++) {
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
351 if (primitive) {
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
352 buf.append(Array.get(array, i));
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
353 } else {
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
354 Object o = ((Object[]) array)[i];
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
355 buf.append(Kind.Object.format(o));
5363
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
356 }
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
357 if (i != length - 1) {
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
358 buf.append(", ");
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
359 }
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
360 }
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
361 if (arrayLength != length) {
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
362 buf.append(", ...");
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
363 }
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
364 return buf.append('}').toString();
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
365 }
1d760684d958 expanded formatting of array CiConstants to show contents of the array
Doug Simon <doug.simon@oracle.com>
parents: 5349
diff changeset
366
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
367 /**
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
368 * The offset from the origin of an array to the first element.
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
369 *
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
370 * @return the offset in bytes
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
371 */
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
372 public final int getArrayBaseOffset() {
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
373 switch (this) {
5456
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
374 case Boolean:
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
375 return Unsafe.ARRAY_BOOLEAN_BASE_OFFSET;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
376 case Byte:
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
377 return Unsafe.ARRAY_BYTE_BASE_OFFSET;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
378 case Char:
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
379 return Unsafe.ARRAY_CHAR_BASE_OFFSET;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
380 case Short:
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
381 return Unsafe.ARRAY_SHORT_BASE_OFFSET;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
382 case Int:
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
383 return Unsafe.ARRAY_INT_BASE_OFFSET;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
384 case Long:
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
385 return Unsafe.ARRAY_LONG_BASE_OFFSET;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
386 case Float:
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
387 return Unsafe.ARRAY_FLOAT_BASE_OFFSET;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
388 case Double:
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
389 return Unsafe.ARRAY_DOUBLE_BASE_OFFSET;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
390 case Object:
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
391 return Unsafe.ARRAY_OBJECT_BASE_OFFSET;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
392 default:
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
393 assert false : "unexpected kind: " + this;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
394 return -1;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
395 }
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
396 }
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
397
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
398 /**
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
399 * The scale used for the index when accessing elements of an array of this kind.
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
400 *
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
401 * @return the scale in order to convert the index into a byte offset
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
402 */
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
403 public final int getArrayIndexScale() {
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
404 switch (this) {
5456
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
405 case Boolean:
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
406 return Unsafe.ARRAY_BOOLEAN_INDEX_SCALE;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
407 case Byte:
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
408 return Unsafe.ARRAY_BYTE_INDEX_SCALE;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
409 case Char:
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
410 return Unsafe.ARRAY_CHAR_INDEX_SCALE;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
411 case Short:
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
412 return Unsafe.ARRAY_SHORT_INDEX_SCALE;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
413 case Int:
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
414 return Unsafe.ARRAY_INT_INDEX_SCALE;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
415 case Long:
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
416 return Unsafe.ARRAY_LONG_INDEX_SCALE;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
417 case Float:
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
418 return Unsafe.ARRAY_FLOAT_INDEX_SCALE;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
419 case Double:
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
420 return Unsafe.ARRAY_DOUBLE_INDEX_SCALE;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
421 case Object:
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
422 return Unsafe.ARRAY_OBJECT_INDEX_SCALE;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
423 default:
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
424 assert false : "unexpected kind: " + this;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
425 return -1;
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
426 }
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
427 }
a5e43a18ac52 added computation of array base offset and index scaling into CiKind and used it to remove a hard coded assumption in canonicalization of LoadIndexedNode
Doug Simon <doug.simon@oracle.com>
parents: 5441
diff changeset
428
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
429 /**
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
430 * Utility function for reading a value of this kind using an object and a displacement.
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
431 *
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
432 * @param object the object from which the value is read
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
433 * @param displacement the displacement within the object in bytes
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
434 * @return the read value encapsulated in a {@link Constant} object
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
435 */
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
436 public Constant readUnsafeConstant(Object object, long displacement) {
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
437 assert object != null;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
438 Unsafe u = Unsafe.getUnsafe();
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
439 switch (this) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
440 case Boolean:
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
441 return Constant.forBoolean(u.getBoolean(object, displacement));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
442 case Byte:
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
443 return Constant.forByte(u.getByte(object, displacement));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
444 case Char:
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
445 return Constant.forChar(u.getChar(object, displacement));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
446 case Short:
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
447 return Constant.forShort(u.getShort(object, displacement));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
448 case Int:
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
449 return Constant.forInt(u.getInt(object, displacement));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
450 case Long:
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
451 return Constant.forLong(u.getLong(object, displacement));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
452 case Float:
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
453 return Constant.forFloat(u.getFloat(object, displacement));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
454 case Double:
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
455 return Constant.forDouble(u.getDouble(object, displacement));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
456 case Object:
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
457 return Constant.forObject(u.getObject(object, displacement));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
458 default:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
459 assert false : "unexpected kind: " + this;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
460 return null;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
461 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
462 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
463
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
464 /**
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
465 * The minimum value that can be represented as a value of this kind.
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
466 *
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
467 * @return the minimum value
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
468 */
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
469 public long getMinValue() {
5441
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
470 switch (this) {
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
471 case Boolean:
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
472 return 0;
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
473 case Byte:
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
474 return java.lang.Byte.MIN_VALUE;
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
475 case Char:
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
476 return java.lang.Character.MIN_VALUE;
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
477 case Short:
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
478 return java.lang.Short.MIN_VALUE;
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
479 case Jsr:
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
480 case Int:
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
481 return java.lang.Integer.MIN_VALUE;
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
482 case Long:
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
483 return java.lang.Long.MIN_VALUE;
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
484 default:
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
485 throw new IllegalArgumentException("illegal call to minValue on " + this);
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
486 }
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
487 }
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
488
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
489 /**
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
490 * The maximum value that can be represented as a value of this kind.
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
491 *
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
492 * @return the maximum value
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
493 */
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
494 public long getMaxValue() {
5441
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
495 switch (this) {
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
496 case Boolean:
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
497 return 1;
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
498 case Byte:
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
499 return java.lang.Byte.MAX_VALUE;
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
500 case Char:
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
501 return java.lang.Character.MAX_VALUE;
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
502 case Short:
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
503 return java.lang.Short.MAX_VALUE;
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
504 case Jsr:
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
505 case Int:
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
506 return java.lang.Integer.MAX_VALUE;
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
507 case Long:
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
508 return java.lang.Long.MAX_VALUE;
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
509 default:
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
510 throw new IllegalArgumentException("illegal call to maxValue on " + this);
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
511 }
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
512 }
ab31310d4af9 CiKind.minValue and CiKind.maxValue for integer types
Lukas Stadler <lukas.stadler@jku.at>
parents: 5363
diff changeset
513
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
514 /**
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
515 * Number of bits that are necessary to represent a value of this kind.
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
516 *
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
517 * @return the number of bits
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
518 */
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6313
diff changeset
519 public int getBitCount() {
5874
f0d4304243ff Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5793
diff changeset
520 switch (this) {
f0d4304243ff Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5793
diff changeset
521 case Boolean:
f0d4304243ff Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5793
diff changeset
522 return 1;
f0d4304243ff Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5793
diff changeset
523 case Byte:
f0d4304243ff Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5793
diff changeset
524 return 8;
f0d4304243ff Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5793
diff changeset
525 case Char:
f0d4304243ff Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5793
diff changeset
526 case Short:
f0d4304243ff Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5793
diff changeset
527 return 16;
f0d4304243ff Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5793
diff changeset
528 case Jsr:
f0d4304243ff Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5793
diff changeset
529 case Int:
f0d4304243ff Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5793
diff changeset
530 return 32;
f0d4304243ff Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5793
diff changeset
531 case Long:
f0d4304243ff Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5793
diff changeset
532 return 64;
f0d4304243ff Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5793
diff changeset
533 default:
f0d4304243ff Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5793
diff changeset
534 throw new IllegalArgumentException("illegal call to bits on " + this);
f0d4304243ff Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5793
diff changeset
535 }
f0d4304243ff Add intrinsics for (Long|Integer).(reverseBytes|numberOf(Trail|Lead)ingZeros)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5793
diff changeset
536 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
537 }