1 /*
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
640 Block* block = rpo_at(rpo);
641
642 if (block->is_parsed()) continue;
643
644 if (!block->is_merged()) {
645 // Dead block, no state reaches this block
646 continue;
647 }
648
649 // Prepare to parse this block.
650 load_state_from(block);
651
652 if (stopped()) {
653 // Block is dead.
654 continue;
655 }
656
657 NOT_PRODUCT(blocks_parsed++);
658
659 progress = true;
660 if (block->is_loop_head() || block->is_handler() || has_irreducible && !block->is_ready()) {
661 // Not all preds have been parsed. We must build phis everywhere.
662 // (Note that dead locals do not get phis built, ever.)
663 ensure_phis_everywhere();
664
665 if (block->is_SEL_head()) {
666 // Add predicate to single entry (not irreducible) loop head.
667 assert(!block->has_merged_backedge(), "only entry paths should be merged for now");
668 // Need correct bci for predicate.
669 // It is fine to set it here since do_one_block() will set it anyway.
670 set_parse_bci(block->start());
671 add_predicate();
672 // Add new region for back branches.
673 int edges = block->pred_count() - block->preds_parsed() + 1; // +1 for original region
674 RegionNode *r = new RegionNode(edges+1);
675 _gvn.set_type(r, Type::CONTROL);
676 record_for_igvn(r);
677 r->init_req(edges, control());
678 set_control(r);
679 // Add new phis.
680 ensure_phis_everywhere();
729 }
730 #endif
731 }
732
733 static Node* mask_int_value(Node* v, BasicType bt, PhaseGVN* gvn) {
734 switch (bt) {
735 case T_BYTE:
736 v = gvn->transform(new LShiftINode(v, gvn->intcon(24)));
737 v = gvn->transform(new RShiftINode(v, gvn->intcon(24)));
738 break;
739 case T_SHORT:
740 v = gvn->transform(new LShiftINode(v, gvn->intcon(16)));
741 v = gvn->transform(new RShiftINode(v, gvn->intcon(16)));
742 break;
743 case T_CHAR:
744 v = gvn->transform(new AndINode(v, gvn->intcon(0xFFFF)));
745 break;
746 case T_BOOLEAN:
747 v = gvn->transform(new AndINode(v, gvn->intcon(0x1)));
748 break;
749 }
750 return v;
751 }
752
753 //-------------------------------build_exits----------------------------------
754 // Build normal and exceptional exit merge points.
755 void Parse::build_exits() {
756 // make a clone of caller to prevent sharing of side-effects
757 _exits.set_map(_exits.clone_map());
758 _exits.clean_stack(_exits.sp());
759 _exits.sync_jvms();
760
761 RegionNode* region = new RegionNode(1);
762 record_for_igvn(region);
763 gvn().set_type_bottom(region);
764 _exits.set_control(region);
765
766 // Note: iophi and memphi are not transformed until do_exits.
767 Node* iophi = new PhiNode(region, Type::ABIO);
768 Node* memphi = new PhiNode(region, Type::MEMORY, TypePtr::BOTTOM);
|
1 /*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
640 Block* block = rpo_at(rpo);
641
642 if (block->is_parsed()) continue;
643
644 if (!block->is_merged()) {
645 // Dead block, no state reaches this block
646 continue;
647 }
648
649 // Prepare to parse this block.
650 load_state_from(block);
651
652 if (stopped()) {
653 // Block is dead.
654 continue;
655 }
656
657 NOT_PRODUCT(blocks_parsed++);
658
659 progress = true;
660 if (block->is_loop_head() || block->is_handler() || (has_irreducible && !block->is_ready())) {
661 // Not all preds have been parsed. We must build phis everywhere.
662 // (Note that dead locals do not get phis built, ever.)
663 ensure_phis_everywhere();
664
665 if (block->is_SEL_head()) {
666 // Add predicate to single entry (not irreducible) loop head.
667 assert(!block->has_merged_backedge(), "only entry paths should be merged for now");
668 // Need correct bci for predicate.
669 // It is fine to set it here since do_one_block() will set it anyway.
670 set_parse_bci(block->start());
671 add_predicate();
672 // Add new region for back branches.
673 int edges = block->pred_count() - block->preds_parsed() + 1; // +1 for original region
674 RegionNode *r = new RegionNode(edges+1);
675 _gvn.set_type(r, Type::CONTROL);
676 record_for_igvn(r);
677 r->init_req(edges, control());
678 set_control(r);
679 // Add new phis.
680 ensure_phis_everywhere();
729 }
730 #endif
731 }
732
733 static Node* mask_int_value(Node* v, BasicType bt, PhaseGVN* gvn) {
734 switch (bt) {
735 case T_BYTE:
736 v = gvn->transform(new LShiftINode(v, gvn->intcon(24)));
737 v = gvn->transform(new RShiftINode(v, gvn->intcon(24)));
738 break;
739 case T_SHORT:
740 v = gvn->transform(new LShiftINode(v, gvn->intcon(16)));
741 v = gvn->transform(new RShiftINode(v, gvn->intcon(16)));
742 break;
743 case T_CHAR:
744 v = gvn->transform(new AndINode(v, gvn->intcon(0xFFFF)));
745 break;
746 case T_BOOLEAN:
747 v = gvn->transform(new AndINode(v, gvn->intcon(0x1)));
748 break;
749 default:
750 break;
751 }
752 return v;
753 }
754
755 //-------------------------------build_exits----------------------------------
756 // Build normal and exceptional exit merge points.
757 void Parse::build_exits() {
758 // make a clone of caller to prevent sharing of side-effects
759 _exits.set_map(_exits.clone_map());
760 _exits.clean_stack(_exits.sp());
761 _exits.sync_jvms();
762
763 RegionNode* region = new RegionNode(1);
764 record_for_igvn(region);
765 gvn().set_type_bottom(region);
766 _exits.set_control(region);
767
768 // Note: iophi and memphi are not transformed until do_exits.
769 Node* iophi = new PhiNode(region, Type::ABIO);
770 Node* memphi = new PhiNode(region, Type::MEMORY, TypePtr::BOTTOM);
|