< prev index next >

src/hotspot/share/oops/klassVtable.cpp

Print this page

        

*** 64,74 **** // entered as a public abstract method in C's vtable. From then on it should // treated as any other public method in C for method over-ride purposes. void klassVtable::compute_vtable_size_and_num_mirandas( 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<InstanceKlass*>* local_interfaces, TRAPS) { NoSafepointVerifier nsv; // set up default result values --- 64,74 ---- // entered as a public abstract method in C's vtable. From then on it should // treated as any other public method in C for method over-ride purposes. void klassVtable::compute_vtable_size_and_num_mirandas( int* vtable_length_ret, int* num_new_mirandas, GrowableArray<Method*>* all_mirandas, const Klass* super, ! Array<Method*>* methods, AccessFlags class_flags, bool is_class_sealed, u2 major_version, Handle classloader, Symbol* classname, Array<InstanceKlass*>* local_interfaces, TRAPS) { NoSafepointVerifier nsv; // set up default result values
*** 81,91 **** int len = methods->length(); for (int i = 0; i < len; i++) { assert(methods->at(i)->is_method(), "must be a Method*"); methodHandle mh(THREAD, methods->at(i)); ! if (needs_new_vtable_entry(mh, super, classloader, classname, class_flags, major_version, THREAD)) { assert(!methods->at(i)->is_private(), "private methods should not need a vtable entry"); vtable_length += vtableEntry::size(); // we need a new entry } } --- 81,91 ---- int len = methods->length(); for (int i = 0; i < len; i++) { assert(methods->at(i)->is_method(), "must be a Method*"); methodHandle mh(THREAD, methods->at(i)); ! if (needs_new_vtable_entry(mh, super, classloader, classname, class_flags, is_class_sealed, major_version, THREAD)) { assert(!methods->at(i)->is_private(), "private methods should not need a vtable entry"); vtable_length += vtableEntry::size(); // we need a new entry } }
*** 395,405 **** if (target_method()->is_private() || target_method()->is_static() || (target_method()->name()->fast_compare(vmSymbols::object_initializer_name()) == 0)) { return false; } ! if (target_method->is_final_method(klass->access_flags())) { // a final method never needs a new entry; final methods can be statically // resolved and they have to be present in the vtable only if they override // a super's method, in which case they re-use its entry allocate_new = false; } else if (klass->is_interface()) { --- 395,405 ---- if (target_method()->is_private() || target_method()->is_static() || (target_method()->name()->fast_compare(vmSymbols::object_initializer_name()) == 0)) { return false; } ! if (target_method->is_final_method(klass->access_flags(), klass->is_sealed())) { // a final method never needs a new entry; final methods can be statically // resolved and they have to be present in the vtable only if they override // a super's method, in which case they re-use its entry allocate_new = false; } else if (klass->is_interface()) {
*** 582,602 **** bool klassVtable::needs_new_vtable_entry(const methodHandle& target_method, const Klass* super, Handle classloader, Symbol* classname, AccessFlags class_flags, u2 major_version, TRAPS) { if (class_flags.is_interface()) { // Interfaces do not use vtables, except for java.lang.Object methods, // so there is no point to assigning // a vtable index to any of their local methods. If we refrain from doing this, // we can use Method::_vtable_index to hold the itable index return false; } ! if (target_method->is_final_method(class_flags) || // a final method never needs a new entry; final methods can be statically // resolved and they have to be present in the vtable only if they override // a super's method, in which case they re-use its entry (target_method()->is_private()) || // private methods don't need to be in vtable --- 582,603 ---- bool klassVtable::needs_new_vtable_entry(const methodHandle& target_method, const Klass* super, Handle classloader, Symbol* classname, AccessFlags class_flags, + bool is_sealed, u2 major_version, TRAPS) { if (class_flags.is_interface()) { // Interfaces do not use vtables, except for java.lang.Object methods, // so there is no point to assigning // a vtable index to any of their local methods. If we refrain from doing this, // we can use Method::_vtable_index to hold the itable index return false; } ! if (target_method->is_final_method(class_flags, is_sealed) || // a final method never needs a new entry; final methods can be statically // resolved and they have to be present in the vtable only if they override // a super's method, in which case they re-use its entry (target_method()->is_private()) || // private methods don't need to be in vtable
< prev index next >