< prev index next >

src/hotspot/share/c1/c1_GraphBuilder.cpp

Print this page

        

@@ -1955,16 +1955,15 @@
       // equal to the number of implementors for target->holder() so
       // if number of implementors of target->holder() == 1 then
       // number of implementors for decl_interface is 0 or 1. If
       // it's 0 then no class implements decl_interface and there's
       // no point in inlining.
-      ciInstanceKlass* singleton = NULL;
       ciInstanceKlass* declared_interface = callee_holder;
-      if (declared_interface->nof_implementors() == 1 &&
-          (!target->is_default_method() || target->is_overpass()) /* CHA doesn't support default methods yet. */) {
-        singleton = declared_interface->implementor();
-        assert(singleton != NULL && singleton != declared_interface, "");
+      ciInstanceKlass* singleton = declared_interface->unique_implementor();
+      if (singleton != NULL &&
+          (!target->is_default_method() || target->is_overpass()) /* CHA doesn't support default methods yet. */ ) {
+        assert(singleton != declared_interface, "not a unique implementor");
         cha_monomorphic_target = target->find_monomorphic_target(calling_klass, declared_interface, singleton);
         if (cha_monomorphic_target != NULL) {
           if (cha_monomorphic_target->holder() != compilation()->env()->Object_klass()) {
             // If CHA is able to bind this invoke then update the class
             // to match that class, otherwise klass will refer to the
< prev index next >