8216189: Remove Klass::compute_is_subtype_of
authorredestad
Sat, 05 Jan 2019 20:08:24 +0100
changeset 53152 08db5aa02f7b
parent 53151 22baf8054a40
child 53153 af7afdababd3
8216189: Remove Klass::compute_is_subtype_of Reviewed-by: hseigel, jiangli
src/hotspot/share/oops/arrayKlass.cpp
src/hotspot/share/oops/arrayKlass.hpp
src/hotspot/share/oops/instanceKlass.cpp
src/hotspot/share/oops/instanceKlass.hpp
src/hotspot/share/oops/klass.cpp
src/hotspot/share/oops/klass.hpp
src/hotspot/share/oops/objArrayKlass.cpp
src/hotspot/share/oops/objArrayKlass.hpp
src/hotspot/share/oops/typeArrayKlass.cpp
src/hotspot/share/oops/typeArrayKlass.hpp
--- a/src/hotspot/share/oops/arrayKlass.cpp	Sat Jan 05 10:48:54 2019 +0800
+++ b/src/hotspot/share/oops/arrayKlass.cpp	Sat Jan 05 20:08:24 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -122,13 +122,6 @@
   return NULL;
 }
 
-bool ArrayKlass::compute_is_subtype_of(Klass* k) {
-  // An array is a subtype of Serializable, Clonable, and Object
-  return    k == SystemDictionary::Object_klass()
-         || k == SystemDictionary::Cloneable_klass()
-         || k == SystemDictionary::Serializable_klass();
-}
-
 objArrayOop ArrayKlass::allocate_arrayArray(int n, int length, TRAPS) {
   check_array_allocation_length(length, arrayOopDesc::max_array_length(T_ARRAY), CHECK_0);
   int size = objArrayOopDesc::object_size(length);
--- a/src/hotspot/share/oops/arrayKlass.hpp	Sat Jan 05 10:48:54 2019 +0800
+++ b/src/hotspot/share/oops/arrayKlass.hpp	Sat Jan 05 20:08:24 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -99,7 +99,6 @@
 
   GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
                                                   Array<InstanceKlass*>* transitive_interfaces);
-  bool compute_is_subtype_of(Klass* k);
 
   // Sizing
   static int static_size(int header_size);
--- a/src/hotspot/share/oops/instanceKlass.cpp	Sat Jan 05 10:48:54 2019 +0800
+++ b/src/hotspot/share/oops/instanceKlass.cpp	Sat Jan 05 20:08:24 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -1199,14 +1199,6 @@
   }
 }
 
-bool InstanceKlass::compute_is_subtype_of(Klass* k) {
-  if (k->is_interface()) {
-    return implements_interface(k);
-  } else {
-    return Klass::compute_is_subtype_of(k);
-  }
-}
-
 bool InstanceKlass::implements_interface(Klass* k) const {
   if (this == k) return true;
   assert(k->is_interface(), "should be an interface class");
--- a/src/hotspot/share/oops/instanceKlass.hpp	Sat Jan 05 10:48:54 2019 +0800
+++ b/src/hotspot/share/oops/instanceKlass.hpp	Sat Jan 05 20:08:24 2019 +0100
@@ -1019,7 +1019,6 @@
   bool is_leaf_class() const               { return _subklass == NULL; }
   GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
                                                   Array<InstanceKlass*>* transitive_interfaces);
-  bool compute_is_subtype_of(Klass* k);
   bool can_be_primary_super_slow() const;
   int oop_size(oop obj)  const             { return size_helper(); }
   // slow because it's a virtual call and used for verifying the layout_helper.
--- a/src/hotspot/share/oops/klass.cpp	Sat Jan 05 10:48:54 2019 +0800
+++ b/src/hotspot/share/oops/klass.cpp	Sat Jan 05 20:08:24 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -159,11 +159,6 @@
   ShouldNotReachHere();
 }
 
-bool Klass::compute_is_subtype_of(Klass* k) {
-  assert(k->is_klass(), "argument must be a class");
-  return is_subclass_of(k);
-}
-
 Klass* Klass::find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const {
 #ifdef ASSERT
   tty->print_cr("Error: find_field called on a klass oop."
--- a/src/hotspot/share/oops/klass.hpp	Sat Jan 05 10:48:54 2019 +0800
+++ b/src/hotspot/share/oops/klass.hpp	Sat Jan 05 20:08:24 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -529,9 +529,6 @@
   virtual void remove_java_mirror();
   virtual void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS);
 
- protected:
-  // computes the subtype relationship
-  virtual bool compute_is_subtype_of(Klass* k);
  public:
   // subclass accessor (here for convenience; undefined for non-klass objects)
   virtual bool is_leaf_class() const { fatal("not a class"); return false; }
--- a/src/hotspot/share/oops/objArrayKlass.cpp	Sat Jan 05 10:48:54 2019 +0800
+++ b/src/hotspot/share/oops/objArrayKlass.cpp	Sat Jan 05 20:08:24 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -395,14 +395,6 @@
   }
 }
 
-bool ObjArrayKlass::compute_is_subtype_of(Klass* k) {
-  if (!k->is_objArray_klass())
-    return ArrayKlass::compute_is_subtype_of(k);
-
-  ObjArrayKlass* oak = ObjArrayKlass::cast(k);
-  return element_klass()->is_subtype_of(oak->element_klass());
-}
-
 void ObjArrayKlass::initialize(TRAPS) {
   bottom_klass()->initialize(THREAD);  // dispatches to either InstanceKlass or TypeArrayKlass
 }
--- a/src/hotspot/share/oops/objArrayKlass.hpp	Sat Jan 05 10:48:54 2019 +0800
+++ b/src/hotspot/share/oops/objArrayKlass.hpp	Sat Jan 05 20:08:24 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -70,7 +70,6 @@
   bool can_be_primary_super_slow() const;
   GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
                                                   Array<InstanceKlass*>* transitive_interfaces);
-  bool compute_is_subtype_of(Klass* k);
   DEBUG_ONLY(bool is_objArray_klass_slow()  const  { return true; })
   int oop_size(oop obj) const;
 
--- a/src/hotspot/share/oops/typeArrayKlass.cpp	Sat Jan 05 10:48:54 2019 +0800
+++ b/src/hotspot/share/oops/typeArrayKlass.cpp	Sat Jan 05 20:08:24 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -44,17 +44,6 @@
 #include "runtime/handles.inline.hpp"
 #include "utilities/macros.hpp"
 
-bool TypeArrayKlass::compute_is_subtype_of(Klass* k) {
-  if (!k->is_typeArray_klass()) {
-    return ArrayKlass::compute_is_subtype_of(k);
-  }
-
-  TypeArrayKlass* tak = TypeArrayKlass::cast(k);
-  if (dimension() != tak->dimension()) return false;
-
-  return element_type() == tak->element_type();
-}
-
 TypeArrayKlass* TypeArrayKlass::create_klass(BasicType type,
                                       const char* name_str, TRAPS) {
   Symbol* sym = NULL;
--- a/src/hotspot/share/oops/typeArrayKlass.hpp	Sat Jan 05 10:48:54 2019 +0800
+++ b/src/hotspot/share/oops/typeArrayKlass.hpp	Sat Jan 05 20:08:24 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -62,8 +62,6 @@
 
   int oop_size(oop obj) const;
 
-  bool compute_is_subtype_of(Klass* k);
-
   // Allocation
   typeArrayOop allocate_common(int length, bool do_zero, TRAPS);
   typeArrayOop allocate(int length, TRAPS) { return allocate_common(length, true, THREAD); }