< prev index next >

src/hotspot/share/adlc/formssel.cpp

Print this page
rev 54995 : 8224675: Late GC barrier insertion for ZGC
Reviewed-by:


 740 
 741   // missed the memory op??
 742   if( true ) {  // %%% should not be necessary
 743     if( is_ideal_store() != Form::none ) {
 744       fprintf(stderr, "Warning: cannot find memory opnd in instr.\n");
 745       ((InstructForm*)this)->dump();
 746       // pretend it has multiple defs and uses
 747       return MANY_MEMORY_OPERANDS;
 748     }
 749     if( is_ideal_load()  != Form::none ) {
 750       fprintf(stderr, "Warning: cannot find memory opnd in instr.\n");
 751       ((InstructForm*)this)->dump();
 752       // pretend it has multiple uses and no defs
 753       return MANY_MEMORY_OPERANDS;
 754     }
 755   }
 756 
 757   return NO_MEMORY_OPERAND;
 758 }
 759 
 760 
 761 // This instruction captures the machine-independent bottom_type
 762 // Expected use is for pointer vs oop determination for LoadP
 763 bool InstructForm::captures_bottom_type(FormDict &globals) const {
 764   if (_matrule && _matrule->_rChild &&
 765       (!strcmp(_matrule->_rChild->_opType,"CastPP")       ||  // new result type
 766        !strcmp(_matrule->_rChild->_opType,"CastX2P")      ||  // new result type
 767        !strcmp(_matrule->_rChild->_opType,"DecodeN")      ||
 768        !strcmp(_matrule->_rChild->_opType,"EncodeP")      ||
 769        !strcmp(_matrule->_rChild->_opType,"DecodeNKlass") ||
 770        !strcmp(_matrule->_rChild->_opType,"EncodePKlass") ||
 771        !strcmp(_matrule->_rChild->_opType,"LoadN")        ||
 772        !strcmp(_matrule->_rChild->_opType,"LoadNKlass")   ||
 773        !strcmp(_matrule->_rChild->_opType,"CreateEx")     ||  // type of exception
 774        !strcmp(_matrule->_rChild->_opType,"CheckCastPP")  ||
 775        !strcmp(_matrule->_rChild->_opType,"GetAndSetP")   ||
 776        !strcmp(_matrule->_rChild->_opType,"GetAndSetN")   ||
 777 #if INCLUDE_ZGC


 778        !strcmp(_matrule->_rChild->_opType,"LoadBarrierSlowReg") ||
 779        !strcmp(_matrule->_rChild->_opType,"LoadBarrierWeakSlowReg") ||
 780 #endif
 781 #if INCLUDE_SHENANDOAHGC
 782        !strcmp(_matrule->_rChild->_opType,"ShenandoahCompareAndExchangeP") ||
 783        !strcmp(_matrule->_rChild->_opType,"ShenandoahCompareAndExchangeN") ||
 784 #endif
 785        !strcmp(_matrule->_rChild->_opType,"CompareAndExchangeP") ||
 786        !strcmp(_matrule->_rChild->_opType,"CompareAndExchangeN"))) return true;
 787   else if ( is_ideal_load() == Form::idealP )                return true;
 788   else if ( is_ideal_store() != Form::none  )                return true;
 789 
 790   if (needs_base_oop_edge(globals)) return true;
 791 
 792   if (is_vector()) return true;
 793   if (is_mach_constant()) return true;
 794 
 795   return  false;
 796 }
 797 
 798 
 799 // Access instr_cost attribute or return NULL.


