< prev index next >

src/share/vm/opto/graphKit.cpp

Print this page
rev 11994 : 8252366: Shenandoah: revert/cleanup changes in graphKit.cpp
Reviewed-by: XXX


1704   // a type assertion that its value is known to be a small positive
1705   // number.  (The prior range check has ensured this.)
1706   // This assertion is used by ConvI2LNode::Ideal.
1707   int index_max = max_jint - 1;  // array size is max_jint, index is one less
1708   if (sizetype != NULL) index_max = sizetype->_hi - 1;
1709   const TypeInt* iidxtype = TypeInt::make(0, index_max, Type::WidenMax);
1710   idx = C->constrained_convI2L(&_gvn, idx, iidxtype, ctrl);
1711 #endif
1712   Node* scale = _gvn.transform( new (C) LShiftXNode(idx, intcon(shift)) );
1713   return basic_plus_adr(ary, base, scale);
1714 }
1715 
1716 //-------------------------load_array_element-------------------------
1717 Node* GraphKit::load_array_element(Node* ctl, Node* ary, Node* idx, const TypeAryPtr* arytype) {
1718   const Type* elemtype = arytype->elem();
1719   BasicType elembt = elemtype->array_element_basic_type();
1720   Node* adr = array_element_address(ary, idx, elembt, arytype->size());
1721   if (elembt == T_NARROWOOP) {
1722     elembt = T_OBJECT; // To satisfy switch in LoadNode::make()
1723   }
1724   assert(elembt != T_OBJECT && elembt != T_ARRAY, "sanity");
1725   Node* ld = make_load(ctl, adr, elemtype, elembt, arytype, MemNode::unordered);





1726   return ld;
1727 }
1728 
1729 //-------------------------set_arguments_for_java_call-------------------------
1730 // Arguments (pre-popped from the stack) are taken from the JVMS.
1731 void GraphKit::set_arguments_for_java_call(CallJavaNode* call) {
1732   // Add the call arguments:
1733   uint nargs = call->method()->arg_size();
1734   for (uint i = 0; i < nargs; i++) {
1735     Node* arg = argument(i);
1736     call->init_req(i + TypeFunc::Parms, arg);
1737   }
1738 }
1739 
1740 //---------------------------set_edges_for_java_call---------------------------
1741 // Connect a newly created call into the current JVMS.
1742 // A return value node (if any) is returned from set_edges_for_java_call.
1743 void GraphKit::set_edges_for_java_call(CallJavaNode* call, bool must_throw, bool separate_io_proj) {
1744 
1745   // Add the predefined inputs:


3867     Node* card_val = __ load( __ ctrl(), card_adr, TypeInt::BYTE, bt, adr_type);
3868     __ if_then(card_val, BoolTest::ne, zero);
3869   }
3870 
3871   // Smash zero into card
3872   if( !UseConcMarkSweepGC ) {
3873     __ store(__ ctrl(), card_adr, zero, bt, adr_type, MemNode::unordered);
3874   } else {
3875     // Specialized path for CM store barrier
3876     __ storeCM(__ ctrl(), card_adr, zero, oop_store, adr_idx, bt, adr_type);
3877   }
3878 
3879   if (UseCondCardMark) {
3880     __ end_if();
3881   }
3882 
3883   // Final sync IdealKit and GraphKit.
3884   final_sync(ideal);
3885 }
3886 
3887 static void g1_write_barrier_pre_helper(const GraphKit& kit, Node* adr) {
3888   if (UseShenandoahGC && adr != NULL) {
3889     Node* c = kit.control();
3890     Node* call = c->in(1)->in(1)->in(1)->in(0);
3891     assert(call->is_g1_wb_pre_call(), "g1_wb_pre call expected");
3892     call->add_req(adr);
3893   }
3894 }
3895 
3896 // G1 pre/post barriers
3897 void GraphKit::g1_write_barrier_pre(bool do_load,
3898                                     Node* obj,
3899                                     Node* adr,
3900                                     uint alias_idx,
3901                                     Node* val,
3902                                     const TypeOopPtr* val_type,
3903                                     Node* pre_val,
3904                                     BasicType bt) {
3905 
3906   // Some sanity checks
3907   // Note: val is unused in this routine.
3908 
3909   if (do_load) {
3910     // We need to generate the load of the previous value
3911     assert(obj != NULL, "must have a base");
3912     assert(adr != NULL, "where are loading from?");
3913     assert(pre_val == NULL, "loaded already?");
3914     assert(val_type != NULL, "need a type");
3915   } else {


3983         // decrement the index
3984         Node* next_index = _gvn.transform(new (C) SubXNode(index, __ ConX(sizeof(intptr_t))));
3985 
3986         // Now get the buffer location we will log the previous value into and store it
3987         Node *log_addr = __ AddP(no_base, buffer, next_index);
3988         __ store(__ ctrl(), log_addr, pre_val, T_OBJECT, Compile::AliasIdxRaw, MemNode::unordered);
3989         // update the index
3990         __ store(__ ctrl(), index_adr, next_index, index_bt, Compile::AliasIdxRaw, MemNode::unordered);
3991 
3992       } __ else_(); {
3993 
3994         // logging buffer is full, call the runtime
3995         const TypeFunc *tf = OptoRuntime::g1_wb_pre_Type();
3996         __ make_leaf_call(tf, CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), "g1_wb_pre", pre_val, tls);
3997       } __ end_if();  // (!index)
3998     } __ end_if();  // (pre_val != NULL)
3999   } __ end_if();  // (!marking)
4000 
4001   // Final sync IdealKit and GraphKit.
4002   final_sync(ideal);
4003   g1_write_barrier_pre_helper(*this, adr);








