annotate src/share/vm/ci/ciConstant.hpp @ 1972:f95d63e2154a

6989984: Use standard include model for Hospot Summary: Replaced MakeDeps and the includeDB files with more standardized solutions. Reviewed-by: coleenp, kvn, kamg
author stefank
date Tue, 23 Nov 2010 13:22:55 -0800
parents c18cbe5936b8
children c124e2e7463e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef SHARE_VM_CI_CICONSTANT_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_CI_CICONSTANT_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "ci/ciClassList.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "ci/ciNullObject.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30
0
a61af66fc99e Initial load
duke
parents:
diff changeset
31 // ciConstant
a61af66fc99e Initial load
duke
parents:
diff changeset
32 //
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // This class represents a constant value.
a61af66fc99e Initial load
duke
parents:
diff changeset
34 class ciConstant VALUE_OBJ_CLASS_SPEC {
a61af66fc99e Initial load
duke
parents:
diff changeset
35 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
36 friend class ciEnv;
a61af66fc99e Initial load
duke
parents:
diff changeset
37 friend class ciField;
a61af66fc99e Initial load
duke
parents:
diff changeset
38
a61af66fc99e Initial load
duke
parents:
diff changeset
39 BasicType _type;
a61af66fc99e Initial load
duke
parents:
diff changeset
40 union {
a61af66fc99e Initial load
duke
parents:
diff changeset
41 jint _int;
a61af66fc99e Initial load
duke
parents:
diff changeset
42 jlong _long;
a61af66fc99e Initial load
duke
parents:
diff changeset
43 jint _long_half[2];
a61af66fc99e Initial load
duke
parents:
diff changeset
44 jfloat _float;
a61af66fc99e Initial load
duke
parents:
diff changeset
45 jdouble _double;
a61af66fc99e Initial load
duke
parents:
diff changeset
46 ciObject* _object;
a61af66fc99e Initial load
duke
parents:
diff changeset
47 } _value;
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // Implementation of the print method.
a61af66fc99e Initial load
duke
parents:
diff changeset
50 void print_impl(outputStream* st);
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
53
a61af66fc99e Initial load
duke
parents:
diff changeset
54 ciConstant() {
a61af66fc99e Initial load
duke
parents:
diff changeset
55 _type = T_ILLEGAL; _value._long = -1;
a61af66fc99e Initial load
duke
parents:
diff changeset
56 }
a61af66fc99e Initial load
duke
parents:
diff changeset
57 ciConstant(BasicType type, jint value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
58 assert(type != T_LONG && type != T_DOUBLE && type != T_FLOAT,
a61af66fc99e Initial load
duke
parents:
diff changeset
59 "using the wrong ciConstant constructor");
a61af66fc99e Initial load
duke
parents:
diff changeset
60 _type = type; _value._int = value;
a61af66fc99e Initial load
duke
parents:
diff changeset
61 }
a61af66fc99e Initial load
duke
parents:
diff changeset
62 ciConstant(jlong value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
63 _type = T_LONG; _value._long = value;
a61af66fc99e Initial load
duke
parents:
diff changeset
64 }
a61af66fc99e Initial load
duke
parents:
diff changeset
65 ciConstant(jfloat value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
66 _type = T_FLOAT; _value._float = value;
a61af66fc99e Initial load
duke
parents:
diff changeset
67 }
a61af66fc99e Initial load
duke
parents:
diff changeset
68 ciConstant(jdouble value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
69 _type = T_DOUBLE; _value._double = value;
a61af66fc99e Initial load
duke
parents:
diff changeset
70 }
a61af66fc99e Initial load
duke
parents:
diff changeset
71 ciConstant(BasicType type, ciObject* p) {
a61af66fc99e Initial load
duke
parents:
diff changeset
72 _type = type; _value._object = p;
a61af66fc99e Initial load
duke
parents:
diff changeset
73 }
a61af66fc99e Initial load
duke
parents:
diff changeset
74
a61af66fc99e Initial load
duke
parents:
diff changeset
75 BasicType basic_type() const { return _type; }
a61af66fc99e Initial load
duke
parents:
diff changeset
76
a61af66fc99e Initial load
duke
parents:
diff changeset
77 jboolean as_boolean() {
a61af66fc99e Initial load
duke
parents:
diff changeset
78 assert(basic_type() == T_BOOLEAN, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
79 return (jboolean)_value._int;
a61af66fc99e Initial load
duke
parents:
diff changeset
80 }
a61af66fc99e Initial load
duke
parents:
diff changeset
81 jchar as_char() {
a61af66fc99e Initial load
duke
parents:
diff changeset
82 assert(basic_type() == T_CHAR, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
83 return (jchar)_value._int;
a61af66fc99e Initial load
duke
parents:
diff changeset
84 }
a61af66fc99e Initial load
duke
parents:
diff changeset
85 jbyte as_byte() {
a61af66fc99e Initial load
duke
parents:
diff changeset
86 assert(basic_type() == T_BYTE, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
87 return (jbyte)_value._int;
a61af66fc99e Initial load
duke
parents:
diff changeset
88 }
a61af66fc99e Initial load
duke
parents:
diff changeset
89 jshort as_short() {
a61af66fc99e Initial load
duke
parents:
diff changeset
90 assert(basic_type() == T_SHORT, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
91 return (jshort)_value._int;
a61af66fc99e Initial load
duke
parents:
diff changeset
92 }
a61af66fc99e Initial load
duke
parents:
diff changeset
93 jint as_int() {
a61af66fc99e Initial load
duke
parents:
diff changeset
94 assert(basic_type() == T_BOOLEAN || basic_type() == T_CHAR ||
a61af66fc99e Initial load
duke
parents:
diff changeset
95 basic_type() == T_BYTE || basic_type() == T_SHORT ||
a61af66fc99e Initial load
duke
parents:
diff changeset
96 basic_type() == T_INT, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
97 return _value._int;
a61af66fc99e Initial load
duke
parents:
diff changeset
98 }
a61af66fc99e Initial load
duke
parents:
diff changeset
99 jlong as_long() {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 assert(basic_type() == T_LONG, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
101 return _value._long;
a61af66fc99e Initial load
duke
parents:
diff changeset
102 }
a61af66fc99e Initial load
duke
parents:
diff changeset
103 jfloat as_float() {
a61af66fc99e Initial load
duke
parents:
diff changeset
104 assert(basic_type() == T_FLOAT, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
105 return _value._float;
a61af66fc99e Initial load
duke
parents:
diff changeset
106 }
a61af66fc99e Initial load
duke
parents:
diff changeset
107 jdouble as_double() {
a61af66fc99e Initial load
duke
parents:
diff changeset
108 assert(basic_type() == T_DOUBLE, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
109 return _value._double;
a61af66fc99e Initial load
duke
parents:
diff changeset
110 }
a61af66fc99e Initial load
duke
parents:
diff changeset
111 ciObject* as_object() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
112 assert(basic_type() == T_OBJECT || basic_type() == T_ARRAY, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
113 return _value._object;
a61af66fc99e Initial load
duke
parents:
diff changeset
114 }
a61af66fc99e Initial load
duke
parents:
diff changeset
115
a61af66fc99e Initial load
duke
parents:
diff changeset
116 // Debugging output
a61af66fc99e Initial load
duke
parents:
diff changeset
117 void print();
a61af66fc99e Initial load
duke
parents:
diff changeset
118 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
119
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
120 #endif // SHARE_VM_CI_CICONSTANT_HPP