3489     fprintf(fp," (%s ",_name);  // " (opcodeName "
3490     if(_lChild) _lChild->output(fp); //               left operand
3491     if(_rChild) _rChild->output(fp); //                    right operand
3492     fprintf(fp,")");                 //                                 ")"
3493   }
3494 }
3495 
3496 int MatchNode::needs_ideal_memory_edge(FormDict &globals) const {
3497   static const char *needs_ideal_memory_list[] = {
3498     "StoreI","StoreL","StoreP","StoreN","StoreNKlass","StoreD","StoreF" ,
3499     "StoreB","StoreC","Store" ,"StoreFP",
3500     "LoadI", "LoadL", "LoadP" ,"LoadN", "LoadD" ,"LoadF"  ,
3501     "LoadB" , "LoadUB", "LoadUS" ,"LoadS" ,"Load" ,
3502     "StoreVector", "LoadVector",
3503     "LoadRange", "LoadKlass", "LoadNKlass", "LoadL_unaligned", "LoadD_unaligned",
3504     "LoadPLocked",
3505     "StorePConditional", "StoreIConditional", "StoreLConditional",
3506     "CompareAndSwapB", "CompareAndSwapS", "CompareAndSwapI", "CompareAndSwapL", "CompareAndSwapP", "CompareAndSwapN",
3507     "WeakCompareAndSwapB", "WeakCompareAndSwapS", "WeakCompareAndSwapI", "WeakCompareAndSwapL", "WeakCompareAndSwapP", "WeakCompareAndSwapN",
3508     "CompareAndExchangeB", "CompareAndExchangeS", "CompareAndExchangeI", "CompareAndExchangeL", "CompareAndExchangeP", "CompareAndExchangeN",

3509     "ShenandoahCompareAndSwapN", "ShenandoahCompareAndSwapP", "ShenandoahWeakCompareAndSwapP", "ShenandoahWeakCompareAndSwapN", "ShenandoahCompareAndExchangeP", "ShenandoahCompareAndExchangeN",

3510     "StoreCM",
3511     "ClearArray",
3512     "GetAndSetB", "GetAndSetS", "GetAndAddI", "GetAndSetI", "GetAndSetP",
3513     "GetAndAddB", "GetAndAddS", "GetAndAddL", "GetAndSetL", "GetAndSetN",
3514     "LoadBarrierSlowReg", "LoadBarrierWeakSlowReg"



3515   };
3516   int cnt = sizeof(needs_ideal_memory_list)/sizeof(char*);
3517   if( strcmp(_opType,"PrefetchAllocation")==0 )
3518     return 1;
3519   if( _lChild ) {
3520     const char *opType = _lChild->_opType;
3521     for( int i=0; i<cnt; i++ )
3522       if( strcmp(opType,needs_ideal_memory_list[i]) == 0 )
3523         return 1;
3524     if( _lChild->needs_ideal_memory_edge(globals) )
3525       return 1;
3526   }
3527   if( _rChild ) {
3528     const char *opType = _rChild->_opType;
3529     for( int i=0; i<cnt; i++ )
3530       if( strcmp(opType,needs_ideal_memory_list[i]) == 0 )
3531         return 1;
3532     if( _rChild->needs_ideal_memory_edge(globals) )
3533       return 1;
3534   }




 740 
 741   // missed the memory op??
 742   if( true ) {  // %%% should not be necessary
 743     if( is_ideal_store() != Form::none ) {
 744       fprintf(stderr, "Warning: cannot find memory opnd in instr.\n");
 745       ((InstructForm*)this)->dump();
 746       // pretend it has multiple defs and uses
 747       return MANY_MEMORY_OPERANDS;
 748     }
 749     if( is_ideal_load()  != Form::none ) {
 750       fprintf(stderr, "Warning: cannot find memory opnd in instr.\n");
 751       ((InstructForm*)this)->dump();
 752       // pretend it has multiple uses and no defs
 753       return MANY_MEMORY_OPERANDS;
 754     }
 755   }
 756 
 757   return NO_MEMORY_OPERAND;
 758 }
 759 

 760 // This instruction captures the machine-independent bottom_type
 761 // Expected use is for pointer vs oop determination for LoadP
 762 bool InstructForm::captures_bottom_type(FormDict &globals) const {
 763   if (_matrule && _matrule->_rChild &&
 764       (!strcmp(_matrule->_rChild->_opType,"CastPP")       ||  // new result type
 765        !strcmp(_matrule->_rChild->_opType,"CastX2P")      ||  // new result type
 766        !strcmp(_matrule->_rChild->_opType,"DecodeN")      ||
 767        !strcmp(_matrule->_rChild->_opType,"EncodeP")      ||
 768        !strcmp(_matrule->_rChild->_opType,"DecodeNKlass") ||
 769        !strcmp(_matrule->_rChild->_opType,"EncodePKlass") ||
 770        !strcmp(_matrule->_rChild->_opType,"LoadN")        ||
 771        !strcmp(_matrule->_rChild->_opType,"LoadNKlass")   ||
 772        !strcmp(_matrule->_rChild->_opType,"CreateEx")     ||  // type of exception
 773        !strcmp(_matrule->_rChild->_opType,"CheckCastPP")  ||
 774        !strcmp(_matrule->_rChild->_opType,"GetAndSetP")   ||
 775        !strcmp(_matrule->_rChild->_opType,"GetAndSetN")   ||
 776 #if INCLUDE_ZGC
 777        !strcmp(_matrule->_rChild->_opType,"ZGetAndSetP") ||
 778        !strcmp(_matrule->_rChild->_opType,"ZCompareAndExchangeP") ||
 779        !strcmp(_matrule->_rChild->_opType,"LoadBarrierSlowReg") ||

 780 #endif
 781 #if INCLUDE_SHENANDOAHGC
 782        !strcmp(_matrule->_rChild->_opType,"ShenandoahCompareAndExchangeP") ||
 783        !strcmp(_matrule->_rChild->_opType,"ShenandoahCompareAndExchangeN") ||
 784 #endif
 785        !strcmp(_matrule->_rChild->_opType,"CompareAndExchangeP") ||
 786        !strcmp(_matrule->_rChild->_opType,"CompareAndExchangeN"))) return true;
 787   else if ( is_ideal_load() == Form::idealP )                return true;
 788   else if ( is_ideal_store() != Form::none  )                return true;
 789 
 790   if (needs_base_oop_edge(globals)) return true;
 791 
 792   if (is_vector()) return true;
 793   if (is_mach_constant()) return true;
 794 
 795   return  false;
 796 }
 797 
 798 
 799 // Access instr_cost attribute or return NULL.