4004 }
4005 
4006 //
4007 // Update the card table and add card address to the queue
4008 //
4009 void GraphKit::g1_mark_card(IdealKit& ideal,
4010                             Node* card_adr,
4011                             Node* oop_store,
4012                             uint oop_alias_idx,
4013                             Node* index,
4014                             Node* index_adr,
4015                             Node* buffer,
4016                             const TypeFunc* tf) {
4017 
4018   Node* zero  = __ ConI(0);
4019   Node* zeroX = __ ConX(0);
4020   Node* no_base = __ top();
4021   BasicType card_bt = T_BYTE;
4022   // Smash zero into card. MUST BE ORDERED WRT TO STORE
4023   __ storeCM(__ ctrl(), card_adr, zero, oop_store, oop_alias_idx, card_bt, Compile::AliasIdxRaw);




1704   // a type assertion that its value is known to be a small positive
1705   // number.  (The prior range check has ensured this.)
1706   // This assertion is used by ConvI2LNode::Ideal.
1707   int index_max = max_jint - 1;  // array size is max_jint, index is one less
1708   if (sizetype != NULL) index_max = sizetype->_hi - 1;
1709   const TypeInt* iidxtype = TypeInt::make(0, index_max, Type::WidenMax);
1710   idx = C->constrained_convI2L(&_gvn, idx, iidxtype, ctrl);
1711 #endif
1712   Node* scale = _gvn.transform( new (C) LShiftXNode(idx, intcon(shift)) );
1713   return basic_plus_adr(ary, base, scale);
1714 }
1715 
1716 //-------------------------load_array_element-------------------------
1717 Node* GraphKit::load_array_element(Node* ctl, Node* ary, Node* idx, const TypeAryPtr* arytype) {
1718   const Type* elemtype = arytype->elem();
1719   BasicType elembt = elemtype->array_element_basic_type();
1720   Node* adr = array_element_address(ary, idx, elembt, arytype->size());
1721   if (elembt == T_NARROWOOP) {
1722     elembt = T_OBJECT; // To satisfy switch in LoadNode::make()
1723   }

1724   Node* ld = make_load(ctl, adr, elemtype, elembt, arytype, MemNode::unordered);
1725 #if INCLUDE_ALL_GCS
1726   if (UseShenandoahGC && (elembt == T_OBJECT || elembt == T_ARRAY)) {
1727     ld = ShenandoahBarrierSetC2::bsc2()->load_reference_barrier(this, ld);
1728   }
1729 #endif
1730   return ld;
1731 }
1732 
1733 //-------------------------set_arguments_for_java_call-------------------------
1734 // Arguments (pre-popped from the stack) are taken from the JVMS.
1735 void GraphKit::set_arguments_for_java_call(CallJavaNode* call) {
1736   // Add the call arguments:
1737   uint nargs = call->method()->arg_size();
1738   for (uint i = 0; i < nargs; i++) {
1739     Node* arg = argument(i);
1740     call->init_req(i + TypeFunc::Parms, arg);
1741   }
1742 }
1743 
1744 //---------------------------set_edges_for_java_call---------------------------
1745 // Connect a newly created call into the current JVMS.
1746 // A return value node (if any) is returned from set_edges_for_java_call.
1747 void GraphKit::set_edges_for_java_call(CallJavaNode* call, bool must_throw, bool separate_io_proj) {
1748 
1749   // Add the predefined inputs:


3871     Node* card_val = __ load( __ ctrl(), card_adr, TypeInt::BYTE, bt, adr_type);
3872     __ if_then(card_val, BoolTest::ne, zero);
3873   }
3874 
3875   // Smash zero into card
3876   if( !UseConcMarkSweepGC ) {
3877     __ store(__ ctrl(), card_adr, zero, bt, adr_type, MemNode::unordered);
3878   } else {
3879     // Specialized path for CM store barrier
3880     __ storeCM(__ ctrl(), card_adr, zero, oop_store, adr_idx, bt, adr_type);
3881   }
3882 
3883   if (UseCondCardMark) {
3884     __ end_if();
3885   }
3886 
3887   // Final sync IdealKit and GraphKit.
3888   final_sync(ideal);
3889 }
3890 









