Mercurial > hg > graal-compiler
comparison src/share/vm/opto/graphKit.cpp @ 3278:66b0e2371912
7026700: regression in 6u24-rev-b23: Crash in C2 compiler in PhaseIdealLoop::build_loop_late_post
Summary: memory slices should be always created for non-static fields after allocation
Reviewed-by: never
author | kvn |
---|---|
date | Wed, 20 Apr 2011 18:29:35 -0700 |
parents | 6c97c830fb6f |
children | 548597e74aa4 |
comparison
equal
deleted
inserted
replaced
3277:d934e4b931e9 | 3278:66b0e2371912 |
---|---|
2948 kit.set_memory(init_out_raw, alias_idx); | 2948 kit.set_memory(init_out_raw, alias_idx); |
2949 } | 2949 } |
2950 | 2950 |
2951 //---------------------------set_output_for_allocation------------------------- | 2951 //---------------------------set_output_for_allocation------------------------- |
2952 Node* GraphKit::set_output_for_allocation(AllocateNode* alloc, | 2952 Node* GraphKit::set_output_for_allocation(AllocateNode* alloc, |
2953 const TypeOopPtr* oop_type, | 2953 const TypeOopPtr* oop_type) { |
2954 bool raw_mem_only) { | |
2955 int rawidx = Compile::AliasIdxRaw; | 2954 int rawidx = Compile::AliasIdxRaw; |
2956 alloc->set_req( TypeFunc::FramePtr, frameptr() ); | 2955 alloc->set_req( TypeFunc::FramePtr, frameptr() ); |
2957 add_safepoint_edges(alloc); | 2956 add_safepoint_edges(alloc); |
2958 Node* allocx = _gvn.transform(alloc); | 2957 Node* allocx = _gvn.transform(alloc); |
2959 set_control( _gvn.transform(new (C, 1) ProjNode(allocx, TypeFunc::Control) ) ); | 2958 set_control( _gvn.transform(new (C, 1) ProjNode(allocx, TypeFunc::Control) ) ); |
2973 // put in an initialization barrier | 2972 // put in an initialization barrier |
2974 InitializeNode* init = insert_mem_bar_volatile(Op_Initialize, rawidx, | 2973 InitializeNode* init = insert_mem_bar_volatile(Op_Initialize, rawidx, |
2975 rawoop)->as_Initialize(); | 2974 rawoop)->as_Initialize(); |
2976 assert(alloc->initialization() == init, "2-way macro link must work"); | 2975 assert(alloc->initialization() == init, "2-way macro link must work"); |
2977 assert(init ->allocation() == alloc, "2-way macro link must work"); | 2976 assert(init ->allocation() == alloc, "2-way macro link must work"); |
2978 if (ReduceFieldZeroing && !raw_mem_only) { | 2977 { |
2979 // Extract memory strands which may participate in the new object's | 2978 // Extract memory strands which may participate in the new object's |
2980 // initialization, and source them from the new InitializeNode. | 2979 // initialization, and source them from the new InitializeNode. |
2981 // This will allow us to observe initializations when they occur, | 2980 // This will allow us to observe initializations when they occur, |
2982 // and link them properly (as a group) to the InitializeNode. | 2981 // and link them properly (as a group) to the InitializeNode. |
2983 assert(init->in(InitializeNode::Memory) == malloc, ""); | 2982 assert(init->in(InitializeNode::Memory) == malloc, ""); |
3034 // or may be non-constant (for reflective code). It will work equally well | 3033 // or may be non-constant (for reflective code). It will work equally well |
3035 // for either, and the graph will fold nicely if the optimizer later reduces | 3034 // for either, and the graph will fold nicely if the optimizer later reduces |
3036 // the type to a constant. | 3035 // the type to a constant. |
3037 // The optional arguments are for specialized use by intrinsics: | 3036 // The optional arguments are for specialized use by intrinsics: |
3038 // - If 'extra_slow_test' if not null is an extra condition for the slow-path. | 3037 // - If 'extra_slow_test' if not null is an extra condition for the slow-path. |
3039 // - If 'raw_mem_only', do not cast the result to an oop. | |
3040 // - If 'return_size_val', report the the total object size to the caller. | 3038 // - If 'return_size_val', report the the total object size to the caller. |
3041 Node* GraphKit::new_instance(Node* klass_node, | 3039 Node* GraphKit::new_instance(Node* klass_node, |
3042 Node* extra_slow_test, | 3040 Node* extra_slow_test, |
3043 bool raw_mem_only, // affect only raw memory | |
3044 Node* *return_size_val) { | 3041 Node* *return_size_val) { |
3045 // Compute size in doublewords | 3042 // Compute size in doublewords |
3046 // The size is always an integral number of doublewords, represented | 3043 // The size is always an integral number of doublewords, represented |
3047 // as a positive bytewise size stored in the klass's layout_helper. | 3044 // as a positive bytewise size stored in the klass's layout_helper. |
3048 // The layout_helper also encodes (in a low bit) the need for a slow path. | 3045 // The layout_helper also encodes (in a low bit) the need for a slow path. |
3109 AllocateNode(C, AllocateNode::alloc_type(), | 3106 AllocateNode(C, AllocateNode::alloc_type(), |
3110 control(), mem, i_o(), | 3107 control(), mem, i_o(), |
3111 size, klass_node, | 3108 size, klass_node, |
3112 initial_slow_test); | 3109 initial_slow_test); |
3113 | 3110 |
3114 return set_output_for_allocation(alloc, oop_type, raw_mem_only); | 3111 return set_output_for_allocation(alloc, oop_type); |
3115 } | 3112 } |
3116 | 3113 |
3117 //-------------------------------new_array------------------------------------- | 3114 //-------------------------------new_array------------------------------------- |
3118 // helper for both newarray and anewarray | 3115 // helper for both newarray and anewarray |
3119 // The 'length' parameter is (obviously) the length of the array. | 3116 // The 'length' parameter is (obviously) the length of the array. |
3120 // See comments on new_instance for the meaning of the other arguments. | 3117 // See comments on new_instance for the meaning of the other arguments. |
3121 Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable) | 3118 Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable) |
3122 Node* length, // number of array elements | 3119 Node* length, // number of array elements |
3123 int nargs, // number of arguments to push back for uncommon trap | 3120 int nargs, // number of arguments to push back for uncommon trap |
3124 bool raw_mem_only, // affect only raw memory | |
3125 Node* *return_size_val) { | 3121 Node* *return_size_val) { |
3126 jint layout_con = Klass::_lh_neutral_value; | 3122 jint layout_con = Klass::_lh_neutral_value; |
3127 Node* layout_val = get_layout_helper(klass_node, layout_con); | 3123 Node* layout_val = get_layout_helper(klass_node, layout_con); |
3128 int layout_is_con = (layout_val == NULL); | 3124 int layout_is_con = (layout_val == NULL); |
3129 | 3125 |
3264 if (ary_type->isa_aryptr() && length_type != NULL) { | 3260 if (ary_type->isa_aryptr() && length_type != NULL) { |
3265 // Try to get a better type than POS for the size | 3261 // Try to get a better type than POS for the size |
3266 ary_type = ary_type->is_aryptr()->cast_to_size(length_type); | 3262 ary_type = ary_type->is_aryptr()->cast_to_size(length_type); |
3267 } | 3263 } |
3268 | 3264 |
3269 Node* javaoop = set_output_for_allocation(alloc, ary_type, raw_mem_only); | 3265 Node* javaoop = set_output_for_allocation(alloc, ary_type); |
3270 | 3266 |
3271 // Cast length on remaining path to be as narrow as possible | 3267 // Cast length on remaining path to be as narrow as possible |
3272 if (map()->find_edge(length) >= 0) { | 3268 if (map()->find_edge(length) >= 0) { |
3273 Node* ccast = alloc->make_ideal_length(ary_type, &_gvn); | 3269 Node* ccast = alloc->make_ideal_length(ary_type, &_gvn); |
3274 if (ccast != length) { | 3270 if (ccast != length) { |