< prev index next >

src/hotspot/share/ci/ciEnv.cpp

Print this page




 137 
 138   // During VM initialization, these instances have not yet been created.
 139   // Assertions ensure that these instances are not accessed before
 140   // their initialization.
 141 
 142   assert(Universe::is_fully_initialized(), "should be complete");
 143 
 144   oop o = Universe::null_ptr_exception_instance();
 145   assert(o != NULL, "should have been initialized");
 146   _NullPointerException_instance = get_object(o)->as_instance();
 147   o = Universe::arithmetic_exception_instance();
 148   assert(o != NULL, "should have been initialized");
 149   _ArithmeticException_instance = get_object(o)->as_instance();
 150 
 151   _ArrayIndexOutOfBoundsException_instance = NULL;
 152   _ArrayStoreException_instance = NULL;
 153   _ClassCastException_instance = NULL;
 154   _the_null_string = NULL;
 155   _the_min_jint_string = NULL;
 156 

 157   _jvmti_can_hotswap_or_post_breakpoint = false;
 158   _jvmti_can_access_local_variables = false;
 159   _jvmti_can_post_on_exceptions = false;
 160   _jvmti_can_pop_frame = false;
 161 }
 162 
 163 ciEnv::ciEnv(Arena* arena) : _ciEnv_arena(mtCompiler) {
 164   ASSERT_IN_VM;
 165 
 166   // Set up ciEnv::current immediately, for the sake of ciObjectFactory, etc.
 167   CompilerThread* current_thread = CompilerThread::current();
 168   assert(current_thread->env() == NULL, "must be");
 169   current_thread->set_env(this);
 170   assert(ciEnv::current() == this, "sanity");
 171 
 172   _oop_recorder = NULL;
 173   _debug_info = NULL;
 174   _dependencies = NULL;
 175   _failure_reason = NULL;
 176   _inc_decompile_count_on_failure = true;


 192 
 193   _arena   = arena;
 194   _factory = new (_arena) ciObjectFactory(_arena, 128);
 195 
 196   // Preload commonly referenced system ciObjects.
 197 
 198   // During VM initialization, these instances have not yet been created.
 199   // Assertions ensure that these instances are not accessed before
 200   // their initialization.
 201 
 202   assert(Universe::is_fully_initialized(), "must be");
 203 
 204   _NullPointerException_instance = NULL;
 205   _ArithmeticException_instance = NULL;
 206   _ArrayIndexOutOfBoundsException_instance = NULL;
 207   _ArrayStoreException_instance = NULL;
 208   _ClassCastException_instance = NULL;
 209   _the_null_string = NULL;
 210   _the_min_jint_string = NULL;
 211 

 212   _jvmti_can_hotswap_or_post_breakpoint = false;
 213   _jvmti_can_access_local_variables = false;
 214   _jvmti_can_post_on_exceptions = false;
 215   _jvmti_can_pop_frame = false;
 216 }
 217 
 218 ciEnv::~ciEnv() {
 219   GUARDED_VM_ENTRY(
 220       CompilerThread* current_thread = CompilerThread::current();
 221       _factory->remove_symbols();
 222       // Need safepoint to clear the env on the thread.  RedefineClasses might
 223       // be reading it.
 224       current_thread->set_env(NULL);
 225   )
 226 }
 227 
 228 // ------------------------------------------------------------------
 229 // Cache Jvmti state
 230 void ciEnv::cache_jvmti_state() {
 231   VM_ENTRY_MARK;
 232   // Get Jvmti capabilities under lock to get consistant values.
 233   MutexLocker mu(JvmtiThreadState_lock);

 234   _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint();
 235   _jvmti_can_access_local_variables     = JvmtiExport::can_access_local_variables();
 236   _jvmti_can_post_on_exceptions         = JvmtiExport::can_post_on_exceptions();
 237   _jvmti_can_pop_frame                  = JvmtiExport::can_pop_frame();
 238 }
 239 
 240 bool ciEnv::jvmti_state_changed() const {





 241   if (!_jvmti_can_access_local_variables &&
 242       JvmtiExport::can_access_local_variables()) {
 243     return true;
 244   }
 245   if (!_jvmti_can_hotswap_or_post_breakpoint &&
 246       JvmtiExport::can_hotswap_or_post_breakpoint()) {
 247     return true;
 248   }
 249   if (!_jvmti_can_post_on_exceptions &&
 250       JvmtiExport::can_post_on_exceptions()) {
 251     return true;
 252   }
 253   if (!_jvmti_can_pop_frame &&
 254       JvmtiExport::can_pop_frame()) {
 255     return true;
 256   }

 257   return false;
 258 }
 259 
 260 // ------------------------------------------------------------------
 261 // Cache DTrace flags
 262 void ciEnv::cache_dtrace_flags() {
 263   // Need lock?
 264   _dtrace_extended_probes = ExtendedDTraceProbes;
 265   if (_dtrace_extended_probes) {
 266     _dtrace_monitor_probes  = true;
 267     _dtrace_method_probes   = true;
 268     _dtrace_alloc_probes    = true;
 269   } else {
 270     _dtrace_monitor_probes  = DTraceMonitorProbes;
 271     _dtrace_method_probes   = DTraceMethodProbes;
 272     _dtrace_alloc_probes    = DTraceAllocProbes;
 273   }
 274 }
 275 
 276 // ------------------------------------------------------------------




 137 
 138   // During VM initialization, these instances have not yet been created.
 139   // Assertions ensure that these instances are not accessed before
 140   // their initialization.
 141 
 142   assert(Universe::is_fully_initialized(), "should be complete");
 143 
 144   oop o = Universe::null_ptr_exception_instance();
 145   assert(o != NULL, "should have been initialized");
 146   _NullPointerException_instance = get_object(o)->as_instance();
 147   o = Universe::arithmetic_exception_instance();
 148   assert(o != NULL, "should have been initialized");
 149   _ArithmeticException_instance = get_object(o)->as_instance();
 150 
 151   _ArrayIndexOutOfBoundsException_instance = NULL;
 152   _ArrayStoreException_instance = NULL;
 153   _ClassCastException_instance = NULL;
 154   _the_null_string = NULL;
 155   _the_min_jint_string = NULL;
 156 
 157   _jvmti_redefinition_count = 0;
 158   _jvmti_can_hotswap_or_post_breakpoint = false;
 159   _jvmti_can_access_local_variables = false;
 160   _jvmti_can_post_on_exceptions = false;
 161   _jvmti_can_pop_frame = false;
 162 }
 163 
 164 ciEnv::ciEnv(Arena* arena) : _ciEnv_arena(mtCompiler) {
 165   ASSERT_IN_VM;
 166 
 167   // Set up ciEnv::current immediately, for the sake of ciObjectFactory, etc.
 168   CompilerThread* current_thread = CompilerThread::current();
 169   assert(current_thread->env() == NULL, "must be");
 170   current_thread->set_env(this);
 171   assert(ciEnv::current() == this, "sanity");
 172 
 173   _oop_recorder = NULL;
 174   _debug_info = NULL;
 175   _dependencies = NULL;
 176   _failure_reason = NULL;
 177   _inc_decompile_count_on_failure = true;


 193 
 194   _arena   = arena;
 195   _factory = new (_arena) ciObjectFactory(_arena, 128);
 196 
 197   // Preload commonly referenced system ciObjects.
 198 
 199   // During VM initialization, these instances have not yet been created.
 200   // Assertions ensure that these instances are not accessed before
 201   // their initialization.
 202 
 203   assert(Universe::is_fully_initialized(), "must be");
 204 
 205   _NullPointerException_instance = NULL;
 206   _ArithmeticException_instance = NULL;
 207   _ArrayIndexOutOfBoundsException_instance = NULL;
 208   _ArrayStoreException_instance = NULL;
 209   _ClassCastException_instance = NULL;
 210   _the_null_string = NULL;
 211   _the_min_jint_string = NULL;
 212 
 213   _jvmti_redefinition_count = 0;
 214   _jvmti_can_hotswap_or_post_breakpoint = false;
 215   _jvmti_can_access_local_variables = false;
 216   _jvmti_can_post_on_exceptions = false;
 217   _jvmti_can_pop_frame = false;
 218 }
 219 
 220 ciEnv::~ciEnv() {
 221   GUARDED_VM_ENTRY(
 222       CompilerThread* current_thread = CompilerThread::current();
 223       _factory->remove_symbols();
 224       // Need safepoint to clear the env on the thread.  RedefineClasses might
 225       // be reading it.
 226       current_thread->set_env(NULL);
 227   )
 228 }
 229 
 230 // ------------------------------------------------------------------
 231 // Cache Jvmti state
 232 void ciEnv::cache_jvmti_state() {
 233   VM_ENTRY_MARK;
 234   // Get Jvmti capabilities under lock to get consistant values.
 235   MutexLocker mu(JvmtiThreadState_lock);
 236   _jvmti_redefinition_count             = JvmtiExport::redefinition_count();
 237   _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint();
 238   _jvmti_can_access_local_variables     = JvmtiExport::can_access_local_variables();
 239   _jvmti_can_post_on_exceptions         = JvmtiExport::can_post_on_exceptions();
 240   _jvmti_can_pop_frame                  = JvmtiExport::can_pop_frame();
 241 }
 242 
 243 bool ciEnv::jvmti_state_changed() const {
 244   // Some classes were redefined
 245   if (_jvmti_redefinition_count != JvmtiExport::redefinition_count()) {
 246     return true;
 247   }
 248 
 249   if (!_jvmti_can_access_local_variables &&
 250       JvmtiExport::can_access_local_variables()) {
 251     return true;
 252   }
 253   if (!_jvmti_can_hotswap_or_post_breakpoint &&
 254       JvmtiExport::can_hotswap_or_post_breakpoint()) {
 255     return true;
 256   }
 257   if (!_jvmti_can_post_on_exceptions &&
 258       JvmtiExport::can_post_on_exceptions()) {
 259     return true;
 260   }
 261   if (!_jvmti_can_pop_frame &&
 262       JvmtiExport::can_pop_frame()) {
 263     return true;
 264   }
 265 
 266   return false;
 267 }
 268 
 269 // ------------------------------------------------------------------
 270 // Cache DTrace flags
 271 void ciEnv::cache_dtrace_flags() {
 272   // Need lock?
 273   _dtrace_extended_probes = ExtendedDTraceProbes;
 274   if (_dtrace_extended_probes) {
 275     _dtrace_monitor_probes  = true;
 276     _dtrace_method_probes   = true;
 277     _dtrace_alloc_probes    = true;
 278   } else {
 279     _dtrace_monitor_probes  = DTraceMonitorProbes;
 280     _dtrace_method_probes   = DTraceMethodProbes;
 281     _dtrace_alloc_probes    = DTraceAllocProbes;
 282   }
 283 }
 284 
 285 // ------------------------------------------------------------------


< prev index next >