src/share/vm/opto/library_call.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6589834 Sdiff src/share/vm/opto

src/share/vm/opto/library_call.cpp

Print this page




3038   if (!stopped()) {
3039     // Either the input type is void.class, or else the
3040     // array klass has not yet been cached.  Either the
3041     // ensuing call will throw an exception, or else it
3042     // will cache the array klass for next time.
3043     PreserveJVMState pjvms(this);
3044     CallJavaNode* slow_call = generate_method_call_static(vmIntrinsics::_newArray);
3045     Node* slow_result = set_results_for_java_call(slow_call);
3046     // this->control() comes from set_results_for_java_call
3047     result_reg->set_req(_slow_path, control());
3048     result_val->set_req(_slow_path, slow_result);
3049     result_io ->set_req(_slow_path, i_o());
3050     result_mem->set_req(_slow_path, reset_memory());
3051   }
3052 
3053   set_control(normal_ctl);
3054   if (!stopped()) {
3055     // Normal case:  The array type has been cached in the java.lang.Class.
3056     // The following call works fine even if the array type is polymorphic.
3057     // It could be a dynamic mix of int[], boolean[], Object[], etc.
3058     _sp += nargs;  // set original stack for use by uncommon_trap
3059     Node* obj = new_array(klass_node, count_val);
3060     _sp -= nargs;
3061     result_reg->init_req(_normal_path, control());
3062     result_val->init_req(_normal_path, obj);
3063     result_io ->init_req(_normal_path, i_o());
3064     result_mem->init_req(_normal_path, reset_memory());
3065   }
3066 
3067   // Return the combined state.
3068   set_i_o(        _gvn.transform(result_io)  );
3069   set_all_memory( _gvn.transform(result_mem) );
3070   push_result(result_reg, result_val);
3071   C->set_has_split_ifs(true); // Has chance for split-if optimization
3072 
3073   return true;
3074 }
3075 
3076 //----------------------inline_native_getLength--------------------------
3077 bool LibraryCallKit::inline_native_getLength() {
3078   if (too_many_traps(Deoptimization::Reason_intrinsic))  return false;
3079 
3080   int nargs = 1;


3162   }
3163 
3164   // Bail out if length is negative.
3165   // ...Not needed, since the new_array will throw the right exception.
3166   //generate_negative_guard(length, bailout, &length);
3167 
3168   if (bailout->req() > 1) {
3169     PreserveJVMState pjvms(this);
3170     set_control( _gvn.transform(bailout) );
3171     _sp += nargs;  // push the arguments back on the stack
3172     uncommon_trap(Deoptimization::Reason_intrinsic,
3173                   Deoptimization::Action_maybe_recompile);
3174   }
3175 
3176   if (!stopped()) {
3177     // How many elements will we copy from the original?
3178     // The answer is MinI(orig_length - start, length).
3179     Node* orig_tail = _gvn.transform( new(C, 3) SubINode(orig_length, start) );
3180     Node* moved = generate_min_max(vmIntrinsics::_min, orig_tail, length);
3181 
3182     _sp += nargs;  // set original stack for use by uncommon_trap
3183     Node* newcopy = new_array(klass_node, length);
3184     _sp -= nargs;
3185 
3186     // Generate a direct call to the right arraycopy function(s).
3187     // We know the copy is disjoint but we might not know if the
3188     // oop stores need checking.
3189     // Extreme case:  Arrays.copyOf((Integer[])x, 10, String[].class).
3190     // This will fail a store-check if x contains any non-nulls.
3191     bool disjoint_bases = true;
3192     bool length_never_negative = true;
3193     generate_arraycopy(TypeAryPtr::OOPS, T_OBJECT,
3194                        original, start, newcopy, intcon(0), moved,
3195                        nargs, disjoint_bases, length_never_negative);
3196 
3197     push(newcopy);
3198   }
3199 
3200   C->set_has_split_ifs(true); // Has chance for split-if optimization
3201 
3202   return true;
3203 }
3204 


