src/share/vm/code/dependencies.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 7105305 Sdiff src/share/vm/code

src/share/vm/code/dependencies.cpp

Print this page




 749       return true;  // Quick win.
 750     if (m->is_private())
 751       return false; // Quick lose.  Should not happen.
 752     if (!(m->is_public() || m->is_protected()))
 753       // The override story is complex when packages get involved.
 754       return true;  // Must punt the assertion to true.
 755     Klass* k = Klass::cast(ctxk);
 756     methodOop lm = k->lookup_method(m->name(), m->signature());
 757     if (lm == NULL && k->oop_is_instance()) {
 758       // It might be an abstract interface method, devoid of mirandas.
 759       lm = ((instanceKlass*)k)->lookup_method_in_all_interfaces(m->name(),
 760                                                                 m->signature());
 761     }
 762     if (lm == m)
 763       // Method m is inherited into ctxk.
 764       return true;
 765     if (lm != NULL) {
 766       if (!(lm->is_public() || lm->is_protected()))
 767         // Method is [package-]private, so the override story is complex.
 768         return true;  // Must punt the assertion to true.




 769       if (   !Dependencies::is_concrete_method(lm)
 770           && !Dependencies::is_concrete_method(m)
 771           && Klass::cast(lm->method_holder())->is_subtype_of(m->method_holder()))
 772         // Method m is overridden by lm, but both are non-concrete.
 773         return true;
 774     }
 775     ResourceMark rm;
 776     tty->print_cr("Dependency method not found in the associated context:");
 777     tty->print_cr("  context = %s", Klass::cast(ctxk)->external_name());
 778     tty->print(   "  method = "); m->print_short_name(tty); tty->cr();
 779     if (lm != NULL) {
 780       tty->print( "  found = "); lm->print_short_name(tty); tty->cr();
 781     }
 782     return false;
 783   }
 784 #endif
 785 
 786   void add_participant(klassOop participant) {
 787     assert(_num_participants + _record_witnesses < PARTICIPANT_LIMIT, "oob");
 788     int np = _num_participants++;


1074       }
1075     }
1076   }
1077 
1078   // No witness found.  The dependency remains unbroken.
1079   return NULL;
1080 #undef ADD_SUBCLASS_CHAIN
1081 }
1082 
1083 
1084 bool Dependencies::is_concrete_klass(klassOop k) {
1085   if (Klass::cast(k)->is_abstract())  return false;
1086   // %%% We could treat classes which are concrete but
1087   // have not yet been instantiated as virtually abstract.
1088   // This would require a deoptimization barrier on first instantiation.
1089   //if (k->is_not_instantiated())  return false;
1090   return true;
1091 }
1092 
1093 bool Dependencies::is_concrete_method(methodOop m) {
1094   if (m->is_abstract())  return false;
1095   // %%% We could treat unexecuted methods as virtually abstract also.
1096   // This would require a deoptimization barrier on first execution.


1097   return !m->is_abstract();
1098 }
1099 
1100 
1101 Klass* Dependencies::find_finalizable_subclass(Klass* k) {
1102   if (k->is_interface())  return NULL;
1103   if (k->has_finalizer()) return k;
1104   k = k->subklass();
1105   while (k != NULL) {
1106     Klass* result = find_finalizable_subclass(k);
1107     if (result != NULL) return result;
1108     k = k->next_sibling();
1109   }
1110   return NULL;
1111 }
1112 
1113 
1114 bool Dependencies::is_concrete_klass(ciInstanceKlass* k) {
1115   if (k->is_abstract())  return false;
1116   // We could return also false if k does not yet appear to be
1117   // instantiated, if the VM version supports this distinction also.
1118   //if (k->is_not_instantiated())  return false;
1119   return true;
1120 }
1121 
1122 bool Dependencies::is_concrete_method(ciMethod* m) {
1123   // Statics are irrelevant to virtual call sites.
1124   if (m->is_static())  return false;
1125 
1126   // We could return also false if m does not yet appear to be
1127   // executed, if the VM version supports this distinction also.
1128   return !m->is_abstract();
1129 }
1130 
1131 
1132 bool Dependencies::has_finalizable_subclass(ciInstanceKlass* k) {
1133   return k->has_finalizable_subclass();
1134 }
1135 
1136 
1137 // Any use of the contents (bytecodes) of a method must be
1138 // marked by an "evol_method" dependency, if those contents
1139 // can change.  (Note: A method is always dependent on itself.)
1140 klassOop Dependencies::check_evol_method(methodOop m) {
1141   assert(must_be_in_vm(), "raw oops here");
1142   // Did somebody do a JVMTI RedefineClasses while our backs were turned?
1143   // Or is there a now a breakpoint?
1144   // (Assumes compiled code cannot handle bkpts; change if UseFastBreakpoints.)
1145   if (m->is_old()
1146       || m->number_of_breakpoints() > 0) {




 749       return true;  // Quick win.
 750     if (m->is_private())
 751       return false; // Quick lose.  Should not happen.
 752     if (!(m->is_public() || m->is_protected()))
 753       // The override story is complex when packages get involved.
 754       return true;  // Must punt the assertion to true.
 755     Klass* k = Klass::cast(ctxk);
 756     methodOop lm = k->lookup_method(m->name(), m->signature());
 757     if (lm == NULL && k->oop_is_instance()) {
 758       // It might be an abstract interface method, devoid of mirandas.
 759       lm = ((instanceKlass*)k)->lookup_method_in_all_interfaces(m->name(),
 760                                                                 m->signature());
 761     }
 762     if (lm == m)
 763       // Method m is inherited into ctxk.
 764       return true;
 765     if (lm != NULL) {
 766       if (!(lm->is_public() || lm->is_protected()))
 767         // Method is [package-]private, so the override story is complex.
 768         return true;  // Must punt the assertion to true.
 769       if (lm->is_static()) {
 770         // Static methods don't override non-static so punt
 771         return true;
 772       }
 773       if (   !Dependencies::is_concrete_method(lm)
 774           && !Dependencies::is_concrete_method(m)
 775           && Klass::cast(lm->method_holder())->is_subtype_of(m->method_holder()))
 776         // Method m is overridden by lm, but both are non-concrete.
 777         return true;
 778     }
 779     ResourceMark rm;
 780     tty->print_cr("Dependency method not found in the associated context:");
 781     tty->print_cr("  context = %s", Klass::cast(ctxk)->external_name());
 782     tty->print(   "  method = "); m->print_short_name(tty); tty->cr();
 783     if (lm != NULL) {
 784       tty->print( "  found = "); lm->print_short_name(tty); tty->cr();
 785     }
 786     return false;
 787   }
 788 #endif
 789 
 790   void add_participant(klassOop participant) {
 791     assert(_num_participants + _record_witnesses < PARTICIPANT_LIMIT, "oob");
 792     int np = _num_participants++;


1078       }
1079     }
1080   }
1081 
1082   // No witness found.  The dependency remains unbroken.
1083   return NULL;
1084 #undef ADD_SUBCLASS_CHAIN
1085 }
1086 
1087 
1088 bool Dependencies::is_concrete_klass(klassOop k) {
1089   if (Klass::cast(k)->is_abstract())  return false;
1090   // %%% We could treat classes which are concrete but
1091   // have not yet been instantiated as virtually abstract.
1092   // This would require a deoptimization barrier on first instantiation.
1093   //if (k->is_not_instantiated())  return false;
1094   return true;
1095 }
1096 
1097 bool Dependencies::is_concrete_method(methodOop m) {
1098   // Statics are irrelevant to virtual call sites.
1099   if (m->is_static())  return false;
1100 
1101   // We could also return false if m does not yet appear to be
1102   // executed, if the VM version supports this distinction also.
1103   return !m->is_abstract();
1104 }
1105 
1106 
1107 Klass* Dependencies::find_finalizable_subclass(Klass* k) {
1108   if (k->is_interface())  return NULL;
1109   if (k->has_finalizer()) return k;
1110   k = k->subklass();
1111   while (k != NULL) {
1112     Klass* result = find_finalizable_subclass(k);
1113     if (result != NULL) return result;
1114     k = k->next_sibling();
1115   }
1116   return NULL;
1117 }
1118 
1119 
1120 bool Dependencies::is_concrete_klass(ciInstanceKlass* k) {
1121   if (k->is_abstract())  return false;
1122   // We could also return false if k does not yet appear to be
1123   // instantiated, if the VM version supports this distinction also.
1124   //if (k->is_not_instantiated())  return false;
1125   return true;
1126 }
1127 
1128 bool Dependencies::is_concrete_method(ciMethod* m) {
1129   // Statics are irrelevant to virtual call sites.
1130   if (m->is_static())  return false;
1131 
1132   // We could also return false if m does not yet appear to be
1133   // executed, if the VM version supports this distinction also.
1134   return !m->is_abstract();
1135 }
1136 
1137 
1138 bool Dependencies::has_finalizable_subclass(ciInstanceKlass* k) {
1139   return k->has_finalizable_subclass();
1140 }
1141 
1142 
1143 // Any use of the contents (bytecodes) of a method must be
1144 // marked by an "evol_method" dependency, if those contents
1145 // can change.  (Note: A method is always dependent on itself.)
1146 klassOop Dependencies::check_evol_method(methodOop m) {
1147   assert(must_be_in_vm(), "raw oops here");
1148   // Did somebody do a JVMTI RedefineClasses while our backs were turned?
1149   // Or is there a now a breakpoint?
1150   // (Assumes compiled code cannot handle bkpts; change if UseFastBreakpoints.)
1151   if (m->is_old()
1152       || m->number_of_breakpoints() > 0) {


src/share/vm/code/dependencies.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File