< prev index next >

src/hotspot/share/ci/ciEnv.cpp

Print this page




 935     } else {
 936       record_failure("invalid non-klass dependency");
 937     }
 938   }
 939 }
 940 
 941 // ------------------------------------------------------------------
 942 // ciEnv::register_method
 943 void ciEnv::register_method(ciMethod* target,
 944                             int entry_bci,
 945                             CodeOffsets* offsets,
 946                             int orig_pc_offset,
 947                             CodeBuffer* code_buffer,
 948                             int frame_words,
 949                             OopMapSet* oop_map_set,
 950                             ExceptionHandlerTable* handler_table,
 951                             ImplicitExceptionTable* inc_table,
 952                             AbstractCompiler* compiler,
 953                             bool has_unsafe_access,
 954                             bool has_wide_vectors,


 955                             RTMState  rtm_state) {
 956   VM_ENTRY_MARK;
 957   nmethod* nm = NULL;
 958   {
 959     // To prevent compile queue updates.
 960     MutexLocker locker(MethodCompileQueue_lock, THREAD);
 961 
 962     // Prevent SystemDictionary::add_to_hierarchy from running
 963     // and invalidating our dependencies until we install this method.
 964     // No safepoints are allowed. Otherwise, class redefinition can occur in between.
 965     MutexLocker ml(Compile_lock);
 966     NoSafepointVerifier nsv;
 967 
 968     // Change in Jvmti state may invalidate compilation.
 969     if (!failing() && jvmti_state_changed()) {
 970       record_failure("Jvmti state change invalidated dependencies");
 971     }
 972 
 973     // Change in DTrace flags may invalidate compilation.
 974     if (!failing() &&


1023 
1024     assert(offsets->value(CodeOffsets::Deopt) != -1, "must have deopt entry");
1025     assert(offsets->value(CodeOffsets::Exceptions) != -1, "must have exception entry");
1026 
1027     nm =  nmethod::new_nmethod(method,
1028                                compile_id(),
1029                                entry_bci,
1030                                offsets,
1031                                orig_pc_offset,
1032                                debug_info(), dependencies(), code_buffer,
1033                                frame_words, oop_map_set,
1034                                handler_table, inc_table,
1035                                compiler, task()->comp_level());
1036 
1037     // Free codeBlobs
1038     code_buffer->free_blob();
1039 
1040     if (nm != NULL) {
1041       nm->set_has_unsafe_access(has_unsafe_access);
1042       nm->set_has_wide_vectors(has_wide_vectors);



1043 #if INCLUDE_RTM_OPT
1044       nm->set_rtm_state(rtm_state);
1045 #endif
1046 
1047       // Record successful registration.
1048       // (Put nm into the task handle *before* publishing to the Java heap.)
1049       if (task() != NULL) {
1050         task()->set_code(nm);
1051       }
1052 
1053       if (entry_bci == InvocationEntryBci) {
1054         if (TieredCompilation) {
1055           // If there is an old version we're done with it
1056           CompiledMethod* old = method->code();
1057           if (TraceMethodReplacement && old != NULL) {
1058             ResourceMark rm;
1059             char *method_name = method->name_and_sig_as_C_string();
1060             tty->print_cr("Replacing method %s", method_name);
1061           }
1062           if (old != NULL) {




 935     } else {
 936       record_failure("invalid non-klass dependency");
 937     }
 938   }
 939 }
 940 
 941 // ------------------------------------------------------------------
 942 // ciEnv::register_method
 943 void ciEnv::register_method(ciMethod* target,
 944                             int entry_bci,
 945                             CodeOffsets* offsets,
 946                             int orig_pc_offset,
 947                             CodeBuffer* code_buffer,
 948                             int frame_words,
 949                             OopMapSet* oop_map_set,
 950                             ExceptionHandlerTable* handler_table,
 951                             ImplicitExceptionTable* inc_table,
 952                             AbstractCompiler* compiler,
 953                             bool has_unsafe_access,
 954                             bool has_wide_vectors,
 955                             bool has_monitors,
 956                             int immediate_oops_patched,
 957                             RTMState  rtm_state) {
 958   VM_ENTRY_MARK;
 959   nmethod* nm = NULL;
 960   {
 961     // To prevent compile queue updates.
 962     MutexLocker locker(MethodCompileQueue_lock, THREAD);
 963 
 964     // Prevent SystemDictionary::add_to_hierarchy from running
 965     // and invalidating our dependencies until we install this method.
 966     // No safepoints are allowed. Otherwise, class redefinition can occur in between.
 967     MutexLocker ml(Compile_lock);
 968     NoSafepointVerifier nsv;
 969 
 970     // Change in Jvmti state may invalidate compilation.
 971     if (!failing() && jvmti_state_changed()) {
 972       record_failure("Jvmti state change invalidated dependencies");
 973     }
 974 
 975     // Change in DTrace flags may invalidate compilation.
 976     if (!failing() &&


1025 
1026     assert(offsets->value(CodeOffsets::Deopt) != -1, "must have deopt entry");
1027     assert(offsets->value(CodeOffsets::Exceptions) != -1, "must have exception entry");
1028 
1029     nm =  nmethod::new_nmethod(method,
1030                                compile_id(),
1031                                entry_bci,
1032                                offsets,
1033                                orig_pc_offset,
1034                                debug_info(), dependencies(), code_buffer,
1035                                frame_words, oop_map_set,
1036                                handler_table, inc_table,
1037                                compiler, task()->comp_level());
1038 
1039     // Free codeBlobs
1040     code_buffer->free_blob();
1041 
1042     if (nm != NULL) {
1043       nm->set_has_unsafe_access(has_unsafe_access);
1044       nm->set_has_wide_vectors(has_wide_vectors);
1045       nm->set_has_monitors(has_monitors);
1046       nm->set_immediate_oops_patched(immediate_oops_patched);
1047       assert (!method->is_synchronized() || nm->has_monitors(), "");
1048 #if INCLUDE_RTM_OPT
1049       nm->set_rtm_state(rtm_state);
1050 #endif
1051 
1052       // Record successful registration.
1053       // (Put nm into the task handle *before* publishing to the Java heap.)
1054       if (task() != NULL) {
1055         task()->set_code(nm);
1056       }
1057 
1058       if (entry_bci == InvocationEntryBci) {
1059         if (TieredCompilation) {
1060           // If there is an old version we're done with it
1061           CompiledMethod* old = method->code();
1062           if (TraceMethodReplacement && old != NULL) {
1063             ResourceMark rm;
1064             char *method_name = method->name_and_sig_as_C_string();
1065             tty->print_cr("Replacing method %s", method_name);
1066           }
1067           if (old != NULL) {


< prev index next >