3886 
3887   // paths into alloc_reg (on the fast path, just before the CopyArray):
3888   enum { _typeArray_alloc = 1, _instance_alloc, ALLOC_LIMIT };
3889   RegionNode* alloc_reg = new(C, ALLOC_LIMIT) RegionNode(ALLOC_LIMIT);
3890   PhiNode*    alloc_val = new(C, ALLOC_LIMIT) PhiNode(alloc_reg, raw_adr_type);
3891   PhiNode*    alloc_siz = new(C, ALLOC_LIMIT) PhiNode(alloc_reg, TypeX_X);
3892   PhiNode*    alloc_i_o = new(C, ALLOC_LIMIT) PhiNode(alloc_reg, Type::ABIO);
3893   PhiNode*    alloc_mem = new(C, ALLOC_LIMIT) PhiNode(alloc_reg, Type::MEMORY,
3894                                                       raw_adr_type);
3895   record_for_igvn(alloc_reg);
3896 
3897   bool card_mark = false;  // (see below)
3898 
3899   Node* array_ctl = generate_array_guard(obj_klass, (RegionNode*)NULL);
3900   if (array_ctl != NULL) {
3901     // It's an array.
3902     PreserveJVMState pjvms(this);
3903     set_control(array_ctl);
3904     Node* obj_length = load_array_length(obj);
3905     Node* obj_size = NULL;
3906     _sp += nargs;  // set original stack for use by uncommon_trap
3907     Node* alloc_obj = new_array(obj_klass, obj_length,
3908                                 raw_mem_only, &obj_size);
3909     _sp -= nargs;
3910     assert(obj_size != NULL, "");
3911     Node* raw_obj = alloc_obj->in(1);
3912     assert(raw_obj->is_Proj() && raw_obj->in(0)->is_Allocate(), "");
3913     if (ReduceBulkZeroing) {
3914       AllocateNode* alloc = AllocateNode::Ideal_allocation(alloc_obj, &_gvn);
3915       if (alloc != NULL) {
3916         // We will be completely responsible for initializing this object.
3917         alloc->maybe_set_complete(&_gvn);
3918       }
3919     }
3920 
3921     if (!use_ReduceInitialCardMarks()) {
3922       // If it is an oop array, it requires very special treatment,
3923       // because card marking is required on each card of the array.
3924       Node* is_obja = generate_objArray_guard(obj_klass, (RegionNode*)NULL);
3925       if (is_obja != NULL) {
3926         PreserveJVMState pjvms2(this);
3927         set_control(is_obja);
3928         // Generate a direct call to the right arraycopy function(s).
3929         bool disjoint_bases = true;




3038   if (!stopped()) {
3039     // Either the input type is void.class, or else the
3040     // array klass has not yet been cached.  Either the
3041     // ensuing call will throw an exception, or else it
3042     // will cache the array klass for next time.
3043     PreserveJVMState pjvms(this);
3044     CallJavaNode* slow_call = generate_method_call_static(vmIntrinsics::_newArray);
3045     Node* slow_result = set_results_for_java_call(slow_call);
3046     // this->control() comes from set_results_for_java_call
3047     result_reg->set_req(_slow_path, control());
3048     result_val->set_req(_slow_path, slow_result);
3049     result_io ->set_req(_slow_path, i_o());
3050     result_mem->set_req(_slow_path, reset_memory());
3051   }
3052 
3053   set_control(normal_ctl);
3054   if (!stopped()) {
3055     // Normal case:  The array type has been cached in the java.lang.Class.
3056     // The following call works fine even if the array type is polymorphic.
3057     // It could be a dynamic mix of int[], boolean[], Object[], etc.
3058     Node* obj = new_array(klass_node, count_val, nargs);


3059     result_reg->init_req(_normal_path, control());
3060     result_val->init_req(_normal_path, obj);
3061     result_io ->init_req(_normal_path, i_o());
3062     result_mem->init_req(_normal_path, reset_memory());
3063   }
3064 
3065   // Return the combined state.
3066   set_i_o(        _gvn.transform(result_io)  );
3067   set_all_memory( _gvn.transform(result_mem) );
3068   push_result(result_reg, result_val);
3069   C->set_has_split_ifs(true); // Has chance for split-if optimization
3070 
3071   return true;
3072 }
3073 
3074 //----------------------inline_native_getLength--------------------------
3075 bool LibraryCallKit::inline_native_getLength() {
3076   if (too_many_traps(Deoptimization::Reason_intrinsic))  return false;
3077 
3078   int nargs = 1;


3160   }
3161 
3162   // Bail out if length is negative.
3163   // ...Not needed, since the new_array will throw the right exception.
3164   //generate_negative_guard(length, bailout, &length);
3165 
3166   if (bailout->req() > 1) {
3167     PreserveJVMState pjvms(this);
3168     set_control( _gvn.transform(bailout) );
3169     _sp += nargs;  // push the arguments back on the stack
3170     uncommon_trap(Deoptimization::Reason_intrinsic,
3171                   Deoptimization::Action_maybe_recompile);
3172   }
3173 
3174   if (!stopped()) {
3175     // How many elements will we copy from the original?
3176     // The answer is MinI(orig_length - start, length).
3177     Node* orig_tail = _gvn.transform( new(C, 3) SubINode(orig_length, start) );
3178     Node* moved = generate_min_max(vmIntrinsics::_min, orig_tail, length);
3179 
3180     Node* newcopy = new_array(klass_node, length, nargs);


3181 
3182     // Generate a direct call to the right arraycopy function(s).
3183     // We know the copy is disjoint but we might not know if the
3184     // oop stores need checking.
3185     // Extreme case:  Arrays.copyOf((Integer[])x, 10, String[].class).
3186     // This will fail a store-check if x contains any non-nulls.
3187     bool disjoint_bases = true;
3188     bool length_never_negative = true;
3189     generate_arraycopy(TypeAryPtr::OOPS, T_OBJECT,
3190                        original, start, newcopy, intcon(0), moved,
3191                        nargs, disjoint_bases, length_never_negative);
3192 
3193     push(newcopy);
3194   }
3195 
3196   C->set_has_split_ifs(true); // Has chance for split-if optimization
3197 
3198   return true;
3199 }
3200 


3882 
3883   // paths into alloc_reg (on the fast path, just before the CopyArray):
3884   enum { _typeArray_alloc = 1, _instance_alloc, ALLOC_LIMIT };
3885   RegionNode* alloc_reg = new(C, ALLOC_LIMIT) RegionNode(ALLOC_LIMIT);
3886   PhiNode*    alloc_val = new(C, ALLOC_LIMIT) PhiNode(alloc_reg, raw_adr_type);
3887   PhiNode*    alloc_siz = new(C, ALLOC_LIMIT) PhiNode(alloc_reg, TypeX_X);
3888   PhiNode*    alloc_i_o = new(C, ALLOC_LIMIT) PhiNode(alloc_reg, Type::ABIO);
3889   PhiNode*    alloc_mem = new(C, ALLOC_LIMIT) PhiNode(alloc_reg, Type::MEMORY,
3890                                                       raw_adr_type);
3891   record_for_igvn(alloc_reg);
3892 
3893   bool card_mark = false;  // (see below)
3894 
3895   Node* array_ctl = generate_array_guard(obj_klass, (RegionNode*)NULL);
3896   if (array_ctl != NULL) {
3897     // It's an array.
3898     PreserveJVMState pjvms(this);
3899     set_control(array_ctl);
3900     Node* obj_length = load_array_length(obj);
3901     Node* obj_size = NULL;
3902     Node* alloc_obj = new_array(obj_klass, obj_length, nargs,

3903                                 raw_mem_only, &obj_size);

3904     assert(obj_size != NULL, "");
3905     Node* raw_obj = alloc_obj->in(1);
3906     assert(raw_obj->is_Proj() && raw_obj->in(0)->is_Allocate(), "");
3907     if (ReduceBulkZeroing) {
3908       AllocateNode* alloc = AllocateNode::Ideal_allocation(alloc_obj, &_gvn);
3909       if (alloc != NULL) {
3910         // We will be completely responsible for initializing this object.
3911         alloc->maybe_set_complete(&_gvn);
3912       }
3913     }
3914 
3915     if (!use_ReduceInitialCardMarks()) {
3916       // If it is an oop array, it requires very special treatment,
3917       // because card marking is required on each card of the array.
3918       Node* is_obja = generate_objArray_guard(obj_klass, (RegionNode*)NULL);
3919       if (is_obja != NULL) {
3920         PreserveJVMState pjvms2(this);
3921         set_control(is_obja);
3922         // Generate a direct call to the right arraycopy function(s).
3923         bool disjoint_bases = true;


src/share/vm/opto/library_call.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File