503 if (is_expensive()) {
504 C->add_expensive_node(n);
505 }
506 if (for_post_loop_opts_igvn()) {
507 // Don't add cloned node to Compile::_for_post_loop_opts_igvn list automatically.
508 // If it is applicable, it will happen anyway when the cloned node is registered with IGVN.
509 n->remove_flag(Node::NodeFlags::Flag_for_post_loop_opts_igvn);
510 }
511 if (for_merge_stores_igvn()) {
512 // Don't add cloned node to Compile::_for_merge_stores_igvn list automatically.
513 // If it is applicable, it will happen anyway when the cloned node is registered with IGVN.
514 n->remove_flag(Node::NodeFlags::Flag_for_merge_stores_igvn);
515 }
516 if (n->is_ParsePredicate()) {
517 C->add_parse_predicate(n->as_ParsePredicate());
518 }
519 if (n->is_OpaqueTemplateAssertionPredicate()) {
520 C->add_template_assertion_predicate_opaque(n->as_OpaqueTemplateAssertionPredicate());
521 }
522
523 BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
524 bs->register_potential_barrier_node(n);
525
526 n->set_idx(C->next_unique()); // Get new unique index as well
527 NOT_PRODUCT(n->_igv_idx = C->next_igv_idx());
528 DEBUG_ONLY( n->verify_construction() );
529 NOT_PRODUCT(nodes_created++);
530 // Do not patch over the debug_idx of a clone, because it makes it
531 // impossible to break on the clone's moment of creation.
532 //DEBUG_ONLY( n->set_debug_idx( debug_idx() ) );
533
534 C->copy_node_notes_to(n, (Node*) this);
535
536 // MachNode clone
537 uint nopnds;
538 if (this->is_Mach() && (nopnds = this->as_Mach()->num_opnds()) > 0) {
539 MachNode *mach = n->as_Mach();
540 MachNode *mthis = this->as_Mach();
541 // Get address of _opnd_array.
542 // It should be the same offset since it is the clone of this node.
543 MachOper **from = mthis->_opnds;
544 MachOper **to = (MachOper **)((size_t)(&mach->_opnds) +
545 pointer_delta((const void*)from,
625 if (is_OpaqueTemplateAssertionPredicate()) {
626 compile->remove_template_assertion_predicate_opaque(as_OpaqueTemplateAssertionPredicate());
627 }
628 if (is_ParsePredicate()) {
629 compile->remove_parse_predicate(as_ParsePredicate());
630 }
631 if (for_post_loop_opts_igvn()) {
632 compile->remove_from_post_loop_opts_igvn(this);
633 }
634 if (for_merge_stores_igvn()) {
635 compile->remove_from_merge_stores_igvn(this);
636 }
637
638 if (is_SafePoint()) {
639 as_SafePoint()->delete_replaced_nodes();
640
641 if (is_CallStaticJava()) {
642 compile->remove_unstable_if_trap(as_CallStaticJava(), false);
643 }
644 }
645 BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
646 bs->unregister_potential_barrier_node(this);
647
648 // See if the input array was allocated just prior to the object
649 int edge_size = _max*sizeof(void*);
650 int out_edge_size = _outmax*sizeof(void*);
651 char *in_array = ((char*)_in);
652 char *edge_end = in_array + edge_size;
653 char *out_array = (char*)(_out == NO_OUT_ARRAY? nullptr: _out);
654 int node_size = size_of();
655
656 #ifdef ASSERT
657 // We will not actually delete the storage, but we'll make the node unusable.
658 compile->remove_modified_node(this);
659 *(address*)this = badAddress; // smash the C++ vtbl, probably
660 _in = _out = (Node**) badAddress;
661 _max = _cnt = _outmax = _outcnt = 0;
662 #endif
663
664 // Free the output edge array
665 if (out_edge_size > 0) {
666 compile->node_arena()->Afree(out_array, out_edge_size);
1452 igvn->set_type(dead, Type::TOP);
1453 // Kill all inputs to the dead guy
1454 for (uint i=0; i < dead->req(); i++) {
1455 Node *n = dead->in(i); // Get input to dead guy
1456 if (n != nullptr && !n->is_top()) { // Input is valid?
1457 dead->set_req(i, top); // Smash input away
1458 if (n->outcnt() == 0) { // Input also goes dead?
1459 if (!n->is_Con())
1460 nstack.push(n); // Clear it out as well
1461 } else if (n->outcnt() == 1 &&
1462 n->has_special_unique_user()) {
1463 igvn->add_users_to_worklist( n );
1464 } else if (n->outcnt() <= 2 && n->is_Store()) {
1465 // Push store's uses on worklist to enable folding optimization for
1466 // store/store and store/load to the same address.
1467 // The restriction (outcnt() <= 2) is the same as in set_req_X()
1468 // and remove_globally_dead_node().
1469 igvn->add_users_to_worklist( n );
1470 } else if (dead->is_data_proj_of_pure_function(n)) {
1471 igvn->_worklist.push(n);
1472 } else {
1473 BarrierSet::barrier_set()->barrier_set_c2()->enqueue_useful_gc_barrier(igvn, n);
1474 }
1475 }
1476 }
1477 igvn->C->remove_useless_node(dead);
1478 } // (dead->outcnt() == 0)
1479 } // while (nstack.size() > 0) for outputs
1480 return;
1481 }
1482
1483 //------------------------------remove_dead_region-----------------------------
1484 bool Node::remove_dead_region(PhaseGVN *phase, bool can_reshape) {
1485 Node *n = in(0);
1486 if( !n ) return false;
1487 // Lost control into this guy? I.e., it became unreachable?
1488 // Aggressively kill all unreachable code.
1489 if (can_reshape && n->is_top()) {
1490 kill_dead_code(this, phase->is_IterGVN());
1491 return false; // Node is dead.
1492 }
1493
|
503 if (is_expensive()) {
504 C->add_expensive_node(n);
505 }
506 if (for_post_loop_opts_igvn()) {
507 // Don't add cloned node to Compile::_for_post_loop_opts_igvn list automatically.
508 // If it is applicable, it will happen anyway when the cloned node is registered with IGVN.
509 n->remove_flag(Node::NodeFlags::Flag_for_post_loop_opts_igvn);
510 }
511 if (for_merge_stores_igvn()) {
512 // Don't add cloned node to Compile::_for_merge_stores_igvn list automatically.
513 // If it is applicable, it will happen anyway when the cloned node is registered with IGVN.
514 n->remove_flag(Node::NodeFlags::Flag_for_merge_stores_igvn);
515 }
516 if (n->is_ParsePredicate()) {
517 C->add_parse_predicate(n->as_ParsePredicate());
518 }
519 if (n->is_OpaqueTemplateAssertionPredicate()) {
520 C->add_template_assertion_predicate_opaque(n->as_OpaqueTemplateAssertionPredicate());
521 }
522
523 n->set_idx(C->next_unique()); // Get new unique index as well
524 NOT_PRODUCT(n->_igv_idx = C->next_igv_idx());
525 DEBUG_ONLY( n->verify_construction() );
526 NOT_PRODUCT(nodes_created++);
527 // Do not patch over the debug_idx of a clone, because it makes it
528 // impossible to break on the clone's moment of creation.
529 //DEBUG_ONLY( n->set_debug_idx( debug_idx() ) );
530
531 C->copy_node_notes_to(n, (Node*) this);
532
533 // MachNode clone
534 uint nopnds;
535 if (this->is_Mach() && (nopnds = this->as_Mach()->num_opnds()) > 0) {
536 MachNode *mach = n->as_Mach();
537 MachNode *mthis = this->as_Mach();
538 // Get address of _opnd_array.
539 // It should be the same offset since it is the clone of this node.
540 MachOper **from = mthis->_opnds;
541 MachOper **to = (MachOper **)((size_t)(&mach->_opnds) +
542 pointer_delta((const void*)from,
622 if (is_OpaqueTemplateAssertionPredicate()) {
623 compile->remove_template_assertion_predicate_opaque(as_OpaqueTemplateAssertionPredicate());
624 }
625 if (is_ParsePredicate()) {
626 compile->remove_parse_predicate(as_ParsePredicate());
627 }
628 if (for_post_loop_opts_igvn()) {
629 compile->remove_from_post_loop_opts_igvn(this);
630 }
631 if (for_merge_stores_igvn()) {
632 compile->remove_from_merge_stores_igvn(this);
633 }
634
635 if (is_SafePoint()) {
636 as_SafePoint()->delete_replaced_nodes();
637
638 if (is_CallStaticJava()) {
639 compile->remove_unstable_if_trap(as_CallStaticJava(), false);
640 }
641 }
642
643 // See if the input array was allocated just prior to the object
644 int edge_size = _max*sizeof(void*);
645 int out_edge_size = _outmax*sizeof(void*);
646 char *in_array = ((char*)_in);
647 char *edge_end = in_array + edge_size;
648 char *out_array = (char*)(_out == NO_OUT_ARRAY? nullptr: _out);
649 int node_size = size_of();
650
651 #ifdef ASSERT
652 // We will not actually delete the storage, but we'll make the node unusable.
653 compile->remove_modified_node(this);
654 *(address*)this = badAddress; // smash the C++ vtbl, probably
655 _in = _out = (Node**) badAddress;
656 _max = _cnt = _outmax = _outcnt = 0;
657 #endif
658
659 // Free the output edge array
660 if (out_edge_size > 0) {
661 compile->node_arena()->Afree(out_array, out_edge_size);
1447 igvn->set_type(dead, Type::TOP);
1448 // Kill all inputs to the dead guy
1449 for (uint i=0; i < dead->req(); i++) {
1450 Node *n = dead->in(i); // Get input to dead guy
1451 if (n != nullptr && !n->is_top()) { // Input is valid?
1452 dead->set_req(i, top); // Smash input away
1453 if (n->outcnt() == 0) { // Input also goes dead?
1454 if (!n->is_Con())
1455 nstack.push(n); // Clear it out as well
1456 } else if (n->outcnt() == 1 &&
1457 n->has_special_unique_user()) {
1458 igvn->add_users_to_worklist( n );
1459 } else if (n->outcnt() <= 2 && n->is_Store()) {
1460 // Push store's uses on worklist to enable folding optimization for
1461 // store/store and store/load to the same address.
1462 // The restriction (outcnt() <= 2) is the same as in set_req_X()
1463 // and remove_globally_dead_node().
1464 igvn->add_users_to_worklist( n );
1465 } else if (dead->is_data_proj_of_pure_function(n)) {
1466 igvn->_worklist.push(n);
1467 }
1468 }
1469 }
1470 igvn->C->remove_useless_node(dead);
1471 } // (dead->outcnt() == 0)
1472 } // while (nstack.size() > 0) for outputs
1473 return;
1474 }
1475
1476 //------------------------------remove_dead_region-----------------------------
1477 bool Node::remove_dead_region(PhaseGVN *phase, bool can_reshape) {
1478 Node *n = in(0);
1479 if( !n ) return false;
1480 // Lost control into this guy? I.e., it became unreachable?
1481 // Aggressively kill all unreachable code.
1482 if (can_reshape && n->is_top()) {
1483 kill_dead_code(this, phase->is_IterGVN());
1484 return false; // Node is dead.
1485 }
1486
|