src/share/vm/opto/lcm.cpp

Print this page




   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 // Optimization - Graph Style



















  26 
  27 #include "incls/_precompiled.incl"
  28 #include "incls/_lcm.cpp.incl"
  29 
  30 //------------------------------implicit_null_check----------------------------
  31 // Detect implicit-null-check opportunities.  Basically, find NULL checks
  32 // with suitable memory ops nearby.  Use the memory op to do the NULL check.
  33 // I can generate a memory op if there is not one nearby.
  34 // The proj is the control projection for the not-null case.
  35 // The val is the pointer being checked for nullness or
  36 // decodeHeapOop_not_null node if it did not fold into address.
  37 void Block::implicit_null_check(PhaseCFG *cfg, Node *proj, Node *val, int allowed_reasons) {
  38   // Assume if null check need for 0 offset then always needed
  39   // Intel solaris doesn't support any null checks yet and no
  40   // mechanism exists (yet) to set the switches at an os_cpu level
  41   if( !ImplicitNullChecks || MacroAssembler::needs_explicit_null_check(0)) return;
  42 
  43   // Make sure the ptr-is-null path appears to be uncommon!
  44   float f = end()->as_MachIf()->_prob;
  45   if( proj->Opcode() == Op_IfTrue ) f = 1.0f - f;
  46   if( f > PROB_UNLIKELY_MAG(4) ) return;
  47 
  48   uint bidx = 0;                // Capture index of value into memop




   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 "memory/allocation.inline.hpp"
  27 #include "opto/block.hpp"
  28 #include "opto/c2compiler.hpp"
  29 #include "opto/callnode.hpp"
  30 #include "opto/cfgnode.hpp"
  31 #include "opto/machnode.hpp"
  32 #include "opto/runtime.hpp"
  33 #ifdef TARGET_ARCH_MODEL_x86_32
  34 # include "adfiles/ad_x86_32.hpp"
  35 #endif
  36 #ifdef TARGET_ARCH_MODEL_x86_64
  37 # include "adfiles/ad_x86_64.hpp"
  38 #endif
  39 #ifdef TARGET_ARCH_MODEL_sparc
  40 # include "adfiles/ad_sparc.hpp"
  41 #endif
  42 #ifdef TARGET_ARCH_MODEL_zero
  43 # include "adfiles/ad_zero.hpp"
  44 #endif
  45 
  46 // Optimization - Graph Style

  47 
  48 //------------------------------implicit_null_check----------------------------
  49 // Detect implicit-null-check opportunities.  Basically, find NULL checks
  50 // with suitable memory ops nearby.  Use the memory op to do the NULL check.
  51 // I can generate a memory op if there is not one nearby.
  52 // The proj is the control projection for the not-null case.
  53 // The val is the pointer being checked for nullness or
  54 // decodeHeapOop_not_null node if it did not fold into address.
  55 void Block::implicit_null_check(PhaseCFG *cfg, Node *proj, Node *val, int allowed_reasons) {
  56   // Assume if null check need for 0 offset then always needed
  57   // Intel solaris doesn't support any null checks yet and no
  58   // mechanism exists (yet) to set the switches at an os_cpu level
  59   if( !ImplicitNullChecks || MacroAssembler::needs_explicit_null_check(0)) return;
  60 
  61   // Make sure the ptr-is-null path appears to be uncommon!
  62   float f = end()->as_MachIf()->_prob;
  63   if( proj->Opcode() == Op_IfTrue ) f = 1.0f - f;
  64   if( f > PROB_UNLIKELY_MAG(4) ) return;
  65 
  66   uint bidx = 0;                // Capture index of value into memop