changeset 48556:9c56c953d8db

8175932: Improve host instance supports Reviewed-by: coleenp, mschoene Contributed-by: harold.seigel@oracle.com
author hseigel
date Mon, 20 Mar 2017 13:05:00 -0400
parents 592e22777742
children d44d912ea9bb
files src/hotspot/share/interpreter/interpreterRuntime.cpp src/hotspot/share/oops/instanceKlass.hpp
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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;
   }