< prev index next >
src/hotspot/share/oops/klassVtable.cpp
Print this page
*** 1331,1340 ****
--- 1331,1352 ----
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
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);
*** 1399,1409 ****
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);
! // There's alway an extra itable entry so we can null-terminate it.
int itable_size = calc_itable_size(cic.nof_interfaces() + 1, cic.nof_methods());
// Statistics
update_stats(itable_size * wordSize);
--- 1411,1421 ----
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);
! // There's always an extra itable entry so we can null-terminate it.
int itable_size = calc_itable_size(cic.nof_interfaces() + 1, cic.nof_methods());
// Statistics
update_stats(itable_size * wordSize);
< prev index next >