src/hotspot/share/opto/matcher.cpp
changeset 50525 767cdb97f103
parent 48309 1a0499fd252e
child 51333 f6641fcf7b7e
equal deleted inserted replaced
50524:04f4e983c2f7 50525:767cdb97f103
    39 #include "opto/type.hpp"
    39 #include "opto/type.hpp"
    40 #include "opto/vectornode.hpp"
    40 #include "opto/vectornode.hpp"
    41 #include "runtime/os.hpp"
    41 #include "runtime/os.hpp"
    42 #include "runtime/sharedRuntime.hpp"
    42 #include "runtime/sharedRuntime.hpp"
    43 #include "utilities/align.hpp"
    43 #include "utilities/align.hpp"
       
    44 #if INCLUDE_ZGC
       
    45 #include "gc/z/zBarrierSetRuntime.hpp"
       
    46 #endif // INCLUDE_ZGC
    44 
    47 
    45 OptoReg::Name OptoReg::c_frame_pointer;
    48 OptoReg::Name OptoReg::c_frame_pointer;
    46 
    49 
    47 const RegMask *Matcher::idealreg2regmask[_last_machine_leaf];
    50 const RegMask *Matcher::idealreg2regmask[_last_machine_leaf];
    48 RegMask Matcher::mreg2regmask[_last_Mach_Reg];
    51 RegMask Matcher::mreg2regmask[_last_Mach_Reg];
  2060     }
  2063     }
  2061     if (nstate == Visit) {
  2064     if (nstate == Visit) {
  2062       mstack.set_state(Post_Visit);
  2065       mstack.set_state(Post_Visit);
  2063       set_visited(n);   // Flag as visited now
  2066       set_visited(n);   // Flag as visited now
  2064       bool mem_op = false;
  2067       bool mem_op = false;
       
  2068       int mem_addr_idx = MemNode::Address;
  2065 
  2069 
  2066       switch( nop ) {  // Handle some opcodes special
  2070       switch( nop ) {  // Handle some opcodes special
  2067       case Op_Phi:             // Treat Phis as shared roots
  2071       case Op_Phi:             // Treat Phis as shared roots
  2068       case Op_Parm:
  2072       case Op_Parm:
  2069       case Op_Proj:            // All handled specially during matching
  2073       case Op_Proj:            // All handled specially during matching
  2148         break;
  2152         break;
  2149       case Op_ClearArray:
  2153       case Op_ClearArray:
  2150       case Op_SafePoint:
  2154       case Op_SafePoint:
  2151         mem_op = true;
  2155         mem_op = true;
  2152         break;
  2156         break;
       
  2157 #if INCLUDE_ZGC
       
  2158       case Op_CallLeaf:
       
  2159         if (UseZGC) {
       
  2160           if (n->as_Call()->entry_point() == ZBarrierSetRuntime::load_barrier_on_oop_field_preloaded_addr() ||
       
  2161               n->as_Call()->entry_point() == ZBarrierSetRuntime::load_barrier_on_weak_oop_field_preloaded_addr()) {
       
  2162             mem_op = true;
       
  2163             mem_addr_idx = TypeFunc::Parms+1;
       
  2164           }
       
  2165           break;
       
  2166         }
       
  2167 #endif
  2153       default:
  2168       default:
  2154         if( n->is_Store() ) {
  2169         if( n->is_Store() ) {
  2155           // Do match stores, despite no ideal reg
  2170           // Do match stores, despite no ideal reg
  2156           mem_op = true;
  2171           mem_op = true;
  2157           break;
  2172           break;
  2197           continue;
  2212           continue;
  2198         }
  2213         }
  2199 #endif
  2214 #endif
  2200 
  2215 
  2201         // Clone addressing expressions as they are "free" in memory access instructions
  2216         // Clone addressing expressions as they are "free" in memory access instructions
  2202         if (mem_op && i == MemNode::Address && mop == Op_AddP &&
  2217         if (mem_op && i == mem_addr_idx && mop == Op_AddP &&
  2203             // When there are other uses besides address expressions
  2218             // When there are other uses besides address expressions
  2204             // put it on stack and mark as shared.
  2219             // put it on stack and mark as shared.
  2205             !is_visited(m)) {
  2220             !is_visited(m)) {
  2206           // Some inputs for address expression are not put on stack
  2221           // Some inputs for address expression are not put on stack
  2207           // to avoid marking them as shared and forcing them into register
  2222           // to avoid marking them as shared and forcing them into register