< prev index next >

src/hotspot/share/ci/ciEnv.cpp

Print this page

1034     } else {
1035       record_failure("invalid non-klass dependency");
1036     }
1037   }
1038 }
1039 
1040 // ------------------------------------------------------------------
1041 // ciEnv::register_method
1042 void ciEnv::register_method(ciMethod* target,
1043                             int entry_bci,
1044                             CodeOffsets* offsets,
1045                             int orig_pc_offset,
1046                             CodeBuffer* code_buffer,
1047                             int frame_words,
1048                             OopMapSet* oop_map_set,
1049                             ExceptionHandlerTable* handler_table,
1050                             ImplicitExceptionTable* inc_table,
1051                             AbstractCompiler* compiler,
1052                             bool has_unsafe_access,
1053                             bool has_wide_vectors,
1054                             RTMState  rtm_state,
1055                             const GrowableArrayView<RuntimeStub*>& native_invokers) {
1056   VM_ENTRY_MARK;
1057   nmethod* nm = NULL;
1058   {
1059     methodHandle method(THREAD, target->get_Method());
1060 
1061     // We require method counters to store some method state (max compilation levels) required by the compilation policy.
1062     if (method->get_method_counters(THREAD) == NULL) {
1063       record_failure("can't create method counters");
1064       // All buffers in the CodeBuffer are allocated in the CodeCache.
1065       // If the code buffer is created on each compile attempt
1066       // as in C2, then it must be freed.
1067       code_buffer->free_blob();
1068       return;
1069     }
1070 
1071     // To prevent compile queue updates.
1072     MutexLocker locker(THREAD, MethodCompileQueue_lock);
1073 
1074     // Prevent SystemDictionary::add_to_hierarchy from running
1075     // and invalidating our dependencies until we install this method.

1124       }
1125 
1126       // All buffers in the CodeBuffer are allocated in the CodeCache.
1127       // If the code buffer is created on each compile attempt
1128       // as in C2, then it must be freed.
1129       code_buffer->free_blob();
1130       return;
1131     }
1132 
1133     assert(offsets->value(CodeOffsets::Deopt) != -1, "must have deopt entry");
1134     assert(offsets->value(CodeOffsets::Exceptions) != -1, "must have exception entry");
1135 
1136     nm =  nmethod::new_nmethod(method,
1137                                compile_id(),
1138                                entry_bci,
1139                                offsets,
1140                                orig_pc_offset,
1141                                debug_info(), dependencies(), code_buffer,
1142                                frame_words, oop_map_set,
1143                                handler_table, inc_table,
1144                                compiler, task()->comp_level(),
1145                                native_invokers);
1146 
1147     // Free codeBlobs
1148     code_buffer->free_blob();
1149 
1150     if (nm != NULL) {
1151       nm->set_has_unsafe_access(has_unsafe_access);
1152       nm->set_has_wide_vectors(has_wide_vectors);
1153 #if INCLUDE_RTM_OPT
1154       nm->set_rtm_state(rtm_state);
1155 #endif
1156 
1157       // Record successful registration.
1158       // (Put nm into the task handle *before* publishing to the Java heap.)
1159       if (task() != NULL) {
1160         task()->set_code(nm);
1161       }
1162 
1163       if (entry_bci == InvocationEntryBci) {
1164         if (TieredCompilation) {
1165           // If there is an old version we're done with it

1034     } else {
1035       record_failure("invalid non-klass dependency");
1036     }
1037   }
1038 }
1039 
1040 // ------------------------------------------------------------------
1041 // ciEnv::register_method
1042 void ciEnv::register_method(ciMethod* target,
1043                             int entry_bci,
1044                             CodeOffsets* offsets,
1045                             int orig_pc_offset,
1046                             CodeBuffer* code_buffer,
1047                             int frame_words,
1048                             OopMapSet* oop_map_set,
1049                             ExceptionHandlerTable* handler_table,
1050                             ImplicitExceptionTable* inc_table,
1051                             AbstractCompiler* compiler,
1052                             bool has_unsafe_access,
1053                             bool has_wide_vectors,
1054                             RTMState  rtm_state) {

1055   VM_ENTRY_MARK;
1056   nmethod* nm = NULL;
1057   {
1058     methodHandle method(THREAD, target->get_Method());
1059 
1060     // We require method counters to store some method state (max compilation levels) required by the compilation policy.
1061     if (method->get_method_counters(THREAD) == NULL) {
1062       record_failure("can't create method counters");
1063       // All buffers in the CodeBuffer are allocated in the CodeCache.
1064       // If the code buffer is created on each compile attempt
1065       // as in C2, then it must be freed.
1066       code_buffer->free_blob();
1067       return;
1068     }
1069 
1070     // To prevent compile queue updates.
1071     MutexLocker locker(THREAD, MethodCompileQueue_lock);
1072 
1073     // Prevent SystemDictionary::add_to_hierarchy from running
1074     // and invalidating our dependencies until we install this method.

1123       }
1124 
1125       // All buffers in the CodeBuffer are allocated in the CodeCache.
1126       // If the code buffer is created on each compile attempt
1127       // as in C2, then it must be freed.
1128       code_buffer->free_blob();
1129       return;
1130     }
1131 
1132     assert(offsets->value(CodeOffsets::Deopt) != -1, "must have deopt entry");
1133     assert(offsets->value(CodeOffsets::Exceptions) != -1, "must have exception entry");
1134 
1135     nm =  nmethod::new_nmethod(method,
1136                                compile_id(),
1137                                entry_bci,
1138                                offsets,
1139                                orig_pc_offset,
1140                                debug_info(), dependencies(), code_buffer,
1141                                frame_words, oop_map_set,
1142                                handler_table, inc_table,
1143                                compiler, task()->comp_level());

1144 
1145     // Free codeBlobs
1146     code_buffer->free_blob();
1147 
1148     if (nm != NULL) {
1149       nm->set_has_unsafe_access(has_unsafe_access);
1150       nm->set_has_wide_vectors(has_wide_vectors);
1151 #if INCLUDE_RTM_OPT
1152       nm->set_rtm_state(rtm_state);
1153 #endif
1154 
1155       // Record successful registration.
1156       // (Put nm into the task handle *before* publishing to the Java heap.)
1157       if (task() != NULL) {
1158         task()->set_code(nm);
1159       }
1160 
1161       if (entry_bci == InvocationEntryBci) {
1162         if (TieredCompilation) {
1163           // If there is an old version we're done with it
< prev index next >