src/share/vm/c1/c1_ValueType.cpp

Wed, 31 Aug 2011 16:46:11 -0700

author
never
date
Wed, 31 Aug 2011 16:46:11 -0700
changeset 3099
c124e2e7463e
parent 2314
f95d63e2154a
child 3969
1d7922586cf6
permissions
-rw-r--r--

7083786: dead various dead chunks of code
Reviewed-by: iveresov, kvn

duke@435 1 /*
stefank@2314 2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #include "precompiled.hpp"
stefank@2314 26 #include "c1/c1_ValueType.hpp"
stefank@2314 27 #include "ci/ciArray.hpp"
stefank@2314 28 #include "ci/ciInstance.hpp"
stefank@2314 29 #include "ci/ciNullObject.hpp"
duke@435 30
duke@435 31
duke@435 32 // predefined types
duke@435 33 VoidType* voidType = NULL;
duke@435 34 IntType* intType = NULL;
duke@435 35 LongType* longType = NULL;
duke@435 36 FloatType* floatType = NULL;
duke@435 37 DoubleType* doubleType = NULL;
duke@435 38 ObjectType* objectType = NULL;
duke@435 39 ArrayType* arrayType = NULL;
duke@435 40 InstanceType* instanceType = NULL;
duke@435 41 ClassType* classType = NULL;
duke@435 42 AddressType* addressType = NULL;
duke@435 43 IllegalType* illegalType = NULL;
duke@435 44
duke@435 45
duke@435 46 // predefined constants
duke@435 47 IntConstant* intZero = NULL;
duke@435 48 IntConstant* intOne = NULL;
duke@435 49 ObjectConstant* objectNull = NULL;
duke@435 50
duke@435 51
iveresov@1939 52 void ValueType::initialize(Arena* arena) {
duke@435 53 // Note: Must initialize all types for each compilation
duke@435 54 // as they are allocated within a ResourceMark!
duke@435 55
duke@435 56 // types
iveresov@1939 57 voidType = new (arena) VoidType();
iveresov@1939 58 intType = new (arena) IntType();
iveresov@1939 59 longType = new (arena) LongType();
iveresov@1939 60 floatType = new (arena) FloatType();
iveresov@1939 61 doubleType = new (arena) DoubleType();
iveresov@1939 62 objectType = new (arena) ObjectType();
iveresov@1939 63 arrayType = new (arena) ArrayType();
iveresov@1939 64 instanceType = new (arena) InstanceType();
iveresov@1939 65 classType = new (arena) ClassType();
iveresov@1939 66 addressType = new (arena) AddressType();
iveresov@1939 67 illegalType = new (arena) IllegalType();
duke@435 68
iveresov@1939 69 intZero = new (arena) IntConstant(0);
iveresov@1939 70 intOne = new (arena) IntConstant(1);
iveresov@1939 71 objectNull = new (arena) ObjectConstant(ciNullObject::make());
duke@435 72 };
duke@435 73
duke@435 74
duke@435 75 ValueType* ValueType::meet(ValueType* y) const {
duke@435 76 // incomplete & conservative solution for now - fix this!
duke@435 77 assert(tag() == y->tag(), "types must match");
duke@435 78 return base();
duke@435 79 }
duke@435 80
duke@435 81
duke@435 82 ValueType* ValueType::join(ValueType* y) const {
duke@435 83 Unimplemented();
duke@435 84 return NULL;
duke@435 85 }
duke@435 86
duke@435 87
duke@435 88
duke@435 89 jobject ObjectType::encoding() const {
duke@435 90 assert(is_constant(), "must be");
jrose@1424 91 return constant_value()->constant_encoding();
duke@435 92 }
duke@435 93
duke@435 94 bool ObjectType::is_loaded() const {
duke@435 95 assert(is_constant(), "must be");
duke@435 96 return constant_value()->is_loaded();
duke@435 97 }
duke@435 98
duke@435 99 ciObject* ObjectConstant::constant_value() const { return _value; }
duke@435 100 ciObject* ArrayConstant::constant_value() const { return _value; }
duke@435 101 ciObject* InstanceConstant::constant_value() const { return _value; }
duke@435 102 ciObject* ClassConstant::constant_value() const { return _value; }
duke@435 103
duke@435 104
duke@435 105 ValueType* as_ValueType(BasicType type) {
duke@435 106 switch (type) {
duke@435 107 case T_VOID : return voidType;
duke@435 108 case T_BYTE : // fall through
duke@435 109 case T_CHAR : // fall through
duke@435 110 case T_SHORT : // fall through
duke@435 111 case T_BOOLEAN: // fall through
duke@435 112 case T_INT : return intType;
duke@435 113 case T_LONG : return longType;
duke@435 114 case T_FLOAT : return floatType;
duke@435 115 case T_DOUBLE : return doubleType;
duke@435 116 case T_ARRAY : return arrayType;
duke@435 117 case T_OBJECT : return objectType;
duke@435 118 case T_ADDRESS: return addressType;
duke@435 119 case T_ILLEGAL: return illegalType;
duke@435 120 }
duke@435 121 ShouldNotReachHere();
duke@435 122 return illegalType;
duke@435 123 }
duke@435 124
duke@435 125
duke@435 126 ValueType* as_ValueType(ciConstant value) {
duke@435 127 switch (value.basic_type()) {
duke@435 128 case T_BYTE : // fall through
duke@435 129 case T_CHAR : // fall through
duke@435 130 case T_SHORT : // fall through
duke@435 131 case T_BOOLEAN: // fall through
duke@435 132 case T_INT : return new IntConstant (value.as_int ());
duke@435 133 case T_LONG : return new LongConstant (value.as_long ());
duke@435 134 case T_FLOAT : return new FloatConstant (value.as_float ());
duke@435 135 case T_DOUBLE : return new DoubleConstant(value.as_double());
duke@435 136 case T_ARRAY : // fall through (ciConstant doesn't have an array accessor)
duke@435 137 case T_OBJECT : return new ObjectConstant(value.as_object());
duke@435 138 }
duke@435 139 ShouldNotReachHere();
duke@435 140 return illegalType;
duke@435 141 }
duke@435 142
duke@435 143
duke@435 144 BasicType as_BasicType(ValueType* type) {
duke@435 145 switch (type->tag()) {
duke@435 146 case voidTag: return T_VOID;
duke@435 147 case intTag: return T_INT;
duke@435 148 case longTag: return T_LONG;
duke@435 149 case floatTag: return T_FLOAT;
duke@435 150 case doubleTag: return T_DOUBLE;
duke@435 151 case objectTag: return T_OBJECT;
duke@435 152 case addressTag: return T_ADDRESS;
duke@435 153 case illegalTag: return T_ILLEGAL;
duke@435 154 }
duke@435 155 ShouldNotReachHere();
duke@435 156 return T_ILLEGAL;
duke@435 157 }

mercurial