comparison src/share/vm/opto/callnode.cpp @ 247:02a35ad4adf8

6723160: Nightly failure: Error: meet not symmetric Summary: Add missing _instance_id settings and other EA fixes. Reviewed-by: rasbold
author kvn
date Wed, 16 Jul 2008 16:04:39 -0700
parents 9c2ecc2ffb12
children ab075d07f1ba
comparison
equal deleted inserted replaced
246:9b66e6287f4a 247:02a35ad4adf8
629 // instance at the specified offset. 629 // instance at the specified offset.
630 // 630 //
631 bool CallNode::may_modify(const TypePtr *addr_t, PhaseTransform *phase) { 631 bool CallNode::may_modify(const TypePtr *addr_t, PhaseTransform *phase) {
632 const TypeOopPtr *adrInst_t = addr_t->isa_oopptr(); 632 const TypeOopPtr *adrInst_t = addr_t->isa_oopptr();
633 633
634 // if not an InstPtr or not an instance type, assume the worst 634 // If not an OopPtr or not an instance type, assume the worst.
635 if (adrInst_t == NULL || !adrInst_t->is_known_instance_field()) { 635 // Note: currently this method is called only for instance types.
636 if (adrInst_t == NULL || !adrInst_t->is_known_instance()) {
636 return true; 637 return true;
637 } 638 }
638 Compile *C = phase->C; 639 // The instance_id is set only for scalar-replaceable allocations which
639 int offset = adrInst_t->offset(); 640 // are not passed as arguments according to Escape Analysis.
640 assert(adrInst_t->klass_is_exact() && offset >= 0, "should be valid offset");
641 ciKlass* adr_k = adrInst_t->klass();
642 assert(adr_k->is_loaded() &&
643 adr_k->is_java_klass() &&
644 !adr_k->is_interface(),
645 "only non-abstract classes are expected");
646
647 int base_idx = C->get_alias_index(adrInst_t);
648 int size = BytesPerLong; // If we don't know the size, assume largest.
649 if (adrInst_t->isa_instptr()) {
650 ciField* field = C->alias_type(base_idx)->field();
651 if (field != NULL) {
652 size = field->size_in_bytes();
653 }
654 } else {
655 assert(adrInst_t->isa_aryptr(), "only arrays are expected");
656 size = type2aelembytes(adr_k->as_array_klass()->element_type()->basic_type());
657 }
658
659 ciMethod * meth = is_CallStaticJava() ? as_CallStaticJava()->method() : NULL;
660 BCEscapeAnalyzer *bcea = (meth != NULL) ? meth->get_bcea() : NULL;
661
662 const TypeTuple * d = tf()->domain();
663 for (uint i = TypeFunc::Parms; i < d->cnt(); i++) {
664 const Type* t = d->field_at(i);
665 Node *arg = in(i);
666 const Type *at = phase->type(arg);
667 if (at == TypePtr::NULL_PTR || at == Type::TOP)
668 continue; // null can't affect anything
669
670 const TypeOopPtr *at_ptr = at->isa_oopptr();
671 if (!arg->is_top() && (t->isa_oopptr() != NULL ||
672 t->isa_ptr() && at_ptr != NULL)) {
673 assert(at_ptr != NULL, "expecting an OopPtr");
674 ciKlass* at_k = at_ptr->klass();
675 if ((adrInst_t->base() == at_ptr->base()) &&
676 at_k->is_loaded() &&
677 at_k->is_java_klass()) {
678 // If we have found an argument matching addr_t, check if the field
679 // at the specified offset is modified.
680 if ((at_k->is_interface() || adr_k == at_k ||
681 adr_k->is_subclass_of(at_k) && !at_ptr->klass_is_exact()) &&
682 (bcea == NULL ||
683 bcea->is_arg_modified(i - TypeFunc::Parms, offset, size))) {
684 return true;
685 }
686 }
687 }
688 }
689 return false; 641 return false;
690 } 642 }
691 643
692 // Does this call have a direct reference to n other than debug information? 644 // Does this call have a direct reference to n other than debug information?
693 bool CallNode::has_non_debug_use(Node *n) { 645 bool CallNode::has_non_debug_use(Node *n) {