2398 //---------------------------collect_null_checks-------------------------------
2399 // Find null checks in the ideal graph; write a machine-specific node for
2400 // it. Used by later implicit-null-check handling. Actually collects
2401 // either an IfTrue or IfFalse for the common NOT-null path, AND the ideal
2402 // value being tested.
2403 void Matcher::collect_null_checks( Node *proj, Node *orig_proj ) {
2404 Node *iff = proj->in(0);
2405 if( iff->Opcode() == Op_If ) {
2406 // During matching If's have Bool & Cmp side-by-side
2407 BoolNode *b = iff->in(1)->as_Bool();
2408 Node *cmp = iff->in(2);
2409 int opc = cmp->Opcode();
2410 if (opc != Op_CmpP && opc != Op_CmpN) return;
2411
2412 const Type* ct = cmp->in(2)->bottom_type();
2413 if (ct == TypePtr::NULL_PTR ||
2414 (opc == Op_CmpN && ct == TypeNarrowOop::NULL_PTR)) {
2415
2416 bool push_it = false;
2417 if( proj->Opcode() == Op_IfTrue ) {
2418 extern int all_null_checks_found;
2419 all_null_checks_found++;
2420 if( b->_test._test == BoolTest::ne ) {
2421 push_it = true;
2422 }
2423 } else {
2424 assert( proj->Opcode() == Op_IfFalse, "" );
2425 if( b->_test._test == BoolTest::eq ) {
2426 push_it = true;
2427 }
2428 }
2429 if( push_it ) {
2430 _null_check_tests.push(proj);
2431 Node* val = cmp->in(1);
2432 #ifdef _LP64
2433 if (val->bottom_type()->isa_narrowoop() &&
2434 !Matcher::narrow_oop_use_complex_address()) {
2435 //
2436 // Look for DecodeN node which should be pinned to orig_proj.
2437 // On platforms (Sparc) which can not handle 2 adds
2438 // in addressing mode we have to keep a DecodeN node and
2439 // use it to do implicit NULL check in address.
|
2398 //---------------------------collect_null_checks-------------------------------
2399 // Find null checks in the ideal graph; write a machine-specific node for
2400 // it. Used by later implicit-null-check handling. Actually collects
2401 // either an IfTrue or IfFalse for the common NOT-null path, AND the ideal
2402 // value being tested.
2403 void Matcher::collect_null_checks( Node *proj, Node *orig_proj ) {
2404 Node *iff = proj->in(0);
2405 if( iff->Opcode() == Op_If ) {
2406 // During matching If's have Bool & Cmp side-by-side
2407 BoolNode *b = iff->in(1)->as_Bool();
2408 Node *cmp = iff->in(2);
2409 int opc = cmp->Opcode();
2410 if (opc != Op_CmpP && opc != Op_CmpN) return;
2411
2412 const Type* ct = cmp->in(2)->bottom_type();
2413 if (ct == TypePtr::NULL_PTR ||
2414 (opc == Op_CmpN && ct == TypeNarrowOop::NULL_PTR)) {
2415
2416 bool push_it = false;
2417 if( proj->Opcode() == Op_IfTrue ) {
2418 #ifndef PRODUCT
2419 extern int all_null_checks_found;
2420 all_null_checks_found++;
2421 #endif
2422 if( b->_test._test == BoolTest::ne ) {
2423 push_it = true;
2424 }
2425 } else {
2426 assert( proj->Opcode() == Op_IfFalse, "" );
2427 if( b->_test._test == BoolTest::eq ) {
2428 push_it = true;
2429 }
2430 }
2431 if( push_it ) {
2432 _null_check_tests.push(proj);
2433 Node* val = cmp->in(1);
2434 #ifdef _LP64
2435 if (val->bottom_type()->isa_narrowoop() &&
2436 !Matcher::narrow_oop_use_complex_address()) {
2437 //
2438 // Look for DecodeN node which should be pinned to orig_proj.
2439 // On platforms (Sparc) which can not handle 2 adds
2440 // in addressing mode we have to keep a DecodeN node and
2441 // use it to do implicit NULL check in address.
|