8216189: Remove Klass::compute_is_subtype_of

Reviewed-by: hseigel, jiangli
This commit is contained in:
Claes Redestad 2019-01-05 20:08:24 +01:00
parent 53f83ebdf9
commit 13fcbf9d8f
10 changed files with 9 additions and 56 deletions

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -122,13 +122,6 @@ GrowableArray<Klass*>* ArrayKlass::compute_secondary_supers(int num_extra_slots,
return NULL; 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) { objArrayOop ArrayKlass::allocate_arrayArray(int n, int length, TRAPS) {
check_array_allocation_length(length, arrayOopDesc::max_array_length(T_ARRAY), CHECK_0); check_array_allocation_length(length, arrayOopDesc::max_array_length(T_ARRAY), CHECK_0);
int size = objArrayOopDesc::object_size(length); int size = objArrayOopDesc::object_size(length);

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -99,7 +99,6 @@ class ArrayKlass: public Klass {
GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots, GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
Array<InstanceKlass*>* transitive_interfaces); Array<InstanceKlass*>* transitive_interfaces);
bool compute_is_subtype_of(Klass* k);
// Sizing // Sizing
static int static_size(int header_size); static int static_size(int header_size);

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -1199,14 +1199,6 @@ GrowableArray<Klass*>* InstanceKlass::compute_secondary_supers(int num_extra_slo
} }
} }
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 { bool InstanceKlass::implements_interface(Klass* k) const {
if (this == k) return true; if (this == k) return true;
assert(k->is_interface(), "should be an interface class"); assert(k->is_interface(), "should be an interface class");

View file

@ -1019,7 +1019,6 @@ public:
bool is_leaf_class() const { return _subklass == NULL; } bool is_leaf_class() const { return _subklass == NULL; }
GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots, GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
Array<InstanceKlass*>* transitive_interfaces); Array<InstanceKlass*>* transitive_interfaces);
bool compute_is_subtype_of(Klass* k);
bool can_be_primary_super_slow() const; bool can_be_primary_super_slow() const;
int oop_size(oop obj) const { return size_helper(); } int oop_size(oop obj) const { return size_helper(); }
// slow because it's a virtual call and used for verifying the layout_helper. // slow because it's a virtual call and used for verifying the layout_helper.

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -159,11 +159,6 @@ void Klass::initialize(TRAPS) {
ShouldNotReachHere(); 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 { Klass* Klass::find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const {
#ifdef ASSERT #ifdef ASSERT
tty->print_cr("Error: find_field called on a klass oop." tty->print_cr("Error: find_field called on a klass oop."

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -529,9 +529,6 @@ protected:
virtual void remove_java_mirror(); virtual void remove_java_mirror();
virtual void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS); 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: public:
// subclass accessor (here for convenience; undefined for non-klass objects) // subclass accessor (here for convenience; undefined for non-klass objects)
virtual bool is_leaf_class() const { fatal("not a class"); return false; } virtual bool is_leaf_class() const { fatal("not a class"); return false; }

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -395,14 +395,6 @@ GrowableArray<Klass*>* ObjArrayKlass::compute_secondary_supers(int num_extra_slo
} }
} }
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) { void ObjArrayKlass::initialize(TRAPS) {
bottom_klass()->initialize(THREAD); // dispatches to either InstanceKlass or TypeArrayKlass bottom_klass()->initialize(THREAD); // dispatches to either InstanceKlass or TypeArrayKlass
} }

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -70,7 +70,6 @@ class ObjArrayKlass : public ArrayKlass {
bool can_be_primary_super_slow() const; bool can_be_primary_super_slow() const;
GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots, GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
Array<InstanceKlass*>* transitive_interfaces); Array<InstanceKlass*>* transitive_interfaces);
bool compute_is_subtype_of(Klass* k);
DEBUG_ONLY(bool is_objArray_klass_slow() const { return true; }) DEBUG_ONLY(bool is_objArray_klass_slow() const { return true; })
int oop_size(oop obj) const; int oop_size(oop obj) const;

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -44,17 +44,6 @@
#include "runtime/handles.inline.hpp" #include "runtime/handles.inline.hpp"
#include "utilities/macros.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, TypeArrayKlass* TypeArrayKlass::create_klass(BasicType type,
const char* name_str, TRAPS) { const char* name_str, TRAPS) {
Symbol* sym = NULL; Symbol* sym = NULL;

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -62,8 +62,6 @@ class TypeArrayKlass : public ArrayKlass {
int oop_size(oop obj) const; int oop_size(oop obj) const;
bool compute_is_subtype_of(Klass* k);
// Allocation // Allocation
typeArrayOop allocate_common(int length, bool do_zero, TRAPS); typeArrayOop allocate_common(int length, bool do_zero, TRAPS);
typeArrayOop allocate(int length, TRAPS) { return allocate_common(length, true, THREAD); } typeArrayOop allocate(int length, TRAPS) { return allocate_common(length, true, THREAD); }