1 /* 2 * Copyright (c) 1997, 2009, 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 * 23 */ 24 25 // Portions of code courtesy of Clifford Click 26 27 // Optimization - Graph Style 28 29 #include "incls/_precompiled.incl" 30 #include "incls/_gcm.cpp.incl" 31 32 // To avoid float value underflow 33 #define MIN_BLOCK_FREQUENCY 1.e-35f 34 35 //----------------------------schedule_node_into_block------------------------- 36 // Insert node n into block b. Look for projections of n and make sure they 37 // are in b also. 38 void PhaseCFG::schedule_node_into_block( Node *n, Block *b ) { 39 // Set basic block of n, Add n to b, 40 _bbs.map(n->_idx, b); 41 b->add_inst(n); 42 43 // After Matching, nearly any old Node may have projections trailing it. 44 // These are usually machine-dependent flags. In any case, they might 45 // float to another block below this one. Move them up. 46 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { 47 Node* use = n->fast_out(i); 48 if (use->is_Proj()) { 49 Block* buse = _bbs[use->_idx]; 50 if (buse != b) { // In wrong block? 51 if (buse != NULL) | 1 /* 2 * Copyright (c) 1997, 2010, 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 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "libadt/vectset.hpp" 27 #include "memory/allocation.inline.hpp" 28 #include "opto/block.hpp" 29 #include "opto/c2compiler.hpp" 30 #include "opto/callnode.hpp" 31 #include "opto/cfgnode.hpp" 32 #include "opto/machnode.hpp" 33 #include "opto/opcodes.hpp" 34 #include "opto/phaseX.hpp" 35 #include "opto/rootnode.hpp" 36 #include "opto/runtime.hpp" 37 #include "runtime/deoptimization.hpp" 38 #ifdef TARGET_ARCH_MODEL_x86_32 39 # include "adfiles/ad_x86_32.hpp" 40 #endif 41 #ifdef TARGET_ARCH_MODEL_x86_64 42 # include "adfiles/ad_x86_64.hpp" 43 #endif 44 #ifdef TARGET_ARCH_MODEL_sparc 45 # include "adfiles/ad_sparc.hpp" 46 #endif 47 #ifdef TARGET_ARCH_MODEL_zero 48 # include "adfiles/ad_zero.hpp" 49 #endif 50 51 // Portions of code courtesy of Clifford Click 52 53 // Optimization - Graph Style 54 55 // To avoid float value underflow 56 #define MIN_BLOCK_FREQUENCY 1.e-35f 57 58 //----------------------------schedule_node_into_block------------------------- 59 // Insert node n into block b. Look for projections of n and make sure they 60 // are in b also. 61 void PhaseCFG::schedule_node_into_block( Node *n, Block *b ) { 62 // Set basic block of n, Add n to b, 63 _bbs.map(n->_idx, b); 64 b->add_inst(n); 65 66 // After Matching, nearly any old Node may have projections trailing it. 67 // These are usually machine-dependent flags. In any case, they might 68 // float to another block below this one. Move them up. 69 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { 70 Node* use = n->fast_out(i); 71 if (use->is_Proj()) { 72 Block* buse = _bbs[use->_idx]; 73 if (buse != b) { // In wrong block? 74 if (buse != NULL) |