3489     fprintf(fp," (%s ",_name);  // " (opcodeName "
3490     if(_lChild) _lChild->output(fp); //               left operand
3491     if(_rChild) _rChild->output(fp); //                    right operand
3492     fprintf(fp,")");                 //                                 ")"
3493   }
3494 }
3495 
3496 int MatchNode::needs_ideal_memory_edge(FormDict &globals) const {
3497   static const char *needs_ideal_memory_list[] = {
3498     "StoreI","StoreL","StoreP","StoreN","StoreNKlass","StoreD","StoreF" ,
3499     "StoreB","StoreC","Store" ,"StoreFP",
3500     "LoadI", "LoadL", "LoadP" ,"LoadN", "LoadD" ,"LoadF"  ,
3501     "LoadB" , "LoadUB", "LoadUS" ,"LoadS" ,"Load" ,
3502     "StoreVector", "LoadVector",
3503     "LoadRange", "LoadKlass", "LoadNKlass", "LoadL_unaligned", "LoadD_unaligned",
3504     "LoadPLocked",
3505     "StorePConditional", "StoreIConditional", "StoreLConditional",
3506     "CompareAndSwapB", "CompareAndSwapS", "CompareAndSwapI", "CompareAndSwapL", "CompareAndSwapP", "CompareAndSwapN",
3507     "WeakCompareAndSwapB", "WeakCompareAndSwapS", "WeakCompareAndSwapI", "WeakCompareAndSwapL", "WeakCompareAndSwapP", "WeakCompareAndSwapN",
3508     "CompareAndExchangeB", "CompareAndExchangeS", "CompareAndExchangeI", "CompareAndExchangeL", "CompareAndExchangeP", "CompareAndExchangeN",
3509 #if INCLUDE_SHENANDOAHGC
3510     "ShenandoahCompareAndSwapN", "ShenandoahCompareAndSwapP", "ShenandoahWeakCompareAndSwapP", "ShenandoahWeakCompareAndSwapN", "ShenandoahCompareAndExchangeP", "ShenandoahCompareAndExchangeN",
3511 #endif
3512     "StoreCM",

3513     "GetAndSetB", "GetAndSetS", "GetAndAddI", "GetAndSetI", "GetAndSetP",
3514     "GetAndAddB", "GetAndAddS", "GetAndAddL", "GetAndSetL", "GetAndSetN",
3515 #if INCLUDE_ZGC
3516     "LoadBarrierSlowReg", "ZGetAndSetP", "ZCompareAndSwapP", "ZCompareAndExchangeP", "ZWeakCompareAndSwapP",
3517 #endif
3518     "ClearArray"
3519   };
3520   int cnt = sizeof(needs_ideal_memory_list)/sizeof(char*);
3521   if( strcmp(_opType,"PrefetchAllocation")==0 )
3522     return 1;
3523   if( _lChild ) {
3524     const char *opType = _lChild->_opType;
3525     for( int i=0; i<cnt; i++ )
3526       if( strcmp(opType,needs_ideal_memory_list[i]) == 0 )
3527         return 1;
3528     if( _lChild->needs_ideal_memory_edge(globals) )
3529       return 1;
3530   }
3531   if( _rChild ) {
3532     const char *opType = _rChild->_opType;
3533     for( int i=0; i<cnt; i++ )
3534       if( strcmp(opType,needs_ideal_memory_list[i]) == 0 )
3535         return 1;
3536     if( _rChild->needs_ideal_memory_edge(globals) )
3537       return 1;
3538   }


< prev index next >