hotspot/src/share/vm/oops/klassVtable.cpp
changeset 46727 6e4a84748e2c
parent 46701 f559541c0daa
child 46729 c62d2e8b2728
equal deleted inserted replaced
46726:7801367e3cc9 46727:6e4a84748e2c
   285 // P1.C extends B, public m
   285 // P1.C extends B, public m
   286 // P1.C.m needs to override P1.A.m and can not override P2.B.m
   286 // P1.C.m needs to override P1.A.m and can not override P2.B.m
   287 // Therefore: all package private methods need their own vtable entries for
   287 // Therefore: all package private methods need their own vtable entries for
   288 // them to be the root of an inheritance overriding decision
   288 // them to be the root of an inheritance overriding decision
   289 // Package private methods may also override other vtable entries
   289 // Package private methods may also override other vtable entries
   290 InstanceKlass* klassVtable::find_transitive_override(InstanceKlass* initialsuper, methodHandle target_method,
   290 InstanceKlass* klassVtable::find_transitive_override(InstanceKlass* initialsuper, const methodHandle& target_method,
   291                             int vtable_index, Handle target_loader, Symbol* target_classname, Thread * THREAD) {
   291                             int vtable_index, Handle target_loader, Symbol* target_classname, Thread * THREAD) {
   292   InstanceKlass* superk = initialsuper;
   292   InstanceKlass* superk = initialsuper;
   293   while (superk != NULL && superk->super() != NULL) {
   293   while (superk != NULL && superk->super() != NULL) {
   294     InstanceKlass* supersuperklass = InstanceKlass::cast(superk->super());
   294     InstanceKlass* supersuperklass = InstanceKlass::cast(superk->super());
   295     klassVtable ssVtable = supersuperklass->vtable();
   295     klassVtable ssVtable = supersuperklass->vtable();
   327   }
   327   }
   328 
   328 
   329   return superk;
   329   return superk;
   330 }
   330 }
   331 
   331 
   332 static void log_vtables(int i, bool overrides, methodHandle target_method,
   332 static void log_vtables(int i, bool overrides, const methodHandle& target_method,
   333                         Klass* target_klass, Method* super_method,
   333                         Klass* target_klass, Method* super_method,
   334                         Thread* thread) {
   334                         Thread* thread) {
   335 #ifndef PRODUCT
   335 #ifndef PRODUCT
   336   if (log_develop_is_enabled(Trace, vtables)) {
   336   if (log_develop_is_enabled(Trace, vtables)) {
   337     ResourceMark rm(thread);
   337     ResourceMark rm(thread);
   355 
   355 
   356 // Update child's copy of super vtable for overrides
   356 // Update child's copy of super vtable for overrides
   357 // OR return true if a new vtable entry is required.
   357 // OR return true if a new vtable entry is required.
   358 // Only called for InstanceKlass's, i.e. not for arrays
   358 // Only called for InstanceKlass's, i.e. not for arrays
   359 // If that changed, could not use _klass as handle for klass
   359 // If that changed, could not use _klass as handle for klass
   360 bool klassVtable::update_inherited_vtable(InstanceKlass* klass, methodHandle target_method,
   360 bool klassVtable::update_inherited_vtable(InstanceKlass* klass, const methodHandle& target_method,
   361                                           int super_vtable_len, int default_index,
   361                                           int super_vtable_len, int default_index,
   362                                           bool checkconstraints, TRAPS) {
   362                                           bool checkconstraints, TRAPS) {
   363   ResourceMark rm;
   363   ResourceMark rm;
   364   bool allocate_new = true;
   364   bool allocate_new = true;
   365   assert(klass->is_instance_klass(), "must be InstanceKlass");
   365   assert(klass->is_instance_klass(), "must be InstanceKlass");
   574 // the vtables indices for a method. We cannot directly use that function because,
   574 // the vtables indices for a method. We cannot directly use that function because,
   575 // we allocate the InstanceKlass at load time, and that requires that the
   575 // we allocate the InstanceKlass at load time, and that requires that the
   576 // superclass has been loaded.
   576 // superclass has been loaded.
   577 // However, the vtable entries are filled in at link time, and therefore
   577 // However, the vtable entries are filled in at link time, and therefore
   578 // the superclass' vtable may not yet have been filled in.
   578 // the superclass' vtable may not yet have been filled in.
   579 bool klassVtable::needs_new_vtable_entry(methodHandle target_method,
   579 bool klassVtable::needs_new_vtable_entry(const methodHandle& target_method,
   580                                          const Klass* super,
   580                                          const Klass* super,
   581                                          Handle classloader,
   581                                          Handle classloader,
   582                                          Symbol* classname,
   582                                          Symbol* classname,
   583                                          AccessFlags class_flags,
   583                                          AccessFlags class_flags,
   584                                          u2 major_version,
   584                                          u2 major_version,