Mercurial > hg > graal-compiler
comparison src/share/vm/oops/klassVtable.cpp @ 12318:36b97be47bde
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
Reviewed-by: coleenp, bharadwaj, minqi
author | acorn |
---|---|
date | Tue, 01 Oct 2013 08:10:42 -0400 |
parents | b2e698d2276c |
children | ac9cb1d5a202 |
comparison
equal
deleted
inserted
replaced
12317:a5ac0873476c | 12318:36b97be47bde |
---|---|
290 // we need a new entry if there is no superclass | 290 // we need a new entry if there is no superclass |
291 if (klass->super() == NULL) { | 291 if (klass->super() == NULL) { |
292 return allocate_new; | 292 return allocate_new; |
293 } | 293 } |
294 | 294 |
295 // private methods always have a new entry in the vtable | 295 // private methods in classes always have a new entry in the vtable |
296 // specification interpretation since classic has | 296 // specification interpretation since classic has |
297 // private methods not overriding | 297 // private methods not overriding |
298 // JDK8 adds private methods in interfaces which require invokespecial | |
298 if (target_method()->is_private()) { | 299 if (target_method()->is_private()) { |
299 return allocate_new; | 300 return allocate_new; |
300 } | 301 } |
301 | 302 |
302 // search through the vtable and update overridden entries | 303 // search through the vtable and update overridden entries |
440 // we need a new entry if there is no superclass | 441 // we need a new entry if there is no superclass |
441 if (super == NULL) { | 442 if (super == NULL) { |
442 return true; | 443 return true; |
443 } | 444 } |
444 | 445 |
445 // private methods always have a new entry in the vtable | 446 // private methods in classes always have a new entry in the vtable |
446 // specification interpretation since classic has | 447 // specification interpretation since classic has |
447 // private methods not overriding | 448 // private methods not overriding |
449 // JDK8 adds private methods in interfaces which require invokespecial | |
448 if (target_method()->is_private()) { | 450 if (target_method()->is_private()) { |
449 return true; | 451 return true; |
450 } | 452 } |
451 | 453 |
452 // search through the super class hierarchy to see if we need | 454 // search through the super class hierarchy to see if we need |
518 bool klassVtable::is_miranda_entry_at(int i) { | 520 bool klassVtable::is_miranda_entry_at(int i) { |
519 Method* m = method_at(i); | 521 Method* m = method_at(i); |
520 Klass* method_holder = m->method_holder(); | 522 Klass* method_holder = m->method_holder(); |
521 InstanceKlass *mhk = InstanceKlass::cast(method_holder); | 523 InstanceKlass *mhk = InstanceKlass::cast(method_holder); |
522 | 524 |
523 // miranda methods are interface methods in a class's vtable | 525 // miranda methods are public abstract instance interface methods in a class's vtable |
524 if (mhk->is_interface()) { | 526 if (mhk->is_interface()) { |
525 assert(m->is_public(), "should be public"); | 527 assert(m->is_public(), "should be public"); |
526 assert(ik()->implements_interface(method_holder) , "this class should implement the interface"); | 528 assert(ik()->implements_interface(method_holder) , "this class should implement the interface"); |
527 assert(is_miranda(m, ik()->methods(), ik()->super()), "should be a miranda_method"); | 529 assert(is_miranda(m, ik()->methods(), ik()->super()), "should be a miranda_method"); |
528 return true; | 530 return true; |
532 | 534 |
533 // check if a method is a miranda method, given a class's methods table and its super | 535 // check if a method is a miranda method, given a class's methods table and its super |
534 // "miranda" means not static, not defined by this class, and not defined | 536 // "miranda" means not static, not defined by this class, and not defined |
535 // in super unless it is private and therefore inaccessible to this class. | 537 // in super unless it is private and therefore inaccessible to this class. |
536 // the caller must make sure that the method belongs to an interface implemented by the class | 538 // the caller must make sure that the method belongs to an interface implemented by the class |
539 // Miranda methods only include public interface instance methods | |
540 // Not private methods, not static methods, not default = concrete abstract | |
537 bool klassVtable::is_miranda(Method* m, Array<Method*>* class_methods, Klass* super) { | 541 bool klassVtable::is_miranda(Method* m, Array<Method*>* class_methods, Klass* super) { |
538 if (m->is_static()) { | 542 if (m->is_static()) { |
539 return false; | 543 return false; |
540 } | 544 } |
541 Symbol* name = m->name(); | 545 Symbol* name = m->name(); |