2920 const TypeKlassPtr* tklass = _gvn.type(klass_node)->isa_klassptr(); |
2920 const TypeKlassPtr* tklass = _gvn.type(klass_node)->isa_klassptr(); |
2921 if (!tklass) tklass = TypeKlassPtr::OBJECT; |
2921 if (!tklass) tklass = TypeKlassPtr::OBJECT; |
2922 const TypeOopPtr* oop_type = tklass->as_instance_type(); |
2922 const TypeOopPtr* oop_type = tklass->as_instance_type(); |
2923 |
2923 |
2924 // Now generate allocation code |
2924 // Now generate allocation code |
|
2925 |
|
2926 // With escape analysis, the entire memory state is needed to be able to |
|
2927 // eliminate the allocation. If the allocations cannot be eliminated, this |
|
2928 // will be optimized to the raw slice when the allocation is expanded. |
|
2929 Node *mem; |
|
2930 if (C->do_escape_analysis()) { |
|
2931 mem = reset_memory(); |
|
2932 set_all_memory(mem); |
|
2933 } else { |
|
2934 mem = memory(Compile::AliasIdxRaw); |
|
2935 } |
|
2936 |
2925 AllocateNode* alloc |
2937 AllocateNode* alloc |
2926 = new (C, AllocateNode::ParmLimit) |
2938 = new (C, AllocateNode::ParmLimit) |
2927 AllocateNode(C, AllocateNode::alloc_type(), |
2939 AllocateNode(C, AllocateNode::alloc_type(), |
2928 control(), memory(Compile::AliasIdxRaw), i_o(), |
2940 control(), mem, i_o(), |
2929 size, klass_node, |
2941 size, klass_node, |
2930 initial_slow_test); |
2942 initial_slow_test); |
2931 |
2943 |
2932 return set_output_for_allocation(alloc, oop_type, raw_mem_only); |
2944 return set_output_for_allocation(alloc, oop_type, raw_mem_only); |
2933 } |
2945 } |
3054 // This is the size |
3066 // This is the size |
3055 (*return_size_val) = size; |
3067 (*return_size_val) = size; |
3056 } |
3068 } |
3057 |
3069 |
3058 // Now generate allocation code |
3070 // Now generate allocation code |
|
3071 |
|
3072 // With escape analysis, the entire memory state is needed to be able to |
|
3073 // eliminate the allocation. If the allocations cannot be eliminated, this |
|
3074 // will be optimized to the raw slice when the allocation is expanded. |
|
3075 Node *mem; |
|
3076 if (C->do_escape_analysis()) { |
|
3077 mem = reset_memory(); |
|
3078 set_all_memory(mem); |
|
3079 } else { |
|
3080 mem = memory(Compile::AliasIdxRaw); |
|
3081 } |
|
3082 |
3059 // Create the AllocateArrayNode and its result projections |
3083 // Create the AllocateArrayNode and its result projections |
3060 AllocateArrayNode* alloc |
3084 AllocateArrayNode* alloc |
3061 = new (C, AllocateArrayNode::ParmLimit) |
3085 = new (C, AllocateArrayNode::ParmLimit) |
3062 AllocateArrayNode(C, AllocateArrayNode::alloc_type(), |
3086 AllocateArrayNode(C, AllocateArrayNode::alloc_type(), |
3063 control(), memory(Compile::AliasIdxRaw), i_o(), |
3087 control(), mem, i_o(), |
3064 size, klass_node, |
3088 size, klass_node, |
3065 initial_slow_test, |
3089 initial_slow_test, |
3066 length); |
3090 length); |
3067 |
3091 |
3068 // Cast to correct type. Note that the klass_node may be constant or not, |
3092 // Cast to correct type. Note that the klass_node may be constant or not, |