< prev index next >

src/hotspot/share/ci/ciEnv.cpp

Print this page

1013     } else {
1014       record_failure("invalid non-klass dependency");
1015     }
1016   }
1017 }
1018 
1019 // ------------------------------------------------------------------
1020 // ciEnv::register_method
1021 void ciEnv::register_method(ciMethod* target,
1022                             int entry_bci,
1023                             CodeOffsets* offsets,
1024                             int orig_pc_offset,
1025                             CodeBuffer* code_buffer,
1026                             int frame_words,
1027                             OopMapSet* oop_map_set,
1028                             ExceptionHandlerTable* handler_table,
1029                             ImplicitExceptionTable* inc_table,
1030                             AbstractCompiler* compiler,
1031                             bool has_unsafe_access,
1032                             bool has_wide_vectors,
1033                             RTMState  rtm_state,
1034                             const GrowableArrayView<RuntimeStub*>& native_invokers) {
1035   VM_ENTRY_MARK;
1036   nmethod* nm = NULL;
1037   {
1038     methodHandle method(THREAD, target->get_Method());
1039 
1040     // We require method counters to store some method state (max compilation levels) required by the compilation policy.
1041     if (method->get_method_counters(THREAD) == NULL) {
1042       record_failure("can't create method counters");
1043       // All buffers in the CodeBuffer are allocated in the CodeCache.
1044       // If the code buffer is created on each compile attempt
1045       // as in C2, then it must be freed.
1046       code_buffer->free_blob();
1047       return;
1048     }
1049 
1050     // To prevent compile queue updates.
1051     MutexLocker locker(THREAD, MethodCompileQueue_lock);
1052 
1053     // Prevent SystemDictionary::add_to_hierarchy from running
1054     // and invalidating our dependencies until we install this method.

1103       }
1104 
1105       // All buffers in the CodeBuffer are allocated in the CodeCache.
1106       // If the code buffer is created on each compile attempt
1107       // as in C2, then it must be freed.
1108       code_buffer->free_blob();
1109       return;
1110     }
1111 
1112     assert(offsets->value(CodeOffsets::Deopt) != -1, "must have deopt entry");
1113     assert(offsets->value(CodeOffsets::Exceptions) != -1, "must have exception entry");
1114 
1115     nm =  nmethod::new_nmethod(method,
1116                                compile_id(),
1117                                entry_bci,
1118                                offsets,
1119                                orig_pc_offset,
1120                                debug_info(), dependencies(), code_buffer,
1121                                frame_words, oop_map_set,
1122                                handler_table, inc_table,
1123                                compiler, task()->comp_level(),
1124                                native_invokers);
1125 
1126     // Free codeBlobs
1127     code_buffer->free_blob();
1128 
1129     if (nm != NULL) {
1130       nm->set_has_unsafe_access(has_unsafe_access);
1131       nm->set_has_wide_vectors(has_wide_vectors);
1132 #if INCLUDE_RTM_OPT
1133       nm->set_rtm_state(rtm_state);
1134 #endif
1135 
1136       // Record successful registration.
1137       // (Put nm into the task handle *before* publishing to the Java heap.)
1138       if (task() != NULL) {
1139         task()->set_code(nm);
1140       }
1141 
1142       if (entry_bci == InvocationEntryBci) {
1143         if (TieredCompilation) {
1144           // If there is an old version we're done with it

1013     } else {
1014       record_failure("invalid non-klass dependency");
1015     }
1016   }
1017 }
1018 
1019 // ------------------------------------------------------------------
1020 // ciEnv::register_method
1021 void ciEnv::register_method(ciMethod* target,
1022                             int entry_bci,
1023                             CodeOffsets* offsets,
1024                             int orig_pc_offset,
1025                             CodeBuffer* code_buffer,
1026                             int frame_words,
1027                             OopMapSet* oop_map_set,
1028                             ExceptionHandlerTable* handler_table,
1029                             ImplicitExceptionTable* inc_table,
1030                             AbstractCompiler* compiler,
1031                             bool has_unsafe_access,
1032                             bool has_wide_vectors,
1033                             RTMState  rtm_state) {

1034   VM_ENTRY_MARK;
1035   nmethod* nm = NULL;
1036   {
1037     methodHandle method(THREAD, target->get_Method());
1038 
1039     // We require method counters to store some method state (max compilation levels) required by the compilation policy.
1040     if (method->get_method_counters(THREAD) == NULL) {
1041       record_failure("can't create method counters");
1042       // All buffers in the CodeBuffer are allocated in the CodeCache.
1043       // If the code buffer is created on each compile attempt
1044       // as in C2, then it must be freed.
1045       code_buffer->free_blob();
1046       return;
1047     }
1048 
1049     // To prevent compile queue updates.
1050     MutexLocker locker(THREAD, MethodCompileQueue_lock);
1051 
1052     // Prevent SystemDictionary::add_to_hierarchy from running
1053     // and invalidating our dependencies until we install this method.

1102       }
1103 
1104       // All buffers in the CodeBuffer are allocated in the CodeCache.
1105       // If the code buffer is created on each compile attempt
1106       // as in C2, then it must be freed.
1107       code_buffer->free_blob();
1108       return;
1109     }
1110 
1111     assert(offsets->value(CodeOffsets::Deopt) != -1, "must have deopt entry");
1112     assert(offsets->value(CodeOffsets::Exceptions) != -1, "must have exception entry");
1113 
1114     nm =  nmethod::new_nmethod(method,
1115                                compile_id(),
1116                                entry_bci,
1117                                offsets,
1118                                orig_pc_offset,
1119                                debug_info(), dependencies(), code_buffer,
1120                                frame_words, oop_map_set,
1121                                handler_table, inc_table,
1122                                compiler, task()->comp_level());

1123 
1124     // Free codeBlobs
1125     code_buffer->free_blob();
1126 
1127     if (nm != NULL) {
1128       nm->set_has_unsafe_access(has_unsafe_access);
1129       nm->set_has_wide_vectors(has_wide_vectors);
1130 #if INCLUDE_RTM_OPT
1131       nm->set_rtm_state(rtm_state);
1132 #endif
1133 
1134       // Record successful registration.
1135       // (Put nm into the task handle *before* publishing to the Java heap.)
1136       if (task() != NULL) {
1137         task()->set_code(nm);
1138       }
1139 
1140       if (entry_bci == InvocationEntryBci) {
1141         if (TieredCompilation) {
1142           // If there is an old version we're done with it
< prev index next >