2963 // since GC and deoptimization can happened. 2964 Node *mem = reset_memory(); 2965 set_all_memory(mem); // Create new memory state 2966 2967 AllocateNode* alloc 2968 = new (C, AllocateNode::ParmLimit) 2969 AllocateNode(C, AllocateNode::alloc_type(), 2970 control(), mem, i_o(), 2971 size, klass_node, 2972 initial_slow_test); 2973 2974 return set_output_for_allocation(alloc, oop_type, raw_mem_only); 2975 } 2976 2977 //-------------------------------new_array------------------------------------- 2978 // helper for both newarray and anewarray 2979 // The 'length' parameter is (obviously) the length of the array. 2980 // See comments on new_instance for the meaning of the other arguments. 2981 Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable) 2982 Node* length, // number of array elements 2983 bool raw_mem_only, // affect only raw memory 2984 Node* *return_size_val) { 2985 jint layout_con = Klass::_lh_neutral_value; 2986 Node* layout_val = get_layout_helper(klass_node, layout_con); 2987 int layout_is_con = (layout_val == NULL); 2988 2989 if (!layout_is_con && !StressReflectiveCode && 2990 !too_many_traps(Deoptimization::Reason_class_check)) { 2991 // This is a reflective array creation site. 2992 // Optimistically assume that it is a subtype of Object[], 2993 // so that we can fold up all the address arithmetic. 2994 layout_con = Klass::array_layout_helper(T_OBJECT); 2995 Node* cmp_lh = _gvn.transform( new(C, 3) CmpINode(layout_val, intcon(layout_con)) ); 2996 Node* bol_lh = _gvn.transform( new(C, 2) BoolNode(cmp_lh, BoolTest::eq) ); 2997 { BuildCutout unless(this, bol_lh, PROB_MAX); 2998 uncommon_trap(Deoptimization::Reason_class_check, 2999 Deoptimization::Action_maybe_recompile); 3000 } 3001 layout_val = NULL; 3002 layout_is_con = true; 3003 } 3004 3005 // Generate the initial go-slow test. Make sure we do not overflow 3006 // if length is huge (near 2Gig) or negative! We do not need 3007 // exact double-words here, just a close approximation of needed 3008 // double-words. We can't add any offset or rounding bits, lest we 3009 // take a size -1 of bytes and make it positive. Use an unsigned 3010 // compare, so negative sizes look hugely positive. 3011 int fast_size_limit = FastAllocateSizeLimit; 3012 if (layout_is_con) { 3013 assert(!StressReflectiveCode, "stress mode does not use these paths"); 3014 // Increase the size limit if we have exact knowledge of array type. 3015 int log2_esize = Klass::layout_helper_log2_element_size(layout_con); 3016 fast_size_limit <<= (LogBytesPerLong - log2_esize); 3017 } | 2963 // since GC and deoptimization can happened. 2964 Node *mem = reset_memory(); 2965 set_all_memory(mem); // Create new memory state 2966 2967 AllocateNode* alloc 2968 = new (C, AllocateNode::ParmLimit) 2969 AllocateNode(C, AllocateNode::alloc_type(), 2970 control(), mem, i_o(), 2971 size, klass_node, 2972 initial_slow_test); 2973 2974 return set_output_for_allocation(alloc, oop_type, raw_mem_only); 2975 } 2976 2977 //-------------------------------new_array------------------------------------- 2978 // helper for both newarray and anewarray 2979 // The 'length' parameter is (obviously) the length of the array. 2980 // See comments on new_instance for the meaning of the other arguments. 2981 Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable) 2982 Node* length, // number of array elements 2983 int nargs, // number of arguments to push back for uncommon trap 2984 bool raw_mem_only, // affect only raw memory 2985 Node* *return_size_val) { 2986 jint layout_con = Klass::_lh_neutral_value; 2987 Node* layout_val = get_layout_helper(klass_node, layout_con); 2988 int layout_is_con = (layout_val == NULL); 2989 2990 if (!layout_is_con && !StressReflectiveCode && 2991 !too_many_traps(Deoptimization::Reason_class_check)) { 2992 // This is a reflective array creation site. 2993 // Optimistically assume that it is a subtype of Object[], 2994 // so that we can fold up all the address arithmetic. 2995 layout_con = Klass::array_layout_helper(T_OBJECT); 2996 Node* cmp_lh = _gvn.transform( new(C, 3) CmpINode(layout_val, intcon(layout_con)) ); 2997 Node* bol_lh = _gvn.transform( new(C, 2) BoolNode(cmp_lh, BoolTest::eq) ); 2998 { BuildCutout unless(this, bol_lh, PROB_MAX); 2999 _sp += nargs; 3000 uncommon_trap(Deoptimization::Reason_class_check, 3001 Deoptimization::Action_maybe_recompile); 3002 } 3003 layout_val = NULL; 3004 layout_is_con = true; 3005 } 3006 3007 // Generate the initial go-slow test. Make sure we do not overflow 3008 // if length is huge (near 2Gig) or negative! We do not need 3009 // exact double-words here, just a close approximation of needed 3010 // double-words. We can't add any offset or rounding bits, lest we 3011 // take a size -1 of bytes and make it positive. Use an unsigned 3012 // compare, so negative sizes look hugely positive. 3013 int fast_size_limit = FastAllocateSizeLimit; 3014 if (layout_is_con) { 3015 assert(!StressReflectiveCode, "stress mode does not use these paths"); 3016 // Increase the size limit if we have exact knowledge of array type. 3017 int log2_esize = Klass::layout_helper_log2_element_size(layout_con); 3018 fast_size_limit <<= (LogBytesPerLong - log2_esize); 3019 } |