< prev index next >

src/hotspot/share/opto/memnode.cpp

Print this page
rev 52801 : Upstream/backport Shenandoah to JDK11u
* * *
[backport] 8237570: Shenandoah: cleanup uses of allocation/free threshold in static heuristics
Reviewed-by: rkennke


  35 #include "opto/cfgnode.hpp"
  36 #include "opto/compile.hpp"
  37 #include "opto/connode.hpp"
  38 #include "opto/convertnode.hpp"
  39 #include "opto/loopnode.hpp"
  40 #include "opto/machnode.hpp"
  41 #include "opto/matcher.hpp"
  42 #include "opto/memnode.hpp"
  43 #include "opto/mulnode.hpp"
  44 #include "opto/narrowptrnode.hpp"
  45 #include "opto/phaseX.hpp"
  46 #include "opto/regmask.hpp"
  47 #include "opto/rootnode.hpp"
  48 #include "utilities/align.hpp"
  49 #include "utilities/copy.hpp"
  50 #include "utilities/macros.hpp"
  51 #include "utilities/vmError.hpp"
  52 #if INCLUDE_ZGC
  53 #include "gc/z/c2/zBarrierSetC2.hpp"
  54 #endif



  55 
  56 // Portions of code courtesy of Clifford Click
  57 
  58 // Optimization - Graph Style
  59 
  60 static Node *step_through_mergemem(PhaseGVN *phase, MergeMemNode *mmem,  const TypePtr *tp, const TypePtr *adr_check, outputStream *st);
  61 
  62 //=============================================================================
  63 uint MemNode::size_of() const { return sizeof(*this); }
  64 
  65 const TypePtr *MemNode::adr_type() const {
  66   Node* adr = in(Address);
  67   if (adr == NULL)  return NULL; // node is dead
  68   const TypePtr* cross_check = NULL;
  69   DEBUG_ONLY(cross_check = _adr_type);
  70   return calculate_adr_type(adr->bottom_type(), cross_check);
  71 }
  72 
  73 bool MemNode::check_if_adr_maybe_raw(Node* adr) {
  74   if (adr != NULL) {


1095     }
1096 
1097     // A load from an initialization barrier can match a captured store.
1098     if (st->is_Proj() && st->in(0)->is_Initialize()) {
1099       InitializeNode* init = st->in(0)->as_Initialize();
1100       AllocateNode* alloc = init->allocation();
1101       if ((alloc != NULL) && (alloc == ld_alloc)) {
1102         // examine a captured store value
1103         st = init->find_captured_store(ld_off, memory_size(), phase);
1104         if (st != NULL) {
1105           continue;             // take one more trip around
1106         }
1107       }
1108     }
1109 
1110     // Load boxed value from result of valueOf() call is input parameter.
1111     if (this->is_Load() && ld_adr->is_AddP() &&
1112         (tp != NULL) && tp->is_ptr_to_boxed_value()) {
1113       intptr_t ignore = 0;
1114       Node* base = AddPNode::Ideal_base_and_offset(ld_adr, phase, ignore);





1115       if (base != NULL && base->is_Proj() &&
1116           base->as_Proj()->_con == TypeFunc::Parms &&
1117           base->in(0)->is_CallStaticJava() &&
1118           base->in(0)->as_CallStaticJava()->is_boxing_method()) {
1119         return base->in(0)->in(TypeFunc::Parms);
1120       }
1121     }
1122 
1123     break;
1124   }
1125 
1126   return NULL;
1127 }
1128 
1129 //----------------------is_instance_field_load_with_local_phi------------------
1130 bool LoadNode::is_instance_field_load_with_local_phi(Node* ctrl) {
1131   if( in(Memory)->is_Phi() && in(Memory)->in(0) == ctrl &&
1132       in(Address)->is_AddP() ) {
1133     const TypeOopPtr* t_oop = in(Address)->bottom_type()->isa_oopptr();
1134     // Only instances and boxed values.




  35 #include "opto/cfgnode.hpp"
  36 #include "opto/compile.hpp"
  37 #include "opto/connode.hpp"
  38 #include "opto/convertnode.hpp"
  39 #include "opto/loopnode.hpp"
  40 #include "opto/machnode.hpp"
  41 #include "opto/matcher.hpp"
  42 #include "opto/memnode.hpp"
  43 #include "opto/mulnode.hpp"
  44 #include "opto/narrowptrnode.hpp"
  45 #include "opto/phaseX.hpp"
  46 #include "opto/regmask.hpp"
  47 #include "opto/rootnode.hpp"
  48 #include "utilities/align.hpp"
  49 #include "utilities/copy.hpp"
  50 #include "utilities/macros.hpp"
  51 #include "utilities/vmError.hpp"
  52 #if INCLUDE_ZGC
  53 #include "gc/z/c2/zBarrierSetC2.hpp"
  54 #endif
  55 #if INCLUDE_SHENANDOAHGC
  56 #include "gc/shenandoah/c2/shenandoahBarrierSetC2.hpp"
  57 #endif
  58 
  59 // Portions of code courtesy of Clifford Click
  60 
  61 // Optimization - Graph Style
  62 
  63 static Node *step_through_mergemem(PhaseGVN *phase, MergeMemNode *mmem,  const TypePtr *tp, const TypePtr *adr_check, outputStream *st);
  64 
  65 //=============================================================================
  66 uint MemNode::size_of() const { return sizeof(*this); }
  67 
  68 const TypePtr *MemNode::adr_type() const {
  69   Node* adr = in(Address);
  70   if (adr == NULL)  return NULL; // node is dead
  71   const TypePtr* cross_check = NULL;
  72   DEBUG_ONLY(cross_check = _adr_type);
  73   return calculate_adr_type(adr->bottom_type(), cross_check);
  74 }
  75 
  76 bool MemNode::check_if_adr_maybe_raw(Node* adr) {
  77   if (adr != NULL) {


1098     }
1099 
1100     // A load from an initialization barrier can match a captured store.
1101     if (st->is_Proj() && st->in(0)->is_Initialize()) {
1102       InitializeNode* init = st->in(0)->as_Initialize();
1103       AllocateNode* alloc = init->allocation();
1104       if ((alloc != NULL) && (alloc == ld_alloc)) {
1105         // examine a captured store value
1106         st = init->find_captured_store(ld_off, memory_size(), phase);
1107         if (st != NULL) {
1108           continue;             // take one more trip around
1109         }
1110       }
1111     }
1112 
1113     // Load boxed value from result of valueOf() call is input parameter.
1114     if (this->is_Load() && ld_adr->is_AddP() &&
1115         (tp != NULL) && tp->is_ptr_to_boxed_value()) {
1116       intptr_t ignore = 0;
1117       Node* base = AddPNode::Ideal_base_and_offset(ld_adr, phase, ignore);
1118 #if INCLUDE_SHENANDOAHGC
1119       if (UseShenandoahGC) {
1120         base = ((ShenandoahBarrierSetC2*) BarrierSet::barrier_set()->barrier_set_c2())->step_over_gc_barrier(base);
1121       }
1122 #endif
1123       if (base != NULL && base->is_Proj() &&
1124           base->as_Proj()->_con == TypeFunc::Parms &&
1125           base->in(0)->is_CallStaticJava() &&
1126           base->in(0)->as_CallStaticJava()->is_boxing_method()) {
1127         return base->in(0)->in(TypeFunc::Parms);
1128       }
1129     }
1130 
1131     break;
1132   }
1133 
1134   return NULL;
1135 }
1136 
1137 //----------------------is_instance_field_load_with_local_phi------------------
1138 bool LoadNode::is_instance_field_load_with_local_phi(Node* ctrl) {
1139   if( in(Memory)->is_Phi() && in(Memory)->in(0) == ctrl &&
1140       in(Address)->is_AddP() ) {
1141     const TypeOopPtr* t_oop = in(Address)->bottom_type()->isa_oopptr();
1142     // Only instances and boxed values.


< prev index next >