src/share/vm/c1/c1_ValueType.cpp

Fri, 04 Jun 2010 11:18:04 -0700

author
iveresov
date
Fri, 04 Jun 2010 11:18:04 -0700
changeset 1939
b812ff5abc73
parent 1907
c18cbe5936b8
child 2314
f95d63e2154a
permissions
-rw-r--r--

6958292: C1: Enable parallel compilation
Summary: Enable parallel compilation in C1
Reviewed-by: never, kvn

duke@435 1 /*
trims@1907 2 * Copyright (c) 1999, 2005, 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
duke@435 25 # include "incls/_precompiled.incl"
duke@435 26 # include "incls/_c1_ValueType.cpp.incl"
duke@435 27
duke@435 28
duke@435 29 // predefined types
duke@435 30 VoidType* voidType = NULL;
duke@435 31 IntType* intType = NULL;
duke@435 32 LongType* longType = NULL;
duke@435 33 FloatType* floatType = NULL;
duke@435 34 DoubleType* doubleType = NULL;
duke@435 35 ObjectType* objectType = NULL;
duke@435 36 ArrayType* arrayType = NULL;
duke@435 37 InstanceType* instanceType = NULL;
duke@435 38 ClassType* classType = NULL;
duke@435 39 AddressType* addressType = NULL;
duke@435 40 IllegalType* illegalType = NULL;
duke@435 41
duke@435 42
duke@435 43 // predefined constants
duke@435 44 IntConstant* intZero = NULL;
duke@435 45 IntConstant* intOne = NULL;
duke@435 46 ObjectConstant* objectNull = NULL;
duke@435 47
duke@435 48
iveresov@1939 49 void ValueType::initialize(Arena* arena) {
duke@435 50 // Note: Must initialize all types for each compilation
duke@435 51 // as they are allocated within a ResourceMark!
duke@435 52
duke@435 53 // types
iveresov@1939 54 voidType = new (arena) VoidType();
iveresov@1939 55 intType = new (arena) IntType();
iveresov@1939 56 longType = new (arena) LongType();
iveresov@1939 57 floatType = new (arena) FloatType();
iveresov@1939 58 doubleType = new (arena) DoubleType();
iveresov@1939 59 objectType = new (arena) ObjectType();
iveresov@1939 60 arrayType = new (arena) ArrayType();
iveresov@1939 61 instanceType = new (arena) InstanceType();
iveresov@1939 62 classType = new (arena) ClassType();
iveresov@1939 63 addressType = new (arena) AddressType();
iveresov@1939 64 illegalType = new (arena) IllegalType();
duke@435 65
iveresov@1939 66 intZero = new (arena) IntConstant(0);
iveresov@1939 67 intOne = new (arena) IntConstant(1);
iveresov@1939 68 objectNull = new (arena) ObjectConstant(ciNullObject::make());
duke@435 69 };
duke@435 70
duke@435 71
duke@435 72 ValueType* ValueType::meet(ValueType* y) const {
duke@435 73 // incomplete & conservative solution for now - fix this!
duke@435 74 assert(tag() == y->tag(), "types must match");
duke@435 75 return base();
duke@435 76 }
duke@435 77
duke@435 78
duke@435 79 ValueType* ValueType::join(ValueType* y) const {
duke@435 80 Unimplemented();
duke@435 81 return NULL;
duke@435 82 }
duke@435 83
duke@435 84
duke@435 85
duke@435 86 jobject ObjectType::encoding() const {
duke@435 87 assert(is_constant(), "must be");
jrose@1424 88 return constant_value()->constant_encoding();
duke@435 89 }
duke@435 90
duke@435 91 bool ObjectType::is_loaded() const {
duke@435 92 assert(is_constant(), "must be");
duke@435 93 return constant_value()->is_loaded();
duke@435 94 }
duke@435 95
duke@435 96 ciObject* ObjectConstant::constant_value() const { return _value; }
duke@435 97 ciObject* ArrayConstant::constant_value() const { return _value; }
duke@435 98 ciObject* InstanceConstant::constant_value() const { return _value; }
duke@435 99 ciObject* ClassConstant::constant_value() const { return _value; }
duke@435 100
duke@435 101
duke@435 102 ValueType* as_ValueType(BasicType type) {
duke@435 103 switch (type) {
duke@435 104 case T_VOID : return voidType;
duke@435 105 case T_BYTE : // fall through
duke@435 106 case T_CHAR : // fall through
duke@435 107 case T_SHORT : // fall through
duke@435 108 case T_BOOLEAN: // fall through
duke@435 109 case T_INT : return intType;
duke@435 110 case T_LONG : return longType;
duke@435 111 case T_FLOAT : return floatType;
duke@435 112 case T_DOUBLE : return doubleType;
duke@435 113 case T_ARRAY : return arrayType;
duke@435 114 case T_OBJECT : return objectType;
duke@435 115 case T_ADDRESS: return addressType;
duke@435 116 case T_ILLEGAL: return illegalType;
duke@435 117 }
duke@435 118 ShouldNotReachHere();
duke@435 119 return illegalType;
duke@435 120 }
duke@435 121
duke@435 122
duke@435 123 ValueType* as_ValueType(ciConstant value) {
duke@435 124 switch (value.basic_type()) {
duke@435 125 case T_BYTE : // fall through
duke@435 126 case T_CHAR : // fall through
duke@435 127 case T_SHORT : // fall through
duke@435 128 case T_BOOLEAN: // fall through
duke@435 129 case T_INT : return new IntConstant (value.as_int ());
duke@435 130 case T_LONG : return new LongConstant (value.as_long ());
duke@435 131 case T_FLOAT : return new FloatConstant (value.as_float ());
duke@435 132 case T_DOUBLE : return new DoubleConstant(value.as_double());
duke@435 133 case T_ARRAY : // fall through (ciConstant doesn't have an array accessor)
duke@435 134 case T_OBJECT : return new ObjectConstant(value.as_object());
duke@435 135 }
duke@435 136 ShouldNotReachHere();
duke@435 137 return illegalType;
duke@435 138 }
duke@435 139
duke@435 140
duke@435 141 BasicType as_BasicType(ValueType* type) {
duke@435 142 switch (type->tag()) {
duke@435 143 case voidTag: return T_VOID;
duke@435 144 case intTag: return T_INT;
duke@435 145 case longTag: return T_LONG;
duke@435 146 case floatTag: return T_FLOAT;
duke@435 147 case doubleTag: return T_DOUBLE;
duke@435 148 case objectTag: return T_OBJECT;
duke@435 149 case addressTag: return T_ADDRESS;
duke@435 150 case illegalTag: return T_ILLEGAL;
duke@435 151 }
duke@435 152 ShouldNotReachHere();
duke@435 153 return T_ILLEGAL;
duke@435 154 }

mercurial