Mercurial > hg > truffle
comparison src/share/vm/opto/escape.cpp @ 38:b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
Summary: During split unique types EA could exceed nodes limit and fail the method compilation.
Reviewed-by: rasbold
author | kvn |
---|---|
date | Thu, 06 Mar 2008 10:30:17 -0800 |
parents | a61af66fc99e |
children | 76256d272075 |
comparison
equal
deleted
inserted
replaced
37:73970d8c0b27 | 38:b789bcaf2dd9 |
---|---|
393 PhiNode *result = get_map_phi(orig_phi->_idx); | 393 PhiNode *result = get_map_phi(orig_phi->_idx); |
394 const TypePtr *atype = C->get_adr_type(alias_idx); | 394 const TypePtr *atype = C->get_adr_type(alias_idx); |
395 if (result != NULL && C->get_alias_index(result->adr_type()) == alias_idx) { | 395 if (result != NULL && C->get_alias_index(result->adr_type()) == alias_idx) { |
396 return result; | 396 return result; |
397 } | 397 } |
398 if ((int)C->unique() + 2*NodeLimitFudgeFactor > MaxNodeLimit) { | |
399 if (C->do_escape_analysis() == true && !C->failing()) { | |
400 // Retry compilation without escape analysis. | |
401 // If this is the first failure, the sentinel string will "stick" | |
402 // to the Compile object, and the C2Compiler will see it and retry. | |
403 C->record_failure(C2Compiler::retry_no_escape_analysis()); | |
404 } | |
405 return NULL; | |
406 } | |
398 | 407 |
399 orig_phi_worklist.append_if_missing(orig_phi); | 408 orig_phi_worklist.append_if_missing(orig_phi); |
400 result = PhiNode::make(orig_phi->in(0), NULL, Type::MEMORY, atype); | 409 result = PhiNode::make(orig_phi->in(0), NULL, Type::MEMORY, atype); |
401 set_map_phi(orig_phi->_idx, result); | 410 set_map_phi(orig_phi->_idx, result); |
402 igvn->set_type(result, result->bottom_type()); | 411 igvn->set_type(result, result->bottom_type()); |
440 idx = 1; | 449 idx = 1; |
441 continue; | 450 continue; |
442 } else { | 451 } else { |
443 mem = nphi; | 452 mem = nphi; |
444 } | 453 } |
454 } | |
455 if (C->failing()) { | |
456 return NULL; | |
445 } | 457 } |
446 result->set_req(idx++, mem); | 458 result->set_req(idx++, mem); |
447 } | 459 } |
448 #ifdef ASSERT | 460 #ifdef ASSERT |
449 // verify that the new Phi has an input for each input of the original | 461 // verify that the new Phi has an input for each input of the original |
669 assert (addr_t->isa_ptr() != NULL, "pointer type required."); | 681 assert (addr_t->isa_ptr() != NULL, "pointer type required."); |
670 int alias_idx = _compile->get_alias_index(addr_t->is_ptr()); | 682 int alias_idx = _compile->get_alias_index(addr_t->is_ptr()); |
671 Node *mem = find_mem(n->in(MemNode::Memory), alias_idx, igvn); | 683 Node *mem = find_mem(n->in(MemNode::Memory), alias_idx, igvn); |
672 if (mem->is_Phi()) { | 684 if (mem->is_Phi()) { |
673 mem = split_memory_phi(mem->as_Phi(), alias_idx, orig_phis, igvn); | 685 mem = split_memory_phi(mem->as_Phi(), alias_idx, orig_phis, igvn); |
686 } | |
687 if (_compile->failing()) { | |
688 return; | |
674 } | 689 } |
675 if (mem != n->in(MemNode::Memory)) | 690 if (mem != n->in(MemNode::Memory)) |
676 set_map(n->_idx, mem); | 691 set_map(n->_idx, mem); |
677 if (n->is_Load()) { | 692 if (n->is_Load()) { |
678 continue; // don't push users | 693 continue; // don't push users |
740 // a value of the instance along the chain. | 755 // a value of the instance along the chain. |
741 for (uint ni = new_index_start; ni < new_index_end; ni++) { | 756 for (uint ni = new_index_start; ni < new_index_end; ni++) { |
742 if((uint)_compile->get_general_index(ni) == i) { | 757 if((uint)_compile->get_general_index(ni) == i) { |
743 Node *m = (ni >= nmm->req()) ? nmm->empty_memory() : nmm->in(ni); | 758 Node *m = (ni >= nmm->req()) ? nmm->empty_memory() : nmm->in(ni); |
744 if (nmm->is_empty_memory(m)) { | 759 if (nmm->is_empty_memory(m)) { |
745 nmm->set_memory_at(ni, split_memory_phi(mem->as_Phi(), ni, orig_phis, igvn)); | 760 m = split_memory_phi(mem->as_Phi(), ni, orig_phis, igvn); |
761 if (_compile->failing()) { | |
762 return; | |
763 } | |
764 nmm->set_memory_at(ni, m); | |
746 } | 765 } |
747 } | 766 } |
748 } | 767 } |
749 } | 768 } |
750 } | 769 } |
879 _collecting = false; | 898 _collecting = false; |
880 | 899 |
881 // Now use the escape information to create unique types for | 900 // Now use the escape information to create unique types for |
882 // unescaped objects | 901 // unescaped objects |
883 split_unique_types(alloc_worklist); | 902 split_unique_types(alloc_worklist); |
903 if (_compile->failing()) return; | |
904 | |
905 // Clean up after split unique types. | |
906 ResourceMark rm; | |
907 PhaseRemoveUseless pru(_compile->initial_gvn(), _compile->for_igvn()); | |
884 } | 908 } |
885 | 909 |
886 Node * ConnectionGraph::skip_casts(Node *n) { | 910 Node * ConnectionGraph::skip_casts(Node *n) { |
887 while(n->Opcode() == Op_CastPP || n->Opcode() == Op_CheckCastPP) { | 911 while(n->Opcode() == Op_CastPP || n->Opcode() == Op_CheckCastPP) { |
888 n = n->in(1); | 912 n = n->in(1); |