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

Split Close
Expand all
Collapse all
          --- old/src/share/vm/opto/matcher.cpp
          +++ new/src/share/vm/opto/matcher.cpp
↓ open down ↓ 62 lines elided ↑ open up ↑
  63   63    _c_reg_save_policy(c_reg_save_policy),
  64   64    _register_save_type(register_save_type),
  65   65    _ruleName(ruleName),
  66   66    _allocation_started(false),
  67   67    _states_arena(Chunk::medium_size),
  68   68    _visited(&_states_arena),
  69   69    _shared(&_states_arena),
  70   70    _dontcare(&_states_arena) {
  71   71    C->set_matcher(this);
  72   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;
       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 +
  86   94    debug_only(_mem_node = NULL;)   // Ideal memory node consumed by mach node
  87   95  }
  88   96  
  89   97  //------------------------------warp_incoming_stk_arg------------------------
  90   98  // This warps a VMReg into an OptoReg::Name
  91   99  OptoReg::Name Matcher::warp_incoming_stk_arg( VMReg reg ) {
  92  100    OptoReg::Name warped;
  93  101    if( reg->is_stack() ) {  // Stack slot argument?
  94  102      warped = OptoReg::add(_old_SP, reg->reg2stack() );
  95  103      warped = OptoReg::add(warped, C->out_preserve_stack_slots());
↓ open down ↓ 286 lines elided ↑ open up ↑
 382  390    return rms;
 383  391  }
 384  392  
 385  393  //---------------------------init_first_stack_mask-----------------------------
 386  394  // Create the initial stack mask used by values spilling to the stack.
 387  395  // Disallow any debug info in outgoing argument areas by setting the
 388  396  // initial mask accordingly.
 389  397  void Matcher::init_first_stack_mask() {
 390  398  
 391  399    // 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];
      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];
 405  422  
 406  423    OptoReg::Name i;
 407  424  
 408  425    // At first, start with the empty mask
 409  426    C->FIRST_STACK_mask().Clear();
 410  427  
 411  428    // Add in the incoming argument area
 412  429    OptoReg::Name init = OptoReg::add(_old_SP, C->out_preserve_stack_slots());
 413  430    for (i = init; i < _in_arg_limit; i = OptoReg::add(i,1))
 414  431      C->FIRST_STACK_mask().Insert(i);
↓ open down ↓ 20 lines elided ↑ open up ↑
 435  452    *idealreg2spillmask[Op_RegF] = *idealreg2regmask[Op_RegF];
 436  453     idealreg2spillmask[Op_RegF]->OR(C->FIRST_STACK_mask());
 437  454    *idealreg2spillmask[Op_RegD] = *idealreg2regmask[Op_RegD];
 438  455     idealreg2spillmask[Op_RegD]->OR(C->FIRST_STACK_mask());
 439  456    *idealreg2spillmask[Op_RegP] = *idealreg2regmask[Op_RegP];
 440  457     idealreg2spillmask[Op_RegP]->OR(C->FIRST_STACK_mask());
 441  458  
 442  459    // Make up debug masks.  Any spill slot plus callee-save registers.
 443  460    // Caller-save registers are assumed to be trashable by the various
 444  461    // 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];
      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];
 451  475  
 452  476    // Prevent stub compilations from attempting to reference
 453  477    // callee-saved registers from debug info
 454  478    bool exclude_soe = !Compile::current()->is_method_compilation();
 455  479  
 456  480    for( i=OptoReg::Name(0); i<OptoReg::Name(_last_Mach_Reg); i = OptoReg::add(i,1) ) {
 457  481      // registers the caller has to save do not work
 458  482      if( _register_save_policy[i] == 'C' ||
 459  483          _register_save_policy[i] == 'A' ||
 460  484          (_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);
      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);
 467  498      }
 468  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);
 469  510  }
 470  511  
 471  512  //---------------------------is_save_on_entry----------------------------------
 472  513  bool Matcher::is_save_on_entry( int reg ) {
 473  514    return
 474  515      _register_save_policy[reg] == 'E' ||
 475  516      _register_save_policy[reg] == 'A' || // Save-on-entry register?
 476  517      // Also save argument registers in the trampolining stubs
 477  518      (C->save_argument_registers() && is_spillable_arg(reg));
 478  519  }
