308 } 309 310 311 // ------------------------------------------------------------------ 312 // ciMethod::get_osr_flow_analysis 313 ciTypeFlow* ciMethod::get_osr_flow_analysis(int osr_bci) { 314 #ifdef COMPILER2 315 // OSR entry points are always place after a call bytecode of some sort 316 assert(osr_bci >= 0, "must supply valid OSR entry point"); 317 ciEnv* env = CURRENT_ENV; 318 ciTypeFlow* flow = new (env->arena()) ciTypeFlow(env, this, osr_bci); 319 flow->do_flow(); 320 return flow; 321 #else // COMPILER2 322 ShouldNotReachHere(); 323 return NULL; 324 #endif // COMPILER2 325 } 326 327 // ------------------------------------------------------------------ 328 // ciMethod::liveness_at_bci 329 // 330 // Which local variables are live at a specific bci? 331 MethodLivenessResult ciMethod::liveness_at_bci(int bci) { 332 check_is_loaded(); 333 if (_liveness == NULL) { 334 // Create the liveness analyzer. 335 Arena* arena = CURRENT_ENV->arena(); 336 _liveness = new (arena) MethodLiveness(arena, this); 337 _liveness->compute_liveness(); 338 } 339 MethodLivenessResult result = _liveness->get_liveness_at(bci); 340 if (CURRENT_ENV->jvmti_can_access_local_variables() || DeoptimizeALot || CompileTheWorld) { 341 // Keep all locals live for the user's edification and amusement. 342 result.at_put_range(0, result.size(), true); 343 } 344 return result; 345 } 346 347 // ciMethod::live_local_oops_at_bci 348 // 349 // find all the live oops in the locals array for a particular bci 350 // Compute what the interpreter believes by using the interpreter 351 // oopmap generator. This is used as a double check during osr to 352 // guard against conservative result from MethodLiveness making us 353 // think a dead oop is live. MethodLiveness is conservative in the 354 // sense that it may consider locals to be live which cannot be live, 355 // like in the case where a local could contain an oop or a primitive 356 // along different paths. In that case the local must be dead when 357 // those paths merge. Since the interpreter's viewpoint is used when 358 // gc'ing an interpreter frame we need to use its viewpoint during 359 // OSR when loading the locals. 360 | 308 } 309 310 311 // ------------------------------------------------------------------ 312 // ciMethod::get_osr_flow_analysis 313 ciTypeFlow* ciMethod::get_osr_flow_analysis(int osr_bci) { 314 #ifdef COMPILER2 315 // OSR entry points are always place after a call bytecode of some sort 316 assert(osr_bci >= 0, "must supply valid OSR entry point"); 317 ciEnv* env = CURRENT_ENV; 318 ciTypeFlow* flow = new (env->arena()) ciTypeFlow(env, this, osr_bci); 319 flow->do_flow(); 320 return flow; 321 #else // COMPILER2 322 ShouldNotReachHere(); 323 return NULL; 324 #endif // COMPILER2 325 } 326 327 // ------------------------------------------------------------------ 328 // ciMethod::raw_liveness_at_bci 329 // 330 // Which local variables are live at a specific bci? 331 MethodLivenessResult ciMethod::raw_liveness_at_bci(int bci) { 332 check_is_loaded(); 333 if (_liveness == NULL) { 334 // Create the liveness analyzer. 335 Arena* arena = CURRENT_ENV->arena(); 336 _liveness = new (arena) MethodLiveness(arena, this); 337 _liveness->compute_liveness(); 338 } 339 return _liveness->get_liveness_at(bci); 340 } 341 342 // ------------------------------------------------------------------ 343 // ciMethod::liveness_at_bci 344 // 345 // Which local variables are live at a specific bci? Will return true 346 // for all locals in some cases to improve debug information. 347 MethodLivenessResult ciMethod::liveness_at_bci(int bci) { 348 MethodLivenessResult result = raw_liveness_at_bci(bci); 349 if ((CURRENT_ENV->jvmti_can_access_local_variables() || DeoptimizeALot || CompileTheWorld)) { 350 // Keep all locals live for the user's edification and amusement. 351 result.at_put_range(0, result.size(), true); 352 } 353 return result; 354 } 355 356 // ciMethod::live_local_oops_at_bci 357 // 358 // find all the live oops in the locals array for a particular bci 359 // Compute what the interpreter believes by using the interpreter 360 // oopmap generator. This is used as a double check during osr to 361 // guard against conservative result from MethodLiveness making us 362 // think a dead oop is live. MethodLiveness is conservative in the 363 // sense that it may consider locals to be live which cannot be live, 364 // like in the case where a local could contain an oop or a primitive 365 // along different paths. In that case the local must be dead when 366 // those paths merge. Since the interpreter's viewpoint is used when 367 // gc'ing an interpreter frame we need to use its viewpoint during 368 // OSR when loading the locals. 369 |