915 (double)deps_find_witness_steps / deps_find_witness_calls,
916 deps_find_witness_recursions,
917 deps_find_witness_singles);
918 }
919 }
920 return true;
921 }
922 return false;
923 }
924 #else
925 #define count_find_witness_calls() (0)
926 #endif //PRODUCT
927
928
929 klassOop ClassHierarchyWalker::find_witness_in(KlassDepChange& changes,
930 klassOop context_type,
931 bool participants_hide_witnesses) {
932 assert(changes.involves_context(context_type), "irrelevant dependency");
933 klassOop new_type = changes.new_type();
934
935 count_find_witness_calls();
936 NOT_PRODUCT(deps_find_witness_singles++);
937
938 // Current thread must be in VM (not native mode, as in CI):
939 assert(must_be_in_vm(), "raw oops here");
940 // Must not move the class hierarchy during this check:
941 assert_locked_or_safepoint(Compile_lock);
942
943 int nof_impls = instanceKlass::cast(context_type)->nof_implementors();
944 if (nof_impls > 1) {
945 // Avoid this case: *I.m > { A.m, C }; B.m > C
946 // %%% Until this is fixed more systematically, bail out.
947 // See corresponding comment in find_witness_anywhere.
948 return context_type;
949 }
950
951 assert(!is_participant(new_type), "only old classes are participants");
952 if (participants_hide_witnesses) {
953 // If the new type is a subtype of a participant, we are done.
954 for (int i = 0; i < num_participants(); i++) {
955 klassOop part = participant(i);
|
915 (double)deps_find_witness_steps / deps_find_witness_calls,
916 deps_find_witness_recursions,
917 deps_find_witness_singles);
918 }
919 }
920 return true;
921 }
922 return false;
923 }
924 #else
925 #define count_find_witness_calls() (0)
926 #endif //PRODUCT
927
928
929 klassOop ClassHierarchyWalker::find_witness_in(KlassDepChange& changes,
930 klassOop context_type,
931 bool participants_hide_witnesses) {
932 assert(changes.involves_context(context_type), "irrelevant dependency");
933 klassOop new_type = changes.new_type();
934
935 (void)count_find_witness_calls();
936 NOT_PRODUCT(deps_find_witness_singles++);
937
938 // Current thread must be in VM (not native mode, as in CI):
939 assert(must_be_in_vm(), "raw oops here");
940 // Must not move the class hierarchy during this check:
941 assert_locked_or_safepoint(Compile_lock);
942
943 int nof_impls = instanceKlass::cast(context_type)->nof_implementors();
944 if (nof_impls > 1) {
945 // Avoid this case: *I.m > { A.m, C }; B.m > C
946 // %%% Until this is fixed more systematically, bail out.
947 // See corresponding comment in find_witness_anywhere.
948 return context_type;
949 }
950
951 assert(!is_participant(new_type), "only old classes are participants");
952 if (participants_hide_witnesses) {
953 // If the new type is a subtype of a participant, we are done.
954 for (int i = 0; i < num_participants(); i++) {
955 klassOop part = participant(i);
|