348 Node* null_check(Node* value, BasicType type = T_OBJECT) { 349 return null_check_common(value, type, false, NULL, !_gvn.type(value)->speculative_maybe_null()); 350 } 351 Node* null_check_receiver() { 352 assert(argument(0)->bottom_type()->isa_ptr(), "must be"); 353 return null_check(argument(0)); 354 } 355 Node* zero_check_int(Node* value) { 356 assert(value->bottom_type()->basic_type() == T_INT, 357 "wrong type: %s", type2name(value->bottom_type()->basic_type())); 358 return null_check_common(value, T_INT); 359 } 360 Node* zero_check_long(Node* value) { 361 assert(value->bottom_type()->basic_type() == T_LONG, 362 "wrong type: %s", type2name(value->bottom_type()->basic_type())); 363 return null_check_common(value, T_LONG); 364 } 365 // Throw an uncommon trap if a given value is __not__ null. 366 // Return the value cast to null, and be clever about dominating checks. 367 Node* null_assert(Node* value, BasicType type = T_OBJECT) { 368 return null_check_common(value, type, true); 369 } 370 371 // Check if value is null and abort if it is 372 Node* must_be_not_null(Node* value, bool do_replace_in_map); 373 374 // Null check oop. Return null-path control into (*null_control). 375 // Return a cast-not-null node which depends on the not-null control. 376 // If never_see_null, use an uncommon trap (*null_control sees a top). 377 // The cast is not valid along the null path; keep a copy of the original. 378 // If safe_for_replace, then we can replace the value with the cast 379 // in the parsing map (the cast is guaranteed to dominate the map) 380 Node* null_check_oop(Node* value, Node* *null_control, 381 bool never_see_null = false, 382 bool safe_for_replace = false, 383 bool speculative = false); 384 385 // Check the null_seen bit. 386 bool seems_never_null(Node* obj, ciProfileData* data, bool& speculating); 387 388 // Check for unique class for receiver at call 389 ciKlass* profile_has_unique_klass() { 390 ciCallProfile profile = method()->call_profile_at_bci(bci()); 391 if (profile.count() >= 0 && // no cast failures here 392 profile.has_receiver(0) && 393 profile.morphism() == 1) { 394 return profile.receiver(0); 395 } 396 return NULL; 397 } 398 399 // record type from profiling with the type system 400 Node* record_profile_for_speculation(Node* n, ciKlass* exact_kls, bool maybe_null); 401 void record_profiled_arguments_for_speculation(ciMethod* dest_method, Bytecodes::Code bc); 402 void record_profiled_parameters_for_speculation(); 403 void record_profiled_return_for_speculation(); 404 Node* record_profiled_receiver_for_speculation(Node* n); 405 406 // Use the type profile to narrow an object type. 407 Node* maybe_cast_profiled_receiver(Node* not_null_obj, 408 ciKlass* require_klass, 409 ciKlass* spec, 410 bool safe_for_replace); 411 412 // Cast obj to type and emit guard unless we had too many traps here already 413 Node* maybe_cast_profiled_obj(Node* obj, 414 ciKlass* type, 415 bool not_null = false); 416 417 // Cast obj to not-null on this path 418 Node* cast_not_null(Node* obj, bool do_replace_in_map = true); 419 // Replace all occurrences of one node by another. 420 void replace_in_map(Node* old, Node* neww); | 348 Node* null_check(Node* value, BasicType type = T_OBJECT) { 349 return null_check_common(value, type, false, NULL, !_gvn.type(value)->speculative_maybe_null()); 350 } 351 Node* null_check_receiver() { 352 assert(argument(0)->bottom_type()->isa_ptr(), "must be"); 353 return null_check(argument(0)); 354 } 355 Node* zero_check_int(Node* value) { 356 assert(value->bottom_type()->basic_type() == T_INT, 357 "wrong type: %s", type2name(value->bottom_type()->basic_type())); 358 return null_check_common(value, T_INT); 359 } 360 Node* zero_check_long(Node* value) { 361 assert(value->bottom_type()->basic_type() == T_LONG, 362 "wrong type: %s", type2name(value->bottom_type()->basic_type())); 363 return null_check_common(value, T_LONG); 364 } 365 // Throw an uncommon trap if a given value is __not__ null. 366 // Return the value cast to null, and be clever about dominating checks. 367 Node* null_assert(Node* value, BasicType type = T_OBJECT) { 368 return null_check_common(value, type, true, NULL, _gvn.type(value)->speculative_always_null()); 369 } 370 371 // Check if value is null and abort if it is 372 Node* must_be_not_null(Node* value, bool do_replace_in_map); 373 374 // Null check oop. Return null-path control into (*null_control). 375 // Return a cast-not-null node which depends on the not-null control. 376 // If never_see_null, use an uncommon trap (*null_control sees a top). 377 // The cast is not valid along the null path; keep a copy of the original. 378 // If safe_for_replace, then we can replace the value with the cast 379 // in the parsing map (the cast is guaranteed to dominate the map) 380 Node* null_check_oop(Node* value, Node* *null_control, 381 bool never_see_null = false, 382 bool safe_for_replace = false, 383 bool speculative = false); 384 385 // Check the null_seen bit. 386 bool seems_never_null(Node* obj, ciProfileData* data, bool& speculating); 387 388 // Check for unique class for receiver at call 389 ciKlass* profile_has_unique_klass() { 390 ciCallProfile profile = method()->call_profile_at_bci(bci()); 391 if (profile.count() >= 0 && // no cast failures here 392 profile.has_receiver(0) && 393 profile.morphism() == 1) { 394 return profile.receiver(0); 395 } 396 return NULL; 397 } 398 399 // record type from profiling with the type system 400 Node* record_profile_for_speculation(Node* n, ciKlass* exact_kls, ProfilePtrKind ptr_kind); 401 void record_profiled_arguments_for_speculation(ciMethod* dest_method, Bytecodes::Code bc); 402 void record_profiled_parameters_for_speculation(); 403 void record_profiled_return_for_speculation(); 404 Node* record_profiled_receiver_for_speculation(Node* n); 405 406 // Use the type profile to narrow an object type. 407 Node* maybe_cast_profiled_receiver(Node* not_null_obj, 408 ciKlass* require_klass, 409 ciKlass* spec, 410 bool safe_for_replace); 411 412 // Cast obj to type and emit guard unless we had too many traps here already 413 Node* maybe_cast_profiled_obj(Node* obj, 414 ciKlass* type, 415 bool not_null = false); 416 417 // Cast obj to not-null on this path 418 Node* cast_not_null(Node* obj, bool do_replace_in_map = true); 419 // Replace all occurrences of one node by another. 420 void replace_in_map(Node* old, Node* neww); |