Merge
authorcoleenp
Mon, 26 Oct 2015 20:07:50 +0100
changeset 33603 450d454670a7
parent 33601 9d0838128dd9 (current diff)
parent 33602 16053580a684 (diff)
child 33604 ad1cd9269bd4
Merge
--- a/hotspot/src/cpu/aarch64/vm/methodHandles_aarch64.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/cpu/aarch64/vm/methodHandles_aarch64.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -62,7 +62,7 @@
 void MethodHandles::verify_klass(MacroAssembler* _masm,
                                  Register obj, SystemDictionary::WKID klass_id,
                                  const char* error_message) {
-  Klass** klass_addr = SystemDictionary::well_known_klass_addr(klass_id);
+  InstanceKlass** klass_addr = SystemDictionary::well_known_klass_addr(klass_id);
   KlassHandle klass = SystemDictionary::well_known_klass(klass_id);
   Register temp = rscratch2;
   Register temp2 = rscratch1; // used by MacroAssembler::cmpptr
--- a/hotspot/src/cpu/ppc/vm/methodHandles_ppc.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/cpu/ppc/vm/methodHandles_ppc.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -73,7 +73,7 @@
                                  Register obj_reg, SystemDictionary::WKID klass_id,
                                  Register temp_reg, Register temp2_reg,
                                  const char* error_message) {
-  Klass** klass_addr = SystemDictionary::well_known_klass_addr(klass_id);
+  InstanceKlass** klass_addr = SystemDictionary::well_known_klass_addr(klass_id);
   KlassHandle klass = SystemDictionary::well_known_klass(klass_id);
   Label L_ok, L_bad;
   BLOCK_COMMENT("verify_klass {");
--- a/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -69,7 +69,7 @@
                                  Register obj_reg, SystemDictionary::WKID klass_id,
                                  Register temp_reg, Register temp2_reg,
                                  const char* error_message) {
-  Klass** klass_addr = SystemDictionary::well_known_klass_addr(klass_id);
+  InstanceKlass** klass_addr = SystemDictionary::well_known_klass_addr(klass_id);
   KlassHandle klass = SystemDictionary::well_known_klass(klass_id);
   bool did_save = false;
   if (temp_reg == noreg || temp2_reg == noreg) {
--- a/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -63,7 +63,7 @@
 void MethodHandles::verify_klass(MacroAssembler* _masm,
                                  Register obj, SystemDictionary::WKID klass_id,
                                  const char* error_message) {
-  Klass** klass_addr = SystemDictionary::well_known_klass_addr(klass_id);
+  InstanceKlass** klass_addr = SystemDictionary::well_known_klass_addr(klass_id);
   KlassHandle klass = SystemDictionary::well_known_klass(klass_id);
   Register temp = rdi;
   Register temp2 = noreg;
--- a/hotspot/src/share/vm/ci/ciInstanceKlass.hpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/ci/ciInstanceKlass.hpp	Mon Oct 26 20:07:50 2015 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -81,7 +81,7 @@
   ciInstanceKlass(ciSymbol* name, jobject loader, jobject protection_domain);
 
   InstanceKlass* get_instanceKlass() const {
-    return (InstanceKlass*)get_Klass();
+    return InstanceKlass::cast(get_Klass());
   }
 
   oop loader();
--- a/hotspot/src/share/vm/ci/ciMethod.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/ci/ciMethod.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -745,7 +745,7 @@
 #ifndef PRODUCT
   if (TraceDependencies && target() != NULL && target() != root_m->get_Method()) {
     tty->print("found a non-root unique target method");
-    tty->print_cr("  context = %s", InstanceKlass::cast(actual_recv->get_Klass())->external_name());
+    tty->print_cr("  context = %s", actual_recv->get_Klass()->external_name());
     tty->print("  method  = ");
     target->print_short_name(tty);
     tty->cr();
--- a/hotspot/src/share/vm/ci/ciReplay.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/ci/ciReplay.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -530,15 +530,15 @@
     if (_imethod != NULL) {
       return; // Replay Inlining
     }
-    Klass* k = method->method_holder();
-    ((InstanceKlass*)k)->initialize(THREAD);
+    InstanceKlass* ik = method->method_holder();
+    ik->initialize(THREAD);
     if (HAS_PENDING_EXCEPTION) {
       oop throwable = PENDING_EXCEPTION;
       java_lang_Throwable::print(throwable, tty);
       tty->cr();
       if (ReplayIgnoreInitErrors) {
         CLEAR_PENDING_EXCEPTION;
-        ((InstanceKlass*)k)->set_init_state(InstanceKlass::fully_initialized);
+        ik->set_init_state(InstanceKlass::fully_initialized);
       } else {
         return;
       }
@@ -842,7 +842,7 @@
       } else if (field_signature[0] == 'L') {
         Symbol* klass_name = SymbolTable::lookup(field_signature, (int)strlen(field_signature), CHECK);
         KlassHandle kelem = resolve_klass(field_signature, CHECK);
-        oop value = ((InstanceKlass*)kelem())->allocate_instance(CHECK);
+        oop value = InstanceKlass::cast(kelem())->allocate_instance(CHECK);
         java_mirror->obj_field_put(fd.offset(), value);
       } else {
         report_error("unhandled staticfield");
--- a/hotspot/src/share/vm/classfile/bytecodeAssembler.hpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/classfile/bytecodeAssembler.hpp	Mon Oct 26 20:07:50 2015 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -140,7 +140,7 @@
   BytecodeCPEntry const& at(u2 index) const { return _entries.at(index); }
 
   InstanceKlass* pool_holder() const {
-    return InstanceKlass::cast(_orig->pool_holder());
+    return _orig->pool_holder();
   }
 
   u2 utf8(Symbol* sym) {
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -822,7 +822,7 @@
       debug_only(No_Safepoint_Verifier nsv;)
       for (index = 0; index < length; index++) {
         Klass* k = _local_interfaces->at(index);
-        Symbol* name = InstanceKlass::cast(k)->name();
+        Symbol* name = k->name();
         // If no duplicates, add (name, NULL) in hashtable interface_names.
         if (!put_after_lookup(name, NULL, interface_names)) {
           dup = true;
@@ -4315,13 +4315,13 @@
         if (caller != NULL) {
           tty->print("[Loaded %s by instance of %s]\n",
                      this_klass->external_name(),
-                     InstanceKlass::cast(caller)->external_name());
+                     caller->external_name());
         } else {
           tty->print("[Loaded %s]\n", this_klass->external_name());
         }
       } else {
         tty->print("[Loaded %s from %s]\n", this_klass->external_name(),
-                   InstanceKlass::cast(class_loader->klass())->external_name());
+                   class_loader->klass()->external_name());
       }
     }
 
@@ -4330,7 +4330,7 @@
       // print out the superclass.
       const char * from = this_klass()->external_name();
       if (this_klass->java_super() != NULL) {
-        tty->print("RESOLVE %s %s (super)\n", from, InstanceKlass::cast(this_klass->java_super())->external_name());
+        tty->print("RESOLVE %s %s (super)\n", from, this_klass->java_super()->external_name());
       }
       // print out each of the interface classes referred to by this class.
       Array<Klass*>* local_interfaces = this_klass->local_interfaces();
@@ -4338,8 +4338,7 @@
         int length = local_interfaces->length();
         for (int i = 0; i < length; i++) {
           Klass* k = local_interfaces->at(i);
-          InstanceKlass* to_class = InstanceKlass::cast(k);
-          const char * to = to_class->external_name();
+          const char * to = k->external_name();
           tty->print("RESOLVE %s %s (interface)\n", from, to);
         }
       }
@@ -4687,7 +4686,7 @@
       vmSymbols::java_lang_IllegalAccessError(),
       "class %s cannot access its superclass %s",
       this_klass->external_name(),
-      InstanceKlass::cast(super)->external_name()
+      super->external_name()
     );
     return;
   }
@@ -4707,7 +4706,7 @@
         vmSymbols::java_lang_IllegalAccessError(),
         "class %s cannot access its superinterface %s",
         this_klass->external_name(),
-        InstanceKlass::cast(k)->external_name()
+        k->external_name()
       );
       return;
     }
