< prev index next >

src/share/vm/opto/parse2.cpp

Print this page
rev 10293 : 8150720: Cleanup code around PrintOptoStatistics
Reviewed-by: kvn, shade, vlivanov


  27 #include "classfile/systemDictionary.hpp"
  28 #include "classfile/vmSymbols.hpp"
  29 #include "compiler/compileLog.hpp"
  30 #include "interpreter/linkResolver.hpp"
  31 #include "memory/universe.inline.hpp"
  32 #include "oops/oop.inline.hpp"
  33 #include "opto/addnode.hpp"
  34 #include "opto/castnode.hpp"
  35 #include "opto/convertnode.hpp"
  36 #include "opto/divnode.hpp"
  37 #include "opto/idealGraphPrinter.hpp"
  38 #include "opto/matcher.hpp"
  39 #include "opto/memnode.hpp"
  40 #include "opto/mulnode.hpp"
  41 #include "opto/opaquenode.hpp"
  42 #include "opto/parse.hpp"
  43 #include "opto/runtime.hpp"
  44 #include "runtime/deoptimization.hpp"
  45 #include "runtime/sharedRuntime.hpp"
  46 

  47 extern int explicit_null_checks_inserted,
  48            explicit_null_checks_elided;

  49 
  50 //---------------------------------array_load----------------------------------
  51 void Parse::array_load(BasicType elem_type) {
  52   const Type* elem = Type::TOP;
  53   Node* adr = array_addressing(elem_type, 0, &elem);
  54   if (stopped())  return;     // guaranteed null or range check
  55   dec_sp(2);                  // Pop array and index
  56   const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(elem_type);
  57   Node* ld = make_load(control(), adr, elem, elem_type, adr_type, MemNode::unordered);
  58   push(ld);
  59 }
  60 
  61 
  62 //--------------------------------array_store----------------------------------
  63 void Parse::array_store(BasicType elem_type) {
  64   Node* adr = array_addressing(elem_type, 1);
  65   if (stopped())  return;     // guaranteed null or range check
  66   Node* val = pop();
  67   dec_sp(2);                  // Pop array and index
  68   const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(elem_type);


 980     if (PrintOpto && Verbose) {
 981       tty->print_cr("Never-taken edge stops compilation at bci %d", bci());
 982     }
 983     repush_if_args(); // to gather stats on loop
 984     // We need to mark this branch as taken so that if we recompile we will
 985     // see that it is possible. In the tiered system the interpreter doesn't
 986     // do profiling and by the time we get to the lower tier from the interpreter
 987     // the path may be cold again. Make sure it doesn't look untaken
 988     profile_taken_branch(target_bci, !ProfileInterpreter);
 989     uncommon_trap(Deoptimization::Reason_unreached,
 990                   Deoptimization::Action_reinterpret,
 991                   NULL, "cold");
 992     if (C->eliminate_boxing()) {
 993       // Mark the successor blocks as parsed
 994       branch_block->next_path_num();
 995       next_block->next_path_num();
 996     }
 997     return;
 998   }
 999 
