Mercurial > hg > truffle
comparison src/share/vm/opto/parse3.cpp @ 730:9c6be3edf0dc
6589834: deoptimization problem with -XX:+DeoptimizeALot
Summary: Relocate the stack pointer adjustment to where uncommon_trap is actually inserted for new_array.
Reviewed-by: kvn, jrose
author | cfang |
---|---|
date | Thu, 23 Apr 2009 14:04:24 -0700 |
parents | d1605aabd0a1 |
children | 8f5825e0aeaa |
comparison
equal
deleted
inserted
replaced
729:04fa5affa478 | 730:9c6be3edf0dc |
---|---|
333 | 333 |
334 kill_dead_locals(); | 334 kill_dead_locals(); |
335 | 335 |
336 const TypeKlassPtr* array_klass_type = TypeKlassPtr::make(array_klass); | 336 const TypeKlassPtr* array_klass_type = TypeKlassPtr::make(array_klass); |
337 Node* count_val = pop(); | 337 Node* count_val = pop(); |
338 Node* obj = new_array(makecon(array_klass_type), count_val); | 338 Node* obj = new_array(makecon(array_klass_type), count_val, 1); |
339 push(obj); | 339 push(obj); |
340 } | 340 } |
341 | 341 |
342 | 342 |
343 void Parse::do_newarray(BasicType elem_type) { | 343 void Parse::do_newarray(BasicType elem_type) { |
344 kill_dead_locals(); | 344 kill_dead_locals(); |
345 | 345 |
346 Node* count_val = pop(); | 346 Node* count_val = pop(); |
347 const TypeKlassPtr* array_klass = TypeKlassPtr::make(ciTypeArrayKlass::make(elem_type)); | 347 const TypeKlassPtr* array_klass = TypeKlassPtr::make(ciTypeArrayKlass::make(elem_type)); |
348 Node* obj = new_array(makecon(array_klass), count_val); | 348 Node* obj = new_array(makecon(array_klass), count_val, 1); |
349 // Push resultant oop onto stack | 349 // Push resultant oop onto stack |
350 push(obj); | 350 push(obj); |
351 } | 351 } |
352 | 352 |
353 // Expand simple expressions like new int[3][5] and new Object[2][nonConLen]. | 353 // Expand simple expressions like new int[3][5] and new Object[2][nonConLen]. |
354 // Also handle the degenerate 1-dimensional case of anewarray. | 354 // Also handle the degenerate 1-dimensional case of anewarray. |
355 Node* Parse::expand_multianewarray(ciArrayKlass* array_klass, Node* *lengths, int ndimensions) { | 355 Node* Parse::expand_multianewarray(ciArrayKlass* array_klass, Node* *lengths, int ndimensions, int nargs) { |
356 Node* length = lengths[0]; | 356 Node* length = lengths[0]; |
357 assert(length != NULL, ""); | 357 assert(length != NULL, ""); |
358 Node* array = new_array(makecon(TypeKlassPtr::make(array_klass)), length); | 358 Node* array = new_array(makecon(TypeKlassPtr::make(array_klass)), length, nargs); |
359 if (ndimensions > 1) { | 359 if (ndimensions > 1) { |
360 jint length_con = find_int_con(length, -1); | 360 jint length_con = find_int_con(length, -1); |
361 guarantee(length_con >= 0, "non-constant multianewarray"); | 361 guarantee(length_con >= 0, "non-constant multianewarray"); |
362 ciArrayKlass* array_klass_1 = array_klass->as_obj_array_klass()->element_klass()->as_array_klass(); | 362 ciArrayKlass* array_klass_1 = array_klass->as_obj_array_klass()->element_klass()->as_array_klass(); |
363 const TypePtr* adr_type = TypeAryPtr::OOPS; | 363 const TypePtr* adr_type = TypeAryPtr::OOPS; |
364 const Type* elemtype = _gvn.type(array)->is_aryptr()->elem(); | 364 const Type* elemtype = _gvn.type(array)->is_aryptr()->elem(); |
365 const intptr_t header = arrayOopDesc::base_offset_in_bytes(T_OBJECT); | 365 const intptr_t header = arrayOopDesc::base_offset_in_bytes(T_OBJECT); |
366 for (jint i = 0; i < length_con; i++) { | 366 for (jint i = 0; i < length_con; i++) { |
367 Node* elem = expand_multianewarray(array_klass_1, &lengths[1], ndimensions-1); | 367 Node* elem = expand_multianewarray(array_klass_1, &lengths[1], ndimensions-1, nargs); |
368 intptr_t offset = header + ((intptr_t)i << LogBytesPerHeapOop); | 368 intptr_t offset = header + ((intptr_t)i << LogBytesPerHeapOop); |
369 Node* eaddr = basic_plus_adr(array, offset); | 369 Node* eaddr = basic_plus_adr(array, offset); |
370 store_oop_to_array(control(), array, eaddr, adr_type, elem, elemtype, T_OBJECT); | 370 store_oop_to_array(control(), array, eaddr, adr_type, elem, elemtype, T_OBJECT); |
371 } | 371 } |
372 } | 372 } |
417 } | 417 } |
418 | 418 |
419 // Can use multianewarray instead of [a]newarray if only one dimension, | 419 // Can use multianewarray instead of [a]newarray if only one dimension, |
420 // or if all non-final dimensions are small constants. | 420 // or if all non-final dimensions are small constants. |
421 if (expand_count == 1 || (1 <= expand_count && expand_count <= expand_limit)) { | 421 if (expand_count == 1 || (1 <= expand_count && expand_count <= expand_limit)) { |
422 Node* obj = expand_multianewarray(array_klass, &length[0], ndimensions); | 422 Node* obj = expand_multianewarray(array_klass, &length[0], ndimensions, ndimensions); |
423 push(obj); | 423 push(obj); |
424 return; | 424 return; |
425 } | 425 } |
426 | 426 |
427 address fun = NULL; | 427 address fun = NULL; |