96 static bool firstEnv = true; |
96 static bool firstEnv = true; |
97 #endif /* PRODUCT */ |
97 #endif /* PRODUCT */ |
98 |
98 |
99 // ------------------------------------------------------------------ |
99 // ------------------------------------------------------------------ |
100 // ciEnv::ciEnv |
100 // ciEnv::ciEnv |
101 ciEnv::ciEnv(CompileTask* task, int system_dictionary_modification_counter) |
101 ciEnv::ciEnv(CompileTask* task) |
102 : _ciEnv_arena(mtCompiler) { |
102 : _ciEnv_arena(mtCompiler) { |
103 VM_ENTRY_MARK; |
103 VM_ENTRY_MARK; |
104 |
104 |
105 // Set up ciEnv::current immediately, for the sake of ciObjectFactory, etc. |
105 // Set up ciEnv::current immediately, for the sake of ciObjectFactory, etc. |
106 thread->set_env(this); |
106 thread->set_env(this); |
116 _compiler_data = NULL; |
116 _compiler_data = NULL; |
117 #ifndef PRODUCT |
117 #ifndef PRODUCT |
118 assert(!firstEnv, "not initialized properly"); |
118 assert(!firstEnv, "not initialized properly"); |
119 #endif /* !PRODUCT */ |
119 #endif /* !PRODUCT */ |
120 |
120 |
121 _system_dictionary_modification_counter = system_dictionary_modification_counter; |
|
122 _num_inlined_bytecodes = 0; |
121 _num_inlined_bytecodes = 0; |
123 assert(task == NULL || thread->task() == task, "sanity"); |
122 assert(task == NULL || thread->task() == task, "sanity"); |
124 if (task != NULL) { |
123 if (task != NULL) { |
125 task->mark_started(os::elapsed_counter()); |
124 task->mark_started(os::elapsed_counter()); |
126 } |
125 } |
181 #ifndef PRODUCT |
180 #ifndef PRODUCT |
182 assert(firstEnv, "must be first"); |
181 assert(firstEnv, "must be first"); |
183 firstEnv = false; |
182 firstEnv = false; |
184 #endif /* !PRODUCT */ |
183 #endif /* !PRODUCT */ |
185 |
184 |
186 _system_dictionary_modification_counter = 0; |
|
187 _num_inlined_bytecodes = 0; |
185 _num_inlined_bytecodes = 0; |
188 _task = NULL; |
186 _task = NULL; |
189 _log = NULL; |
187 _log = NULL; |
190 |
188 |
191 // Temporary buffer for creating symbols and such. |
189 // Temporary buffer for creating symbols and such. |
917 // ciEnv::is_in_vm |
915 // ciEnv::is_in_vm |
918 bool ciEnv::is_in_vm() { |
916 bool ciEnv::is_in_vm() { |
919 return JavaThread::current()->thread_state() == _thread_in_vm; |
917 return JavaThread::current()->thread_state() == _thread_in_vm; |
920 } |
918 } |
921 |
919 |
922 bool ciEnv::system_dictionary_modification_counter_changed_locked() { |
|
923 assert_locked_or_safepoint(Compile_lock); |
|
924 return _system_dictionary_modification_counter != SystemDictionary::number_of_modifications(); |
|
925 } |
|
926 |
|
927 bool ciEnv::system_dictionary_modification_counter_changed() { |
|
928 VM_ENTRY_MARK; |
|
929 MutexLocker ml(Compile_lock, THREAD); // lock with safepoint check |
|
930 return system_dictionary_modification_counter_changed_locked(); |
|
931 } |
|
932 |
|
933 // ------------------------------------------------------------------ |
920 // ------------------------------------------------------------------ |
934 // ciEnv::validate_compile_task_dependencies |
921 // ciEnv::validate_compile_task_dependencies |
935 // |
922 // |
936 // Check for changes during compilation (e.g. class loads, evolution, |
923 // Check for changes during compilation (e.g. class loads, evolution, |
937 // breakpoints, call site invalidation). |
924 // breakpoints, call site invalidation). |
938 void ciEnv::validate_compile_task_dependencies(ciMethod* target) { |
925 void ciEnv::validate_compile_task_dependencies(ciMethod* target) { |
939 if (failing()) return; // no need for further checks |
926 if (failing()) return; // no need for further checks |
940 |
927 |
941 bool counter_changed = system_dictionary_modification_counter_changed_locked(); |
928 Dependencies::DepType result = dependencies()->validate_dependencies(_task); |
942 Dependencies::DepType result = dependencies()->validate_dependencies(_task, counter_changed); |
|
943 if (result != Dependencies::end_marker) { |
929 if (result != Dependencies::end_marker) { |
944 if (result == Dependencies::call_site_target_value) { |
930 if (result == Dependencies::call_site_target_value) { |
945 _inc_decompile_count_on_failure = false; |
931 _inc_decompile_count_on_failure = false; |
946 record_failure("call site target change"); |
932 record_failure("call site target change"); |
947 } else if (Dependencies::is_klass_type(result)) { |
933 } else if (Dependencies::is_klass_type(result)) { |