↓ open down ↓ 503 lines elided ↑ open up ↑
 982 1023  // They match alone with no children.  Their children, the incoming
 983 1024  // arguments, match normally.
 984 1025  MachNode *Matcher::match_sfpt( SafePointNode *sfpt ) {
 985 1026    MachSafePointNode *msfpt = NULL;
 986 1027    MachCallNode      *mcall = NULL;
 987 1028    uint               cnt;
 988 1029    // Split out case for SafePoint vs Call
 989 1030    CallNode *call;
 990 1031    const TypeTuple *domain;
 991 1032    ciMethod*        method = NULL;
     1033 +  bool             is_method_handle_invoke = false;  // for special kill effects
 992 1034    if( sfpt->is_Call() ) {
 993 1035      call = sfpt->as_Call();
 994 1036      domain = call->tf()->domain();
 995 1037      cnt = domain->cnt();
 996 1038  
 997 1039      // Match just the call, nothing else
 998 1040      MachNode *m = match_tree(call);
 999 1041      if (C->failing())  return NULL;
1000 1042      if( m == NULL ) { Matcher::soft_match_failure(); return NULL; }
1001 1043  
↓ open down ↓ 4 lines elided ↑ open up ↑
1006 1048      mcall->set_entry_point(call->entry_point());
1007 1049      mcall->set_cnt(        call->cnt());
1008 1050  
1009 1051      if( mcall->is_MachCallJava() ) {
1010 1052        MachCallJavaNode *mcall_java  = mcall->as_MachCallJava();
1011 1053        const CallJavaNode *call_java =  call->as_CallJava();
1012 1054        method = call_java->method();
1013 1055        mcall_java->_method = method;
1014 1056        mcall_java->_bci = call_java->_bci;
1015 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;
1016 1060        if( mcall_java->is_MachCallStaticJava() )
1017 1061          mcall_java->as_MachCallStaticJava()->_name =
1018 1062           call_java->as_CallStaticJava()->_name;
1019 1063        if( mcall_java->is_MachCallDynamicJava() )
1020 1064          mcall_java->as_MachCallDynamicJava()->_vtable_index =
1021 1065           call_java->as_CallDynamicJava()->_vtable_index;
1022 1066      }
1023 1067      else if( mcall->is_MachCallRuntime() ) {
1024 1068        mcall->as_MachCallRuntime()->_name = call->as_CallRuntime()->_name;
1025 1069      }
↓ open down ↓ 93 lines elided ↑ open up ↑
1119 1163        OptoReg::Name reg2 = warp_outgoing_stk_arg(parm_regs[i].second(), begin_out_arg_area, out_arg_limit_per_call );
1120 1164        if (OptoReg::is_valid(reg2))
1121 1165          rm->Insert( reg2 );
1122 1166      } // End of for all arguments
1123 1167  
1124 1168      // Compute number of stack slots needed to restore stack in case of
1125 1169      // Pascal-style argument popping.
1126 1170      mcall->_argsize = out_arg_limit_per_call - begin_out_arg_area;
1127 1171    }
1128 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 +
1129 1182    // Compute the max stack slot killed by any call.  These will not be
1130 1183    // available for debug info, and will be used to adjust FIRST_STACK_mask
1131 1184    // after all call sites have been visited.
1132 1185    if( _out_arg_limit < out_arg_limit_per_call)
1133 1186      _out_arg_limit = out_arg_limit_per_call;
1134 1187  
1135 1188    if (mcall) {
1136 1189      // Kill the outgoing argument area, including any non-argument holes and
1137 1190      // any legacy C-killed slots.  Use Fat-Projections to do the killing.
1138 1191      // Since the max-per-method covers the max-per-call-site and debug info
↓ open down ↓ 1145 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX