8175932: Improve host instance supports
authorhseigel
Mon, 20 Mar 2017 13:05:00 -0400
changeset 48555 9c56c953d8db
parent 48554 592e22777742
child 48556 d44d912ea9bb
8175932: Improve host instance supports Reviewed-by: coleenp, mschoene Contributed-by: harold.seigel@oracle.com
src/hotspot/share/interpreter/interpreterRuntime.cpp
src/hotspot/share/oops/instanceKlass.hpp
--- a/src/hotspot/share/interpreter/interpreterRuntime.cpp	Sun Sep 03 16:08:13 2017 +0100
+++ b/src/hotspot/share/interpreter/interpreterRuntime.cpp	Mon Mar 20 13:05:00 2017 -0400
@@ -804,7 +804,7 @@
   // it is not an interface.  The receiver for invokespecial calls within interface
   // methods must be checked for every call.
   InstanceKlass* sender = pool->pool_holder();
-  sender = sender->is_anonymous() ? sender->host_klass() : sender;
+  sender = sender->has_host_klass() ? sender->host_klass() : sender;
 
   switch (info.call_kind()) {
   case CallInfo::direct_call:
--- a/src/hotspot/share/oops/instanceKlass.hpp	Sun Sep 03 16:08:13 2017 +0100
+++ b/src/hotspot/share/oops/instanceKlass.hpp	Mon Mar 20 13:05:00 2017 -0400
@@ -609,9 +609,11 @@
   InstanceKlass* host_klass() const              {
     InstanceKlass** hk = adr_host_klass();
     if (hk == NULL) {
+      assert(!is_anonymous(), "Anonymous classes have host klasses");
       return NULL;
     } else {
       assert(*hk != NULL, "host klass should always be set if the address is not null");
+      assert(is_anonymous(), "Only anonymous classes have host klasses");
       return *hk;
     }
   }
@@ -623,6 +625,9 @@
       *addr = host;
     }
   }
+  bool has_host_klass() const              {
+    return adr_host_klass() != NULL;
+  }
   bool is_anonymous() const                {
     return (_misc_flags & _misc_is_anonymous) != 0;
   }