< prev index next >

src/hotspot/share/opto/cfgnode.cpp

Print this page



  26 #include "classfile/systemDictionary.hpp"
  27 #include "gc/shared/barrierSet.hpp"
  28 #include "gc/shared/c2/barrierSetC2.hpp"
  29 #include "memory/allocation.inline.hpp"
  30 #include "memory/resourceArea.hpp"
  31 #include "oops/objArrayKlass.hpp"
  32 #include "opto/addnode.hpp"
  33 #include "opto/castnode.hpp"
  34 #include "opto/cfgnode.hpp"
  35 #include "opto/connode.hpp"
  36 #include "opto/convertnode.hpp"
  37 #include "opto/loopnode.hpp"
  38 #include "opto/machnode.hpp"
  39 #include "opto/movenode.hpp"
  40 #include "opto/narrowptrnode.hpp"
  41 #include "opto/mulnode.hpp"
  42 #include "opto/phaseX.hpp"
  43 #include "opto/regmask.hpp"
  44 #include "opto/runtime.hpp"
  45 #include "opto/subnode.hpp"

  46 #include "utilities/vmError.hpp"
  47 
  48 // Portions of code courtesy of Clifford Click
  49 
  50 // Optimization - Graph Style
  51 
  52 //=============================================================================
  53 //------------------------------Value------------------------------------------
  54 // Compute the type of the RegionNode.
  55 const Type* RegionNode::Value(PhaseGVN* phase) const {
  56   for( uint i=1; i<req(); ++i ) {       // For all paths in
  57     Node *n = in(i);            // Get Control source
  58     if( !n ) continue;          // Missing inputs are TOP
  59     if( phase->type(n) == Type::CONTROL )
  60       return Type::CONTROL;
  61   }
  62   return Type::TOP;             // All paths dead?  Then so are we
  63 }
  64 
  65 //------------------------------Identity---------------------------------------


2310             if (is_decodeN) {
2311               new_ii = new EncodePNode(ii, narrow_t);
2312             } else {
2313               new_ii = new EncodePKlassNode(ii, narrow_t);
2314             }
2315             igvn->register_new_node_with_optimizer(new_ii);
2316           }
2317         }
2318         new_phi->set_req(i, new_ii);
2319       }
2320       igvn->register_new_node_with_optimizer(new_phi, this);
2321       if (is_decodeN) {
2322         progress = new DecodeNNode(new_phi, bottom_type());
2323       } else {
2324         progress = new DecodeNKlassNode(new_phi, bottom_type());
2325       }
2326     }
2327   }
2328 #endif
2329 









































