src/share/vm/opto/matcher.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6829187 Sdiff src/share/vm/opto

src/share/vm/opto/matcher.cpp

Print this page
rev 1082 : [mq]: indy.compiler.patch


  53   _old2new_map(C->comp_arena()),
  54   _new2old_map(C->comp_arena()),
  55 #endif
  56   _shared_nodes(C->comp_arena()),
  57   _reduceOp(reduceOp), _leftOp(leftOp), _rightOp(rightOp),
  58   _swallowed(swallowed),
  59   _begin_inst_chain_rule(_BEGIN_INST_CHAIN_RULE),
  60   _end_inst_chain_rule(_END_INST_CHAIN_RULE),
  61   _must_clone(must_clone), _proj_list(proj_list),
  62   _register_save_policy(register_save_policy),
  63   _c_reg_save_policy(c_reg_save_policy),
  64   _register_save_type(register_save_type),
  65   _ruleName(ruleName),
  66   _allocation_started(false),
  67   _states_arena(Chunk::medium_size),
  68   _visited(&_states_arena),
  69   _shared(&_states_arena),
  70   _dontcare(&_states_arena) {
  71   C->set_matcher(this);
  72 
  73   idealreg2spillmask[Op_RegI] = NULL;
  74   idealreg2spillmask[Op_RegN] = NULL;
  75   idealreg2spillmask[Op_RegL] = NULL;
  76   idealreg2spillmask[Op_RegF] = NULL;
  77   idealreg2spillmask[Op_RegD] = NULL;
  78   idealreg2spillmask[Op_RegP] = NULL;
  79 
  80   idealreg2debugmask[Op_RegI] = NULL;
  81   idealreg2debugmask[Op_RegN] = NULL;
  82   idealreg2debugmask[Op_RegL] = NULL;
  83   idealreg2debugmask[Op_RegF] = NULL;
  84   idealreg2debugmask[Op_RegD] = NULL;
  85   idealreg2debugmask[Op_RegP] = NULL;








  86   debug_only(_mem_node = NULL;)   // Ideal memory node consumed by mach node
  87 }
  88 
  89 //------------------------------warp_incoming_stk_arg------------------------
  90 // This warps a VMReg into an OptoReg::Name
  91 OptoReg::Name Matcher::warp_incoming_stk_arg( VMReg reg ) {
  92   OptoReg::Name warped;
  93   if( reg->is_stack() ) {  // Stack slot argument?
  94     warped = OptoReg::add(_old_SP, reg->reg2stack() );
  95     warped = OptoReg::add(warped, C->out_preserve_stack_slots());
  96     if( warped >= _in_arg_limit )
  97       _in_arg_limit = OptoReg::add(warped, 1); // Bump max stack slot seen
  98     if (!RegMask::can_represent(warped)) {
  99       // the compiler cannot represent this method's calling sequence
 100       C->record_method_not_compilable_all_tiers("unsupported incoming calling sequence");
 101       return OptoReg::Bad;
 102     }
 103     return warped;
 104   }
 105   return OptoReg::as_OptoReg(reg);


 372 // course gives them a mask).
 373 
 374 static RegMask *init_input_masks( uint size, RegMask &ret_adr, RegMask &fp ) {
 375   RegMask *rms = NEW_RESOURCE_ARRAY( RegMask, size );
 376   // Do all the pre-defined register masks
 377   rms[TypeFunc::Control  ] = RegMask::Empty;
 378   rms[TypeFunc::I_O      ] = RegMask::Empty;
 379   rms[TypeFunc::Memory   ] = RegMask::Empty;
 380   rms[TypeFunc::ReturnAdr] = ret_adr;
 381   rms[TypeFunc::FramePtr ] = fp;
 382   return rms;
 383 }
 384 
 385 //---------------------------init_first_stack_mask-----------------------------
 386 // Create the initial stack mask used by values spilling to the stack.
 387 // Disallow any debug info in outgoing argument areas by setting the
 388 // initial mask accordingly.
 389 void Matcher::init_first_stack_mask() {
 390 
 391   // Allocate storage for spill masks as masks for the appropriate load type.
 392   RegMask *rms = (RegMask*)C->comp_arena()->Amalloc_D(sizeof(RegMask)*12);
 393   idealreg2spillmask[Op_RegN] = &rms[0];
 394   idealreg2spillmask[Op_RegI] = &rms[1];
 395   idealreg2spillmask[Op_RegL] = &rms[2];
 396   idealreg2spillmask[Op_RegF] = &rms[3];
 397   idealreg2spillmask[Op_RegD] = &rms[4];
 398   idealreg2spillmask[Op_RegP] = &rms[5];
 399   idealreg2debugmask[Op_RegN] = &rms[6];
 400   idealreg2debugmask[Op_RegI] = &rms[7];
 401   idealreg2debugmask[Op_RegL] = &rms[8];
 402   idealreg2debugmask[Op_RegF] = &rms[9];
 403   idealreg2debugmask[Op_RegD] = &rms[10];
 404   idealreg2debugmask[Op_RegP] = &rms[11];









 405 
 406   OptoReg::Name i;
 407 
 408   // At first, start with the empty mask
 409   C->FIRST_STACK_mask().Clear();
 410 
 411   // Add in the incoming argument area
 412   OptoReg::Name init = OptoReg::add(_old_SP, C->out_preserve_stack_slots());
 413   for (i = init; i < _in_arg_limit; i = OptoReg::add(i,1))
 414     C->FIRST_STACK_mask().Insert(i);
 415 
 416   // Add in all bits past the outgoing argument area
 417   guarantee(RegMask::can_represent(OptoReg::add(_out_arg_limit,-1)),
 418             "must be able to represent all call arguments in reg mask");
 419   init = _out_arg_limit;
 420   for (i = init; RegMask::can_represent(i); i = OptoReg::add(i,1))
 421     C->FIRST_STACK_mask().Insert(i);
 422 
 423   // Finally, set the "infinite stack" bit.
 424   C->FIRST_STACK_mask().set_AllStack();
 425 
 426   // Make spill masks.  Registers for their class, plus FIRST_STACK_mask.
 427 #ifdef _LP64
 428   *idealreg2spillmask[Op_RegN] = *idealreg2regmask[Op_RegN];
 429    idealreg2spillmask[Op_RegN]->OR(C->FIRST_STACK_mask());
 430 #endif
 431   *idealreg2spillmask[Op_RegI] = *idealreg2regmask[Op_RegI];
 432    idealreg2spillmask[Op_RegI]->OR(C->FIRST_STACK_mask());
 433   *idealreg2spillmask[Op_RegL] = *idealreg2regmask[Op_RegL];
 434    idealreg2spillmask[Op_RegL]->OR(C->FIRST_STACK_mask());
 435   *idealreg2spillmask[Op_RegF] = *idealreg2regmask[Op_RegF];
 436    idealreg2spillmask[Op_RegF]->OR(C->FIRST_STACK_mask());
 437   *idealreg2spillmask[Op_RegD] = *idealreg2regmask[Op_RegD];
 438    idealreg2spillmask[Op_RegD]->OR(C->FIRST_STACK_mask());
 439   *idealreg2spillmask[Op_RegP] = *idealreg2regmask[Op_RegP];
 440    idealreg2spillmask[Op_RegP]->OR(C->FIRST_STACK_mask());
 441 
 442   // Make up debug masks.  Any spill slot plus callee-save registers.
 443   // Caller-save registers are assumed to be trashable by the various
 444   // inline-cache fixup routines.
 445   *idealreg2debugmask[Op_RegN]= *idealreg2spillmask[Op_RegN];
 446   *idealreg2debugmask[Op_RegI]= *idealreg2spillmask[Op_RegI];
 447   *idealreg2debugmask[Op_RegL]= *idealreg2spillmask[Op_RegL];
 448   *idealreg2debugmask[Op_RegF]= *idealreg2spillmask[Op_RegF];
 449   *idealreg2debugmask[Op_RegD]= *idealreg2spillmask[Op_RegD];
 450   *idealreg2debugmask[Op_RegP]= *idealreg2spillmask[Op_RegP];







 451 
 452   // Prevent stub compilations from attempting to reference
 453   // callee-saved registers from debug info
 454   bool exclude_soe = !Compile::current()->is_method_compilation();
 455 
 456   for( i=OptoReg::Name(0); i<OptoReg::Name(_last_Mach_Reg); i = OptoReg::add(i,1) ) {
 457     // registers the caller has to save do not work
 458     if( _register_save_policy[i] == 'C' ||
 459         _register_save_policy[i] == 'A' ||
 460         (_register_save_policy[i] == 'E' && exclude_soe) ) {
 461       idealreg2debugmask[Op_RegN]->Remove(i);
 462       idealreg2debugmask[Op_RegI]->Remove(i); // Exclude save-on-call
 463       idealreg2debugmask[Op_RegL]->Remove(i); // registers from debug
 464       idealreg2debugmask[Op_RegF]->Remove(i); // masks
 465       idealreg2debugmask[Op_RegD]->Remove(i);
 466       idealreg2debugmask[Op_RegP]->Remove(i);







 467     }
 468   }










 469 }
 470 
 471 //---------------------------is_save_on_entry----------------------------------
 472 bool Matcher::is_save_on_entry( int reg ) {
 473   return
 474     _register_save_policy[reg] == 'E' ||
 475     _register_save_policy[reg] == 'A' || // Save-on-entry register?
 476     // Also save argument registers in the trampolining stubs
 477     (C->save_argument_registers() && is_spillable_arg(reg));
 478 }
 479 
 480 //---------------------------Fixup_Save_On_Entry-------------------------------
 481 void Matcher::Fixup_Save_On_Entry( ) {
 482   init_first_stack_mask();
 483 
 484   Node *root = C->root();       // Short name for root
 485   // Count number of save-on-entry registers.
 486   uint soe_cnt = number_of_saved_registers();
 487   uint i;
 488 


 972       return OptoReg::Bad;
 973     }
 974     return warped;
 975   }
 976   return OptoReg::as_OptoReg(reg);
 977 }
 978 
 979 
 980 //------------------------------match_sfpt-------------------------------------
 981 // Helper function to match call instructions.  Calls match special.
 982 // They match alone with no children.  Their children, the incoming
 983 // arguments, match normally.
 984 MachNode *Matcher::match_sfpt( SafePointNode *sfpt ) {
 985   MachSafePointNode *msfpt = NULL;
 986   MachCallNode      *mcall = NULL;
 987   uint               cnt;
 988   // Split out case for SafePoint vs Call
 989   CallNode *call;
 990   const TypeTuple *domain;
 991   ciMethod*        method = NULL;

 992   if( sfpt->is_Call() ) {
 993     call = sfpt->as_Call();
 994     domain = call->tf()->domain();
 995     cnt = domain->cnt();
 996 
 997     // Match just the call, nothing else
 998     MachNode *m = match_tree(call);
 999     if (C->failing())  return NULL;
1000     if( m == NULL ) { Matcher::soft_match_failure(); return NULL; }
1001 
1002     // Copy data from the Ideal SafePoint to the machine version
1003     mcall = m->as_MachCall();
1004 
1005     mcall->set_tf(         call->tf());
1006     mcall->set_entry_point(call->entry_point());
1007     mcall->set_cnt(        call->cnt());
1008 
1009     if( mcall->is_MachCallJava() ) {
1010       MachCallJavaNode *mcall_java  = mcall->as_MachCallJava();
1011       const CallJavaNode *call_java =  call->as_CallJava();
1012       method = call_java->method();
1013       mcall_java->_method = method;
1014       mcall_java->_bci = call_java->_bci;
1015       mcall_java->_optimized_virtual = call_java->is_optimized_virtual();


1016       if( mcall_java->is_MachCallStaticJava() )
1017         mcall_java->as_MachCallStaticJava()->_name =
1018          call_java->as_CallStaticJava()->_name;
1019       if( mcall_java->is_MachCallDynamicJava() )
1020         mcall_java->as_MachCallDynamicJava()->_vtable_index =
1021          call_java->as_CallDynamicJava()->_vtable_index;
1022     }
1023     else if( mcall->is_MachCallRuntime() ) {
1024       mcall->as_MachCallRuntime()->_name = call->as_CallRuntime()->_name;
1025     }
1026     msfpt = mcall;
1027   }
1028   // This is a non-call safepoint
1029   else {
1030     call = NULL;
1031     domain = NULL;
1032     MachNode *mn = match_tree(sfpt);
1033     if (C->failing())  return NULL;
1034     msfpt = mn->as_MachSafePoint();
1035     cnt = TypeFunc::Parms;


1109       RegMask *rm = &mcall->_in_rms[i+TypeFunc::Parms];
1110       if( !parm_regs[i].first()->is_valid() &&
1111           !parm_regs[i].second()->is_valid() ) {
1112         continue;               // Avoid Halves
1113       }
1114       // Grab first register, adjust stack slots and insert in mask.
1115       OptoReg::Name reg1 = warp_outgoing_stk_arg(parm_regs[i].first(), begin_out_arg_area, out_arg_limit_per_call );
1116       if (OptoReg::is_valid(reg1))
1117         rm->Insert( reg1 );
1118       // Grab second register (if any), adjust stack slots and insert in mask.
1119       OptoReg::Name reg2 = warp_outgoing_stk_arg(parm_regs[i].second(), begin_out_arg_area, out_arg_limit_per_call );
1120       if (OptoReg::is_valid(reg2))
1121         rm->Insert( reg2 );
1122     } // End of for all arguments
1123 
1124     // Compute number of stack slots needed to restore stack in case of
1125     // Pascal-style argument popping.
1126     mcall->_argsize = out_arg_limit_per_call - begin_out_arg_area;
1127   }
1128 









