# HG changeset patch # User redestad # Date 1546715304 -3600 # Node ID 08db5aa02f7b9a299b81811e3abd70ba3a2a3491 # Parent 22baf8054a40a2af513015b16c16bf6e92dc889d 8216189: Remove Klass::compute_is_subtype_of Reviewed-by: hseigel, jiangli diff -r 22baf8054a40 -r 08db5aa02f7b src/hotspot/share/oops/arrayKlass.cpp --- 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); diff -r 22baf8054a40 -r 08db5aa02f7b src/hotspot/share/oops/arrayKlass.hpp --- 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* compute_secondary_supers(int num_extra_slots, Array* transitive_interfaces); - bool compute_is_subtype_of(Klass* k); // Sizing static int static_size(int header_size); diff -r 22baf8054a40 -r 08db5aa02f7b src/hotspot/share/oops/instanceKlass.cpp --- 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"); diff -r 22baf8054a40 -r 08db5aa02f7b src/hotspot/share/oops/instanceKlass.hpp --- 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* compute_secondary_supers(int num_extra_slots, Array* 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. diff -r 22baf8054a40 -r 08db5aa02f7b src/hotspot/share/oops/klass.cpp --- 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." diff -r 22baf8054a40 -r 08db5aa02f7b src/hotspot/share/oops/klass.hpp --- 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; } diff -r 22baf8054a40 -r 08db5aa02f7b src/hotspot/share/oops/objArrayKlass.cpp --- 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 } diff -r 22baf8054a40 -r 08db5aa02f7b src/hotspot/share/oops/objArrayKlass.hpp --- 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* compute_secondary_supers(int num_extra_slots, Array* 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; diff -r 22baf8054a40 -r 08db5aa02f7b src/hotspot/share/oops/typeArrayKlass.cpp --- 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; diff -r 22baf8054a40 -r 08db5aa02f7b src/hotspot/share/oops/typeArrayKlass.hpp --- 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); }