src/hotspot/share/oops/method.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File open Sdiff src/hotspot/share/oops

src/hotspot/share/oops/method.cpp

Print this page




 814   // Note: is_method_handle_intrinsic() is allowed here.
 815   set_native_function(
 816     SharedRuntime::native_method_throw_unsatisfied_link_error_entry(),
 817     !native_bind_event_is_interesting);
 818   this->unlink_code();
 819 }
 820 
 821 address Method::critical_native_function() {
 822   methodHandle mh(this);
 823   return NativeLookup::lookup_critical_entry(mh);
 824 }
 825 
 826 
 827 void Method::set_signature_handler(address handler) {
 828   address* signature_handler =  signature_handler_addr();
 829   *signature_handler = handler;
 830 }
 831 
 832 
 833 void Method::print_made_not_compilable(int comp_level, bool is_osr, bool report, const char* reason) {

 834   if (PrintCompilation && report) {
 835     ttyLocker ttyl;
 836     tty->print("made not %scompilable on ", is_osr ? "OSR " : "");
 837     if (comp_level == CompLevel_all) {
 838       tty->print("all levels ");
 839     } else {
 840       tty->print("levels ");
 841       for (int i = (int)CompLevel_none; i <= comp_level; i++) {
 842         tty->print("%d ", i);
 843       }
 844     }
 845     this->print_short_name(tty);
 846     int size = this->code_size();
 847     if (size > 0) {
 848       tty->print(" (%d bytes)", size);
 849     }
 850     if (reason != NULL) {
 851       tty->print("   %s", reason);
 852     }
 853     tty->cr();


 874   }
 875 
 876   return false;
 877 }
 878 
 879 bool Method::is_not_compilable(int comp_level) const {
 880   if (number_of_breakpoints() > 0)
 881     return true;
 882   if (is_always_compilable())
 883     return false;
 884   if (comp_level == CompLevel_any)
 885     return is_not_c1_compilable() || is_not_c2_compilable();
 886   if (is_c1_compile(comp_level))
 887     return is_not_c1_compilable();
 888   if (is_c2_compile(comp_level))
 889     return is_not_c2_compilable();
 890   return false;
 891 }
 892 
 893 // call this when compiler finds that this method is not compilable
 894 void Method::set_not_compilable(int comp_level, bool report, const char* reason) {
 895   if (is_always_compilable()) {
 896     // Don't mark a method which should be always compilable
 897     return;
 898   }
 899   print_made_not_compilable(comp_level, /*is_osr*/ false, report, reason);
 900   if (comp_level == CompLevel_all) {
 901     set_not_c1_compilable();
 902     set_not_c2_compilable();
 903   } else {
 904     if (is_c1_compile(comp_level))
 905       set_not_c1_compilable();
 906     if (is_c2_compile(comp_level))
 907       set_not_c2_compilable();
 908   }
 909   CompilationPolicy::policy()->disable_compilation(this);
 910   assert(!CompilationPolicy::can_be_compiled(this, comp_level), "sanity check");
 911 }
 912 
 913 bool Method::is_not_osr_compilable(int comp_level) const {
 914   if (is_not_compilable(comp_level))
 915     return true;
 916   if (comp_level == CompLevel_any)
 917     return is_not_c1_osr_compilable() || is_not_c2_osr_compilable();
 918   if (is_c1_compile(comp_level))
 919     return is_not_c1_osr_compilable();
 920   if (is_c2_compile(comp_level))
 921     return is_not_c2_osr_compilable();
 922   return false;
 923 }
 924 
 925 void Method::set_not_osr_compilable(int comp_level, bool report, const char* reason) {
 926   print_made_not_compilable(comp_level, /*is_osr*/ true, report, reason);
 927   if (comp_level == CompLevel_all) {
 928     set_not_c1_osr_compilable();
 929     set_not_c2_osr_compilable();
 930   } else {
 931     if (is_c1_compile(comp_level))
 932       set_not_c1_osr_compilable();
 933     if (is_c2_compile(comp_level))
 934       set_not_c2_osr_compilable();
 935   }
 936   CompilationPolicy::policy()->disable_compilation(this);
 937   assert(!CompilationPolicy::can_be_osr_compiled(this, comp_level), "sanity check");
 938 }
 939 
 940 // Revert to using the interpreter and clear out the nmethod
 941 void Method::clear_code() {
 942   // this may be NULL if c2i adapters have not been made yet
 943   // Only should happen at allocate time.
 944   if (adapter() == NULL) {
 945     _from_compiled_entry    = NULL;




 814   // Note: is_method_handle_intrinsic() is allowed here.
 815   set_native_function(
 816     SharedRuntime::native_method_throw_unsatisfied_link_error_entry(),
 817     !native_bind_event_is_interesting);
 818   this->unlink_code();
 819 }
 820 
 821 address Method::critical_native_function() {
 822   methodHandle mh(this);
 823   return NativeLookup::lookup_critical_entry(mh);
 824 }
 825 
 826 
 827 void Method::set_signature_handler(address handler) {
 828   address* signature_handler =  signature_handler_addr();
 829   *signature_handler = handler;
 830 }
 831 
 832 
 833 void Method::print_made_not_compilable(int comp_level, bool is_osr, bool report, const char* reason) {
 834   assert(reason != NULL, "must provide a reason");
 835   if (PrintCompilation && report) {
 836     ttyLocker ttyl;
 837     tty->print("made not %scompilable on ", is_osr ? "OSR " : "");
 838     if (comp_level == CompLevel_all) {
 839       tty->print("all levels ");
 840     } else {
 841       tty->print("levels ");
 842       for (int i = (int)CompLevel_none; i <= comp_level; i++) {
 843         tty->print("%d ", i);
 844       }
 845     }
 846     this->print_short_name(tty);
 847     int size = this->code_size();
 848     if (size > 0) {
 849       tty->print(" (%d bytes)", size);
 850     }
 851     if (reason != NULL) {
 852       tty->print("   %s", reason);
 853     }
 854     tty->cr();


 875   }
 876 
 877   return false;
 878 }
 879 
 880 bool Method::is_not_compilable(int comp_level) const {
 881   if (number_of_breakpoints() > 0)
 882     return true;
 883   if (is_always_compilable())
 884     return false;
 885   if (comp_level == CompLevel_any)
 886     return is_not_c1_compilable() || is_not_c2_compilable();
 887   if (is_c1_compile(comp_level))
 888     return is_not_c1_compilable();
 889   if (is_c2_compile(comp_level))
 890     return is_not_c2_compilable();
 891   return false;
 892 }
 893 
 894 // call this when compiler finds that this method is not compilable
 895 void Method::set_not_compilable(const char* reason, int comp_level, bool report) {
 896   if (is_always_compilable()) {
 897     // Don't mark a method which should be always compilable
 898     return;
 899   }
 900   print_made_not_compilable(comp_level, /*is_osr*/ false, report, reason);
 901   if (comp_level == CompLevel_all) {
 902     set_not_c1_compilable();
 903     set_not_c2_compilable();
 904   } else {
 905     if (is_c1_compile(comp_level))
 906       set_not_c1_compilable();
 907     if (is_c2_compile(comp_level))
 908       set_not_c2_compilable();
 909   }
 910   CompilationPolicy::policy()->disable_compilation(this);
 911   assert(!CompilationPolicy::can_be_compiled(this, comp_level), "sanity check");
 912 }
 913 
 914 bool Method::is_not_osr_compilable(int comp_level) const {
 915   if (is_not_compilable(comp_level))
 916     return true;
 917   if (comp_level == CompLevel_any)
 918     return is_not_c1_osr_compilable() || is_not_c2_osr_compilable();
 919   if (is_c1_compile(comp_level))
 920     return is_not_c1_osr_compilable();
 921   if (is_c2_compile(comp_level))
 922     return is_not_c2_osr_compilable();
 923   return false;
 924 }
 925 
 926 void Method::set_not_osr_compilable(const char* reason, int comp_level, bool report) {
 927   print_made_not_compilable(comp_level, /*is_osr*/ true, report, reason);
 928   if (comp_level == CompLevel_all) {
 929     set_not_c1_osr_compilable();
 930     set_not_c2_osr_compilable();
 931   } else {
 932     if (is_c1_compile(comp_level))
 933       set_not_c1_osr_compilable();
 934     if (is_c2_compile(comp_level))
 935       set_not_c2_osr_compilable();
 936   }
 937   CompilationPolicy::policy()->disable_compilation(this);
 938   assert(!CompilationPolicy::can_be_osr_compiled(this, comp_level), "sanity check");
 939 }
 940 
 941 // Revert to using the interpreter and clear out the nmethod
 942 void Method::clear_code() {
 943   // this may be NULL if c2i adapters have not been made yet
 944   // Only should happen at allocate time.
 945   if (adapter() == NULL) {
 946     _from_compiled_entry    = NULL;


src/hotspot/share/oops/method.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File