--- a/hotspot/src/share/vm/classfile/dictionary.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/classfile/dictionary.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -78,7 +78,7 @@
 
 bool DictionaryEntry::contains_protection_domain(oop protection_domain) const {
 #ifdef ASSERT
-  if (protection_domain == InstanceKlass::cast(klass())->protection_domain()) {
+  if (protection_domain == klass()->protection_domain()) {
     // Ensure this doesn't show up in the pd_set (invariant)
     bool in_pd_set = false;
     for (ProtectionDomainEntry* current = _pd_set;
@@ -96,7 +96,7 @@
   }
 #endif /* ASSERT */
 
-  if (protection_domain == InstanceKlass::cast(klass())->protection_domain()) {
+  if (protection_domain == klass()->protection_domain()) {
     // Succeeds trivially
     return true;
   }
@@ -275,7 +275,7 @@
                           probe != NULL;
                           probe = probe->next()) {
       Klass* k = probe->klass();
-      if (probe->loader_data() == InstanceKlass::cast(k)->class_loader_data()) {
+      if (probe->loader_data() == k->class_loader_data()) {
         f(k);
       }
     }
@@ -290,7 +290,7 @@
                           probe != NULL;
                           probe = probe->next()) {
       Klass* k = probe->klass();
-      if (probe->loader_data() == InstanceKlass::cast(k)->class_loader_data()) {
+      if (probe->loader_data() == k->class_loader_data()) {
         f(k, CHECK);
       }
     }
@@ -322,7 +322,7 @@
                           probe != NULL;
                           probe = probe->next()) {
       Klass* k = probe->klass();
-      if (probe->loader_data() == InstanceKlass::cast(k)->class_loader_data()) {
+      if (probe->loader_data() == k->class_loader_data()) {
         // only take klass is we have the entry with the defining class loader
         InstanceKlass::cast(k)->methods_do(f);
       }
@@ -476,7 +476,7 @@
     DictionaryEntry* p = master_list;
     master_list = master_list->next();
     p->set_next(NULL);
-    Symbol* class_name = InstanceKlass::cast((Klass*)(p->klass()))->name();
+    Symbol* class_name = p->klass()->name();
     // Since the null class loader data isn't copied to the CDS archive,
     // compute the hash with NULL for loader data.
     unsigned int hash = compute_hash(class_name, NULL);
@@ -723,7 +723,7 @@
       Klass* e = probe->klass();
       ClassLoaderData* loader_data =  probe->loader_data();
       bool is_defining_class =
-         (loader_data == InstanceKlass::cast(e)->class_loader_data());
+         (loader_data == e->class_loader_data());
       tty->print("%s%s", ((!details) || is_defining_class) ? " " : "^",
                    e->external_name());
 
--- a/hotspot/src/share/vm/classfile/dictionary.hpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/classfile/dictionary.hpp	Mon Oct 26 20:07:50 2015 +0100
@@ -323,8 +323,7 @@
 
   bool equals(Symbol* class_name, ClassLoaderData* loader_data) const {
     Klass* klass = (Klass*)literal();
-    return (InstanceKlass::cast(klass)->name() == class_name &&
-            _loader_data == loader_data);
+    return (klass->name() == class_name && _loader_data == loader_data);
   }
 
   void print() {
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -114,17 +114,17 @@
 // Helpful routine for computing field offsets at run time rather than hardcoding them
 static void
 compute_offset(int &dest_offset,
-               Klass* klass_oop, Symbol* name_symbol, Symbol* signature_symbol,
+               Klass* klass, Symbol* name_symbol, Symbol* signature_symbol,
                bool is_static = false, bool allow_super = false) {
   fieldDescriptor fd;
-  InstanceKlass* ik = InstanceKlass::cast(klass_oop);
+  InstanceKlass* ik = InstanceKlass::cast(klass);
   if (!find_field(ik, name_symbol, signature_symbol, &fd, is_static, allow_super)) {
     ResourceMark rm;
     tty->print_cr("Invalid layout of %s at %s", ik->external_name(), name_symbol->as_C_string());
 #ifndef PRODUCT
-    klass_oop->print();
+    ik->print();
     tty->print_cr("all fields:");
-    for (AllFieldStream fs(InstanceKlass::cast(klass_oop)); !fs.done(); fs.next()) {
+    for (AllFieldStream fs(ik); !fs.done(); fs.next()) {
       tty->print_cr("  name: %s, sig: %s, flags: %08x", fs.name()->as_C_string(), fs.signature()->as_C_string(), fs.access_flags().as_int());
     }
 #endif //PRODUCT
@@ -136,10 +136,10 @@
 // Same as above but for "optional" offsets that might not be present in certain JDK versions
 static void
 compute_optional_offset(int& dest_offset,
-                        Klass* klass_oop, Symbol* name_symbol, Symbol* signature_symbol,
+                        Klass* klass, Symbol* name_symbol, Symbol* signature_symbol,
                         bool allow_super = false) {
   fieldDescriptor fd;
-  InstanceKlass* ik = InstanceKlass::cast(klass_oop);
+  InstanceKlass* ik = InstanceKlass::cast(klass);
   if (find_field(ik, name_symbol, signature_symbol, &fd, allow_super)) {
     dest_offset = fd.offset();
   }
@@ -174,7 +174,7 @@
   // Create the String object first, so there's a chance that the String
   // and the char array it points to end up in the same cache line.
   oop obj;
-  obj = InstanceKlass::cast(SystemDictionary::String_klass())->allocate_instance(CHECK_NH);
+  obj = SystemDictionary::String_klass()->allocate_instance(CHECK_NH);
 
   // Create the char array.  The String object must be handlized here
   // because GC can happen as a result of the allocation attempt.
@@ -1236,7 +1236,7 @@
 }
 
 oop java_lang_Throwable::unassigned_stacktrace() {
-  InstanceKlass* ik = InstanceKlass::cast(SystemDictionary::Throwable_klass());
+  InstanceKlass* ik = SystemDictionary::Throwable_klass();
   address addr = ik->static_field_addr(static_unassigned_stacktrace_offset);
   if (UseCompressedOops) {
     return oopDesc::load_decode_heap_oop((narrowOop *)addr);
@@ -1293,7 +1293,7 @@
   ResourceMark rm;
   Klass* k = throwable->klass();
   assert(k != NULL, "just checking");
-  st->print("%s", InstanceKlass::cast(k)->external_name());
+  st->print("%s", k->external_name());
   oop msg = message(throwable);
   if (msg != NULL) {
     st->print(": %s", java_lang_String::as_utf8_string(msg));
@@ -1305,7 +1305,7 @@
   ResourceMark rm;
   Klass* k = throwable->klass();
   assert(k != NULL, "just checking");
-  st->print("%s", InstanceKlass::cast(k)->external_name());
+  st->print("%s", k->external_name());
   oop msg = message(throwable);
   if (msg != NULL) {
     st->print(": %s", java_lang_String::as_utf8_string(msg));
@@ -2663,13 +2663,13 @@
 
 // Support for java_lang_ref_Reference
 HeapWord *java_lang_ref_Reference::pending_list_lock_addr() {
-  InstanceKlass* ik = InstanceKlass::cast(SystemDictionary::Reference_klass());
+  InstanceKlass* ik = SystemDictionary::Reference_klass();
   address addr = ik->static_field_addr(static_lock_offset);
   return (HeapWord*) addr;
 }
 
 oop java_lang_ref_Reference::pending_list_lock() {
-  InstanceKlass* ik = InstanceKlass::cast(SystemDictionary::Reference_klass());
+  InstanceKlass* ik = SystemDictionary::Reference_klass();
   address addr = ik->static_field_addr(static_lock_offset);
   if (UseCompressedOops) {
     return oopDesc::load_decode_heap_oop((narrowOop *)addr);
@@ -2679,7 +2679,7 @@
 }
 
 HeapWord *java_lang_ref_Reference::pending_list_addr() {
-  InstanceKlass* ik = InstanceKlass::cast(SystemDictionary::Reference_klass());
+  InstanceKlass* ik = SystemDictionary::Reference_klass();
   address addr = ik->static_field_addr(static_pending_offset);
   // XXX This might not be HeapWord aligned, almost rather be char *.
   return (HeapWord*)addr;
@@ -2702,13 +2702,13 @@
 }
 
 jlong java_lang_ref_SoftReference::clock() {
-  InstanceKlass* ik = InstanceKlass::cast(SystemDictionary::SoftReference_klass());
+  InstanceKlass* ik = SystemDictionary::SoftReference_klass();
   jlong* offset = (jlong*)ik->static_field_addr(static_clock_offset);
   return *offset;
 }
 
 void java_lang_ref_SoftReference::set_clock(jlong value) {
-  InstanceKlass* ik = InstanceKlass::cast(SystemDictionary::SoftReference_klass());
+  InstanceKlass* ik = SystemDictionary::SoftReference_klass();
   jlong* offset = (jlong*)ik->static_field_addr(static_clock_offset);
   *offset = value;
 }
@@ -3033,7 +3033,7 @@
 void java_security_AccessControlContext::compute_offsets() {
   assert(_isPrivileged_offset == 0, "offsets should be initialized only once");
   fieldDescriptor fd;
-  InstanceKlass* ik = InstanceKlass::cast(SystemDictionary::AccessControlContext_klass());
+  InstanceKlass* ik = SystemDictionary::AccessControlContext_klass();
 
   if (!ik->find_local_field(vmSymbols::context_name(), vmSymbols::protectiondomain_signature(), &fd)) {
     fatal("Invalid layout of java.security.AccessControlContext");
@@ -3066,9 +3066,9 @@
 oop java_security_AccessControlContext::create(objArrayHandle context, bool isPrivileged, Handle privileged_context, TRAPS) {
   assert(_isPrivileged_offset != 0, "offsets should have been initialized");
   // Ensure klass is initialized
-  InstanceKlass::cast(SystemDictionary::AccessControlContext_klass())->initialize(CHECK_0);
+  SystemDictionary::AccessControlContext_klass()->initialize(CHECK_0);
   // Allocate result
-  oop result = InstanceKlass::cast(SystemDictionary::AccessControlContext_klass())->allocate_instance(CHECK_0);
+  oop result = SystemDictionary::AccessControlContext_klass()->allocate_instance(CHECK_0);
   // Fill in values
   result->obj_field_put(_context_offset, context());
   result->obj_field_put(_privilegedContext_offset, privileged_context());
@@ -3190,7 +3190,7 @@
 
 
 bool java_lang_System::has_security_manager() {
-  InstanceKlass* ik = InstanceKlass::cast(SystemDictionary::System_klass());
+  InstanceKlass* ik = SystemDictionary::System_klass();
   address addr = ik->static_field_addr(static_security_offset);
   if (UseCompressedOops) {
     return oopDesc::load_decode_heap_oop((narrowOop *)addr) != NULL;
@@ -3630,8 +3630,8 @@
 #endif // PRODUCT
 
 int InjectedField::compute_offset() {
-  Klass* klass_oop = klass();
-  for (AllFieldStream fs(InstanceKlass::cast(klass_oop)); !fs.done(); fs.next()) {
+  InstanceKlass* ik = InstanceKlass::cast(klass());
+  for (AllFieldStream fs(ik); !fs.done(); fs.next()) {
     if (!may_be_java && !fs.access_flags().is_internal()) {
       // Only look at injected fields
       continue;
@@ -3641,11 +3641,11 @@
     }
   }
   ResourceMark rm;
-  tty->print_cr("Invalid layout of %s at %s/%s%s", InstanceKlass::cast(klass_oop)->external_name(), name()->as_C_string(), signature()->as_C_string(), may_be_java ? " (may_be_java)" : "");
+  tty->print_cr("Invalid layout of %s at %s/%s%s", ik->external_name(), name()->as_C_string(), signature()->as_C_string(), may_be_java ? " (may_be_java)" : "");
 #ifndef PRODUCT
-  klass_oop->print();
+  ik->print();
   tty->print_cr("all fields:");
-  for (AllFieldStream fs(InstanceKlass::cast(klass_oop)); !fs.done(); fs.next()) {
+  for (AllFieldStream fs(ik); !fs.done(); fs.next()) {
     tty->print_cr("  name: %s, sig: %s, flags: %08x", fs.name()->as_C_string(), fs.signature()->as_C_string(), fs.access_flags().as_int());
   }
 #endif //PRODUCT
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -88,10 +88,10 @@
 
 oop         SystemDictionary::_system_loader_lock_obj     =  NULL;
 
-Klass*      SystemDictionary::_well_known_klasses[SystemDictionary::WKID_LIMIT]
+InstanceKlass*      SystemDictionary::_well_known_klasses[SystemDictionary::WKID_LIMIT]
                                                           =  { NULL /*, NULL...*/ };
 
-Klass*      SystemDictionary::_box_klasses[T_VOID+1]      =  { NULL /*, NULL...*/ };
+InstanceKlass*      SystemDictionary::_box_klasses[T_VOID+1]      =  { NULL /*, NULL...*/ };
 
 oop         SystemDictionary::_java_system_loader         =  NULL;
 
@@ -99,7 +99,7 @@
 bool        SystemDictionary::_has_checkPackageAccess     =  false;
 
 // lazily initialized klass variables
-Klass* volatile SystemDictionary::_abstract_ownable_synchronizer_klass = NULL;
+InstanceKlass* volatile SystemDictionary::_abstract_ownable_synchronizer_klass = NULL;
 
 
 // ----------------------------------------------------------------------------
@@ -357,7 +357,7 @@
     // so we don't throw an exception here.
     // see: nsk redefclass014 & java.lang.instrument Instrument032
     if ((childk != NULL ) && (is_superclass) &&
-       ((quicksuperk = InstanceKlass::cast(childk)->super()) != NULL) &&
+       ((quicksuperk = childk->super()) != NULL) &&
 
          ((quicksuperk->name() == class_name) &&
             (quicksuperk->class_loader()  == class_loader()))) {
@@ -1257,8 +1257,7 @@
     }
 
     // notify a class loaded from shared object
-    ClassLoadingService::notify_class_loaded(InstanceKlass::cast(ik()),
-                                             true /* shared class */);
+    ClassLoadingService::notify_class_loaded(ik(), true /* shared class */);
   }
   return ik;
 }
@@ -1805,7 +1804,7 @@
     Klass* k = resolve_or_fail(vmSymbols::java_util_concurrent_locks_AbstractOwnableSynchronizer(), true, CHECK);
     // Force a fence to prevent any read before the write completes
     OrderAccess::fence();
-    _abstract_ownable_synchronizer_klass = k;
+    _abstract_ownable_synchronizer_klass = InstanceKlass::cast(k);
   }
 }
 
@@ -1846,14 +1845,16 @@
   int  info = wk_init_info[id - FIRST_WKID];
   int  sid  = (info >> CEIL_LG_OPTION_LIMIT);
   Symbol* symbol = vmSymbols::symbol_at((vmSymbols::SID)sid);
-  Klass**    klassp = &_well_known_klasses[id];
+  InstanceKlass** klassp = &_well_known_klasses[id];
   bool must_load = (init_opt < SystemDictionary::Opt);
   if ((*klassp) == NULL) {
+    Klass* k;
     if (must_load) {
-      (*klassp) = resolve_or_fail(symbol, true, CHECK_0); // load required class
+      k = resolve_or_fail(symbol, true, CHECK_0); // load required class
     } else {
-      (*klassp) = resolve_or_null(symbol,       CHECK_0); // load optional klass
+      k = resolve_or_null(symbol,       CHECK_0); // load optional klass
     }
+    (*klassp) = (k == NULL) ? NULL : InstanceKlass::cast(k);
   }
   return ((*klassp) != NULL);
 }
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp	Mon Oct 26 20:07:50 2015 +0100
@@ -403,15 +403,15 @@
   static void initialize(TRAPS);
 
   // Fast access to commonly used classes (preloaded)
-  static Klass* check_klass(Klass* k) {
+  static InstanceKlass* check_klass(InstanceKlass* k) {
     assert(k != NULL, "preloaded klass not initialized");
     return k;
   }
 
-  static Klass* check_klass_Pre(       Klass* k) { return check_klass(k); }
-  static Klass* check_klass_Opt(       Klass* k) { return k; }
+  static InstanceKlass* check_klass_Pre(InstanceKlass* k) { return check_klass(k); }
+  static InstanceKlass* check_klass_Opt(InstanceKlass* k) { return k; }
 
-  JVMCI_ONLY(static Klass* check_klass_Jvmci(Klass* k) { return k; })
+  JVMCI_ONLY(static InstanceKlass* check_klass_Jvmci(InstanceKlass* k) { return k; })
 
   static bool initialize_wk_klass(WKID id, int init_opt, TRAPS);
   static void initialize_wk_klasses_until(WKID limit_id, WKID &start_id, TRAPS);
@@ -422,19 +422,19 @@
 
 public:
   #define WK_KLASS_DECLARE(name, symbol, option) \
-    static Klass* name() { return check_klass_##option(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); } \
-    static Klass** name##_addr() {                                                                       \
+    static InstanceKlass* name() { return check_klass_##option(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); } \
+    static InstanceKlass** name##_addr() {                                                                       \
       return &SystemDictionary::_well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)];           \
     }
   WK_KLASSES_DO(WK_KLASS_DECLARE);
   #undef WK_KLASS_DECLARE
 
-  static Klass* well_known_klass(WKID id) {
+  static InstanceKlass* well_known_klass(WKID id) {
     assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
     return _well_known_klasses[id];
   }
 
-  static Klass** well_known_klass_addr(WKID id) {
+  static InstanceKlass** well_known_klass_addr(WKID id) {
     assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
     return &_well_known_klasses[id];
   }
@@ -442,7 +442,7 @@
   // Local definition for direct access to the private array:
   #define WK_KLASS(name) _well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)]
 
-  static Klass* box_klass(BasicType t) {
+  static InstanceKlass* box_klass(BasicType t) {
     assert((uint)t < T_VOID+1, "range check");
     return check_klass(_box_klasses[t]);
   }
@@ -450,7 +450,7 @@
 
   // methods returning lazily loaded klasses
   // The corresponding method to load the class must be called before calling them.
-  static Klass* abstract_ownable_synchronizer_klass() { return check_klass(_abstract_ownable_synchronizer_klass); }
+  static InstanceKlass* abstract_ownable_synchronizer_klass() { return check_klass(_abstract_ownable_synchronizer_klass); }
 
   static void load_abstract_ownable_synchronizer_klass(TRAPS);
 
@@ -700,13 +700,13 @@
                                 TRAPS);
 
   // Variables holding commonly used klasses (preloaded)
-  static Klass* _well_known_klasses[];
+  static InstanceKlass* _well_known_klasses[];
 
   // Lazily loaded klasses
-  static Klass* volatile _abstract_ownable_synchronizer_klass;
+  static InstanceKlass* volatile _abstract_ownable_synchronizer_klass;
 
   // table of box klasses (int_klass, etc.)
-  static Klass* _box_klasses[T_VOID+1];
+  static InstanceKlass* _box_klasses[T_VOID+1];
 
   static oop  _java_system_loader;
 
--- a/hotspot/src/share/vm/classfile/verifier.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/classfile/verifier.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -184,7 +184,7 @@
     if (HAS_PENDING_EXCEPTION) {
       tty->print("Verification for %s has", klassName);
       tty->print_cr(" exception pending %s ",
-        InstanceKlass::cast(PENDING_EXCEPTION->klass())->external_name());
+        PENDING_EXCEPTION->klass()->external_name());
     } else if (exception_name != NULL) {
       tty->print_cr("Verification for %s failed", klassName);
     }
--- a/hotspot/src/share/vm/code/dependencies.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/code/dependencies.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -1086,8 +1086,8 @@
     Method* lm = k->lookup_method(m->name(), m->signature());
     if (lm == NULL && k->oop_is_instance()) {
       // It might be an interface method
-        lm = ((InstanceKlass*)k)->lookup_method_in_ordered_interfaces(m->name(),
-                                                                m->signature());
+      lm = InstanceKlass::cast(k)->lookup_method_in_ordered_interfaces(m->name(),
+                                                                 m->signature());
     }
     if (lm == m)
       // Method m is inherited into ctxk.
@@ -1840,20 +1840,20 @@
     Klass* k = str.klass();
     switch (str.change_type()) {
     case Change_new_type:
-      tty->print_cr("  dependee = %s", InstanceKlass::cast(k)->external_name());
+      tty->print_cr("  dependee = %s", k->external_name());
       break;
     case Change_new_sub:
       if (!WizardMode) {
         ++nsup;
       } else {
-        tty->print_cr("  context super = %s", InstanceKlass::cast(k)->external_name());
+        tty->print_cr("  context super = %s", k->external_name());
       }
       break;
     case Change_new_impl:
       if (!WizardMode) {
         ++nint;
       } else {
-        tty->print_cr("  context interface = %s", InstanceKlass::cast(k)->external_name());
+        tty->print_cr("  context interface = %s", k->external_name());
       }
       break;
     }
@@ -1885,7 +1885,7 @@
   case Change_new_sub:
     // 6598190: brackets workaround Sun Studio C++ compiler bug 6629277
     {
-      _klass = InstanceKlass::cast(_klass)->super();
+      _klass = _klass->super();
       if (_klass != NULL) {
         return true;
       }
--- a/hotspot/src/share/vm/code/nmethod.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -3021,7 +3021,7 @@
     deps.print_dependency();
     Klass* ctxk = deps.context_type();
     if (ctxk != NULL) {
-      if (ctxk->oop_is_instance() && ((InstanceKlass*)ctxk)->is_dependent_nmethod(this)) {
+      if (ctxk->oop_is_instance() && InstanceKlass::cast(ctxk)->is_dependent_nmethod(this)) {
         tty->print_cr("   [nmethod<=klass]%s", ctxk->external_name());
       }
     }
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -4592,7 +4592,8 @@
       klass =_klass_iterator.next_klass();
     } while (klass != NULL && !klass->oop_is_instance());
 
-    return (InstanceKlass*)klass;
+    // this can be null so don't call InstanceKlass::cast
+    return static_cast<InstanceKlass*>(klass);
   }
 
 public:
--- a/hotspot/src/share/vm/gc/g1/heapRegion.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/heapRegion.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -660,7 +660,7 @@
   void print_object(outputStream* out, oop obj) {
 #ifdef PRODUCT
     Klass* k = obj->klass();
-    const char* class_name = InstanceKlass::cast(k)->external_name();
+    const char* class_name = k->external_name();
     out->print_cr("class name %s", class_name);
 #else // PRODUCT
     obj->print_on(out);
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -2148,11 +2148,8 @@
         if (!constants->tag_at(index).is_unresolved_klass()) {
           // Make sure klass is initialized and doesn't have a finalizer
           Klass* entry = constants->slot_at(index).get_klass();
-          assert(entry->is_klass(), "Should be resolved klass");
-          Klass* k_entry = (Klass*) entry;
-          assert(k_entry->oop_is_instance(), "Should be InstanceKlass");
-          InstanceKlass* ik = (InstanceKlass*) k_entry;
-          if ( ik->is_initialized() && ik->can_be_fastpath_allocated() ) {
+          InstanceKlass* ik = InstanceKlass::cast(entry);
+          if (ik->is_initialized() && ik->can_be_fastpath_allocated() ) {
             size_t obj_size = ik->size_helper();
             oop result = NULL;
             // If the TLAB isn't pre-zeroed then we'll have to do it
@@ -2611,7 +2608,7 @@
                   but using InstanceKlass::cast(STACK_OBJECT(-parms)->klass()) causes in assertion failure
                   because rcvr->klass()->oop_is_instance() == 0
                   However it seems to have a vtable in the right location. Huh?
-
+                  Because vtables have the same offset for ArrayKlass and InstanceKlass.
               */
               callee = (Method*) rcvrKlass->start_of_vtable()[ cache->f2_as_index()];
               // Profile virtual call.
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -307,12 +307,14 @@
     return methodHandle(THREAD, result);
   }
 
+  InstanceKlass* ik = InstanceKlass::cast(klass());
+
   // JDK 8, JVMS 5.4.3.4: Interface method resolution should
   // ignore static and non-public methods of java.lang.Object,
   // like clone, finalize, registerNatives.
   if (in_imethod_resolve &&
       result != NULL &&
-      klass->is_interface() &&
+      ik->is_interface() &&
       (result->is_static() || !result->is_public()) &&
       result->method_holder() == SystemDictionary::Object_klass()) {
     result = NULL;
@@ -321,11 +323,11 @@
   // Before considering default methods, check for an overpass in the
   // current class if a method has not been found.
   if (result == NULL) {
-    result = InstanceKlass::cast(klass())->find_method(name, signature);
+    result = ik->find_method(name, signature);
   }
 
   if (result == NULL) {
-    Array<Method*>* default_methods = InstanceKlass::cast(klass())->default_methods();
+    Array<Method*>* default_methods = ik->default_methods();
     if (default_methods != NULL) {
       result = InstanceKlass::find_method(default_methods, name, signature);
     }
@@ -374,21 +376,21 @@
   int vtable_index = Method::invalid_vtable_index;
   Symbol* name = resolved_method->name();
   Symbol* signature = resolved_method->signature();
+  InstanceKlass* ik = InstanceKlass::cast(klass());
 
   // First check in default method array
-  if (!resolved_method->is_abstract() &&
-    (InstanceKlass::cast(klass())->default_methods() != NULL)) {
-    int index = InstanceKlass::find_method_index(InstanceKlass::cast(klass())->default_methods(),
+  if (!resolved_method->is_abstract() && ik->default_methods() != NULL) {
+    int index = InstanceKlass::find_method_index(ik->default_methods(),
                                                  name, signature, Klass::find_overpass,
                                                  Klass::find_static, Klass::find_private);
     if (index >= 0 ) {
-      vtable_index = InstanceKlass::cast(klass())->default_vtable_indices()->at(index);
+      vtable_index = ik->default_vtable_indices()->at(index);
     }
   }
   if (vtable_index == Method::invalid_vtable_index) {
     // get vtable_index for miranda methods
     ResourceMark rm;
-    klassVtable *vt = InstanceKlass::cast(klass())->vtable();
+    klassVtable *vt = ik->vtable();
     vtable_index = vt->index_of_miranda(name, signature);
   }
   return vtable_index;
--- a/hotspot/src/share/vm/jvmci/jvmciCompiler.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/jvmci/jvmciCompiler.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -72,7 +72,7 @@
   }
   jlong start = os::javaTimeMillis();
 
-  Array<Method*>* objectMethods = InstanceKlass::cast(SystemDictionary::Object_klass())->methods();
+  Array<Method*>* objectMethods = SystemDictionary::Object_klass()->methods();
   // Initialize compile queue with a selected set of methods.
   int len = objectMethods->length();
   for (int i = 0; i < len; i++) {
--- a/hotspot/src/share/vm/jvmci/jvmciJavaClasses.hpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/jvmci/jvmciJavaClasses.hpp	Mon Oct 26 20:07:50 2015 +0100
@@ -306,7 +306,7 @@
     }                                                                                                                                                          \
     static void compute_offsets();                                                                                                                             \
   public:                                                                                                                                                      \
-    static InstanceKlass* klass() { return SystemDictionary::name##_klass() == NULL ? NULL : InstanceKlass::cast(SystemDictionary::name##_klass()); }
+    static InstanceKlass* klass() { return SystemDictionary::name##_klass(); }
 
 #define END_CLASS };
 
--- a/hotspot/src/share/vm/memory/heapInspection.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/memory/heapInspection.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -348,8 +348,7 @@
 
   for(int i = 0; i < elements.length(); i++) {
     KlassInfoEntry* cie = elements.at(i);
-    const InstanceKlass* k = (InstanceKlass*)cie->klass();
-    Klass* super = ((InstanceKlass*)k)->java_super();
+    Klass* super = cie->klass()->super();
 
     // Set the index for the class.
     cie->set_index(i + 1);
--- a/hotspot/src/share/vm/memory/metaspaceShared.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -680,7 +680,7 @@
 void MetaspaceShared::link_one_shared_class(Klass* obj, TRAPS) {
   Klass* k = obj;
   if (k->oop_is_instance()) {
-    InstanceKlass* ik = (InstanceKlass*) k;
+    InstanceKlass* ik = InstanceKlass::cast(k);
     // Link the class to cause the bytecodes to be rewritten and the
     // cpcache to be created. Class verification is done according
     // to -Xverify setting.
--- a/hotspot/src/share/vm/memory/oopFactory.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/memory/oopFactory.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -82,9 +82,8 @@
 objArrayOop oopFactory::new_objArray(Klass* klass, int length, TRAPS) {
   assert(klass->is_klass(), "must be instance class");
   if (klass->oop_is_array()) {
-    return ((ArrayKlass*)klass)->allocate_arrayArray(1, length, THREAD);
+    return ArrayKlass::cast(klass)->allocate_arrayArray(1, length, THREAD);
   } else {
-    assert (klass->oop_is_instance(), "new object array with klass not an InstanceKlass");
-    return ((InstanceKlass*)klass)->allocate_objArray(1, length, THREAD);
+    return InstanceKlass::cast(klass)->allocate_objArray(1, length, THREAD);
   }
 }
--- a/hotspot/src/share/vm/memory/universe.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/memory/universe.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -409,7 +409,7 @@
     int i = 0;
     while (i < size) {
         // Allocate dummy in old generation
-      oop dummy = InstanceKlass::cast(SystemDictionary::Object_klass())->allocate_instance(CHECK);
+      oop dummy = SystemDictionary::Object_klass()->allocate_instance(CHECK);
       dummy_array->obj_at_put(i++, dummy);
     }
     {
@@ -484,8 +484,8 @@
     _mirrors[T_LONG]    = _long_mirror;
     _mirrors[T_SHORT]   = _short_mirror;
     _mirrors[T_VOID]    = _void_mirror;
-  //_mirrors[T_OBJECT]  = InstanceKlass::cast(_object_klass)->java_mirror();
-  //_mirrors[T_ARRAY]   = InstanceKlass::cast(_object_klass)->java_mirror();
+  //_mirrors[T_OBJECT]  = _object_klass->java_mirror();
+  //_mirrors[T_ARRAY]   = _object_klass->java_mirror();
 }
 
 void Universe::fixup_mirrors(TRAPS) {
@@ -546,8 +546,7 @@
   klassVtable* vt = ko->vtable();
   if (vt) vt->initialize_vtable(false, CHECK);
   if (ko->oop_is_instance()) {
-    InstanceKlass* ik = (InstanceKlass*)ko;
-    for (KlassHandle s_h(THREAD, ik->subklass());
+    for (KlassHandle s_h(THREAD, ko->subklass());
          s_h() != NULL;
          s_h = KlassHandle(THREAD, s_h()->next_sibling())) {
       reinitialize_vtable_of(s_h, CHECK);
@@ -998,8 +997,8 @@
   // Setup static method for registering finalizers
   // The finalizer klass must be linked before looking up the method, in
   // case it needs to get rewritten.
-  InstanceKlass::cast(SystemDictionary::Finalizer_klass())->link_class(CHECK_false);
-  Method* m = InstanceKlass::cast(SystemDictionary::Finalizer_klass())->find_method(
+  SystemDictionary::Finalizer_klass()->link_class(CHECK_false);
+  Method* m = SystemDictionary::Finalizer_klass()->find_method(
                                   vmSymbols::register_method_name(),
                                   vmSymbols::register_method_signature());
   if (m == NULL || !m->is_static()) {
@@ -1009,8 +1008,8 @@
   Universe::_finalizer_register_cache->init(
     SystemDictionary::Finalizer_klass(), m);
 
-  InstanceKlass::cast(SystemDictionary::misc_Unsafe_klass())->link_class(CHECK_false);
-  m = InstanceKlass::cast(SystemDictionary::misc_Unsafe_klass())->find_method(
+  SystemDictionary::misc_Unsafe_klass()->link_class(CHECK_false);
+  m = SystemDictionary::misc_Unsafe_klass()->find_method(
                                   vmSymbols::throwIllegalAccessError_name(),
                                   vmSymbols::void_method_signature());
   if (m != NULL && !m->is_static()) {
@@ -1023,8 +1022,8 @@
     SystemDictionary::misc_Unsafe_klass(), m);
 
   // Setup method for registering loaded classes in class loader vector
-  InstanceKlass::cast(SystemDictionary::ClassLoader_klass())->link_class(CHECK_false);
-  m = InstanceKlass::cast(SystemDictionary::ClassLoader_klass())->find_method(vmSymbols::addClass_name(), vmSymbols::class_void_signature());
+  SystemDictionary::ClassLoader_klass()->link_class(CHECK_false);
+  m = SystemDictionary::ClassLoader_klass()->find_method(vmSymbols::addClass_name(), vmSymbols::class_void_signature());
   if (m == NULL || m->is_static()) {
     tty->print_cr("Unable to link/verify ClassLoader.addClass method");
     return false; // initialization failed (cannot throw exception yet)
@@ -1033,8 +1032,8 @@
     SystemDictionary::ClassLoader_klass(), m);
 
   // Setup method for checking protection domain
-  InstanceKlass::cast(SystemDictionary::ProtectionDomain_klass())->link_class(CHECK_false);
-  m = InstanceKlass::cast(SystemDictionary::ProtectionDomain_klass())->
+  SystemDictionary::ProtectionDomain_klass()->link_class(CHECK_false);
+  m = SystemDictionary::ProtectionDomain_klass()->
             find_method(vmSymbols::impliesCreateAccessControlContext_name(),
                         vmSymbols::void_boolean_signature());
   // Allow NULL which should only happen with bootstrapping.
--- a/hotspot/src/share/vm/oops/constantPool.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/oops/constantPool.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -198,11 +198,11 @@
     if (source_file != NULL) {
       tty->print("RESOLVE %s %s %s:%d\n",
                  this_cp->pool_holder()->external_name(),
-                 InstanceKlass::cast(k())->external_name(), source_file, line_number);
+                 k->external_name(), source_file, line_number);
     } else {
       tty->print("RESOLVE %s %s\n",
                  this_cp->pool_holder()->external_name(),
-                 InstanceKlass::cast(k())->external_name());
+                 k->external_name());
     }
   }
 }
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -742,7 +742,7 @@
   // A class could already be verified, since it has been reflected upon.
   this_k->link_class(CHECK);
 
-  DTRACE_CLASSINIT_PROBE(required, InstanceKlass::cast(this_k()), -1);
+  DTRACE_CLASSINIT_PROBE(required, this_k(), -1);
 
   bool wait = false;
 
@@ -765,19 +765,19 @@
 
     // Step 3
     if (this_k->is_being_initialized() && this_k->is_reentrant_initialization(self)) {
-      DTRACE_CLASSINIT_PROBE_WAIT(recursive, InstanceKlass::cast(this_k()), -1,wait);
+      DTRACE_CLASSINIT_PROBE_WAIT(recursive, this_k(), -1,wait);
       return;
     }
 
     // Step 4
     if (this_k->is_initialized()) {
-      DTRACE_CLASSINIT_PROBE_WAIT(concurrent, InstanceKlass::cast(this_k()), -1,wait);
+      DTRACE_CLASSINIT_PROBE_WAIT(concurrent, this_k(), -1,wait);
       return;
     }
 
     // Step 5
     if (this_k->is_in_error_state()) {
-      DTRACE_CLASSINIT_PROBE_WAIT(erroneous, InstanceKlass::cast(this_k()), -1,wait);
+      DTRACE_CLASSINIT_PROBE_WAIT(erroneous, this_k(), -1,wait);
       ResourceMark rm(THREAD);
       const char* desc = "Could not initialize class ";
       const char* className = this_k->external_name();
@@ -810,7 +810,7 @@
         this_k->set_initialization_state_and_notify(initialization_error, THREAD); // Locks object, set state, and notify all waiting threads
         CLEAR_PENDING_EXCEPTION;   // ignore any exception thrown, superclass initialization error is thrown below
       }
-      DTRACE_CLASSINIT_PROBE_WAIT(super__failed, InstanceKlass::cast(this_k()), -1,wait);
+      DTRACE_CLASSINIT_PROBE_WAIT(super__failed, this_k(), -1,wait);
       THROW_OOP(e());
     }
   }
@@ -826,7 +826,7 @@
   {
     assert(THREAD->is_Java_thread(), "non-JavaThread in initialize_impl");
     JavaThread* jt = (JavaThread*)THREAD;
-    DTRACE_CLASSINIT_PROBE_WAIT(clinit, InstanceKlass::cast(this_k()), -1,wait);
+    DTRACE_CLASSINIT_PROBE_WAIT(clinit, this_k(), -1,wait);
     // Timer includes any side effects of class initialization (resolution,
     // etc), but not recursive entry into call_class_initializer().
     PerfClassTraceTime timer(ClassLoader::perf_class_init_time(),
@@ -860,7 +860,7 @@
       // JVMTI internal flag reset is needed in order to report ExceptionInInitializerError
       JvmtiExport::clear_detected_exception((JavaThread*)THREAD);
     }
-    DTRACE_CLASSINIT_PROBE_WAIT(error, InstanceKlass::cast(this_k()), -1,wait);
+    DTRACE_CLASSINIT_PROBE_WAIT(error, this_k(), -1,wait);
     if (e->is_a(SystemDictionary::Error_klass())) {
       THROW_OOP(e());
     } else {
@@ -870,7 +870,7 @@
                 &args);
     }
   }
-  DTRACE_CLASSINIT_PROBE_WAIT(end, InstanceKlass::cast(this_k()), -1,wait);
+  DTRACE_CLASSINIT_PROBE_WAIT(end, this_k(), -1,wait);
 }
 
 
@@ -907,7 +907,7 @@
   // Filter out subclasses whose supers already implement me.
   // (Note: CHA must walk subclasses of direct implementors
   // in order to locate indirect implementors.)
-  Klass* sk = InstanceKlass::cast(k)->super();
+  Klass* sk = k->super();
   if (sk != NULL && InstanceKlass::cast(sk)->implements_interface(this))
     // We only need to check one immediate superclass, since the
     // implements_interface query looks at transitive_interfaces.
@@ -955,8 +955,7 @@
 
 GrowableArray<Klass*>* InstanceKlass::compute_secondary_supers(int num_extra_slots) {
   // The secondaries are the implemented interfaces.
-  InstanceKlass* ik = InstanceKlass::cast(this);
-  Array<Klass*>* interfaces = ik->transitive_interfaces();
+  Array<Klass*>* interfaces = transitive_interfaces();
   int num_secondaries = num_extra_slots + interfaces->length();
   if (num_secondaries == 0) {
     // Must share this for correct bootstrapping!
@@ -1532,7 +1531,7 @@
     if (method != NULL) {
       return method;
     }
-    klass = InstanceKlass::cast(klass)->super();
+    klass = klass->super();
     overpass_local_mode = skip_overpass;   // Always ignore overpass methods in superclasses
   }
   return NULL;
@@ -1541,13 +1540,13 @@
 #ifdef ASSERT
 // search through class hierarchy and return true if this class or
 // one of the superclasses was redefined
-bool InstanceKlass::has_redefined_this_or_super() const {
-  const InstanceKlass* klass = this;
+bool InstanceKlass::has_redefined_this_or_super() {
+  Klass* klass = this;
   while (klass != NULL) {
-    if (klass->has_been_redefined()) {
+    if (InstanceKlass::cast(klass)->has_been_redefined()) {
       return true;
     }
-    klass = InstanceKlass::cast(klass->super());
+    klass = klass->super();
   }
   return false;
 }
@@ -2325,32 +2324,18 @@
 
 // different verisons of is_same_class_package
 bool InstanceKlass::is_same_class_package(Klass* class2) {
-  Klass* class1 = this;
-  oop classloader1 = InstanceKlass::cast(class1)->class_loader();
-  Symbol* classname1 = class1->name();
-
   if (class2->oop_is_objArray()) {
     class2 = ObjArrayKlass::cast(class2)->bottom_klass();
   }
-  oop classloader2;
-  if (class2->oop_is_instance()) {
-    classloader2 = InstanceKlass::cast(class2)->class_loader();
-  } else {
-    assert(class2->oop_is_typeArray(), "should be type array");
-    classloader2 = NULL;
-  }
+  oop classloader2 = class2->class_loader();
   Symbol* classname2 = class2->name();
 
-  return InstanceKlass::is_same_class_package(classloader1, classname1,
+  return InstanceKlass::is_same_class_package(class_loader(), name(),
                                               classloader2, classname2);
 }
 
 bool InstanceKlass::is_same_class_package(oop classloader2, Symbol* classname2) {
-  Klass* class1 = this;
-  oop classloader1 = InstanceKlass::cast(class1)->class_loader();
-  Symbol* classname1 = class1->name();
-
-  return InstanceKlass::is_same_class_package(classloader1, classname1,
+  return InstanceKlass::is_same_class_package(class_loader(), name(),
                                               classloader2, classname2);
 }
 
@@ -2910,7 +2895,8 @@
   ((InstanceKlass*)this)->do_local_static_fields(&print_static_field);
   st->print_cr(BULLET"---- non-static fields (%d words):", nonstatic_field_size());
   FieldPrinter print_nonstatic_field(st);
-  ((InstanceKlass*)this)->do_nonstatic_fields(&print_nonstatic_field);
+  InstanceKlass* ik = const_cast<InstanceKlass*>(this);
+  ik->do_nonstatic_fields(&print_nonstatic_field);
 
   st->print(BULLET"non-static oop maps: ");
   OopMapBlock* map     = start_of_nonstatic_oop_maps();
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Mon Oct 26 20:07:50 2015 +0100
@@ -862,7 +862,7 @@
 
 #ifdef ASSERT
   // check whether this class or one of its superclasses was redefined
-  bool has_redefined_this_or_super() const;
+  bool has_redefined_this_or_super();
 #endif
 
   // Access to the implementor of an interface.
@@ -922,7 +922,8 @@
 
   // Casting from Klass*
   static InstanceKlass* cast(Klass* k) {
-    assert(k == NULL || k->oop_is_instance(), "cast to InstanceKlass");
+    assert(k != NULL, "k should not be null");
+    assert(k->oop_is_instance(), "cast to InstanceKlass");
     return static_cast<InstanceKlass*>(k);
   }
 
--- a/hotspot/src/share/vm/oops/klass.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/oops/klass.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -557,9 +557,11 @@
 
 oop Klass::class_loader() const { return class_loader_data()->class_loader(); }
 
+// In product mode, this function doesn't have virtual function calls so
+// there might be some performance advantage to handling InstanceKlass here.
 const char* Klass::external_name() const {
   if (oop_is_instance()) {
-    InstanceKlass* ik = (InstanceKlass*) this;
+    const InstanceKlass* ik = static_cast<const InstanceKlass*>(this);
     if (ik->is_anonymous()) {
       intptr_t hash = 0;
       if (ik->java_mirror() != NULL) {
@@ -687,14 +689,8 @@
 #ifndef PRODUCT
 
 bool Klass::verify_vtable_index(int i) {
-  if (oop_is_instance()) {
-    int limit = ((InstanceKlass*)this)->vtable_length()/vtableEntry::size();
-    assert(i >= 0 && i < limit, "index %d out of bounds %d", i, limit);
-  } else {
-    assert(oop_is_array(), "Must be");
-    int limit = ((ArrayKlass*)this)->vtable_length()/vtableEntry::size();
-    assert(i >= 0 && i < limit, "index %d out of bounds %d", i, limit);
-  }
+  int limit = vtable_length()/vtableEntry::size();
+  assert(i >= 0 && i < limit, "index %d out of bounds %d", i, limit);
   return true;
 }
 
--- a/hotspot/src/share/vm/oops/klass.hpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/oops/klass.hpp	Mon Oct 26 20:07:50 2015 +0100
@@ -373,8 +373,8 @@
 #endif
 
   // vtables
-  virtual klassVtable* vtable() const        { return NULL; }
-  virtual int vtable_length() const          { return 0; }
+  virtual klassVtable* vtable() const = 0;
+  virtual int vtable_length() const = 0;
 
   // subclass check
   bool is_subclass_of(const Klass* k) const;
--- a/hotspot/src/share/vm/oops/klassVtable.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/oops/klassVtable.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -39,9 +39,7 @@
 #include "utilities/copy.hpp"
 
 inline InstanceKlass* klassVtable::ik() const {
-  Klass* k = _klass();
-  assert(k->oop_is_instance(), "not an InstanceKlass");
-  return (InstanceKlass*)k;
+  return InstanceKlass::cast(_klass());
 }
 
 
@@ -66,8 +64,7 @@
   int vtable_length = 0;
 
   // start off with super's vtable length
-  InstanceKlass* sk = (InstanceKlass*)super;
-  vtable_length = super == NULL ? 0 : sk->vtable_length();
+  vtable_length = super == NULL ? 0 : super->vtable_length();
 
   // go thru each method in the methods table to see if it needs a new entry
   int len = methods->length();
@@ -131,10 +128,7 @@
     return 0;
   } else {
     // copy methods from superKlass
-    // can't inherit from array class, so must be InstanceKlass
-    assert(super->oop_is_instance(), "must be instance klass");
-    InstanceKlass* sk = (InstanceKlass*)super();
-    klassVtable* superVtable = sk->vtable();
+    klassVtable* superVtable = super->vtable();
     assert(superVtable->length() <= _length, "vtable too short");
 #ifdef ASSERT
     superVtable->verify(tty, true);
@@ -143,7 +137,7 @@
 #ifndef PRODUCT
     if (PrintVtables && Verbose) {
       ResourceMark rm;
-      tty->print_cr("copy vtable from %s to %s size %d", sk->internal_name(), klass()->internal_name(), _length);
+      tty->print_cr("copy vtable from %s to %s size %d", super->internal_name(), klass()->internal_name(), _length);
     }
 #endif
     return superVtable->length();
@@ -303,7 +297,7 @@
       break;
     }
     // if no override found yet, continue to search up
-    superk = InstanceKlass::cast(superk->super());
+    superk = superk->super() == NULL ? NULL : InstanceKlass::cast(superk->super());
   }
 
   return superk;
@@ -761,15 +755,14 @@
      return false;
    }
 
-  InstanceKlass* cursuper;
-  // Iterate on all superclasses, which should have instanceKlasses
+  // Iterate on all superclasses, which should be InstanceKlasses.
   // Note that we explicitly look for overpasses at each level.
   // Overpasses may or may not exist for supers for pass 1,
   // they should have been created for pass 2 and later.
 
-  for (cursuper = InstanceKlass::cast(super); cursuper != NULL;  cursuper = (InstanceKlass*)cursuper->super())
+  for (Klass* cursuper = super; cursuper != NULL; cursuper = cursuper->super())
   {
-     if (cursuper->find_local_method(name, signature,
+     if (InstanceKlass::cast(cursuper)->find_local_method(name, signature,
            Klass::find_overpass, Klass::skip_static, Klass::skip_private) != NULL) {
        return false;
      }
--- a/hotspot/src/share/vm/oops/method.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/oops/method.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -299,10 +299,7 @@
 
 
 Symbol* Method::klass_name() const {
-  Klass* k = method_holder();
-  assert(k->is_klass(), "must be klass");
-  InstanceKlass* ik = (InstanceKlass*) k;
-  return ik->name();
+  return method_holder()->name();
 }
 
 
--- a/hotspot/src/share/vm/prims/jvm.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -1156,7 +1156,7 @@
 // Create an AccessControlContext with a protection domain with null codesource
 // and null permissions - which gives no permissions.
 oop create_dummy_access_control_context(TRAPS) {
-  InstanceKlass* pd_klass = InstanceKlass::cast(SystemDictionary::ProtectionDomain_klass());
+  InstanceKlass* pd_klass = SystemDictionary::ProtectionDomain_klass();
   Handle obj = pd_klass->allocate_instance_handle(CHECK_NULL);
   // Call constructor ProtectionDomain(null, null);
   JavaValue result(T_VOID);
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -104,7 +104,7 @@
         ClassLoaderData* cld = _scratch_classes[i]->class_loader_data();
         // Free the memory for this class at class unloading time.  Not before
         // because CMS might think this is still live.
-        cld->add_to_deallocate_list((InstanceKlass*)_scratch_classes[i]);
+        cld->add_to_deallocate_list(InstanceKlass::cast(_scratch_classes[i]));
       }
     }
     // Free os::malloc allocated memory in load_new_class_version.
@@ -4133,7 +4133,7 @@
        subk = subk->next_sibling()) {
     if (subk->oop_is_instance()) {
       // Only update instanceKlasses
-      InstanceKlass *subik = (InstanceKlass*)subk;
+      InstanceKlass *subik = InstanceKlass::cast(subk);
       // recursively do subclasses of the current subclass
       increment_class_counter(subik, THREAD);
     }
--- a/hotspot/src/share/vm/prims/jvmtiTagMap.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/prims/jvmtiTagMap.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -588,7 +588,7 @@
     _obj_tag = (_entry == NULL) ? 0 : _entry->tag();
 
     // get the class and the class's tag value
-    assert(InstanceKlass::cast(SystemDictionary::Class_klass())->is_mirror_instance_klass(), "Is not?");
+    assert(SystemDictionary::Class_klass()->is_mirror_instance_klass(), "Is not?");
 
     _klass_tag = tag_for(tag_map, _o->klass()->java_mirror());
   }
--- a/hotspot/src/share/vm/runtime/reflection.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/runtime/reflection.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -647,11 +647,9 @@
     return Handle(THREAD, Universe::java_mirror(type));
   }
 
-  oop loader = InstanceKlass::cast(k())->class_loader();
-  oop protection_domain = k()->protection_domain();
   Klass* result = SystemDictionary::resolve_or_fail(signature,
-                                    Handle(THREAD, loader),
-                                    Handle(THREAD, protection_domain),
+                                    Handle(THREAD, k->class_loader()),
+                                    Handle(THREAD, k->protection_domain()),
                                     true, CHECK_(Handle()));
 
   if (TraceClassResolution) {
--- a/hotspot/src/share/vm/runtime/thread.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -2101,7 +2101,7 @@
           frame f = last_frame();
           tty->print(" (pc: " INTPTR_FORMAT " sp: " INTPTR_FORMAT " )", p2i(f.pc()), p2i(f.sp()));
         }
-        tty->print_cr(" of type: %s", InstanceKlass::cast(_pending_async_exception->klass())->external_name());
+        tty->print_cr(" of type: %s", _pending_async_exception->klass()->external_name());
       }
       _pending_async_exception = NULL;
       clear_has_async_exception();
@@ -2219,10 +2219,10 @@
 
       if (TraceExceptions) {
         ResourceMark rm;
-        tty->print_cr("Pending Async. exception installed of type: %s", InstanceKlass::cast(_pending_async_exception->klass())->external_name());
+        tty->print_cr("Pending Async. exception installed of type: %s", _pending_async_exception->klass()->external_name());
       }
       // for AbortVMOnException flag
-      Exceptions::debug_check_abort(InstanceKlass::cast(_pending_async_exception->klass())->external_name());
+      Exceptions::debug_check_abort(_pending_async_exception->klass()->external_name());
     }
   }
 
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -688,42 +688,42 @@
      static_field(SystemDictionary,            _shared_dictionary,                            Dictionary*)                           \
      static_field(SystemDictionary,            _system_loader_lock_obj,                       oop)                                   \
      static_field(SystemDictionary,            _loader_constraints,                           LoaderConstraintTable*)                \
-     static_field(SystemDictionary,            WK_KLASS(Object_klass),                        Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(String_klass),                        Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(Class_klass),                         Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(Cloneable_klass),                     Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(ClassLoader_klass),                   Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(Serializable_klass),                  Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(System_klass),                        Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(Throwable_klass),                     Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(ThreadDeath_klass),                   Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(Error_klass),                         Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(Exception_klass),                     Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(RuntimeException_klass),              Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(ClassNotFoundException_klass),        Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(NoClassDefFoundError_klass),          Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(LinkageError_klass),                  Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(ClassCastException_klass),            Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(ArrayStoreException_klass),           Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(VirtualMachineError_klass),           Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(OutOfMemoryError_klass),              Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(StackOverflowError_klass),            Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(ProtectionDomain_klass),              Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(AccessControlContext_klass),          Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(SecureClassLoader_klass),             Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(Reference_klass),                     Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(SoftReference_klass),                 Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(WeakReference_klass),                 Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(FinalReference_klass),                Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(PhantomReference_klass),              Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(Cleaner_klass),                       Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(Finalizer_klass),                     Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(Thread_klass),                        Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(ThreadGroup_klass),                   Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(Properties_klass),                    Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(StringBuffer_klass),                  Klass*)                                \
-     static_field(SystemDictionary,            WK_KLASS(MethodHandle_klass),                  Klass*)                                \
-     static_field(SystemDictionary,            _box_klasses[0],                               Klass*)                                \
+     static_field(SystemDictionary,            WK_KLASS(Object_klass),                        InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(String_klass),                        InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(Class_klass),                         InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(Cloneable_klass),                     InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(ClassLoader_klass),                   InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(Serializable_klass),                  InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(System_klass),                        InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(Throwable_klass),                     InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(ThreadDeath_klass),                   InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(Error_klass),                         InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(Exception_klass),                     InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(RuntimeException_klass),              InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(ClassNotFoundException_klass),        InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(NoClassDefFoundError_klass),          InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(LinkageError_klass),                  InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(ClassCastException_klass),            InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(ArrayStoreException_klass),           InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(VirtualMachineError_klass),           InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(OutOfMemoryError_klass),              InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(StackOverflowError_klass),            InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(ProtectionDomain_klass),              InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(AccessControlContext_klass),          InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(SecureClassLoader_klass),             InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(Reference_klass),                     InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(SoftReference_klass),                 InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(WeakReference_klass),                 InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(FinalReference_klass),                InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(PhantomReference_klass),              InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(Cleaner_klass),                       InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(Finalizer_klass),                     InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(Thread_klass),                        InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(ThreadGroup_klass),                   InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(Properties_klass),                    InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(StringBuffer_klass),                  InstanceKlass*)                        \
+     static_field(SystemDictionary,            WK_KLASS(MethodHandle_klass),                  InstanceKlass*)                        \
+     static_field(SystemDictionary,            _box_klasses[0],                               InstanceKlass*)                        \
      static_field(SystemDictionary,            _java_system_loader,                           oop)                                   \
                                                                                                                                      \
   /*************/                                                                                                                    \
--- a/hotspot/src/share/vm/services/heapDumper.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/services/heapDumper.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -895,9 +895,7 @@
 // creates HPROF_GC_CLASS_DUMP record for the given class and each of
 // its array classes
 void DumperSupport::dump_class_and_array_classes(DumpWriter* writer, Klass* k) {
-  Klass* klass = k;
-  assert(klass->oop_is_instance(), "not an InstanceKlass");
-  InstanceKlass* ik = (InstanceKlass*)klass;
+  InstanceKlass* ik = InstanceKlass::cast(k);
 
   // Ignore the class if it hasn't been initialized yet
   if (!ik->is_linked()) {
@@ -939,7 +937,7 @@
   dump_instance_field_descriptors(writer, k);
 
   // array classes
-  k = klass->array_klass_or_null();
+  k = k->array_klass_or_null();
   while (k != NULL) {
     Klass* klass = k;
     assert(klass->oop_is_objArray(), "not an ObjArrayKlass");
@@ -1396,7 +1394,7 @@
     if (oome) {
       assert(!Thread::current()->is_VM_thread(), "Dump from OutOfMemoryError cannot be called by the VMThread");
       // get OutOfMemoryError zero-parameter constructor
-      InstanceKlass* oome_ik = InstanceKlass::cast(SystemDictionary::OutOfMemoryError_klass());
+      InstanceKlass* oome_ik = SystemDictionary::OutOfMemoryError_klass();
       _oome_constructor = oome_ik->find_method(vmSymbols::object_initializer_name(),
                                                           vmSymbols::void_method_signature());
       // get thread throwing OOME when generating the heap dump at OOME
--- a/hotspot/src/share/vm/services/threadService.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/services/threadService.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -505,8 +505,7 @@
   int len = (_locked_monitors != NULL ? _locked_monitors->length() : 0);
   for (int i = 0; i < len; i++) {
     oop o = _locked_monitors->at(i);
-    InstanceKlass* ik = InstanceKlass::cast(o->klass());
-    st->print_cr("\t- locked <" INTPTR_FORMAT "> (a %s)", p2i(o), ik->external_name());
+    st->print_cr("\t- locked <" INTPTR_FORMAT "> (a %s)", p2i(o), o->klass()->external_name());
   }
 
 }
@@ -729,8 +728,7 @@
 
   for (int i = 0; i < locks->length(); i++) {
     instanceOop obj = locks->at(i);
-    InstanceKlass* ik = InstanceKlass::cast(obj->klass());
-    st->print_cr("\t- <" INTPTR_FORMAT "> (a %s)", p2i(obj), ik->external_name());
+    st->print_cr("\t- <" INTPTR_FORMAT "> (a %s)", p2i(obj), obj->klass()->external_name());
   }
   st->cr();
 }
@@ -887,7 +885,7 @@
       oop obj = (oop)waitingToLockMonitor->object();
       if (obj != NULL) {
         st->print(" (object " INTPTR_FORMAT ", a %s)", p2i(obj),
-                   (InstanceKlass::cast(obj->klass()))->external_name());
+                   obj->klass()->external_name());
 
         if (!currentThread->current_pending_monitor_is_from_java()) {
           owner_desc = "\n  in JNI, which is held by";
@@ -911,7 +909,7 @@
     } else {
       st->print("  waiting for ownable synchronizer " INTPTR_FORMAT ", (a %s)",
                 p2i(waitingToLockBlocker),
-                (InstanceKlass::cast(waitingToLockBlocker->klass()))->external_name());
+                waitingToLockBlocker->klass()->external_name());
       assert(waitingToLockBlocker->is_a(SystemDictionary::abstract_ownable_synchronizer_klass()),
              "Must be an AbstractOwnableSynchronizer");
       oop ownerObj = java_util_concurrent_locks_AbstractOwnableSynchronizer::get_owner_threadObj(waitingToLockBlocker);
--- a/hotspot/src/share/vm/utilities/exceptions.cpp	Mon Oct 26 18:27:33 2015 +0100
+++ b/hotspot/src/share/vm/utilities/exceptions.cpp	Mon Oct 26 20:07:50 2015 +0100
@@ -502,5 +502,5 @@
       message = java_lang_String::as_utf8_string(msg);
     }
   }
-  debug_check_abort(InstanceKlass::cast(exception()->klass())->external_name(), message);
+  debug_check_abort(exception()->klass()->external_name(), message);
 }