Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/macro.cpp @ 565:7fe62bb75bf4
6799693: Server compiler leads to data corruption when expression throws an Exception
Summary: Use merged memory state for an allocation's slow path.
Reviewed-by: never
author | kvn |
---|---|
date | Thu, 05 Feb 2009 14:43:58 -0800 |
parents | dd70dd4c91de |
children | 0fbdb4381b99 49a36a80b0c7 |
comparison
equal
deleted
inserted
replaced
564:323728917cf4 | 565:7fe62bb75bf4 |
---|---|
950 Node* i_o = alloc->in(TypeFunc::I_O); | 950 Node* i_o = alloc->in(TypeFunc::I_O); |
951 Node* size_in_bytes = alloc->in(AllocateNode::AllocSize); | 951 Node* size_in_bytes = alloc->in(AllocateNode::AllocSize); |
952 Node* klass_node = alloc->in(AllocateNode::KlassNode); | 952 Node* klass_node = alloc->in(AllocateNode::KlassNode); |
953 Node* initial_slow_test = alloc->in(AllocateNode::InitialTest); | 953 Node* initial_slow_test = alloc->in(AllocateNode::InitialTest); |
954 | 954 |
955 // With escape analysis, the entire memory state was needed to be able to | |
956 // eliminate the allocation. Since the allocations cannot be eliminated, | |
957 // optimize it to the raw slice. | |
958 if (mem->is_MergeMem()) { | |
959 mem = mem->as_MergeMem()->memory_at(Compile::AliasIdxRaw); | |
960 } | |
961 | |
962 assert(ctrl != NULL, "must have control"); | 955 assert(ctrl != NULL, "must have control"); |
963 // We need a Region and corresponding Phi's to merge the slow-path and fast-path results. | 956 // We need a Region and corresponding Phi's to merge the slow-path and fast-path results. |
964 // they will not be used if "always_slow" is set | 957 // they will not be used if "always_slow" is set |
965 enum { slow_result_path = 1, fast_result_path = 2 }; | 958 enum { slow_result_path = 1, fast_result_path = 2 }; |
966 Node *result_region; | 959 Node *result_region; |
1014 } | 1007 } |
1015 | 1008 |
1016 Node *slow_mem = mem; // save the current memory state for slow path | 1009 Node *slow_mem = mem; // save the current memory state for slow path |
1017 // generate the fast allocation code unless we know that the initial test will always go slow | 1010 // generate the fast allocation code unless we know that the initial test will always go slow |
1018 if (!always_slow) { | 1011 if (!always_slow) { |
1012 // Fast path modifies only raw memory. | |
1013 if (mem->is_MergeMem()) { | |
1014 mem = mem->as_MergeMem()->memory_at(Compile::AliasIdxRaw); | |
1015 } | |
1016 | |
1019 Node* eden_top_adr; | 1017 Node* eden_top_adr; |
1020 Node* eden_end_adr; | 1018 Node* eden_end_adr; |
1021 | 1019 |
1022 set_eden_pointers(eden_top_adr, eden_end_adr); | 1020 set_eden_pointers(eden_top_adr, eden_end_adr); |
1023 | 1021 |
1236 _igvn._worklist.push(use); | 1234 _igvn._worklist.push(use); |
1237 // back up iterator | 1235 // back up iterator |
1238 --i; | 1236 --i; |
1239 } | 1237 } |
1240 } | 1238 } |
1241 | |
1242 mem = result_phi_rawmem; | |
1243 | 1239 |
1244 // An allocate node has separate i_o projections for the uses on the control and i_o paths | 1240 // An allocate node has separate i_o projections for the uses on the control and i_o paths |
1245 // Replace uses of the control i_o projection with result_phi_i_o (unless we are only generating a slow call) | 1241 // Replace uses of the control i_o projection with result_phi_i_o (unless we are only generating a slow call) |
1246 if (_ioproj_fallthrough == NULL) { | 1242 if (_ioproj_fallthrough == NULL) { |
1247 _ioproj_fallthrough = new (C, 1) ProjNode(call, TypeFunc::I_O); | 1243 _ioproj_fallthrough = new (C, 1) ProjNode(call, TypeFunc::I_O); |