1 /*
2 * Copyright (c) 2005, 2014, 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 *
1785 #endif
1786
1787 // Optimize ideal graph.
1788 void ConnectionGraph::optimize_ideal_graph(GrowableArray<Node*>& ptr_cmp_worklist,
1789 GrowableArray<Node*>& storestore_worklist) {
1790 Compile* C = _compile;
1791 PhaseIterGVN* igvn = _igvn;
1792 if (EliminateLocks) {
1793 // Mark locks before changing ideal graph.
1794 int cnt = C->macro_count();
1795 for( int i=0; i < cnt; i++ ) {
1796 Node *n = C->macro_node(i);
1797 if (n->is_AbstractLock()) { // Lock and Unlock nodes
1798 AbstractLockNode* alock = n->as_AbstractLock();
1799 if (!alock->is_non_esc_obj()) {
1800 if (not_global_escape(alock->obj_node())) {
1801 assert(!alock->is_eliminated() || alock->is_coarsened(), "sanity");
1802 // The lock could be marked eliminated by lock coarsening
1803 // code during first IGVN before EA. Replace coarsened flag
1804 // to eliminate all associated locks/unlocks.
1805 alock->set_non_esc_obj();
1806 }
1807 }
1808 }
1809 }
1810 }
1811
1812 if (OptimizePtrCompare) {
1813 // Add ConI(#CC_GT) and ConI(#CC_EQ).
1814 _pcmp_neq = igvn->makecon(TypeInt::CC_GT);
1815 _pcmp_eq = igvn->makecon(TypeInt::CC_EQ);
1816 // Optimize objects compare.
1817 while (ptr_cmp_worklist.length() != 0) {
1818 Node *n = ptr_cmp_worklist.pop();
1819 Node *res = optimize_ptr_compare(n);
1820 if (res != NULL) {
1821 #ifndef PRODUCT
1822 if (PrintOptimizePtrCompare) {
1823 tty->print_cr("++++ Replaced: %d %s(%d,%d) --> %s", n->_idx, (n->Opcode() == Op_CmpP ? "CmpP" : "CmpN"), n->in(1)->_idx, n->in(2)->_idx, (res == _pcmp_eq ? "EQ" : "NotEQ"));
1824 if (Verbose) {
|
1 /*
2 * Copyright (c) 2005, 2015, 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 *
1785 #endif
1786
1787 // Optimize ideal graph.
1788 void ConnectionGraph::optimize_ideal_graph(GrowableArray<Node*>& ptr_cmp_worklist,
1789 GrowableArray<Node*>& storestore_worklist) {
1790 Compile* C = _compile;
1791 PhaseIterGVN* igvn = _igvn;
1792 if (EliminateLocks) {
1793 // Mark locks before changing ideal graph.
1794 int cnt = C->macro_count();
1795 for( int i=0; i < cnt; i++ ) {
1796 Node *n = C->macro_node(i);
1797 if (n->is_AbstractLock()) { // Lock and Unlock nodes
1798 AbstractLockNode* alock = n->as_AbstractLock();
1799 if (!alock->is_non_esc_obj()) {
1800 if (not_global_escape(alock->obj_node())) {
1801 assert(!alock->is_eliminated() || alock->is_coarsened(), "sanity");
1802 // The lock could be marked eliminated by lock coarsening
1803 // code during first IGVN before EA. Replace coarsened flag
1804 // to eliminate all associated locks/unlocks.
1805 #ifdef ASSERT
1806 alock->log_lock_optimization(C, "eliminate_lock_set_non_esc3");
1807 #endif
1808 alock->set_non_esc_obj();
1809 }
1810 }
1811 }
1812 }
1813 }
1814
1815 if (OptimizePtrCompare) {
1816 // Add ConI(#CC_GT) and ConI(#CC_EQ).
1817 _pcmp_neq = igvn->makecon(TypeInt::CC_GT);
1818 _pcmp_eq = igvn->makecon(TypeInt::CC_EQ);
1819 // Optimize objects compare.
1820 while (ptr_cmp_worklist.length() != 0) {
1821 Node *n = ptr_cmp_worklist.pop();
1822 Node *res = optimize_ptr_compare(n);
1823 if (res != NULL) {
1824 #ifndef PRODUCT
1825 if (PrintOptimizePtrCompare) {
1826 tty->print_cr("++++ Replaced: %d %s(%d,%d) --> %s", n->_idx, (n->Opcode() == Op_CmpP ? "CmpP" : "CmpN"), n->in(1)->_idx, n->in(2)->_idx, (res == _pcmp_eq ? "EQ" : "NotEQ"));
1827 if (Verbose) {
|