Mercurial > hg > graal-jvmci-8
comparison src/share/vm/graal/graalCodeInstaller.cpp @ 16580:a7d9b88ecd68
use LIRKind in graalCodeInstaller, support compressed oops in frame states
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Tue, 22 Jul 2014 15:06:15 +0200 |
parents | a2ec1ac769e4 |
children | 6bdd2ec553eb |
comparison
equal
deleted
inserted
replaced
16579:8a23eeeb7b06 | 16580:a7d9b88ecd68 |
---|---|
202 second = NULL; | 202 second = NULL; |
203 if (value == Value::ILLEGAL()) { | 203 if (value == Value::ILLEGAL()) { |
204 return new LocationValue(Location::new_stk_loc(Location::invalid, 0)); | 204 return new LocationValue(Location::new_stk_loc(Location::invalid, 0)); |
205 } | 205 } |
206 | 206 |
207 BasicType type = GraalRuntime::kindToBasicType(Kind::typeChar(Value::kind(value))); | 207 oop lirKind = Value::lirKind(value); |
208 Location::Type locationType = Location::normal; | 208 oop platformKind = LIRKind::platformKind(lirKind); |
209 if (type == T_OBJECT || type == T_ARRAY) locationType = Location::oop; | 209 jint referenceMask = LIRKind::referenceMask(lirKind); |
210 assert(referenceMask == 0 || referenceMask == 1, "unexpected referenceMask"); | |
211 bool reference = referenceMask == 1; | |
212 | |
213 BasicType type = GraalRuntime::kindToBasicType(Kind::typeChar(platformKind)); | |
210 | 214 |
211 if (value->is_a(RegisterValue::klass())) { | 215 if (value->is_a(RegisterValue::klass())) { |
212 jint number = code_Register::number(RegisterValue::reg(value)); | 216 jint number = code_Register::number(RegisterValue::reg(value)); |
213 if (number < RegisterImpl::number_of_registers) { | 217 if (number < RegisterImpl::number_of_registers) { |
214 if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BOOLEAN || type == T_BYTE || type == T_ADDRESS) { | 218 Location::Type locationType; |
219 if (type == T_INT) { | |
220 locationType = reference ? Location::narrowoop : Location::int_in_long; | |
221 } else if (type == T_FLOAT) { | |
215 locationType = Location::int_in_long; | 222 locationType = Location::int_in_long; |
216 } else if (type == T_LONG) { | 223 } else if (type == T_LONG) { |
217 locationType = Location::lng; | 224 locationType = reference ? Location::oop : Location::lng; |
218 } else { | 225 } else { |
219 assert(type == T_OBJECT || type == T_ARRAY, "unexpected type in cpu register"); | 226 assert(type == T_OBJECT && reference, "unexpected type in cpu register"); |
227 locationType = Location::oop; | |
220 } | 228 } |
221 ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, as_Register(number)->as_VMReg())); | 229 ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, as_Register(number)->as_VMReg())); |
222 if (type == T_LONG) { | 230 if (type == T_LONG && !reference) { |
223 second = value; | 231 second = value; |
224 } | 232 } |
225 return value; | 233 return value; |
226 } else { | 234 } else { |
227 assert(type == T_FLOAT || type == T_DOUBLE, "only float and double expected in xmm register"); | 235 assert(type == T_FLOAT || type == T_DOUBLE, "only float and double expected in xmm register"); |
236 Location::Type locationType; | |
228 if (type == T_FLOAT) { | 237 if (type == T_FLOAT) { |
229 // this seems weird, but the same value is used in c1_LinearScan | 238 // this seems weird, but the same value is used in c1_LinearScan |
230 locationType = Location::normal; | 239 locationType = Location::normal; |
231 } else { | 240 } else { |
232 locationType = Location::dbl; | 241 locationType = Location::dbl; |
233 } | 242 } |
234 #ifdef TARGET_ARCH_x86 | 243 #ifdef TARGET_ARCH_x86 |
235 ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, as_XMMRegister(number - 16)->as_VMReg())); | 244 ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, as_XMMRegister(number - 16)->as_VMReg())); |
236 if (type == T_DOUBLE) { | 245 if (type == T_DOUBLE && !reference) { |
237 second = value; | 246 second = value; |
238 } | 247 } |
239 return value; | 248 return value; |
240 #else | 249 #else |
241 #ifdef TARGET_ARCH_sparc | 250 #ifdef TARGET_ARCH_sparc |
242 ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, as_FloatRegister(number)->as_VMReg())); | 251 ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, as_FloatRegister(number)->as_VMReg())); |
243 if (type == T_DOUBLE) { | 252 if (type == T_DOUBLE && !reference) { |
244 second = value; | 253 second = value; |
245 } | 254 } |
246 return value; | 255 return value; |
247 #else | 256 #else |
248 ShouldNotReachHere("Platform currently does not support floating point values."); | 257 ShouldNotReachHere("Platform currently does not support floating point values."); |
249 #endif | 258 #endif |
250 #endif | 259 #endif |
251 } | 260 } |
252 } else if (value->is_a(StackSlot::klass())) { | 261 } else if (value->is_a(StackSlot::klass())) { |
253 if (type == T_DOUBLE) { | 262 Location::Type locationType; |
263 if (type == T_LONG) { | |
264 locationType = reference ? Location::oop : Location::lng; | |
265 } else if (type == T_INT) { | |
266 locationType = reference ? Location::narrowoop : Location::normal; | |
267 } else if (type == T_FLOAT) { | |
268 locationType = Location::normal; | |
269 } else if (type == T_DOUBLE) { | |
254 locationType = Location::dbl; | 270 locationType = Location::dbl; |
255 } else if (type == T_LONG) { | 271 } else { |
256 locationType = Location::lng; | 272 assert(type == T_OBJECT && reference, "unexpected type in stack slot"); |
273 locationType = Location::oop; | |
257 } | 274 } |
258 jint offset = StackSlot::offset(value); | 275 jint offset = StackSlot::offset(value); |
259 if (StackSlot::addFrameSize(value)) { | 276 if (StackSlot::addFrameSize(value)) { |
260 offset += total_frame_size; | 277 offset += total_frame_size; |
261 } | 278 } |
262 ScopeValue* value = new LocationValue(Location::new_stk_loc(locationType, offset)); | 279 ScopeValue* value = new LocationValue(Location::new_stk_loc(locationType, offset)); |
263 if (type == T_DOUBLE || type == T_LONG) { | 280 if (type == T_DOUBLE || (type == T_LONG && !reference)) { |
264 second = value; | 281 second = value; |
265 } | 282 } |
266 return value; | 283 return value; |
267 } else if (value->is_a(Constant::klass())){ | 284 } else if (value->is_a(Constant::klass())){ |
268 record_metadata_in_constant(value, oop_recorder); | 285 record_metadata_in_constant(value, oop_recorder); |
269 if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BOOLEAN || type == T_BYTE) { | 286 if (value->is_a(PrimitiveConstant::klass())) { |
270 jint prim = (jint)PrimitiveConstant::primitive(value); | 287 assert(!reference, "unexpected primitive constant type"); |
271 return new ConstantIntValue(prim); | 288 if (type == T_INT || type == T_FLOAT) { |
272 } else if (type == T_LONG || type == T_DOUBLE) { | 289 jint prim = (jint)PrimitiveConstant::primitive(value); |
273 jlong prim = PrimitiveConstant::primitive(value); | 290 return new ConstantIntValue(prim); |
274 second = new ConstantIntValue(0); | 291 } else { |
275 return new ConstantLongValue(prim); | 292 assert(type == T_LONG || type == T_DOUBLE, "unexpected primitive constant type"); |
276 } else if (type == T_OBJECT) { | 293 jlong prim = PrimitiveConstant::primitive(value); |
294 second = new ConstantIntValue(0); | |
295 return new ConstantLongValue(prim); | |
296 } | |
297 } else { | |
298 assert(reference, "unexpected object constant type"); | |
277 if (value->is_a(NullConstant::klass())) { | 299 if (value->is_a(NullConstant::klass())) { |
278 return new ConstantOopWriteValue(NULL); | 300 return new ConstantOopWriteValue(NULL); |
279 } else { | 301 } else { |
302 assert(value->is_a(HotSpotObjectConstant::klass()), "unexpected constant type"); | |
280 oop obj = HotSpotObjectConstant::object(value); | 303 oop obj = HotSpotObjectConstant::object(value); |
281 assert(obj != NULL, "null value must be in NullConstant"); | 304 assert(obj != NULL, "null value must be in NullConstant"); |
282 return new ConstantOopWriteValue(JNIHandles::make_local(obj)); | 305 return new ConstantOopWriteValue(JNIHandles::make_local(obj)); |
283 } | 306 } |
284 } else if (type == T_ADDRESS) { | 307 } |
285 ShouldNotReachHere(); | |
286 } | |
287 tty->print("%i", type); | |
288 } else if (value->is_a(VirtualObject::klass())) { | 308 } else if (value->is_a(VirtualObject::klass())) { |
289 oop type = VirtualObject::type(value); | 309 oop type = VirtualObject::type(value); |
290 int id = VirtualObject::id(value); | 310 int id = VirtualObject::id(value); |
291 oop javaMirror = HotSpotResolvedObjectType::javaClass(type); | 311 oop javaMirror = HotSpotResolvedObjectType::javaClass(type); |
292 Klass* klass = java_lang_Class::as_Klass(javaMirror); | 312 Klass* klass = java_lang_Class::as_Klass(javaMirror); |