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);
1449 igvn->set_type(dead, Type::TOP);
1450 // Kill all inputs to the dead guy
1451 for (uint i=0; i < dead->req(); i++) {
1452 Node *n = dead->in(i); // Get input to dead guy
1453 if (n != nullptr && !n->is_top()) { // Input is valid?
1454 dead->set_req(i, top); // Smash input away
1455 if (n->outcnt() == 0) { // Input also goes dead?
1456 if (!n->is_Con())
1457 nstack.push(n); // Clear it out as well
1458 } else if (n->outcnt() == 1 &&
1459 n->has_special_unique_user()) {
1460 igvn->add_users_to_worklist( n );
1461 } else if (n->outcnt() <= 2 && n->is_Store()) {
1462 // Push store's uses on worklist to enable folding optimization for
1463 // store/store and store/load to the same address.
1464 // The restriction (outcnt() <= 2) is the same as in set_req_X()
1465 // and remove_globally_dead_node().
1466 igvn->add_users_to_worklist( n );
1467 } else if (dead->is_data_proj_of_pure_function(n)) {
1468 igvn->_worklist.push(n);
1469 } else {
1470 BarrierSet::barrier_set()->barrier_set_c2()->enqueue_useful_gc_barrier(igvn, n);
1471 }
1472 }
1473 }
1474 igvn->C->remove_useless_node(dead);
1475 } // (dead->outcnt() == 0)
1476 } // while (nstack.size() > 0) for outputs
1477 return;
1478 }
1479
1480 //------------------------------remove_dead_region-----------------------------
1481 bool Node::remove_dead_region(PhaseGVN *phase, bool can_reshape) {
1482 Node *n = in(0);
1483 if( !n ) return false;
1484 // Lost control into this guy? I.e., it became unreachable?
1485 // Aggressively kill all unreachable code.
1486 if (can_reshape && n->is_top()) {
1487 kill_dead_code(this, phase->is_IterGVN());
1488 return false; // Node is dead.
1489 }
1490
|
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);
1444 igvn->set_type(dead, Type::TOP);
1445 // Kill all inputs to the dead guy
1446 for (uint i=0; i < dead->req(); i++) {
1447 Node *n = dead->in(i); // Get input to dead guy
1448 if (n != nullptr && !n->is_top()) { // Input is valid?
1449 dead->set_req(i, top); // Smash input away
1450 if (n->outcnt() == 0) { // Input also goes dead?
1451 if (!n->is_Con())
1452 nstack.push(n); // Clear it out as well
1453 } else if (n->outcnt() == 1 &&
1454 n->has_special_unique_user()) {
1455 igvn->add_users_to_worklist( n );
1456 } else if (n->outcnt() <= 2 && n->is_Store()) {
1457 // Push store's uses on worklist to enable folding optimization for
1458 // store/store and store/load to the same address.
1459 // The restriction (outcnt() <= 2) is the same as in set_req_X()
1460 // and remove_globally_dead_node().
1461 igvn->add_users_to_worklist( n );
1462 } else if (dead->is_data_proj_of_pure_function(n)) {
1463 igvn->_worklist.push(n);
1464 }
1465 }
1466 }
1467 igvn->C->remove_useless_node(dead);
1468 } // (dead->outcnt() == 0)
1469 } // while (nstack.size() > 0) for outputs
1470 return;
1471 }
1472
1473 //------------------------------remove_dead_region-----------------------------
1474 bool Node::remove_dead_region(PhaseGVN *phase, bool can_reshape) {
1475 Node *n = in(0);
1476 if( !n ) return false;
1477 // Lost control into this guy? I.e., it became unreachable?
1478 // Aggressively kill all unreachable code.
1479 if (can_reshape && n->is_top()) {
1480 kill_dead_code(this, phase->is_IterGVN());
1481 return false; // Node is dead.
1482 }
1483
|