--- a/src/hotspot/share/oops/klassVtable.cpp Tue Aug 07 16:07:47 2018 -0700
+++ b/src/hotspot/share/oops/klassVtable.cpp Tue Aug 07 15:45:07 2018 -0700
@@ -66,7 +66,7 @@
int* vtable_length_ret, int* num_new_mirandas,
GrowableArray<Method*>* all_mirandas, const Klass* super,
Array<Method*>* methods, AccessFlags class_flags, u2 major_version,
- Handle classloader, Symbol* classname, Array<Klass*>* local_interfaces,
+ Handle classloader, Symbol* classname, Array<InstanceKlass*>* local_interfaces,
TRAPS) {
NoSafepointVerifier nsv;
@@ -166,7 +166,7 @@
void klassVtable::initialize_vtable(bool checkconstraints, TRAPS) {
// Note: Arrays can have intermediate array supers. Use java_super to skip them.
- Klass* super = _klass->java_super();
+ InstanceKlass* super = _klass->java_super();
int nofNewEntries = 0;
bool is_shared = _klass->is_shared();
@@ -871,7 +871,7 @@
const Klass* super,
Array<Method*>* class_methods,
Array<Method*>* default_methods,
- Array<Klass*>* local_interfaces,
+ Array<InstanceKlass*>* local_interfaces,
bool is_interface) {
assert((new_mirandas->length() == 0) , "current mirandas must be 0");
@@ -883,10 +883,10 @@
ik->methods(), class_methods,
default_methods, super, is_interface);
// iterate thru each local's super interfaces
- Array<Klass*>* super_ifs = ik->transitive_interfaces();
+ Array<InstanceKlass*>* super_ifs = ik->transitive_interfaces();
int num_super_ifs = super_ifs->length();
for (int j = 0; j < num_super_ifs; j++) {
- InstanceKlass *sik = InstanceKlass::cast(super_ifs->at(j));
+ InstanceKlass *sik = super_ifs->at(j);
add_new_mirandas_to_lists(new_mirandas, all_mirandas,
sik->methods(), class_methods,
default_methods, super, is_interface);
@@ -1082,7 +1082,7 @@
if (_klass->is_interface()) {
// This needs to go after vtable indices are assigned but
// before implementors need to know the number of itable indices.
- assign_itable_indices_for_interface(_klass, THREAD);
+ assign_itable_indices_for_interface(InstanceKlass::cast(_klass), THREAD);
}
// Cannot be setup doing bootstrapping, interfaces don't have
@@ -1107,7 +1107,7 @@
HandleMark hm(THREAD);
Klass* interf = ioe->interface_klass();
assert(interf != NULL && ioe->offset() != 0, "bad offset entry in itable");
- initialize_itable_for_interface(ioe->offset(), interf, checkconstraints, CHECK);
+ initialize_itable_for_interface(ioe->offset(), InstanceKlass::cast(interf), checkconstraints, CHECK);
}
}
@@ -1128,12 +1128,12 @@
return true;
}
-int klassItable::assign_itable_indices_for_interface(Klass* klass, TRAPS) {
+int klassItable::assign_itable_indices_for_interface(InstanceKlass* klass, TRAPS) {
// an interface does not have an itable, but its methods need to be numbered
ResourceMark rm(THREAD);
log_develop_debug(itables)("%3d: Initializing itable indices for interface %s",
++initialize_count, klass->name()->as_C_string());
- Array<Method*>* methods = InstanceKlass::cast(klass)->methods();
+ Array<Method*>* methods = klass->methods();
int nof_methods = methods->length();
int ime_num = 0;
for (int i = 0; i < nof_methods; i++) {
@@ -1170,10 +1170,9 @@
return ime_num;
}
-int klassItable::method_count_for_interface(Klass* interf) {
- assert(interf->is_instance_klass(), "must be");
+int klassItable::method_count_for_interface(InstanceKlass* interf) {
assert(interf->is_interface(), "must be");
- Array<Method*>* methods = InstanceKlass::cast(interf)->methods();
+ Array<Method*>* methods = interf->methods();
int nof_methods = methods->length();
int length = 0;
while (nof_methods > 0) {
@@ -1197,11 +1196,12 @@
}
-void klassItable::initialize_itable_for_interface(int method_table_offset, Klass* interf, bool checkconstraints, TRAPS) {
- Array<Method*>* methods = InstanceKlass::cast(interf)->methods();
+void klassItable::initialize_itable_for_interface(int method_table_offset, InstanceKlass* interf, bool checkconstraints, TRAPS) {
+ assert(interf->is_interface(), "must be");
+ Array<Method*>* methods = interf->methods();
int nof_methods = methods->length();
HandleMark hm;
- Handle interface_loader (THREAD, InstanceKlass::cast(interf)->class_loader());
+ Handle interface_loader (THREAD, interf->class_loader());
int ime_count = method_count_for_interface(interf);
for (int i = 0; i < nof_methods; i++) {
@@ -1349,20 +1349,20 @@
// Setup
class InterfaceVisiterClosure : public StackObj {
public:
- virtual void doit(Klass* intf, int method_count) = 0;
+ virtual void doit(InstanceKlass* intf, int method_count) = 0;
};
// Visit all interfaces with at least one itable method
-void visit_all_interfaces(Array<Klass*>* transitive_intf, InterfaceVisiterClosure *blk) {
+void visit_all_interfaces(Array<InstanceKlass*>* transitive_intf, InterfaceVisiterClosure *blk) {
// Handle array argument
for(int i = 0; i < transitive_intf->length(); i++) {
- Klass* intf = transitive_intf->at(i);
+ InstanceKlass* intf = transitive_intf->at(i);
assert(intf->is_interface(), "sanity check");
// Find no. of itable methods
int method_count = 0;
// method_count = klassItable::method_count_for_interface(intf);
- Array<Method*>* methods = InstanceKlass::cast(intf)->methods();
+ Array<Method*>* methods = intf->methods();
if (methods->length() > 0) {
for (int i = methods->length(); --i >= 0; ) {
if (interface_method_needs_itable_index(methods->at(i))) {
@@ -1374,7 +1374,7 @@
// Visit all interfaces which either have any methods or can participate in receiver type check.
// We do not bother to count methods in transitive interfaces, although that would allow us to skip
// this step in the rare case of a zero-method interface extending another zero-method interface.
- if (method_count > 0 || InstanceKlass::cast(intf)->transitive_interfaces()->length() > 0) {
+ if (method_count > 0 || intf->transitive_interfaces()->length() > 0) {
blk->doit(intf, method_count);
}
}
@@ -1390,7 +1390,7 @@
int nof_methods() const { return _nof_methods; }
int nof_interfaces() const { return _nof_interfaces; }
- void doit(Klass* intf, int method_count) { _nof_methods += method_count; _nof_interfaces++; }
+ void doit(InstanceKlass* intf, int method_count) { _nof_methods += method_count; _nof_interfaces++; }
};
class SetupItableClosure : public InterfaceVisiterClosure {
@@ -1407,7 +1407,7 @@
itableMethodEntry* method_entry() const { return _method_entry; }
- void doit(Klass* intf, int method_count) {
+ void doit(InstanceKlass* intf, int method_count) {
int offset = ((address)_method_entry) - _klass_begin;
_offset_entry->initialize(intf, offset);
_offset_entry++;
@@ -1415,7 +1415,7 @@
}
};
-int klassItable::compute_itable_size(Array<Klass*>* transitive_interfaces) {
+int klassItable::compute_itable_size(Array<InstanceKlass*>* transitive_interfaces) {
// Count no of interfaces and total number of interface methods
CountInterfacesClosure cic;
visit_all_interfaces(transitive_interfaces, &cic);
@@ -1468,8 +1468,8 @@
// inverse to itable_index
-Method* klassItable::method_for_itable_index(Klass* intf, int itable_index) {
- assert(InstanceKlass::cast(intf)->is_interface(), "sanity check");
+Method* klassItable::method_for_itable_index(InstanceKlass* intf, int itable_index) {
+ assert(intf->is_interface(), "sanity check");
assert(intf->verify_itable_index(itable_index), "");
Array<Method*>* methods = InstanceKlass::cast(intf)->methods();