comparison src/share/vm/code/dependencies.cpp @ 14265:3e2b76368121

Merge
author morris
date Fri, 17 Jan 2014 10:43:43 -0800
parents ce86c36b8921 3aaa4b9966f6
children cb0dc98c287d
comparison
equal deleted inserted replaced
14256:99331f31a971 14265:3e2b76368121
676 676
677 assert(result == NULL || result->is_klass() || result->is_method(), "must be"); 677 assert(result == NULL || result->is_klass() || result->is_method(), "must be");
678 return result; 678 return result;
679 } 679 }
680 680
681 /**
682 * Returns a unique identifier for each dependency argument.
683 */
684 uintptr_t Dependencies::DepStream::get_identifier(int i) {
685 if (has_oop_argument()) {
686 return (uintptr_t)(oopDesc*)argument_oop(i);
687 } else {
688 return (uintptr_t)argument(i);
689 }
690 }
691
681 oop Dependencies::DepStream::argument_oop(int i) { 692 oop Dependencies::DepStream::argument_oop(int i) {
682 oop result = recorded_oop_at(argument_index(i)); 693 oop result = recorded_oop_at(argument_index(i));
683 assert(result == NULL || result->is_oop(), "must be"); 694 assert(result == NULL || result->is_oop(), "must be");
684 return result; 695 return result;
685 } 696 }
710 721
711 // And some dependencies don't have a context type at all, 722 // And some dependencies don't have a context type at all,
712 // e.g. evol_method. 723 // e.g. evol_method.
713 return NULL; 724 return NULL;
714 } 725 }
726
727 // ----------------- DependencySignature --------------------------------------
728 bool DependencySignature::equals(const DependencySignature& sig) const {
729 if (type() != sig.type()) {
730 return false;
731 }
732
733 if (args_count() != sig.args_count()) {
734 return false;
735 }
736
737 for (int i = 0; i < sig.args_count(); i++) {
738 if (arg(i) != sig.arg(i)) {
739 return false;
740 }
741 }
742 return true;
743 }
744
745
746 // ----------------- DependencySignatureBuffer --------------------------------------
747 DependencySignatureBuffer::DependencySignatureBuffer() {
748 _signatures = NEW_RESOURCE_ARRAY(GrowableArray<DependencySignature*>*, Dependencies::TYPE_LIMIT);
749 memset(_signatures, 0, sizeof(DependencySignature*) * Dependencies::TYPE_LIMIT);
750 }
751
752 /* Check if arguments are identical. Two dependency signatures are considered
753 * identical, if the type as well as all argument identifiers are identical.
754 * If the dependency has not already been checked, the dependency signature is
755 * added to the checked dependencies of the same type. The function returns
756 * false, which causes the dependency to be checked in the caller.
757 */
758 bool DependencySignatureBuffer::add_if_missing(const DependencySignature& sig) {
759 const int index = sig.type();
760 GrowableArray<DependencySignature*>* buffer = _signatures[index];
761 if (buffer == NULL) {
762 buffer = new GrowableArray<DependencySignature*>();
763 _signatures[index] = buffer;
764 }
765
766 // Check if we have already checked the dependency
767 for (int i = 0; i < buffer->length(); i++) {
768 DependencySignature* checked_signature = buffer->at(i);
769 if (checked_signature->equals(sig)) {
770 return true;
771 }
772 }
773 buffer->append((DependencySignature*)&sig);
774 return false;
775 }
776
715 777
716 /// Checking dependencies: 778 /// Checking dependencies:
717 779
718 // This hierarchy walker inspects subtypes of a given type, 780 // This hierarchy walker inspects subtypes of a given type,
719 // trying to find a "bad" class which breaks a dependency. 781 // trying to find a "bad" class which breaks a dependency.