annotate src/share/vm/ci/ciConstant.hpp @ 666:ebebd376f657

6805522: Server VM fails with assertion (block1->start() != block2->start(),"successors have unique bcis") Reviewed-by: kvn
author never
date Mon, 23 Mar 2009 13:58:58 -0700
parents a61af66fc99e
children c18cbe5936b8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright 1999-2003 Sun Microsystems, Inc. All Rights Reserved.
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 // ciConstant
a61af66fc99e Initial load
duke
parents:
diff changeset
26 //
a61af66fc99e Initial load
duke
parents:
diff changeset
27 // This class represents a constant value.
a61af66fc99e Initial load
duke
parents:
diff changeset
28 class ciConstant VALUE_OBJ_CLASS_SPEC {
a61af66fc99e Initial load
duke
parents:
diff changeset
29 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
30 friend class ciEnv;
a61af66fc99e Initial load
duke
parents:
diff changeset
31 friend class ciField;
a61af66fc99e Initial load
duke
parents:
diff changeset
32
a61af66fc99e Initial load
duke
parents:
diff changeset
33 BasicType _type;
a61af66fc99e Initial load
duke
parents:
diff changeset
34 union {
a61af66fc99e Initial load
duke
parents:
diff changeset
35 jint _int;
a61af66fc99e Initial load
duke
parents:
diff changeset
36 jlong _long;
a61af66fc99e Initial load
duke
parents:
diff changeset
37 jint _long_half[2];
a61af66fc99e Initial load
duke
parents:
diff changeset
38 jfloat _float;
a61af66fc99e Initial load
duke
parents:
diff changeset
39 jdouble _double;
a61af66fc99e Initial load
duke
parents:
diff changeset
40 ciObject* _object;
a61af66fc99e Initial load
duke
parents:
diff changeset
41 } _value;
a61af66fc99e Initial load
duke
parents:
diff changeset
42
a61af66fc99e Initial load
duke
parents:
diff changeset
43 // Implementation of the print method.
a61af66fc99e Initial load
duke
parents:
diff changeset
44 void print_impl(outputStream* st);
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
47
a61af66fc99e Initial load
duke
parents:
diff changeset
48 ciConstant() {
a61af66fc99e Initial load
duke
parents:
diff changeset
49 _type = T_ILLEGAL; _value._long = -1;
a61af66fc99e Initial load
duke
parents:
diff changeset
50 }
a61af66fc99e Initial load
duke
parents:
diff changeset
51 ciConstant(BasicType type, jint value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
52 assert(type != T_LONG && type != T_DOUBLE && type != T_FLOAT,
a61af66fc99e Initial load
duke
parents:
diff changeset
53 "using the wrong ciConstant constructor");
a61af66fc99e Initial load
duke
parents:
diff changeset
54 _type = type; _value._int = value;
a61af66fc99e Initial load
duke
parents:
diff changeset
55 }
a61af66fc99e Initial load
duke
parents:
diff changeset
56 ciConstant(jlong value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
57 _type = T_LONG; _value._long = value;
a61af66fc99e Initial load
duke
parents:
diff changeset
58 }
a61af66fc99e Initial load
duke
parents:
diff changeset
59 ciConstant(jfloat value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
60 _type = T_FLOAT; _value._float = value;
a61af66fc99e Initial load
duke
parents:
diff changeset
61 }
a61af66fc99e Initial load
duke
parents:
diff changeset
62 ciConstant(jdouble value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
63 _type = T_DOUBLE; _value._double = value;
a61af66fc99e Initial load
duke
parents:
diff changeset
64 }
a61af66fc99e Initial load
duke
parents:
diff changeset
65 ciConstant(BasicType type, ciObject* p) {
a61af66fc99e Initial load
duke
parents:
diff changeset
66 _type = type; _value._object = p;
a61af66fc99e Initial load
duke
parents:
diff changeset
67 }
a61af66fc99e Initial load
duke
parents:
diff changeset
68
a61af66fc99e Initial load
duke
parents:
diff changeset
69 BasicType basic_type() const { return _type; }
a61af66fc99e Initial load
duke
parents:
diff changeset
70
a61af66fc99e Initial load
duke
parents:
diff changeset
71 jboolean as_boolean() {
a61af66fc99e Initial load
duke
parents:
diff changeset
72 assert(basic_type() == T_BOOLEAN, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
73 return (jboolean)_value._int;
a61af66fc99e Initial load
duke
parents:
diff changeset
74 }
a61af66fc99e Initial load
duke
parents:
diff changeset
75 jchar as_char() {
a61af66fc99e Initial load
duke
parents:
diff changeset
76 assert(basic_type() == T_CHAR, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
77 return (jchar)_value._int;
a61af66fc99e Initial load
duke
parents:
diff changeset
78 }
a61af66fc99e Initial load
duke
parents:
diff changeset
79 jbyte as_byte() {
a61af66fc99e Initial load
duke
parents:
diff changeset
80 assert(basic_type() == T_BYTE, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
81 return (jbyte)_value._int;
a61af66fc99e Initial load
duke
parents:
diff changeset
82 }
a61af66fc99e Initial load
duke
parents:
diff changeset
83 jshort as_short() {
a61af66fc99e Initial load
duke
parents:
diff changeset
84 assert(basic_type() == T_SHORT, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
85 return (jshort)_value._int;
a61af66fc99e Initial load
duke
parents:
diff changeset
86 }
a61af66fc99e Initial load
duke
parents:
diff changeset
87 jint as_int() {
a61af66fc99e Initial load
duke
parents:
diff changeset
88 assert(basic_type() == T_BOOLEAN || basic_type() == T_CHAR ||
a61af66fc99e Initial load
duke
parents:
diff changeset
89 basic_type() == T_BYTE || basic_type() == T_SHORT ||
a61af66fc99e Initial load
duke
parents:
diff changeset
90 basic_type() == T_INT, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
91 return _value._int;
a61af66fc99e Initial load
duke
parents:
diff changeset
92 }
a61af66fc99e Initial load
duke
parents:
diff changeset
93 jlong as_long() {
a61af66fc99e Initial load
duke
parents:
diff changeset
94 assert(basic_type() == T_LONG, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
95 return _value._long;
a61af66fc99e Initial load
duke
parents:
diff changeset
96 }
a61af66fc99e Initial load
duke
parents:
diff changeset
97 jfloat as_float() {
a61af66fc99e Initial load
duke
parents:
diff changeset
98 assert(basic_type() == T_FLOAT, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
99 return _value._float;
a61af66fc99e Initial load
duke
parents:
diff changeset
100 }
a61af66fc99e Initial load
duke
parents:
diff changeset
101 jdouble as_double() {
a61af66fc99e Initial load
duke
parents:
diff changeset
102 assert(basic_type() == T_DOUBLE, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
103 return _value._double;
a61af66fc99e Initial load
duke
parents:
diff changeset
104 }
a61af66fc99e Initial load
duke
parents:
diff changeset
105 ciObject* as_object() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
106 assert(basic_type() == T_OBJECT || basic_type() == T_ARRAY, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
107 return _value._object;
a61af66fc99e Initial load
duke
parents:
diff changeset
108 }
a61af66fc99e Initial load
duke
parents:
diff changeset
109
a61af66fc99e Initial load
duke
parents:
diff changeset
110 // Debugging output
a61af66fc99e Initial load
duke
parents:
diff changeset
111 void print();
a61af66fc99e Initial load
duke
parents:
diff changeset
112 };