2330   return progress;              // Return any progress
2331 }
2332 
2333 //------------------------------is_tripcount-----------------------------------
2334 bool PhiNode::is_tripcount() const {
2335   return (in(0) != NULL && in(0)->is_CountedLoop() &&
2336           in(0)->as_CountedLoop()->phi() == this);
2337 }
2338 
2339 //------------------------------out_RegMask------------------------------------
2340 const RegMask &PhiNode::in_RegMask(uint i) const {
2341   return i ? out_RegMask() : RegMask::Empty;
2342 }
2343 
2344 const RegMask &PhiNode::out_RegMask() const {
2345   uint ideal_reg = _type->ideal_reg();
2346   assert( ideal_reg != Node::NotAMachineReg, "invalid type at Phi" );
2347   if( ideal_reg == 0 ) return RegMask::Empty;
2348   assert(ideal_reg != Op_RegFlags, "flags register is not spillable");
2349   return *(Compile::current()->matcher()->idealreg2spillmask[ideal_reg]);



  26 #include "classfile/systemDictionary.hpp"
  27 #include "gc/shared/barrierSet.hpp"
  28 #include "gc/shared/c2/barrierSetC2.hpp"
  29 #include "memory/allocation.inline.hpp"
  30 #include "memory/resourceArea.hpp"
  31 #include "oops/objArrayKlass.hpp"
  32 #include "opto/addnode.hpp"
  33 #include "opto/castnode.hpp"
  34 #include "opto/cfgnode.hpp"
  35 #include "opto/connode.hpp"
  36 #include "opto/convertnode.hpp"
  37 #include "opto/loopnode.hpp"
  38 #include "opto/machnode.hpp"
  39 #include "opto/movenode.hpp"
  40 #include "opto/narrowptrnode.hpp"
  41 #include "opto/mulnode.hpp"
  42 #include "opto/phaseX.hpp"
  43 #include "opto/regmask.hpp"
  44 #include "opto/runtime.hpp"
  45 #include "opto/subnode.hpp"
  46 #include "opto/vectornode.hpp"
  47 #include "utilities/vmError.hpp"
  48 
  49 // Portions of code courtesy of Clifford Click
  50 
  51 // Optimization - Graph Style
  52 
  53 //=============================================================================
  54 //------------------------------Value------------------------------------------
  55 // Compute the type of the RegionNode.
  56 const Type* RegionNode::Value(PhaseGVN* phase) const {
  57   for( uint i=1; i<req(); ++i ) {       // For all paths in
  58     Node *n = in(i);            // Get Control source
  59     if( !n ) continue;          // Missing inputs are TOP
  60     if( phase->type(n) == Type::CONTROL )
  61       return Type::CONTROL;
  62   }
  63   return Type::TOP;             // All paths dead?  Then so are we
  64 }
  65 
  66 //------------------------------Identity---------------------------------------


2311             if (is_decodeN) {
2312               new_ii = new EncodePNode(ii, narrow_t);
2313             } else {
2314               new_ii = new EncodePKlassNode(ii, narrow_t);
2315             }
2316             igvn->register_new_node_with_optimizer(new_ii);
2317           }
2318         }
2319         new_phi->set_req(i, new_ii);
2320       }
2321       igvn->register_new_node_with_optimizer(new_phi, this);
2322       if (is_decodeN) {
2323         progress = new DecodeNNode(new_phi, bottom_type());
2324       } else {
2325         progress = new DecodeNKlassNode(new_phi, bottom_type());
2326       }
2327     }
2328   }
2329 #endif
2330 
2331   // Phi (VB ... VB) => VB (Phi ...) (Phi ...)
2332   if (EnableVectorReboxing && can_reshape && progress == NULL) {
2333     PhaseIterGVN *igvn = phase->is_IterGVN();
2334 
2335     bool all_inputs_are_equiv_vboxes = true;
2336     for (uint i = 1; i < req(); ++i) {
2337       Node *n = in(i);
2338       if (in(i)->Opcode() != Op_VectorBox) {
2339         all_inputs_are_equiv_vboxes = false;
2340         break;
2341       }
2342       // Check that vector type of vboxes is equivalent
2343       if (i != 1) {
2344         if (Type::cmp(in(i-0)->in(VectorBoxNode::Value)->bottom_type(),
2345                       in(i-1)->in(VectorBoxNode::Value)->bottom_type()) != 0) {
2346           all_inputs_are_equiv_vboxes = false;
2347           break;
2348         }
2349         if (Type::cmp(in(i-0)->in(VectorBoxNode::Box)->bottom_type(),
2350                       in(i-1)->in(VectorBoxNode::Box)->bottom_type()) != 0) {
2351           all_inputs_are_equiv_vboxes = false;
2352           break;
2353         }
2354       }
2355     }
2356 
2357     if (all_inputs_are_equiv_vboxes) {
2358       VectorBoxNode* vbox = static_cast<VectorBoxNode*>(in(1));
2359       PhiNode* new_vbox_phi = new PhiNode(r, vbox->box_type());
2360       PhiNode* new_vect_phi = new PhiNode(r, vbox->vec_type());
2361       for (uint i = 1; i < req(); ++i) {
2362         VectorBoxNode* old_vbox = static_cast<VectorBoxNode*>(in(i));
2363         new_vbox_phi->set_req(i, old_vbox->in(VectorBoxNode::Box));
2364         new_vect_phi->set_req(i, old_vbox->in(VectorBoxNode::Value));
2365       }
2366       igvn->register_new_node_with_optimizer(new_vbox_phi, this);
2367       igvn->register_new_node_with_optimizer(new_vect_phi, this);
2368       progress = new VectorBoxNode(igvn->C, new_vbox_phi, new_vect_phi, vbox->box_type(), vbox->vec_type());
2369     }
2370   }
2371 
2372   return progress;              // Return any progress
2373 }
2374 
2375 //------------------------------is_tripcount-----------------------------------
2376 bool PhiNode::is_tripcount() const {
2377   return (in(0) != NULL && in(0)->is_CountedLoop() &&
2378           in(0)->as_CountedLoop()->phi() == this);
2379 }
2380 
2381 //------------------------------out_RegMask------------------------------------
2382 const RegMask &PhiNode::in_RegMask(uint i) const {
2383   return i ? out_RegMask() : RegMask::Empty;
2384 }
2385 
2386 const RegMask &PhiNode::out_RegMask() const {
2387   uint ideal_reg = _type->ideal_reg();
2388   assert( ideal_reg != Node::NotAMachineReg, "invalid type at Phi" );
2389   if( ideal_reg == 0 ) return RegMask::Empty;
2390   assert(ideal_reg != Op_RegFlags, "flags register is not spillable");
2391   return *(Compile::current()->matcher()->idealreg2spillmask[ideal_reg]);


< prev index next >