< prev index next > src/hotspot/share/oops/klassVtable.cpp
Print this page
initialize_itable(supers);
check_constraints(supers, CHECK);
}
inline bool interface_method_needs_itable_index(Method* m) {
- if (m->is_static()) return false; // e.g., Stream.empty
- if (m->is_initializer()) return false; // <init> or <clinit>
- if (m->is_private()) return false; // uses direct call
+ if (m->is_static()) return false; // e.g., Stream.empty
+ if (m->is_private()) return false; // uses direct call
+ if (m->is_object_constructor()) return false; // <init>(...)V
+ if (m->is_class_initializer()) return false; // <clinit>()V
// If an interface redeclares a method from java.lang.Object,
// it should already have a vtable index, don't touch it.
// e.g., CharSequence.toString (from initialize_vtable)
// if (m->has_vtable_index()) return false; // NO!
return true;
class InterfaceVisiterClosure : public StackObj {
public:
virtual void doit(InstanceKlass* intf, int method_count) = 0;
};
+ int count_interface_methods_needing_itable_index(Array<Method*>* methods) {
+ int method_count = 0;
+ if (methods->length() > 0) {
+ for (int i = methods->length(); --i >= 0; ) {
+ if (interface_method_needs_itable_index(methods->at(i))) {
+ method_count++;
+ }
+ }
+ }
+ return method_count;
+ }
+
// Visit all interfaces with at least one itable method
static void visit_all_interfaces(Array<InstanceKlass*>* transitive_intf, InterfaceVisiterClosure *blk) {
// Handle array argument
for(int i = 0; i < transitive_intf->length(); i++) {
InstanceKlass* intf = transitive_intf->at(i);
< prev index next >