1000   explicit_null_checks_inserted++;
1001 
1002   // Generate real control flow
1003   Node   *tst = _gvn.transform( new BoolNode( c, btest ) );
1004 
1005   // Sanity check the probability value
1006   assert(prob > 0.0f,"Bad probability in Parser");
1007  // Need xform to put node in hash table
1008   IfNode *iff = create_and_xform_if( control(), tst, prob, cnt );
1009   assert(iff->_prob > 0.0f,"Optimizer made bad probability in parser");
1010   // True branch
1011   { PreserveJVMState pjvms(this);
1012     Node* iftrue  = _gvn.transform( new IfTrueNode (iff) );
1013     set_control(iftrue);
1014 
1015     if (stopped()) {            // Path is dead?
1016       explicit_null_checks_elided++;
1017       if (C->eliminate_boxing()) {
1018         // Mark the successor block as parsed
1019         branch_block->next_path_num();
1020       }
1021     } else {                    // Path is live.
1022       // Update method data
1023       profile_taken_branch(target_bci);
1024       adjust_map_after_if(btest, c, prob, branch_block, next_block);
1025       if (!stopped()) {
1026         merge(target_bci);
1027       }
1028     }
1029   }
1030 
1031   // False branch
1032   Node* iffalse = _gvn.transform( new IfFalseNode(iff) );
1033   set_control(iffalse);
1034 
1035   if (stopped()) {              // Path is dead?
1036     explicit_null_checks_elided++;
1037     if (C->eliminate_boxing()) {
1038       // Mark the successor block as parsed
1039       next_block->next_path_num();
1040     }
1041   } else  {                     // Path is live.
1042     // Update method data
1043     profile_not_taken_branch();
1044     adjust_map_after_if(BoolTest(btest).negate(), c, 1.0-prob,
1045                         next_block, branch_block);
1046   }
1047 }
1048 
1049 //------------------------------------do_if------------------------------------
1050 void Parse::do_if(BoolTest::mask btest, Node* c) {
1051   int target_bci = iter().get_dest();
1052 
1053   Block* branch_block = successor_for_bci(target_bci);
1054   Block* next_block   = successor_for_bci(iter().next_bci());
1055 
1056   float cnt;




  27 #include "classfile/systemDictionary.hpp"
  28 #include "classfile/vmSymbols.hpp"
  29 #include "compiler/compileLog.hpp"
  30 #include "interpreter/linkResolver.hpp"
  31 #include "memory/universe.inline.hpp"
  32 #include "oops/oop.inline.hpp"
  33 #include "opto/addnode.hpp"
  34 #include "opto/castnode.hpp"
  35 #include "opto/convertnode.hpp"
  36 #include "opto/divnode.hpp"
  37 #include "opto/idealGraphPrinter.hpp"
  38 #include "opto/matcher.hpp"
  39 #include "opto/memnode.hpp"
  40 #include "opto/mulnode.hpp"
  41 #include "opto/opaquenode.hpp"
  42 #include "opto/parse.hpp"
  43 #include "opto/runtime.hpp"
  44 #include "runtime/deoptimization.hpp"
  45 #include "runtime/sharedRuntime.hpp"
  46 
  47 #ifndef PRODUCT
  48 extern int explicit_null_checks_inserted,
  49            explicit_null_checks_elided;
  50 #endif
  51 
  52 //---------------------------------array_load----------------------------------
  53 void Parse::array_load(BasicType elem_type) {
  54   const Type* elem = Type::TOP;
  55   Node* adr = array_addressing(elem_type, 0, &elem);
  56   if (stopped())  return;     // guaranteed null or range check
  57   dec_sp(2);                  // Pop array and index
  58   const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(elem_type);
  59   Node* ld = make_load(control(), adr, elem, elem_type, adr_type, MemNode::unordered);
  60   push(ld);
  61 }
  62 
  63 
  64 //--------------------------------array_store----------------------------------
  65 void Parse::array_store(BasicType elem_type) {
  66   Node* adr = array_addressing(elem_type, 1);
  67   if (stopped())  return;     // guaranteed null or range check
  68   Node* val = pop();
  69   dec_sp(2);                  // Pop array and index
  70   const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(elem_type);


 982     if (PrintOpto && Verbose) {
 983       tty->print_cr("Never-taken edge stops compilation at bci %d", bci());
 984     }
 985     repush_if_args(); // to gather stats on loop
 986     // We need to mark this branch as taken so that if we recompile we will
 987     // see that it is possible. In the tiered system the interpreter doesn't
 988     // do profiling and by the time we get to the lower tier from the interpreter
 989     // the path may be cold again. Make sure it doesn't look untaken
 990     profile_taken_branch(target_bci, !ProfileInterpreter);
 991     uncommon_trap(Deoptimization::Reason_unreached,
 992                   Deoptimization::Action_reinterpret,
 993                   NULL, "cold");
 994     if (C->eliminate_boxing()) {
 995       // Mark the successor blocks as parsed
 996       branch_block->next_path_num();
 997       next_block->next_path_num();
 998     }
 999     return;
1000   }
1001 
1002   NOT_PRODUCT(explicit_null_checks_inserted++);
1003 
1004   // Generate real control flow
1005   Node   *tst = _gvn.transform( new BoolNode( c, btest ) );
1006 
1007   // Sanity check the probability value
1008   assert(prob > 0.0f,"Bad probability in Parser");
1009  // Need xform to put node in hash table
1010   IfNode *iff = create_and_xform_if( control(), tst, prob, cnt );
1011   assert(iff->_prob > 0.0f,"Optimizer made bad probability in parser");
1012   // True branch
1013   { PreserveJVMState pjvms(this);
1014     Node* iftrue  = _gvn.transform( new IfTrueNode (iff) );
1015     set_control(iftrue);
1016 
1017     if (stopped()) {            // Path is dead?
1018       NOT_PRODUCT(explicit_null_checks_elided++);
1019       if (C->eliminate_boxing()) {
1020         // Mark the successor block as parsed
1021         branch_block->next_path_num();
1022       }
1023     } else {                    // Path is live.
1024       // Update method data
1025       profile_taken_branch(target_bci);
1026       adjust_map_after_if(btest, c, prob, branch_block, next_block);
1027       if (!stopped()) {
1028         merge(target_bci);
1029       }
1030     }
1031   }
1032 
1033   // False branch
1034   Node* iffalse = _gvn.transform( new IfFalseNode(iff) );
1035   set_control(iffalse);
1036 
1037   if (stopped()) {              // Path is dead?
1038     NOT_PRODUCT(explicit_null_checks_elided++);
1039     if (C->eliminate_boxing()) {
1040       // Mark the successor block as parsed
1041       next_block->next_path_num();
1042     }
1043   } else  {                     // Path is live.
1044     // Update method data
1045     profile_not_taken_branch();
1046     adjust_map_after_if(BoolTest(btest).negate(), c, 1.0-prob,
1047                         next_block, branch_block);
1048   }
1049 }
1050 
1051 //------------------------------------do_if------------------------------------
1052 void Parse::do_if(BoolTest::mask btest, Node* c) {
1053   int target_bci = iter().get_dest();
1054 
1055   Block* branch_block = successor_for_bci(target_bci);
1056   Block* next_block   = successor_for_bci(iter().next_bci());
1057 
1058   float cnt;


< prev index next >