1129   // Compute the max stack slot killed by any call.  These will not be
1130   // available for debug info, and will be used to adjust FIRST_STACK_mask
1131   // after all call sites have been visited.
1132   if( _out_arg_limit < out_arg_limit_per_call)
1133     _out_arg_limit = out_arg_limit_per_call;
1134 
1135   if (mcall) {
1136     // Kill the outgoing argument area, including any non-argument holes and
1137     // any legacy C-killed slots.  Use Fat-Projections to do the killing.
1138     // Since the max-per-method covers the max-per-call-site and debug info
1139     // is excluded on the max-per-method basis, debug info cannot land in
1140     // this killed area.
1141     uint r_cnt = mcall->tf()->range()->cnt();
1142     MachProjNode *proj = new (C, 1) MachProjNode( mcall, r_cnt+10000, RegMask::Empty, MachProjNode::fat_proj );
1143     if (!RegMask::can_represent(OptoReg::Name(out_arg_limit_per_call-1))) {
1144       C->record_method_not_compilable_all_tiers("unsupported outgoing calling sequence");
1145     } else {
1146       for (int i = begin_out_arg_area; i < out_arg_limit_per_call; i++)
1147         proj->_rout.Insert(OptoReg::Name(i));
1148     }




  53   _old2new_map(C->comp_arena()),
  54   _new2old_map(C->comp_arena()),
  55 #endif
  56   _shared_nodes(C->comp_arena()),
  57   _reduceOp(reduceOp), _leftOp(leftOp), _rightOp(rightOp),
  58   _swallowed(swallowed),
  59   _begin_inst_chain_rule(_BEGIN_INST_CHAIN_RULE),
  60   _end_inst_chain_rule(_END_INST_CHAIN_RULE),
  61   _must_clone(must_clone), _proj_list(proj_list),
  62   _register_save_policy(register_save_policy),
  63   _c_reg_save_policy(c_reg_save_policy),
  64   _register_save_type(register_save_type),
  65   _ruleName(ruleName),
  66   _allocation_started(false),
  67   _states_arena(Chunk::medium_size),
  68   _visited(&_states_arena),
  69   _shared(&_states_arena),
  70   _dontcare(&_states_arena) {
  71   C->set_matcher(this);
  72 
  73   idealreg2spillmask  [Op_RegI] = NULL;
  74   idealreg2spillmask  [Op_RegN] = NULL;
  75   idealreg2spillmask  [Op_RegL] = NULL;
  76   idealreg2spillmask  [Op_RegF] = NULL;
  77   idealreg2spillmask  [Op_RegD] = NULL;
  78   idealreg2spillmask  [Op_RegP] = NULL;
  79 
  80   idealreg2debugmask  [Op_RegI] = NULL;
  81   idealreg2debugmask  [Op_RegN] = NULL;
  82   idealreg2debugmask  [Op_RegL] = NULL;
  83   idealreg2debugmask  [Op_RegF] = NULL;
  84   idealreg2debugmask  [Op_RegD] = NULL;
  85   idealreg2debugmask  [Op_RegP] = NULL;
  86 
  87   idealreg2mhdebugmask[Op_RegI] = NULL;
  88   idealreg2mhdebugmask[Op_RegN] = NULL;
  89   idealreg2mhdebugmask[Op_RegL] = NULL;
  90   idealreg2mhdebugmask[Op_RegF] = NULL;
  91   idealreg2mhdebugmask[Op_RegD] = NULL;
  92   idealreg2mhdebugmask[Op_RegP] = NULL;
  93 
  94   debug_only(_mem_node = NULL;)   // Ideal memory node consumed by mach node
  95 }
  96 
  97 //------------------------------warp_incoming_stk_arg------------------------
  98 // This warps a VMReg into an OptoReg::Name
  99 OptoReg::Name Matcher::warp_incoming_stk_arg( VMReg reg ) {
 100   OptoReg::Name warped;
 101   if( reg->is_stack() ) {  // Stack slot argument?
 102     warped = OptoReg::add(_old_SP, reg->reg2stack() );
 103     warped = OptoReg::add(warped, C->out_preserve_stack_slots());
 104     if( warped >= _in_arg_limit )
 105       _in_arg_limit = OptoReg::add(warped, 1); // Bump max stack slot seen
 106     if (!RegMask::can_represent(warped)) {
 107       // the compiler cannot represent this method's calling sequence
 108       C->record_method_not_compilable_all_tiers("unsupported incoming calling sequence");
 109       return OptoReg::Bad;
 110     }
 111     return warped;
 112   }
 113   return OptoReg::as_OptoReg(reg);


 380 // course gives them a mask).
 381 
 382 static RegMask *init_input_masks( uint size, RegMask &ret_adr, RegMask &fp ) {
 383   RegMask *rms = NEW_RESOURCE_ARRAY( RegMask, size );
 384   // Do all the pre-defined register masks
 385   rms[TypeFunc::Control  ] = RegMask::Empty;
 386   rms[TypeFunc::I_O      ] = RegMask::Empty;
 387   rms[TypeFunc::Memory   ] = RegMask::Empty;
 388   rms[TypeFunc::ReturnAdr] = ret_adr;
 389   rms[TypeFunc::FramePtr ] = fp;
 390   return rms;
 391 }
 392 
 393 //---------------------------init_first_stack_mask-----------------------------
 394 // Create the initial stack mask used by values spilling to the stack.
 395 // Disallow any debug info in outgoing argument areas by setting the
 396 // initial mask accordingly.
 397 void Matcher::init_first_stack_mask() {
 398 
 399   // Allocate storage for spill masks as masks for the appropriate load type.
 400   RegMask *rms = (RegMask*)C->comp_arena()->Amalloc_D(sizeof(RegMask) * 3*6);
 401 
 402   idealreg2spillmask  [Op_RegN] = &rms[0];
 403   idealreg2spillmask  [Op_RegI] = &rms[1];
 404   idealreg2spillmask  [Op_RegL] = &rms[2];
 405   idealreg2spillmask  [Op_RegF] = &rms[3];
 406   idealreg2spillmask  [Op_RegD] = &rms[4];
 407   idealreg2spillmask  [Op_RegP] = &rms[5];
 408 
 409   idealreg2debugmask  [Op_RegN] = &rms[6];
 410   idealreg2debugmask  [Op_RegI] = &rms[7];
 411   idealreg2debugmask  [Op_RegL] = &rms[8];
 412   idealreg2debugmask  [Op_RegF] = &rms[9];
 413   idealreg2debugmask  [Op_RegD] = &rms[10];
 414   idealreg2debugmask  [Op_RegP] = &rms[11];
 415 
 416   idealreg2mhdebugmask[Op_RegN] = &rms[12];
 417   idealreg2mhdebugmask[Op_RegI] = &rms[13];
 418   idealreg2mhdebugmask[Op_RegL] = &rms[14];
 419   idealreg2mhdebugmask[Op_RegF] = &rms[15];
 420   idealreg2mhdebugmask[Op_RegD] = &rms[16];
 421   idealreg2mhdebugmask[Op_RegP] = &rms[17];
 422 
 423   OptoReg::Name i;
 424 
 425   // At first, start with the empty mask
 426   C->FIRST_STACK_mask().Clear();
 427 
 428   // Add in the incoming argument area
 429   OptoReg::Name init = OptoReg::add(_old_SP, C->out_preserve_stack_slots());
 430   for (i = init; i < _in_arg_limit; i = OptoReg::add(i,1))
 431     C->FIRST_STACK_mask().Insert(i);
 432 
 433   // Add in all bits past the outgoing argument area
 434   guarantee(RegMask::can_represent(OptoReg::add(_out_arg_limit,-1)),
 435             "must be able to represent all call arguments in reg mask");
 436   init = _out_arg_limit;
 437   for (i = init; RegMask::can_represent(i); i = OptoReg::add(i,1))
 438     C->FIRST_STACK_mask().Insert(i);
 439 
 440   // Finally, set the "infinite stack" bit.
 441   C->FIRST_STACK_mask().set_AllStack();
 442 
 443   // Make spill masks.  Registers for their class, plus FIRST_STACK_mask.
 444 #ifdef _LP64
 445   *idealreg2spillmask[Op_RegN] = *idealreg2regmask[Op_RegN];
 446    idealreg2spillmask[Op_RegN]->OR(C->FIRST_STACK_mask());
 447 #endif
 448   *idealreg2spillmask[Op_RegI] = *idealreg2regmask[Op_RegI];
 449    idealreg2spillmask[Op_RegI]->OR(C->FIRST_STACK_mask());
 450   *idealreg2spillmask[Op_RegL] = *idealreg2regmask[Op_RegL];
 451    idealreg2spillmask[Op_RegL]->OR(C->FIRST_STACK_mask());
 452   *idealreg2spillmask[Op_RegF] = *idealreg2regmask[Op_RegF];
 453    idealreg2spillmask[Op_RegF]->OR(C->FIRST_STACK_mask());
 454   *idealreg2spillmask[Op_RegD] = *idealreg2regmask[Op_RegD];
 455    idealreg2spillmask[Op_RegD]->OR(C->FIRST_STACK_mask());
 456   *idealreg2spillmask[Op_RegP] = *idealreg2regmask[Op_RegP];
 457    idealreg2spillmask[Op_RegP]->OR(C->FIRST_STACK_mask());
 458 
 459   // Make up debug masks.  Any spill slot plus callee-save registers.
 460   // Caller-save registers are assumed to be trashable by the various
 461   // inline-cache fixup routines.
 462   *idealreg2debugmask  [Op_RegN]= *idealreg2spillmask[Op_RegN];
 463   *idealreg2debugmask  [Op_RegI]= *idealreg2spillmask[Op_RegI];
 464   *idealreg2debugmask  [Op_RegL]= *idealreg2spillmask[Op_RegL];
 465   *idealreg2debugmask  [Op_RegF]= *idealreg2spillmask[Op_RegF];
 466   *idealreg2debugmask  [Op_RegD]= *idealreg2spillmask[Op_RegD];
 467   *idealreg2debugmask  [Op_RegP]= *idealreg2spillmask[Op_RegP];
 468 
 469   *idealreg2mhdebugmask[Op_RegN]= *idealreg2spillmask[Op_RegN];
 470   *idealreg2mhdebugmask[Op_RegI]= *idealreg2spillmask[Op_RegI];
 471   *idealreg2mhdebugmask[Op_RegL]= *idealreg2spillmask[Op_RegL];
 472   *idealreg2mhdebugmask[Op_RegF]= *idealreg2spillmask[Op_RegF];
 473   *idealreg2mhdebugmask[Op_RegD]= *idealreg2spillmask[Op_RegD];
 474   *idealreg2mhdebugmask[Op_RegP]= *idealreg2spillmask[Op_RegP];
 475 
 476   // Prevent stub compilations from attempting to reference
 477   // callee-saved registers from debug info
 478   bool exclude_soe = !Compile::current()->is_method_compilation();
 479 
 480   for( i=OptoReg::Name(0); i<OptoReg::Name(_last_Mach_Reg); i = OptoReg::add(i,1) ) {
 481     // registers the caller has to save do not work
 482     if( _register_save_policy[i] == 'C' ||
 483         _register_save_policy[i] == 'A' ||
 484         (_register_save_policy[i] == 'E' && exclude_soe) ) {
 485       idealreg2debugmask  [Op_RegN]->Remove(i);
 486       idealreg2debugmask  [Op_RegI]->Remove(i); // Exclude save-on-call
 487       idealreg2debugmask  [Op_RegL]->Remove(i); // registers from debug
 488       idealreg2debugmask  [Op_RegF]->Remove(i); // masks
 489       idealreg2debugmask  [Op_RegD]->Remove(i);
 490       idealreg2debugmask  [Op_RegP]->Remove(i);
 491 
 492       idealreg2mhdebugmask[Op_RegN]->Remove(i);
 493       idealreg2mhdebugmask[Op_RegI]->Remove(i);
 494       idealreg2mhdebugmask[Op_RegL]->Remove(i);
 495       idealreg2mhdebugmask[Op_RegF]->Remove(i);
 496       idealreg2mhdebugmask[Op_RegD]->Remove(i);
 497       idealreg2mhdebugmask[Op_RegP]->Remove(i);
 498     }
 499   }
 500 
 501   // Subtract the register we use to save the SP for MethodHandle
 502   // invokes to from the debug mask.
 503   const RegMask save_mask = method_handle_invoke_SP_save_mask();
 504   idealreg2mhdebugmask[Op_RegN]->SUBTRACT(save_mask);
 505   idealreg2mhdebugmask[Op_RegI]->SUBTRACT(save_mask);
 506   idealreg2mhdebugmask[Op_RegL]->SUBTRACT(save_mask);
 507   idealreg2mhdebugmask[Op_RegF]->SUBTRACT(save_mask);
 508   idealreg2mhdebugmask[Op_RegD]->SUBTRACT(save_mask);
 509   idealreg2mhdebugmask[Op_RegP]->SUBTRACT(save_mask);
 510 }
 511 
 512 //---------------------------is_save_on_entry----------------------------------
 513 bool Matcher::is_save_on_entry( int reg ) {
 514   return
 515     _register_save_policy[reg] == 'E' ||
 516     _register_save_policy[reg] == 'A' || // Save-on-entry register?
 517     // Also save argument registers in the trampolining stubs
 518     (C->save_argument_registers() && is_spillable_arg(reg));
 519 }
 520 
 521 //---------------------------Fixup_Save_On_Entry-------------------------------
 522 void Matcher::Fixup_Save_On_Entry( ) {
 523   init_first_stack_mask();
 524 
 525   Node *root = C->root();       // Short name for root
 526   // Count number of save-on-entry registers.
 527   uint soe_cnt = number_of_saved_registers();
 528   uint i;
 529 


1013       return OptoReg::Bad;
1014     }
1015     return warped;
1016   }
1017   return OptoReg::as_OptoReg(reg);
1018 }
1019 
1020 
1021 //------------------------------match_sfpt-------------------------------------
1022 // Helper function to match call instructions.  Calls match special.
1023 // They match alone with no children.  Their children, the incoming
1024 // arguments, match normally.
1025 MachNode *Matcher::match_sfpt( SafePointNode *sfpt ) {
1026   MachSafePointNode *msfpt = NULL;
1027   MachCallNode      *mcall = NULL;
1028   uint               cnt;
1029   // Split out case for SafePoint vs Call
1030   CallNode *call;
1031   const TypeTuple *domain;
1032   ciMethod*        method = NULL;
1033   bool             is_method_handle_invoke = false;  // for special kill effects
1034   if( sfpt->is_Call() ) {
1035     call = sfpt->as_Call();
1036     domain = call->tf()->domain();
1037     cnt = domain->cnt();
1038 
1039     // Match just the call, nothing else
1040     MachNode *m = match_tree(call);
1041     if (C->failing())  return NULL;
1042     if( m == NULL ) { Matcher::soft_match_failure(); return NULL; }
1043 
1044     // Copy data from the Ideal SafePoint to the machine version
1045     mcall = m->as_MachCall();
1046 
1047     mcall->set_tf(         call->tf());
1048     mcall->set_entry_point(call->entry_point());
1049     mcall->set_cnt(        call->cnt());
1050 
1051     if( mcall->is_MachCallJava() ) {
1052       MachCallJavaNode *mcall_java  = mcall->as_MachCallJava();
1053       const CallJavaNode *call_java =  call->as_CallJava();
1054       method = call_java->method();
1055       mcall_java->_method = method;
1056       mcall_java->_bci = call_java->_bci;
1057       mcall_java->_optimized_virtual = call_java->is_optimized_virtual();
1058       is_method_handle_invoke = call_java->is_method_handle_invoke();
1059       mcall_java->_method_handle_invoke = is_method_handle_invoke;
1060       if( mcall_java->is_MachCallStaticJava() )
1061         mcall_java->as_MachCallStaticJava()->_name =
1062          call_java->as_CallStaticJava()->_name;
1063       if( mcall_java->is_MachCallDynamicJava() )
1064         mcall_java->as_MachCallDynamicJava()->_vtable_index =
1065          call_java->as_CallDynamicJava()->_vtable_index;
1066     }
1067     else if( mcall->is_MachCallRuntime() ) {
1068       mcall->as_MachCallRuntime()->_name = call->as_CallRuntime()->_name;
1069     }
1070     msfpt = mcall;
1071   }
1072   // This is a non-call safepoint
1073   else {
1074     call = NULL;
1075     domain = NULL;
1076     MachNode *mn = match_tree(sfpt);
1077     if (C->failing())  return NULL;
1078     msfpt = mn->as_MachSafePoint();
1079     cnt = TypeFunc::Parms;


1153       RegMask *rm = &mcall->_in_rms[i+TypeFunc::Parms];
1154       if( !parm_regs[i].first()->is_valid() &&
1155           !parm_regs[i].second()->is_valid() ) {
1156         continue;               // Avoid Halves
1157       }
1158       // Grab first register, adjust stack slots and insert in mask.
1159       OptoReg::Name reg1 = warp_outgoing_stk_arg(parm_regs[i].first(), begin_out_arg_area, out_arg_limit_per_call );
1160       if (OptoReg::is_valid(reg1))
1161         rm->Insert( reg1 );
1162       // Grab second register (if any), adjust stack slots and insert in mask.
1163       OptoReg::Name reg2 = warp_outgoing_stk_arg(parm_regs[i].second(), begin_out_arg_area, out_arg_limit_per_call );
1164       if (OptoReg::is_valid(reg2))
1165         rm->Insert( reg2 );
1166     } // End of for all arguments
1167 
1168     // Compute number of stack slots needed to restore stack in case of
1169     // Pascal-style argument popping.
1170     mcall->_argsize = out_arg_limit_per_call - begin_out_arg_area;
1171   }
1172 
1173   if (is_method_handle_invoke) {
1174     // Kill some extra stack space in case method handles want to do
1175     // a little in-place argument insertion.
1176     int regs_per_word  = NOT_LP64(1) LP64_ONLY(2); // %%% make a global const!
1177     out_arg_limit_per_call += MethodHandlePushLimit * regs_per_word;
1178     // Do not update mcall->_argsize because (a) the extra space is not
1179     // pushed as arguments and (b) _argsize is dead (not used anywhere).
1180   }
1181 
1182   // Compute the max stack slot killed by any call.  These will not be
1183   // available for debug info, and will be used to adjust FIRST_STACK_mask
1184   // after all call sites have been visited.
1185   if( _out_arg_limit < out_arg_limit_per_call)
1186     _out_arg_limit = out_arg_limit_per_call;
1187 
1188   if (mcall) {
1189     // Kill the outgoing argument area, including any non-argument holes and
1190     // any legacy C-killed slots.  Use Fat-Projections to do the killing.
1191     // Since the max-per-method covers the max-per-call-site and debug info
1192     // is excluded on the max-per-method basis, debug info cannot land in
1193     // this killed area.
1194     uint r_cnt = mcall->tf()->range()->cnt();
1195     MachProjNode *proj = new (C, 1) MachProjNode( mcall, r_cnt+10000, RegMask::Empty, MachProjNode::fat_proj );
1196     if (!RegMask::can_represent(OptoReg::Name(out_arg_limit_per_call-1))) {
1197       C->record_method_not_compilable_all_tiers("unsupported outgoing calling sequence");
1198     } else {
1199       for (int i = begin_out_arg_area; i < out_arg_limit_per_call; i++)
1200         proj->_rout.Insert(OptoReg::Name(i));
1201     }


src/share/vm/opto/matcher.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File