3891 // G1 pre/post barriers
3892 void GraphKit::g1_write_barrier_pre(bool do_load,
3893                                     Node* obj,
3894                                     Node* adr,
3895                                     uint alias_idx,
3896                                     Node* val,
3897                                     const TypeOopPtr* val_type,
3898                                     Node* pre_val,
3899                                     BasicType bt) {
3900 
3901   // Some sanity checks
3902   // Note: val is unused in this routine.
3903 
3904   if (do_load) {
3905     // We need to generate the load of the previous value
3906     assert(obj != NULL, "must have a base");
3907     assert(adr != NULL, "where are loading from?");
3908     assert(pre_val == NULL, "loaded already?");
3909     assert(val_type != NULL, "need a type");
3910   } else {


3978         // decrement the index
3979         Node* next_index = _gvn.transform(new (C) SubXNode(index, __ ConX(sizeof(intptr_t))));
3980 
3981         // Now get the buffer location we will log the previous value into and store it
3982         Node *log_addr = __ AddP(no_base, buffer, next_index);
3983         __ store(__ ctrl(), log_addr, pre_val, T_OBJECT, Compile::AliasIdxRaw, MemNode::unordered);
3984         // update the index
3985         __ store(__ ctrl(), index_adr, next_index, index_bt, Compile::AliasIdxRaw, MemNode::unordered);
3986 
3987       } __ else_(); {
3988 
3989         // logging buffer is full, call the runtime
3990         const TypeFunc *tf = OptoRuntime::g1_wb_pre_Type();
3991         __ make_leaf_call(tf, CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), "g1_wb_pre", pre_val, tls);
3992       } __ end_if();  // (!index)
3993     } __ end_if();  // (pre_val != NULL)
3994   } __ end_if();  // (!marking)
3995 
3996   // Final sync IdealKit and GraphKit.
3997   final_sync(ideal);
3998 
3999 #if INCLUDE_ALL_GCS
4000   if (UseShenandoahGC && adr != NULL) {
4001     Node* c = control();
4002     Node* call = c->in(1)->in(1)->in(1)->in(0);
4003     assert(call->is_g1_wb_pre_call(), "g1_wb_pre call expected");
4004     call->add_req(adr);
4005   }
4006 #endif
4007 }
4008 
4009 //
4010 // Update the card table and add card address to the queue
4011 //
4012 void GraphKit::g1_mark_card(IdealKit& ideal,
4013                             Node* card_adr,
4014                             Node* oop_store,
4015                             uint oop_alias_idx,
4016                             Node* index,
4017                             Node* index_adr,
4018                             Node* buffer,
4019                             const TypeFunc* tf) {
4020 
4021   Node* zero  = __ ConI(0);
4022   Node* zeroX = __ ConX(0);
4023   Node* no_base = __ top();
4024   BasicType card_bt = T_BYTE;
4025   // Smash zero into card. MUST BE ORDERED WRT TO STORE
4026   __ storeCM(__ ctrl(), card_adr, zero, oop_store, oop_alias_idx, card_bt, Compile::AliasIdxRaw);


< prev index next >