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