16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "gc/shared/barrierSet.hpp"
27 #include "gc/shared/c2/barrierSetC2.hpp"
28 #include "libadt/vectset.hpp"
29 #include "memory/allocation.inline.hpp"
30 #include "memory/resourceArea.hpp"
31 #include "opto/ad.hpp"
32 #include "opto/callGenerator.hpp"
33 #include "opto/castnode.hpp"
34 #include "opto/cfgnode.hpp"
35 #include "opto/connode.hpp"
36 #include "opto/loopnode.hpp"
37 #include "opto/machnode.hpp"
38 #include "opto/matcher.hpp"
39 #include "opto/node.hpp"
40 #include "opto/opcodes.hpp"
41 #include "opto/reachability.hpp"
42 #include "opto/regmask.hpp"
43 #include "opto/rootnode.hpp"
44 #include "opto/type.hpp"
45 #include "utilities/copy.hpp"
46 #include "utilities/macros.hpp"
47 #include "utilities/powerOfTwo.hpp"
48 #include "utilities/stringUtils.hpp"
49
50 class RegMask;
51 // #include "phase.hpp"
52 class PhaseTransform;
53 class PhaseGVN;
54
55 // Arena we are currently building Nodes in
558 // externally allocated memory. Make sure to use a proper constructor
559 // instead of just shallowly copying.
560 MachProjNode* mach = n->as_MachProj();
561 MachProjNode* mthis = this->as_MachProj();
562 new (&mach->_rout) RegMask(mthis->_rout);
563 }
564 if (n->is_Call()) {
565 // CallGenerator is linked to the original node.
566 CallGenerator* cg = n->as_Call()->generator();
567 if (cg != nullptr) {
568 CallGenerator* cloned_cg = cg->with_call_node(n->as_Call());
569 n->as_Call()->set_generator(cloned_cg);
570 }
571 }
572 if (n->is_SafePoint()) {
573 // Scalar replacement and macro expansion might modify the JVMState.
574 // Clone it to make sure it's not shared between SafePointNodes.
575 n->as_SafePoint()->clone_jvms(C);
576 n->as_SafePoint()->clone_replaced_nodes();
577 }
578 Compile::current()->record_modified_node(n);
579 return n; // Return the clone
580 }
581
582 //---------------------------setup_is_top--------------------------------------
583 // Call this when changing the top node, to reassert the invariants
584 // required by Node::is_top. See Compile::set_cached_top_node.
585 void Node::setup_is_top() {
586 if (this == (Node*)Compile::current()->top()) {
587 // This node has just become top. Kill its out array.
588 _outcnt = _outmax = 0;
589 _out = nullptr; // marker value for top
590 assert(is_top(), "must be top");
591 } else {
592 if (_out == nullptr) _out = NO_OUT_ARRAY;
593 assert(!is_top(), "must not be top");
594 }
595 }
596
597 //------------------------------~Node------------------------------------------
621 assert(outcnt() == 0, "deleting a node must not leave a dangling use");
622
623 if (is_macro()) {
624 compile->remove_macro_node(this);
625 }
626 if (is_expensive()) {
627 compile->remove_expensive_node(this);
628 }
629 if (is_ReachabilityFence()) {
630 compile->remove_reachability_fence(as_ReachabilityFence());
631 }
632 if (is_OpaqueTemplateAssertionPredicate()) {
633 compile->remove_template_assertion_predicate_opaque(as_OpaqueTemplateAssertionPredicate());
634 }
635 if (is_ParsePredicate()) {
636 compile->remove_parse_predicate(as_ParsePredicate());
637 }
638 if (for_post_loop_opts_igvn()) {
639 compile->remove_from_post_loop_opts_igvn(this);
640 }
641 if (for_merge_stores_igvn()) {
642 compile->remove_from_merge_stores_igvn(this);
643 }
644
645 if (is_SafePoint()) {
646 as_SafePoint()->delete_replaced_nodes();
647
648 if (is_CallStaticJava()) {
649 compile->remove_unstable_if_trap(as_CallStaticJava(), false);
650 }
651 }
652 BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
653 bs->unregister_potential_barrier_node(this);
654
655 // See if the input array was allocated just prior to the object
656 int edge_size = _max*sizeof(void*);
657 int out_edge_size = _outmax*sizeof(void*);
658 char *in_array = ((char*)_in);
659 char *edge_end = in_array + edge_size;
660 char *out_array = (char*)(_out == NO_OUT_ARRAY? nullptr: _out);
|
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "gc/shared/barrierSet.hpp"
27 #include "gc/shared/c2/barrierSetC2.hpp"
28 #include "libadt/vectset.hpp"
29 #include "memory/allocation.inline.hpp"
30 #include "memory/resourceArea.hpp"
31 #include "opto/ad.hpp"
32 #include "opto/callGenerator.hpp"
33 #include "opto/castnode.hpp"
34 #include "opto/cfgnode.hpp"
35 #include "opto/connode.hpp"
36 #include "opto/inlinetypenode.hpp"
37 #include "opto/loopnode.hpp"
38 #include "opto/machnode.hpp"
39 #include "opto/matcher.hpp"
40 #include "opto/node.hpp"
41 #include "opto/opcodes.hpp"
42 #include "opto/reachability.hpp"
43 #include "opto/regmask.hpp"
44 #include "opto/rootnode.hpp"
45 #include "opto/type.hpp"
46 #include "utilities/copy.hpp"
47 #include "utilities/macros.hpp"
48 #include "utilities/powerOfTwo.hpp"
49 #include "utilities/stringUtils.hpp"
50
51 class RegMask;
52 // #include "phase.hpp"
53 class PhaseTransform;
54 class PhaseGVN;
55
56 // Arena we are currently building Nodes in
559 // externally allocated memory. Make sure to use a proper constructor
560 // instead of just shallowly copying.
561 MachProjNode* mach = n->as_MachProj();
562 MachProjNode* mthis = this->as_MachProj();
563 new (&mach->_rout) RegMask(mthis->_rout);
564 }
565 if (n->is_Call()) {
566 // CallGenerator is linked to the original node.
567 CallGenerator* cg = n->as_Call()->generator();
568 if (cg != nullptr) {
569 CallGenerator* cloned_cg = cg->with_call_node(n->as_Call());
570 n->as_Call()->set_generator(cloned_cg);
571 }
572 }
573 if (n->is_SafePoint()) {
574 // Scalar replacement and macro expansion might modify the JVMState.
575 // Clone it to make sure it's not shared between SafePointNodes.
576 n->as_SafePoint()->clone_jvms(C);
577 n->as_SafePoint()->clone_replaced_nodes();
578 }
579 if (n->is_InlineType()) {
580 C->add_inline_type(n);
581 }
582 if (n->is_LoadFlat() || n->is_StoreFlat()) {
583 C->add_flat_access(n);
584 }
585 Compile::current()->record_modified_node(n);
586 return n; // Return the clone
587 }
588
589 //---------------------------setup_is_top--------------------------------------
590 // Call this when changing the top node, to reassert the invariants
591 // required by Node::is_top. See Compile::set_cached_top_node.
592 void Node::setup_is_top() {
593 if (this == (Node*)Compile::current()->top()) {
594 // This node has just become top. Kill its out array.
595 _outcnt = _outmax = 0;
596 _out = nullptr; // marker value for top
597 assert(is_top(), "must be top");
598 } else {
599 if (_out == nullptr) _out = NO_OUT_ARRAY;
600 assert(!is_top(), "must not be top");
601 }
602 }
603
604 //------------------------------~Node------------------------------------------
628 assert(outcnt() == 0, "deleting a node must not leave a dangling use");
629
630 if (is_macro()) {
631 compile->remove_macro_node(this);
632 }
633 if (is_expensive()) {
634 compile->remove_expensive_node(this);
635 }
636 if (is_ReachabilityFence()) {
637 compile->remove_reachability_fence(as_ReachabilityFence());
638 }
639 if (is_OpaqueTemplateAssertionPredicate()) {
640 compile->remove_template_assertion_predicate_opaque(as_OpaqueTemplateAssertionPredicate());
641 }
642 if (is_ParsePredicate()) {
643 compile->remove_parse_predicate(as_ParsePredicate());
644 }
645 if (for_post_loop_opts_igvn()) {
646 compile->remove_from_post_loop_opts_igvn(this);
647 }
648 if (is_InlineType()) {
649 compile->remove_inline_type(this);
650 }
651 if (for_merge_stores_igvn()) {
652 compile->remove_from_merge_stores_igvn(this);
653 }
654
655 if (is_SafePoint()) {
656 as_SafePoint()->delete_replaced_nodes();
657
658 if (is_CallStaticJava()) {
659 compile->remove_unstable_if_trap(as_CallStaticJava(), false);
660 }
661 }
662 BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
663 bs->unregister_potential_barrier_node(this);
664
665 // See if the input array was allocated just prior to the object
666 int edge_size = _max*sizeof(void*);
667 int out_edge_size = _outmax*sizeof(void*);
668 char *in_array = ((char*)_in);
669 char *edge_end = in_array + edge_size;
670 char *out_array = (char*)(_out == NO_OUT_ARRAY? nullptr: _out);
|