Mercurial > hg > truffle
comparison src/share/vm/opto/macro.cpp @ 6804:e626685e9f6c
7193318: C2: remove number of inputs requirement from Node's new operator
Summary: Deleted placement new operator of Node - node(size_t, Compile *, int).
Reviewed-by: kvn, twisti
Contributed-by: bharadwaj.yadavalli@oracle.com
author | kvn |
---|---|
date | Thu, 27 Sep 2012 09:38:42 -0700 |
parents | da91efe96a93 |
children | 8e47bac5643a |
comparison
equal
deleted
inserted
replaced
6803:06f52c4d0e18 | 6804:e626685e9f6c |
---|---|
101 } | 101 } |
102 | 102 |
103 Node* PhaseMacroExpand::opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path) { | 103 Node* PhaseMacroExpand::opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path) { |
104 Node* cmp; | 104 Node* cmp; |
105 if (mask != 0) { | 105 if (mask != 0) { |
106 Node* and_node = transform_later(new (C, 3) AndXNode(word, MakeConX(mask))); | 106 Node* and_node = transform_later(new (C) AndXNode(word, MakeConX(mask))); |
107 cmp = transform_later(new (C, 3) CmpXNode(and_node, MakeConX(bits))); | 107 cmp = transform_later(new (C) CmpXNode(and_node, MakeConX(bits))); |
108 } else { | 108 } else { |
109 cmp = word; | 109 cmp = word; |
110 } | 110 } |
111 Node* bol = transform_later(new (C, 2) BoolNode(cmp, BoolTest::ne)); | 111 Node* bol = transform_later(new (C) BoolNode(cmp, BoolTest::ne)); |
112 IfNode* iff = new (C, 2) IfNode( ctrl, bol, PROB_MIN, COUNT_UNKNOWN ); | 112 IfNode* iff = new (C) IfNode( ctrl, bol, PROB_MIN, COUNT_UNKNOWN ); |
113 transform_later(iff); | 113 transform_later(iff); |
114 | 114 |
115 // Fast path taken. | 115 // Fast path taken. |
116 Node *fast_taken = transform_later( new (C, 1) IfFalseNode(iff) ); | 116 Node *fast_taken = transform_later( new (C) IfFalseNode(iff) ); |
117 | 117 |
118 // Fast path not-taken, i.e. slow path | 118 // Fast path not-taken, i.e. slow path |
119 Node *slow_taken = transform_later( new (C, 1) IfTrueNode(iff) ); | 119 Node *slow_taken = transform_later( new (C) IfTrueNode(iff) ); |
120 | 120 |
121 if (return_fast_path) { | 121 if (return_fast_path) { |
122 region->init_req(edge, slow_taken); // Capture slow-control | 122 region->init_req(edge, slow_taken); // Capture slow-control |
123 return fast_taken; | 123 return fast_taken; |
124 } else { | 124 } else { |
139 | 139 |
140 //------------------------------make_slow_call--------------------------------- | 140 //------------------------------make_slow_call--------------------------------- |
141 CallNode* PhaseMacroExpand::make_slow_call(CallNode *oldcall, const TypeFunc* slow_call_type, address slow_call, const char* leaf_name, Node* slow_path, Node* parm0, Node* parm1) { | 141 CallNode* PhaseMacroExpand::make_slow_call(CallNode *oldcall, const TypeFunc* slow_call_type, address slow_call, const char* leaf_name, Node* slow_path, Node* parm0, Node* parm1) { |
142 | 142 |
143 // Slow-path call | 143 // Slow-path call |
144 int size = slow_call_type->domain()->cnt(); | |
145 CallNode *call = leaf_name | 144 CallNode *call = leaf_name |
146 ? (CallNode*)new (C, size) CallLeafNode ( slow_call_type, slow_call, leaf_name, TypeRawPtr::BOTTOM ) | 145 ? (CallNode*)new (C) CallLeafNode ( slow_call_type, slow_call, leaf_name, TypeRawPtr::BOTTOM ) |
147 : (CallNode*)new (C, size) CallStaticJavaNode( slow_call_type, slow_call, OptoRuntime::stub_name(slow_call), oldcall->jvms()->bci(), TypeRawPtr::BOTTOM ); | 146 : (CallNode*)new (C) CallStaticJavaNode( slow_call_type, slow_call, OptoRuntime::stub_name(slow_call), oldcall->jvms()->bci(), TypeRawPtr::BOTTOM ); |
148 | 147 |
149 // Slow path call has no side-effects, uses few values | 148 // Slow path call has no side-effects, uses few values |
150 copy_predefined_input_for_runtime_call(slow_path, oldcall, call ); | 149 copy_predefined_input_for_runtime_call(slow_path, oldcall, call ); |
151 if (parm0 != NULL) call->init_req(TypeFunc::Parms+0, parm0); | 150 if (parm0 != NULL) call->init_req(TypeFunc::Parms+0, parm0); |
152 if (parm1 != NULL) call->init_req(TypeFunc::Parms+1, parm1); | 151 if (parm1 != NULL) call->init_req(TypeFunc::Parms+1, parm1); |
410 | 409 |
411 uint length = mem->req(); | 410 uint length = mem->req(); |
412 GrowableArray <Node *> values(length, length, NULL, false); | 411 GrowableArray <Node *> values(length, length, NULL, false); |
413 | 412 |
414 // create a new Phi for the value | 413 // create a new Phi for the value |
415 PhiNode *phi = new (C, length) PhiNode(mem->in(0), phi_type, NULL, instance_id, alias_idx, offset); | 414 PhiNode *phi = new (C) PhiNode(mem->in(0), phi_type, NULL, instance_id, alias_idx, offset); |
416 transform_later(phi); | 415 transform_later(phi); |
417 value_phis->push(phi, mem->_idx); | 416 value_phis->push(phi, mem->_idx); |
418 | 417 |
419 for (uint j = 1; j < length; j++) { | 418 for (uint j = 1; j < length; j++) { |
420 Node *in = mem->in(j); | 419 Node *in = mem->in(j); |
718 // | 717 // |
719 while (safepoints.length() > 0) { | 718 while (safepoints.length() > 0) { |
720 SafePointNode* sfpt = safepoints.pop(); | 719 SafePointNode* sfpt = safepoints.pop(); |
721 Node* mem = sfpt->memory(); | 720 Node* mem = sfpt->memory(); |
722 uint first_ind = sfpt->req(); | 721 uint first_ind = sfpt->req(); |
723 SafePointScalarObjectNode* sobj = new (C, 1) SafePointScalarObjectNode(res_type, | 722 SafePointScalarObjectNode* sobj = new (C) SafePointScalarObjectNode(res_type, |
724 #ifdef ASSERT | 723 #ifdef ASSERT |
725 alloc, | 724 alloc, |
726 #endif | 725 #endif |
727 first_ind, nfields); | 726 first_ind, nfields); |
728 sobj->init_req(0, C->root()); | 727 sobj->init_req(0, C->root()); |
826 // Enable "DecodeN(EncodeP(Allocate)) --> Allocate" transformation | 825 // Enable "DecodeN(EncodeP(Allocate)) --> Allocate" transformation |
827 // to be able scalar replace the allocation. | 826 // to be able scalar replace the allocation. |
828 if (field_val->is_EncodeP()) { | 827 if (field_val->is_EncodeP()) { |
829 field_val = field_val->in(1); | 828 field_val = field_val->in(1); |
830 } else { | 829 } else { |
831 field_val = transform_later(new (C, 2) DecodeNNode(field_val, field_val->bottom_type()->make_ptr())); | 830 field_val = transform_later(new (C) DecodeNNode(field_val, field_val->bottom_type()->make_ptr())); |
832 } | 831 } |
833 } | 832 } |
834 sfpt->add_req(field_val); | 833 sfpt->add_req(field_val); |
835 } | 834 } |
836 JVMState *jvms = sfpt->jvms(); | 835 JVMState *jvms = sfpt->jvms(); |
993 | 992 |
994 | 993 |
995 //---------------------------set_eden_pointers------------------------- | 994 //---------------------------set_eden_pointers------------------------- |
996 void PhaseMacroExpand::set_eden_pointers(Node* &eden_top_adr, Node* &eden_end_adr) { | 995 void PhaseMacroExpand::set_eden_pointers(Node* &eden_top_adr, Node* &eden_end_adr) { |
997 if (UseTLAB) { // Private allocation: load from TLS | 996 if (UseTLAB) { // Private allocation: load from TLS |
998 Node* thread = transform_later(new (C, 1) ThreadLocalNode()); | 997 Node* thread = transform_later(new (C) ThreadLocalNode()); |
999 int tlab_top_offset = in_bytes(JavaThread::tlab_top_offset()); | 998 int tlab_top_offset = in_bytes(JavaThread::tlab_top_offset()); |
1000 int tlab_end_offset = in_bytes(JavaThread::tlab_end_offset()); | 999 int tlab_end_offset = in_bytes(JavaThread::tlab_end_offset()); |
1001 eden_top_adr = basic_plus_adr(top()/*not oop*/, thread, tlab_top_offset); | 1000 eden_top_adr = basic_plus_adr(top()/*not oop*/, thread, tlab_top_offset); |
1002 eden_end_adr = basic_plus_adr(top()/*not oop*/, thread, tlab_end_offset); | 1001 eden_end_adr = basic_plus_adr(top()/*not oop*/, thread, tlab_end_offset); |
1003 } else { // Shared allocation: load from globals | 1002 } else { // Shared allocation: load from globals |
1135 Node *toobig_false = ctrl; | 1134 Node *toobig_false = ctrl; |
1136 | 1135 |
1137 assert (initial_slow_test == NULL || !always_slow, "arguments must be consistent"); | 1136 assert (initial_slow_test == NULL || !always_slow, "arguments must be consistent"); |
1138 // generate the initial test if necessary | 1137 // generate the initial test if necessary |
1139 if (initial_slow_test != NULL ) { | 1138 if (initial_slow_test != NULL ) { |
1140 slow_region = new (C, 3) RegionNode(3); | 1139 slow_region = new (C) RegionNode(3); |
1141 | 1140 |
1142 // Now make the initial failure test. Usually a too-big test but | 1141 // Now make the initial failure test. Usually a too-big test but |
1143 // might be a TRUE for finalizers or a fancy class check for | 1142 // might be a TRUE for finalizers or a fancy class check for |
1144 // newInstance0. | 1143 // newInstance0. |
1145 IfNode *toobig_iff = new (C, 2) IfNode(ctrl, initial_slow_test, PROB_MIN, COUNT_UNKNOWN); | 1144 IfNode *toobig_iff = new (C) IfNode(ctrl, initial_slow_test, PROB_MIN, COUNT_UNKNOWN); |
1146 transform_later(toobig_iff); | 1145 transform_later(toobig_iff); |
1147 // Plug the failing-too-big test into the slow-path region | 1146 // Plug the failing-too-big test into the slow-path region |
1148 Node *toobig_true = new (C, 1) IfTrueNode( toobig_iff ); | 1147 Node *toobig_true = new (C) IfTrueNode( toobig_iff ); |
1149 transform_later(toobig_true); | 1148 transform_later(toobig_true); |
1150 slow_region ->init_req( too_big_or_final_path, toobig_true ); | 1149 slow_region ->init_req( too_big_or_final_path, toobig_true ); |
1151 toobig_false = new (C, 1) IfFalseNode( toobig_iff ); | 1150 toobig_false = new (C) IfFalseNode( toobig_iff ); |
1152 transform_later(toobig_false); | 1151 transform_later(toobig_false); |
1153 } else { // No initial test, just fall into next case | 1152 } else { // No initial test, just fall into next case |
1154 toobig_false = ctrl; | 1153 toobig_false = ctrl; |
1155 debug_only(slow_region = NodeSentinel); | 1154 debug_only(slow_region = NodeSentinel); |
1156 } | 1155 } |
1179 // prevent a degradation of the optimization. | 1178 // prevent a degradation of the optimization. |
1180 // See comment in memnode.hpp, around line 227 in class LoadPNode. | 1179 // See comment in memnode.hpp, around line 227 in class LoadPNode. |
1181 Node *eden_end = make_load(ctrl, mem, eden_end_adr, 0, TypeRawPtr::BOTTOM, T_ADDRESS); | 1180 Node *eden_end = make_load(ctrl, mem, eden_end_adr, 0, TypeRawPtr::BOTTOM, T_ADDRESS); |
1182 | 1181 |
1183 // allocate the Region and Phi nodes for the result | 1182 // allocate the Region and Phi nodes for the result |
1184 result_region = new (C, 3) RegionNode(3); | 1183 result_region = new (C) RegionNode(3); |
1185 result_phi_rawmem = new (C, 3) PhiNode(result_region, Type::MEMORY, TypeRawPtr::BOTTOM); | 1184 result_phi_rawmem = new (C) PhiNode(result_region, Type::MEMORY, TypeRawPtr::BOTTOM); |
1186 result_phi_rawoop = new (C, 3) PhiNode(result_region, TypeRawPtr::BOTTOM); | 1185 result_phi_rawoop = new (C) PhiNode(result_region, TypeRawPtr::BOTTOM); |
1187 result_phi_i_o = new (C, 3) PhiNode(result_region, Type::ABIO); // I/O is used for Prefetch | 1186 result_phi_i_o = new (C) PhiNode(result_region, Type::ABIO); // I/O is used for Prefetch |
1188 | 1187 |
1189 // We need a Region for the loop-back contended case. | 1188 // We need a Region for the loop-back contended case. |
1190 enum { fall_in_path = 1, contended_loopback_path = 2 }; | 1189 enum { fall_in_path = 1, contended_loopback_path = 2 }; |
1191 Node *contended_region; | 1190 Node *contended_region; |
1192 Node *contended_phi_rawmem; | 1191 Node *contended_phi_rawmem; |
1193 if (UseTLAB) { | 1192 if (UseTLAB) { |
1194 contended_region = toobig_false; | 1193 contended_region = toobig_false; |
1195 contended_phi_rawmem = mem; | 1194 contended_phi_rawmem = mem; |
1196 } else { | 1195 } else { |
1197 contended_region = new (C, 3) RegionNode(3); | 1196 contended_region = new (C) RegionNode(3); |
1198 contended_phi_rawmem = new (C, 3) PhiNode(contended_region, Type::MEMORY, TypeRawPtr::BOTTOM); | 1197 contended_phi_rawmem = new (C) PhiNode(contended_region, Type::MEMORY, TypeRawPtr::BOTTOM); |
1199 // Now handle the passing-too-big test. We fall into the contended | 1198 // Now handle the passing-too-big test. We fall into the contended |
1200 // loop-back merge point. | 1199 // loop-back merge point. |
1201 contended_region ->init_req(fall_in_path, toobig_false); | 1200 contended_region ->init_req(fall_in_path, toobig_false); |
1202 contended_phi_rawmem->init_req(fall_in_path, mem); | 1201 contended_phi_rawmem->init_req(fall_in_path, mem); |
1203 transform_later(contended_region); | 1202 transform_later(contended_region); |
1205 } | 1204 } |
1206 | 1205 |
1207 // Load(-locked) the heap top. | 1206 // Load(-locked) the heap top. |
1208 // See note above concerning the control input when using a TLAB | 1207 // See note above concerning the control input when using a TLAB |
1209 Node *old_eden_top = UseTLAB | 1208 Node *old_eden_top = UseTLAB |
1210 ? new (C, 3) LoadPNode (ctrl, contended_phi_rawmem, eden_top_adr, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM) | 1209 ? new (C) LoadPNode (ctrl, contended_phi_rawmem, eden_top_adr, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM) |
1211 : new (C, 3) LoadPLockedNode(contended_region, contended_phi_rawmem, eden_top_adr); | 1210 : new (C) LoadPLockedNode(contended_region, contended_phi_rawmem, eden_top_adr); |
1212 | 1211 |
1213 transform_later(old_eden_top); | 1212 transform_later(old_eden_top); |
1214 // Add to heap top to get a new heap top | 1213 // Add to heap top to get a new heap top |
1215 Node *new_eden_top = new (C, 4) AddPNode(top(), old_eden_top, size_in_bytes); | 1214 Node *new_eden_top = new (C) AddPNode(top(), old_eden_top, size_in_bytes); |
1216 transform_later(new_eden_top); | 1215 transform_later(new_eden_top); |
1217 // Check for needing a GC; compare against heap end | 1216 // Check for needing a GC; compare against heap end |
1218 Node *needgc_cmp = new (C, 3) CmpPNode(new_eden_top, eden_end); | 1217 Node *needgc_cmp = new (C) CmpPNode(new_eden_top, eden_end); |
1219 transform_later(needgc_cmp); | 1218 transform_later(needgc_cmp); |
1220 Node *needgc_bol = new (C, 2) BoolNode(needgc_cmp, BoolTest::ge); | 1219 Node *needgc_bol = new (C) BoolNode(needgc_cmp, BoolTest::ge); |
1221 transform_later(needgc_bol); | 1220 transform_later(needgc_bol); |
1222 IfNode *needgc_iff = new (C, 2) IfNode(contended_region, needgc_bol, PROB_UNLIKELY_MAG(4), COUNT_UNKNOWN); | 1221 IfNode *needgc_iff = new (C) IfNode(contended_region, needgc_bol, PROB_UNLIKELY_MAG(4), COUNT_UNKNOWN); |
1223 transform_later(needgc_iff); | 1222 transform_later(needgc_iff); |
1224 | 1223 |
1225 // Plug the failing-heap-space-need-gc test into the slow-path region | 1224 // Plug the failing-heap-space-need-gc test into the slow-path region |
1226 Node *needgc_true = new (C, 1) IfTrueNode(needgc_iff); | 1225 Node *needgc_true = new (C) IfTrueNode(needgc_iff); |
1227 transform_later(needgc_true); | 1226 transform_later(needgc_true); |
1228 if (initial_slow_test) { | 1227 if (initial_slow_test) { |
1229 slow_region->init_req(need_gc_path, needgc_true); | 1228 slow_region->init_req(need_gc_path, needgc_true); |
1230 // This completes all paths into the slow merge point | 1229 // This completes all paths into the slow merge point |
1231 transform_later(slow_region); | 1230 transform_later(slow_region); |
1232 } else { // No initial slow path needed! | 1231 } else { // No initial slow path needed! |
1233 // Just fall from the need-GC path straight into the VM call. | 1232 // Just fall from the need-GC path straight into the VM call. |
1234 slow_region = needgc_true; | 1233 slow_region = needgc_true; |
1235 } | 1234 } |
1236 // No need for a GC. Setup for the Store-Conditional | 1235 // No need for a GC. Setup for the Store-Conditional |
1237 Node *needgc_false = new (C, 1) IfFalseNode(needgc_iff); | 1236 Node *needgc_false = new (C) IfFalseNode(needgc_iff); |
1238 transform_later(needgc_false); | 1237 transform_later(needgc_false); |
1239 | 1238 |
1240 // Grab regular I/O before optional prefetch may change it. | 1239 // Grab regular I/O before optional prefetch may change it. |
1241 // Slow-path does no I/O so just set it to the original I/O. | 1240 // Slow-path does no I/O so just set it to the original I/O. |
1242 result_phi_i_o->init_req(slow_result_path, i_o); | 1241 result_phi_i_o->init_req(slow_result_path, i_o); |
1252 // Store (-conditional) the modified eden top back down. | 1251 // Store (-conditional) the modified eden top back down. |
1253 // StorePConditional produces flags for a test PLUS a modified raw | 1252 // StorePConditional produces flags for a test PLUS a modified raw |
1254 // memory state. | 1253 // memory state. |
1255 if (UseTLAB) { | 1254 if (UseTLAB) { |
1256 Node* store_eden_top = | 1255 Node* store_eden_top = |
1257 new (C, 4) StorePNode(needgc_false, contended_phi_rawmem, eden_top_adr, | 1256 new (C) StorePNode(needgc_false, contended_phi_rawmem, eden_top_adr, |
1258 TypeRawPtr::BOTTOM, new_eden_top); | 1257 TypeRawPtr::BOTTOM, new_eden_top); |
1259 transform_later(store_eden_top); | 1258 transform_later(store_eden_top); |
1260 fast_oop_ctrl = needgc_false; // No contention, so this is the fast path | 1259 fast_oop_ctrl = needgc_false; // No contention, so this is the fast path |
1261 fast_oop_rawmem = store_eden_top; | 1260 fast_oop_rawmem = store_eden_top; |
1262 } else { | 1261 } else { |
1263 Node* store_eden_top = | 1262 Node* store_eden_top = |
1264 new (C, 5) StorePConditionalNode(needgc_false, contended_phi_rawmem, eden_top_adr, | 1263 new (C) StorePConditionalNode(needgc_false, contended_phi_rawmem, eden_top_adr, |
1265 new_eden_top, fast_oop/*old_eden_top*/); | 1264 new_eden_top, fast_oop/*old_eden_top*/); |
1266 transform_later(store_eden_top); | 1265 transform_later(store_eden_top); |
1267 Node *contention_check = new (C, 2) BoolNode(store_eden_top, BoolTest::ne); | 1266 Node *contention_check = new (C) BoolNode(store_eden_top, BoolTest::ne); |
1268 transform_later(contention_check); | 1267 transform_later(contention_check); |
1269 store_eden_top = new (C, 1) SCMemProjNode(store_eden_top); | 1268 store_eden_top = new (C) SCMemProjNode(store_eden_top); |
1270 transform_later(store_eden_top); | 1269 transform_later(store_eden_top); |
1271 | 1270 |
1272 // If not using TLABs, check to see if there was contention. | 1271 // If not using TLABs, check to see if there was contention. |
1273 IfNode *contention_iff = new (C, 2) IfNode (needgc_false, contention_check, PROB_MIN, COUNT_UNKNOWN); | 1272 IfNode *contention_iff = new (C) IfNode (needgc_false, contention_check, PROB_MIN, COUNT_UNKNOWN); |
1274 transform_later(contention_iff); | 1273 transform_later(contention_iff); |
1275 Node *contention_true = new (C, 1) IfTrueNode(contention_iff); | 1274 Node *contention_true = new (C) IfTrueNode(contention_iff); |
1276 transform_later(contention_true); | 1275 transform_later(contention_true); |
1277 // If contention, loopback and try again. | 1276 // If contention, loopback and try again. |
1278 contended_region->init_req(contended_loopback_path, contention_true); | 1277 contended_region->init_req(contended_loopback_path, contention_true); |
1279 contended_phi_rawmem->init_req(contended_loopback_path, store_eden_top); | 1278 contended_phi_rawmem->init_req(contended_loopback_path, store_eden_top); |
1280 | 1279 |
1281 // Fast-path succeeded with no contention! | 1280 // Fast-path succeeded with no contention! |
1282 Node *contention_false = new (C, 1) IfFalseNode(contention_iff); | 1281 Node *contention_false = new (C) IfFalseNode(contention_iff); |
1283 transform_later(contention_false); | 1282 transform_later(contention_false); |
1284 fast_oop_ctrl = contention_false; | 1283 fast_oop_ctrl = contention_false; |
1285 | 1284 |
1286 // Bump total allocated bytes for this thread | 1285 // Bump total allocated bytes for this thread |
1287 Node* thread = new (C, 1) ThreadLocalNode(); | 1286 Node* thread = new (C) ThreadLocalNode(); |
1288 transform_later(thread); | 1287 transform_later(thread); |
1289 Node* alloc_bytes_adr = basic_plus_adr(top()/*not oop*/, thread, | 1288 Node* alloc_bytes_adr = basic_plus_adr(top()/*not oop*/, thread, |
1290 in_bytes(JavaThread::allocated_bytes_offset())); | 1289 in_bytes(JavaThread::allocated_bytes_offset())); |
1291 Node* alloc_bytes = make_load(fast_oop_ctrl, store_eden_top, alloc_bytes_adr, | 1290 Node* alloc_bytes = make_load(fast_oop_ctrl, store_eden_top, alloc_bytes_adr, |
1292 0, TypeLong::LONG, T_LONG); | 1291 0, TypeLong::LONG, T_LONG); |
1293 #ifdef _LP64 | 1292 #ifdef _LP64 |
1294 Node* alloc_size = size_in_bytes; | 1293 Node* alloc_size = size_in_bytes; |
1295 #else | 1294 #else |
1296 Node* alloc_size = new (C, 2) ConvI2LNode(size_in_bytes); | 1295 Node* alloc_size = new (C) ConvI2LNode(size_in_bytes); |
1297 transform_later(alloc_size); | 1296 transform_later(alloc_size); |
1298 #endif | 1297 #endif |
1299 Node* new_alloc_bytes = new (C, 3) AddLNode(alloc_bytes, alloc_size); | 1298 Node* new_alloc_bytes = new (C) AddLNode(alloc_bytes, alloc_size); |
1300 transform_later(new_alloc_bytes); | 1299 transform_later(new_alloc_bytes); |
1301 fast_oop_rawmem = make_store(fast_oop_ctrl, store_eden_top, alloc_bytes_adr, | 1300 fast_oop_rawmem = make_store(fast_oop_ctrl, store_eden_top, alloc_bytes_adr, |
1302 0, new_alloc_bytes, T_LONG); | 1301 0, new_alloc_bytes, T_LONG); |
1303 } | 1302 } |
1304 | 1303 |
1321 MemBarNode* mb = MemBarNode::make(C, Op_MemBarStoreStore, Compile::AliasIdxBot, fast_oop_rawmem); | 1320 MemBarNode* mb = MemBarNode::make(C, Op_MemBarStoreStore, Compile::AliasIdxBot, fast_oop_rawmem); |
1322 transform_later(mb); | 1321 transform_later(mb); |
1323 | 1322 |
1324 mb->init_req(TypeFunc::Memory, fast_oop_rawmem); | 1323 mb->init_req(TypeFunc::Memory, fast_oop_rawmem); |
1325 mb->init_req(TypeFunc::Control, fast_oop_ctrl); | 1324 mb->init_req(TypeFunc::Control, fast_oop_ctrl); |
1326 fast_oop_ctrl = new (C, 1) ProjNode(mb,TypeFunc::Control); | 1325 fast_oop_ctrl = new (C) ProjNode(mb,TypeFunc::Control); |
1327 transform_later(fast_oop_ctrl); | 1326 transform_later(fast_oop_ctrl); |
1328 fast_oop_rawmem = new (C, 1) ProjNode(mb,TypeFunc::Memory); | 1327 fast_oop_rawmem = new (C) ProjNode(mb,TypeFunc::Memory); |
1329 transform_later(fast_oop_rawmem); | 1328 transform_later(fast_oop_rawmem); |
1330 } else { | 1329 } else { |
1331 // Add the MemBarStoreStore after the InitializeNode so that | 1330 // Add the MemBarStoreStore after the InitializeNode so that |
1332 // all stores performing the initialization that were moved | 1331 // all stores performing the initialization that were moved |
1333 // before the InitializeNode happen before the storestore | 1332 // before the InitializeNode happen before the storestore |
1337 Node* init_mem = init->proj_out(TypeFunc::Memory); | 1336 Node* init_mem = init->proj_out(TypeFunc::Memory); |
1338 | 1337 |
1339 MemBarNode* mb = MemBarNode::make(C, Op_MemBarStoreStore, Compile::AliasIdxBot); | 1338 MemBarNode* mb = MemBarNode::make(C, Op_MemBarStoreStore, Compile::AliasIdxBot); |
1340 transform_later(mb); | 1339 transform_later(mb); |
1341 | 1340 |
1342 Node* ctrl = new (C, 1) ProjNode(init,TypeFunc::Control); | 1341 Node* ctrl = new (C) ProjNode(init,TypeFunc::Control); |
1343 transform_later(ctrl); | 1342 transform_later(ctrl); |
1344 Node* mem = new (C, 1) ProjNode(init,TypeFunc::Memory); | 1343 Node* mem = new (C) ProjNode(init,TypeFunc::Memory); |
1345 transform_later(mem); | 1344 transform_later(mem); |
1346 | 1345 |
1347 // The MemBarStoreStore depends on control and memory coming | 1346 // The MemBarStoreStore depends on control and memory coming |
1348 // from the InitializeNode | 1347 // from the InitializeNode |
1349 mb->init_req(TypeFunc::Memory, mem); | 1348 mb->init_req(TypeFunc::Memory, mem); |
1350 mb->init_req(TypeFunc::Control, ctrl); | 1349 mb->init_req(TypeFunc::Control, ctrl); |
1351 | 1350 |
1352 ctrl = new (C, 1) ProjNode(mb,TypeFunc::Control); | 1351 ctrl = new (C) ProjNode(mb,TypeFunc::Control); |
1353 transform_later(ctrl); | 1352 transform_later(ctrl); |
1354 mem = new (C, 1) ProjNode(mb,TypeFunc::Memory); | 1353 mem = new (C) ProjNode(mb,TypeFunc::Memory); |
1355 transform_later(mem); | 1354 transform_later(mem); |
1356 | 1355 |
1357 // All nodes that depended on the InitializeNode for control | 1356 // All nodes that depended on the InitializeNode for control |
1358 // and memory must now depend on the MemBarNode that itself | 1357 // and memory must now depend on the MemBarNode that itself |
1359 // depends on the InitializeNode | 1358 // depends on the InitializeNode |
1363 } | 1362 } |
1364 | 1363 |
1365 if (C->env()->dtrace_extended_probes()) { | 1364 if (C->env()->dtrace_extended_probes()) { |
1366 // Slow-path call | 1365 // Slow-path call |
1367 int size = TypeFunc::Parms + 2; | 1366 int size = TypeFunc::Parms + 2; |
1368 CallLeafNode *call = new (C, size) CallLeafNode(OptoRuntime::dtrace_object_alloc_Type(), | 1367 CallLeafNode *call = new (C) CallLeafNode(OptoRuntime::dtrace_object_alloc_Type(), |
1369 CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc_base), | 1368 CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc_base), |
1370 "dtrace_object_alloc", | 1369 "dtrace_object_alloc", |
1371 TypeRawPtr::BOTTOM); | 1370 TypeRawPtr::BOTTOM); |
1372 | 1371 |
1373 // Get base of thread-local storage area | 1372 // Get base of thread-local storage area |
1374 Node* thread = new (C, 1) ThreadLocalNode(); | 1373 Node* thread = new (C) ThreadLocalNode(); |
1375 transform_later(thread); | 1374 transform_later(thread); |
1376 | 1375 |
1377 call->init_req(TypeFunc::Parms+0, thread); | 1376 call->init_req(TypeFunc::Parms+0, thread); |
1378 call->init_req(TypeFunc::Parms+1, fast_oop); | 1377 call->init_req(TypeFunc::Parms+1, fast_oop); |
1379 call->init_req(TypeFunc::Control, fast_oop_ctrl); | 1378 call->init_req(TypeFunc::Control, fast_oop_ctrl); |
1380 call->init_req(TypeFunc::I_O , top()); // does no i/o | 1379 call->init_req(TypeFunc::I_O , top()); // does no i/o |
1381 call->init_req(TypeFunc::Memory , fast_oop_rawmem); | 1380 call->init_req(TypeFunc::Memory , fast_oop_rawmem); |
1382 call->init_req(TypeFunc::ReturnAdr, alloc->in(TypeFunc::ReturnAdr)); | 1381 call->init_req(TypeFunc::ReturnAdr, alloc->in(TypeFunc::ReturnAdr)); |
1383 call->init_req(TypeFunc::FramePtr, alloc->in(TypeFunc::FramePtr)); | 1382 call->init_req(TypeFunc::FramePtr, alloc->in(TypeFunc::FramePtr)); |
1384 transform_later(call); | 1383 transform_later(call); |
1385 fast_oop_ctrl = new (C, 1) ProjNode(call,TypeFunc::Control); | 1384 fast_oop_ctrl = new (C) ProjNode(call,TypeFunc::Control); |
1386 transform_later(fast_oop_ctrl); | 1385 transform_later(fast_oop_ctrl); |
1387 fast_oop_rawmem = new (C, 1) ProjNode(call,TypeFunc::Memory); | 1386 fast_oop_rawmem = new (C) ProjNode(call,TypeFunc::Memory); |
1388 transform_later(fast_oop_rawmem); | 1387 transform_later(fast_oop_rawmem); |
1389 } | 1388 } |
1390 | 1389 |
1391 // Plug in the successful fast-path into the result merge point | 1390 // Plug in the successful fast-path into the result merge point |
1392 result_region ->init_req(fast_result_path, fast_oop_ctrl); | 1391 result_region ->init_req(fast_result_path, fast_oop_ctrl); |
1397 slow_region = ctrl; | 1396 slow_region = ctrl; |
1398 result_phi_i_o = i_o; // Rename it to use in the following code. | 1397 result_phi_i_o = i_o; // Rename it to use in the following code. |
1399 } | 1398 } |
1400 | 1399 |
1401 // Generate slow-path call | 1400 // Generate slow-path call |
1402 CallNode *call = new (C, slow_call_type->domain()->cnt()) | 1401 CallNode *call = new (C) CallStaticJavaNode(slow_call_type, slow_call_address, |
1403 CallStaticJavaNode(slow_call_type, slow_call_address, | 1402 OptoRuntime::stub_name(slow_call_address), |
1404 OptoRuntime::stub_name(slow_call_address), | 1403 alloc->jvms()->bci(), |
1405 alloc->jvms()->bci(), | 1404 TypePtr::BOTTOM); |
1406 TypePtr::BOTTOM); | |
1407 call->init_req( TypeFunc::Control, slow_region ); | 1405 call->init_req( TypeFunc::Control, slow_region ); |
1408 call->init_req( TypeFunc::I_O , top() ) ; // does no i/o | 1406 call->init_req( TypeFunc::I_O , top() ) ; // does no i/o |
1409 call->init_req( TypeFunc::Memory , slow_mem ); // may gc ptrs | 1407 call->init_req( TypeFunc::Memory , slow_mem ); // may gc ptrs |
1410 call->init_req( TypeFunc::ReturnAdr, alloc->in(TypeFunc::ReturnAdr) ); | 1408 call->init_req( TypeFunc::ReturnAdr, alloc->in(TypeFunc::ReturnAdr) ); |
1411 call->init_req( TypeFunc::FramePtr, alloc->in(TypeFunc::FramePtr) ); | 1409 call->init_req( TypeFunc::FramePtr, alloc->in(TypeFunc::FramePtr) ); |
1455 } | 1453 } |
1456 // Now change uses of _memproj_catchall to use _memproj_fallthrough and delete | 1454 // Now change uses of _memproj_catchall to use _memproj_fallthrough and delete |
1457 // _memproj_catchall so we end up with a call that has only 1 memory projection. | 1455 // _memproj_catchall so we end up with a call that has only 1 memory projection. |
1458 if (_memproj_catchall != NULL ) { | 1456 if (_memproj_catchall != NULL ) { |
1459 if (_memproj_fallthrough == NULL) { | 1457 if (_memproj_fallthrough == NULL) { |
1460 _memproj_fallthrough = new (C, 1) ProjNode(call, TypeFunc::Memory); | 1458 _memproj_fallthrough = new (C) ProjNode(call, TypeFunc::Memory); |
1461 transform_later(_memproj_fallthrough); | 1459 transform_later(_memproj_fallthrough); |
1462 } | 1460 } |
1463 for (DUIterator_Fast imax, i = _memproj_catchall->fast_outs(imax); i < imax; i++) { | 1461 for (DUIterator_Fast imax, i = _memproj_catchall->fast_outs(imax); i < imax; i++) { |
1464 Node *use = _memproj_catchall->fast_out(i); | 1462 Node *use = _memproj_catchall->fast_out(i); |
1465 _igvn.rehash_node_delayed(use); | 1463 _igvn.rehash_node_delayed(use); |
1487 } | 1485 } |
1488 // Now change uses of _ioproj_catchall to use _ioproj_fallthrough and delete | 1486 // Now change uses of _ioproj_catchall to use _ioproj_fallthrough and delete |
1489 // _ioproj_catchall so we end up with a call that has only 1 i_o projection. | 1487 // _ioproj_catchall so we end up with a call that has only 1 i_o projection. |
1490 if (_ioproj_catchall != NULL ) { | 1488 if (_ioproj_catchall != NULL ) { |
1491 if (_ioproj_fallthrough == NULL) { | 1489 if (_ioproj_fallthrough == NULL) { |
1492 _ioproj_fallthrough = new (C, 1) ProjNode(call, TypeFunc::I_O); | 1490 _ioproj_fallthrough = new (C) ProjNode(call, TypeFunc::I_O); |
1493 transform_later(_ioproj_fallthrough); | 1491 transform_later(_ioproj_fallthrough); |
1494 } | 1492 } |
1495 for (DUIterator_Fast imax, i = _ioproj_catchall->fast_outs(imax); i < imax; i++) { | 1493 for (DUIterator_Fast imax, i = _ioproj_catchall->fast_outs(imax); i < imax; i++) { |
1496 Node *use = _ioproj_catchall->fast_out(i); | 1494 Node *use = _ioproj_catchall->fast_out(i); |
1497 _igvn.rehash_node_delayed(use); | 1495 _igvn.rehash_node_delayed(use); |
1621 if( UseTLAB && AllocatePrefetchStyle == 2 ) { | 1619 if( UseTLAB && AllocatePrefetchStyle == 2 ) { |
1622 // Generate prefetch allocation with watermark check. | 1620 // Generate prefetch allocation with watermark check. |
1623 // As an allocation hits the watermark, we will prefetch starting | 1621 // As an allocation hits the watermark, we will prefetch starting |
1624 // at a "distance" away from watermark. | 1622 // at a "distance" away from watermark. |
1625 | 1623 |
1626 Node *pf_region = new (C, 3) RegionNode(3); | 1624 Node *pf_region = new (C) RegionNode(3); |
1627 Node *pf_phi_rawmem = new (C, 3) PhiNode( pf_region, Type::MEMORY, | 1625 Node *pf_phi_rawmem = new (C) PhiNode( pf_region, Type::MEMORY, |
1628 TypeRawPtr::BOTTOM ); | 1626 TypeRawPtr::BOTTOM ); |
1629 // I/O is used for Prefetch | 1627 // I/O is used for Prefetch |
1630 Node *pf_phi_abio = new (C, 3) PhiNode( pf_region, Type::ABIO ); | 1628 Node *pf_phi_abio = new (C) PhiNode( pf_region, Type::ABIO ); |
1631 | 1629 |
1632 Node *thread = new (C, 1) ThreadLocalNode(); | 1630 Node *thread = new (C) ThreadLocalNode(); |
1633 transform_later(thread); | 1631 transform_later(thread); |
1634 | 1632 |
1635 Node *eden_pf_adr = new (C, 4) AddPNode( top()/*not oop*/, thread, | 1633 Node *eden_pf_adr = new (C) AddPNode( top()/*not oop*/, thread, |
1636 _igvn.MakeConX(in_bytes(JavaThread::tlab_pf_top_offset())) ); | 1634 _igvn.MakeConX(in_bytes(JavaThread::tlab_pf_top_offset())) ); |
1637 transform_later(eden_pf_adr); | 1635 transform_later(eden_pf_adr); |
1638 | 1636 |
1639 Node *old_pf_wm = new (C, 3) LoadPNode( needgc_false, | 1637 Node *old_pf_wm = new (C) LoadPNode( needgc_false, |
1640 contended_phi_rawmem, eden_pf_adr, | 1638 contended_phi_rawmem, eden_pf_adr, |
1641 TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM ); | 1639 TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM ); |
1642 transform_later(old_pf_wm); | 1640 transform_later(old_pf_wm); |
1643 | 1641 |
1644 // check against new_eden_top | 1642 // check against new_eden_top |
1645 Node *need_pf_cmp = new (C, 3) CmpPNode( new_eden_top, old_pf_wm ); | 1643 Node *need_pf_cmp = new (C) CmpPNode( new_eden_top, old_pf_wm ); |
1646 transform_later(need_pf_cmp); | 1644 transform_later(need_pf_cmp); |
1647 Node *need_pf_bol = new (C, 2) BoolNode( need_pf_cmp, BoolTest::ge ); | 1645 Node *need_pf_bol = new (C) BoolNode( need_pf_cmp, BoolTest::ge ); |
1648 transform_later(need_pf_bol); | 1646 transform_later(need_pf_bol); |
1649 IfNode *need_pf_iff = new (C, 2) IfNode( needgc_false, need_pf_bol, | 1647 IfNode *need_pf_iff = new (C) IfNode( needgc_false, need_pf_bol, |
1650 PROB_UNLIKELY_MAG(4), COUNT_UNKNOWN ); | 1648 PROB_UNLIKELY_MAG(4), COUNT_UNKNOWN ); |
1651 transform_later(need_pf_iff); | 1649 transform_later(need_pf_iff); |
1652 | 1650 |
1653 // true node, add prefetchdistance | 1651 // true node, add prefetchdistance |
1654 Node *need_pf_true = new (C, 1) IfTrueNode( need_pf_iff ); | 1652 Node *need_pf_true = new (C) IfTrueNode( need_pf_iff ); |
1655 transform_later(need_pf_true); | 1653 transform_later(need_pf_true); |
1656 | 1654 |
1657 Node *need_pf_false = new (C, 1) IfFalseNode( need_pf_iff ); | 1655 Node *need_pf_false = new (C) IfFalseNode( need_pf_iff ); |
1658 transform_later(need_pf_false); | 1656 transform_later(need_pf_false); |
1659 | 1657 |
1660 Node *new_pf_wmt = new (C, 4) AddPNode( top(), old_pf_wm, | 1658 Node *new_pf_wmt = new (C) AddPNode( top(), old_pf_wm, |
1661 _igvn.MakeConX(AllocatePrefetchDistance) ); | 1659 _igvn.MakeConX(AllocatePrefetchDistance) ); |
1662 transform_later(new_pf_wmt ); | 1660 transform_later(new_pf_wmt ); |
1663 new_pf_wmt->set_req(0, need_pf_true); | 1661 new_pf_wmt->set_req(0, need_pf_true); |
1664 | 1662 |
1665 Node *store_new_wmt = new (C, 4) StorePNode( need_pf_true, | 1663 Node *store_new_wmt = new (C) StorePNode( need_pf_true, |
1666 contended_phi_rawmem, eden_pf_adr, | 1664 contended_phi_rawmem, eden_pf_adr, |
1667 TypeRawPtr::BOTTOM, new_pf_wmt ); | 1665 TypeRawPtr::BOTTOM, new_pf_wmt ); |
1668 transform_later(store_new_wmt); | 1666 transform_later(store_new_wmt); |
1669 | 1667 |
1670 // adding prefetches | 1668 // adding prefetches |
1675 uint lines = AllocatePrefetchDistance / AllocatePrefetchStepSize; | 1673 uint lines = AllocatePrefetchDistance / AllocatePrefetchStepSize; |
1676 uint step_size = AllocatePrefetchStepSize; | 1674 uint step_size = AllocatePrefetchStepSize; |
1677 uint distance = 0; | 1675 uint distance = 0; |
1678 | 1676 |
1679 for ( uint i = 0; i < lines; i++ ) { | 1677 for ( uint i = 0; i < lines; i++ ) { |
1680 prefetch_adr = new (C, 4) AddPNode( old_pf_wm, new_pf_wmt, | 1678 prefetch_adr = new (C) AddPNode( old_pf_wm, new_pf_wmt, |
1681 _igvn.MakeConX(distance) ); | 1679 _igvn.MakeConX(distance) ); |
1682 transform_later(prefetch_adr); | 1680 transform_later(prefetch_adr); |
1683 prefetch = new (C, 3) PrefetchAllocationNode( i_o, prefetch_adr ); | 1681 prefetch = new (C) PrefetchAllocationNode( i_o, prefetch_adr ); |
1684 transform_later(prefetch); | 1682 transform_later(prefetch); |
1685 distance += step_size; | 1683 distance += step_size; |
1686 i_o = prefetch; | 1684 i_o = prefetch; |
1687 } | 1685 } |
1688 pf_phi_abio->set_req( pf_path, i_o ); | 1686 pf_phi_abio->set_req( pf_path, i_o ); |
1701 contended_phi_rawmem = pf_phi_rawmem; | 1699 contended_phi_rawmem = pf_phi_rawmem; |
1702 i_o = pf_phi_abio; | 1700 i_o = pf_phi_abio; |
1703 } else if( UseTLAB && AllocatePrefetchStyle == 3 ) { | 1701 } else if( UseTLAB && AllocatePrefetchStyle == 3 ) { |
1704 // Insert a prefetch for each allocation. | 1702 // Insert a prefetch for each allocation. |
1705 // This code is used for Sparc with BIS. | 1703 // This code is used for Sparc with BIS. |
1706 Node *pf_region = new (C, 3) RegionNode(3); | 1704 Node *pf_region = new (C) RegionNode(3); |
1707 Node *pf_phi_rawmem = new (C, 3) PhiNode( pf_region, Type::MEMORY, | 1705 Node *pf_phi_rawmem = new (C) PhiNode( pf_region, Type::MEMORY, |
1708 TypeRawPtr::BOTTOM ); | 1706 TypeRawPtr::BOTTOM ); |
1709 | 1707 |
1710 // Generate several prefetch instructions. | 1708 // Generate several prefetch instructions. |
1711 uint lines = (length != NULL) ? AllocatePrefetchLines : AllocateInstancePrefetchLines; | 1709 uint lines = (length != NULL) ? AllocatePrefetchLines : AllocateInstancePrefetchLines; |
1712 uint step_size = AllocatePrefetchStepSize; | 1710 uint step_size = AllocatePrefetchStepSize; |
1713 uint distance = AllocatePrefetchDistance; | 1711 uint distance = AllocatePrefetchDistance; |
1714 | 1712 |
1715 // Next cache address. | 1713 // Next cache address. |
1716 Node *cache_adr = new (C, 4) AddPNode(old_eden_top, old_eden_top, | 1714 Node *cache_adr = new (C) AddPNode(old_eden_top, old_eden_top, |
1717 _igvn.MakeConX(distance)); | 1715 _igvn.MakeConX(distance)); |
1718 transform_later(cache_adr); | 1716 transform_later(cache_adr); |
1719 cache_adr = new (C, 2) CastP2XNode(needgc_false, cache_adr); | 1717 cache_adr = new (C) CastP2XNode(needgc_false, cache_adr); |
1720 transform_later(cache_adr); | 1718 transform_later(cache_adr); |
1721 Node* mask = _igvn.MakeConX(~(intptr_t)(step_size-1)); | 1719 Node* mask = _igvn.MakeConX(~(intptr_t)(step_size-1)); |
1722 cache_adr = new (C, 3) AndXNode(cache_adr, mask); | 1720 cache_adr = new (C) AndXNode(cache_adr, mask); |
1723 transform_later(cache_adr); | 1721 transform_later(cache_adr); |
1724 cache_adr = new (C, 2) CastX2PNode(cache_adr); | 1722 cache_adr = new (C) CastX2PNode(cache_adr); |
1725 transform_later(cache_adr); | 1723 transform_later(cache_adr); |
1726 | 1724 |
1727 // Prefetch | 1725 // Prefetch |
1728 Node *prefetch = new (C, 3) PrefetchAllocationNode( contended_phi_rawmem, cache_adr ); | 1726 Node *prefetch = new (C) PrefetchAllocationNode( contended_phi_rawmem, cache_adr ); |
1729 prefetch->set_req(0, needgc_false); | 1727 prefetch->set_req(0, needgc_false); |
1730 transform_later(prefetch); | 1728 transform_later(prefetch); |
1731 contended_phi_rawmem = prefetch; | 1729 contended_phi_rawmem = prefetch; |
1732 Node *prefetch_adr; | 1730 Node *prefetch_adr; |
1733 distance = step_size; | 1731 distance = step_size; |
1734 for ( uint i = 1; i < lines; i++ ) { | 1732 for ( uint i = 1; i < lines; i++ ) { |
1735 prefetch_adr = new (C, 4) AddPNode( cache_adr, cache_adr, | 1733 prefetch_adr = new (C) AddPNode( cache_adr, cache_adr, |
1736 _igvn.MakeConX(distance) ); | 1734 _igvn.MakeConX(distance) ); |
1737 transform_later(prefetch_adr); | 1735 transform_later(prefetch_adr); |
1738 prefetch = new (C, 3) PrefetchAllocationNode( contended_phi_rawmem, prefetch_adr ); | 1736 prefetch = new (C) PrefetchAllocationNode( contended_phi_rawmem, prefetch_adr ); |
1739 transform_later(prefetch); | 1737 transform_later(prefetch); |
1740 distance += step_size; | 1738 distance += step_size; |
1741 contended_phi_rawmem = prefetch; | 1739 contended_phi_rawmem = prefetch; |
1742 } | 1740 } |
1743 } else if( AllocatePrefetchStyle > 0 ) { | 1741 } else if( AllocatePrefetchStyle > 0 ) { |
1747 // Generate several prefetch instructions. | 1745 // Generate several prefetch instructions. |
1748 uint lines = (length != NULL) ? AllocatePrefetchLines : AllocateInstancePrefetchLines; | 1746 uint lines = (length != NULL) ? AllocatePrefetchLines : AllocateInstancePrefetchLines; |
1749 uint step_size = AllocatePrefetchStepSize; | 1747 uint step_size = AllocatePrefetchStepSize; |
1750 uint distance = AllocatePrefetchDistance; | 1748 uint distance = AllocatePrefetchDistance; |
1751 for ( uint i = 0; i < lines; i++ ) { | 1749 for ( uint i = 0; i < lines; i++ ) { |
1752 prefetch_adr = new (C, 4) AddPNode( old_eden_top, new_eden_top, | 1750 prefetch_adr = new (C) AddPNode( old_eden_top, new_eden_top, |
1753 _igvn.MakeConX(distance) ); | 1751 _igvn.MakeConX(distance) ); |
1754 transform_later(prefetch_adr); | 1752 transform_later(prefetch_adr); |
1755 prefetch = new (C, 3) PrefetchAllocationNode( i_o, prefetch_adr ); | 1753 prefetch = new (C) PrefetchAllocationNode( i_o, prefetch_adr ); |
1756 // Do not let it float too high, since if eden_top == eden_end, | 1754 // Do not let it float too high, since if eden_top == eden_end, |
1757 // both might be null. | 1755 // both might be null. |
1758 if( i == 0 ) { // Set control for first prefetch, next follows it | 1756 if( i == 0 ) { // Set control for first prefetch, next follows it |
1759 prefetch->init_req(0, needgc_false); | 1757 prefetch->init_req(0, needgc_false); |
1760 } | 1758 } |
2099 * OptoRuntime::complete_monitor_locking_Java(obj); | 2097 * OptoRuntime::complete_monitor_locking_Java(obj); |
2100 * } | 2098 * } |
2101 * } | 2099 * } |
2102 */ | 2100 */ |
2103 | 2101 |
2104 region = new (C, 5) RegionNode(5); | 2102 region = new (C) RegionNode(5); |
2105 // create a Phi for the memory state | 2103 // create a Phi for the memory state |
2106 mem_phi = new (C, 5) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); | 2104 mem_phi = new (C) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); |
2107 | 2105 |
2108 Node* fast_lock_region = new (C, 3) RegionNode(3); | 2106 Node* fast_lock_region = new (C) RegionNode(3); |
2109 Node* fast_lock_mem_phi = new (C, 3) PhiNode( fast_lock_region, Type::MEMORY, TypeRawPtr::BOTTOM); | 2107 Node* fast_lock_mem_phi = new (C) PhiNode( fast_lock_region, Type::MEMORY, TypeRawPtr::BOTTOM); |
2110 | 2108 |
2111 // First, check mark word for the biased lock pattern. | 2109 // First, check mark word for the biased lock pattern. |
2112 Node* mark_node = make_load(ctrl, mem, obj, oopDesc::mark_offset_in_bytes(), TypeX_X, TypeX_X->basic_type()); | 2110 Node* mark_node = make_load(ctrl, mem, obj, oopDesc::mark_offset_in_bytes(), TypeX_X, TypeX_X->basic_type()); |
2113 | 2111 |
2114 // Get fast path - mark word has the biased lock pattern. | 2112 // Get fast path - mark word has the biased lock pattern. |
2134 #endif | 2132 #endif |
2135 klass_node->init_req(0, ctrl); | 2133 klass_node->init_req(0, ctrl); |
2136 } | 2134 } |
2137 Node *proto_node = make_load(ctrl, mem, klass_node, in_bytes(Klass::prototype_header_offset()), TypeX_X, TypeX_X->basic_type()); | 2135 Node *proto_node = make_load(ctrl, mem, klass_node, in_bytes(Klass::prototype_header_offset()), TypeX_X, TypeX_X->basic_type()); |
2138 | 2136 |
2139 Node* thread = transform_later(new (C, 1) ThreadLocalNode()); | 2137 Node* thread = transform_later(new (C) ThreadLocalNode()); |
2140 Node* cast_thread = transform_later(new (C, 2) CastP2XNode(ctrl, thread)); | 2138 Node* cast_thread = transform_later(new (C) CastP2XNode(ctrl, thread)); |
2141 Node* o_node = transform_later(new (C, 3) OrXNode(cast_thread, proto_node)); | 2139 Node* o_node = transform_later(new (C) OrXNode(cast_thread, proto_node)); |
2142 Node* x_node = transform_later(new (C, 3) XorXNode(o_node, mark_node)); | 2140 Node* x_node = transform_later(new (C) XorXNode(o_node, mark_node)); |
2143 | 2141 |
2144 // Get slow path - mark word does NOT match the value. | 2142 // Get slow path - mark word does NOT match the value. |
2145 Node* not_biased_ctrl = opt_bits_test(ctrl, region, 3, x_node, | 2143 Node* not_biased_ctrl = opt_bits_test(ctrl, region, 3, x_node, |
2146 (~markOopDesc::age_mask_in_place), 0); | 2144 (~markOopDesc::age_mask_in_place), 0); |
2147 // region->in(3) is set to fast path - the object is biased to the current thread. | 2145 // region->in(3) is set to fast path - the object is biased to the current thread. |
2160 // fast_lock_region->in(2) - the prototype header is no longer biased | 2158 // fast_lock_region->in(2) - the prototype header is no longer biased |
2161 // and we have to revoke the bias on this object. | 2159 // and we have to revoke the bias on this object. |
2162 // We are going to try to reset the mark of this object to the prototype | 2160 // We are going to try to reset the mark of this object to the prototype |
2163 // value and fall through to the CAS-based locking scheme. | 2161 // value and fall through to the CAS-based locking scheme. |
2164 Node* adr = basic_plus_adr(obj, oopDesc::mark_offset_in_bytes()); | 2162 Node* adr = basic_plus_adr(obj, oopDesc::mark_offset_in_bytes()); |
2165 Node* cas = new (C, 5) StoreXConditionalNode(not_biased_ctrl, mem, adr, | 2163 Node* cas = new (C) StoreXConditionalNode(not_biased_ctrl, mem, adr, |
2166 proto_node, mark_node); | 2164 proto_node, mark_node); |
2167 transform_later(cas); | 2165 transform_later(cas); |
2168 Node* proj = transform_later( new (C, 1) SCMemProjNode(cas)); | 2166 Node* proj = transform_later( new (C) SCMemProjNode(cas)); |
2169 fast_lock_mem_phi->init_req(2, proj); | 2167 fast_lock_mem_phi->init_req(2, proj); |
2170 | 2168 |
2171 | 2169 |
2172 // Second, check epoch bits. | 2170 // Second, check epoch bits. |
2173 Node* rebiased_region = new (C, 3) RegionNode(3); | 2171 Node* rebiased_region = new (C) RegionNode(3); |
2174 Node* old_phi = new (C, 3) PhiNode( rebiased_region, TypeX_X); | 2172 Node* old_phi = new (C) PhiNode( rebiased_region, TypeX_X); |
2175 Node* new_phi = new (C, 3) PhiNode( rebiased_region, TypeX_X); | 2173 Node* new_phi = new (C) PhiNode( rebiased_region, TypeX_X); |
2176 | 2174 |
2177 // Get slow path - mark word does NOT match epoch bits. | 2175 // Get slow path - mark word does NOT match epoch bits. |
2178 Node* epoch_ctrl = opt_bits_test(ctrl, rebiased_region, 1, x_node, | 2176 Node* epoch_ctrl = opt_bits_test(ctrl, rebiased_region, 1, x_node, |
2179 markOopDesc::epoch_mask_in_place, 0); | 2177 markOopDesc::epoch_mask_in_place, 0); |
2180 // The epoch of the current bias is not valid, attempt to rebias the object | 2178 // The epoch of the current bias is not valid, attempt to rebias the object |
2187 // The epoch of the current bias is still valid but we know | 2185 // The epoch of the current bias is still valid but we know |
2188 // nothing about the owner; it might be set or it might be clear. | 2186 // nothing about the owner; it might be set or it might be clear. |
2189 Node* cmask = MakeConX(markOopDesc::biased_lock_mask_in_place | | 2187 Node* cmask = MakeConX(markOopDesc::biased_lock_mask_in_place | |
2190 markOopDesc::age_mask_in_place | | 2188 markOopDesc::age_mask_in_place | |
2191 markOopDesc::epoch_mask_in_place); | 2189 markOopDesc::epoch_mask_in_place); |
2192 Node* old = transform_later(new (C, 3) AndXNode(mark_node, cmask)); | 2190 Node* old = transform_later(new (C) AndXNode(mark_node, cmask)); |
2193 cast_thread = transform_later(new (C, 2) CastP2XNode(ctrl, thread)); | 2191 cast_thread = transform_later(new (C) CastP2XNode(ctrl, thread)); |
2194 Node* new_mark = transform_later(new (C, 3) OrXNode(cast_thread, old)); | 2192 Node* new_mark = transform_later(new (C) OrXNode(cast_thread, old)); |
2195 old_phi->init_req(1, old); | 2193 old_phi->init_req(1, old); |
2196 new_phi->init_req(1, new_mark); | 2194 new_phi->init_req(1, new_mark); |
2197 | 2195 |
2198 transform_later(rebiased_region); | 2196 transform_later(rebiased_region); |
2199 transform_later(old_phi); | 2197 transform_later(old_phi); |
2200 transform_later(new_phi); | 2198 transform_later(new_phi); |
2201 | 2199 |
2202 // Try to acquire the bias of the object using an atomic operation. | 2200 // Try to acquire the bias of the object using an atomic operation. |
2203 // If this fails we will go in to the runtime to revoke the object's bias. | 2201 // If this fails we will go in to the runtime to revoke the object's bias. |
2204 cas = new (C, 5) StoreXConditionalNode(rebiased_region, mem, adr, | 2202 cas = new (C) StoreXConditionalNode(rebiased_region, mem, adr, |
2205 new_phi, old_phi); | 2203 new_phi, old_phi); |
2206 transform_later(cas); | 2204 transform_later(cas); |
2207 proj = transform_later( new (C, 1) SCMemProjNode(cas)); | 2205 proj = transform_later( new (C) SCMemProjNode(cas)); |
2208 | 2206 |
2209 // Get slow path - Failed to CAS. | 2207 // Get slow path - Failed to CAS. |
2210 not_biased_ctrl = opt_bits_test(rebiased_region, region, 4, cas, 0, 0); | 2208 not_biased_ctrl = opt_bits_test(rebiased_region, region, 4, cas, 0, 0); |
2211 mem_phi->init_req(4, proj); | 2209 mem_phi->init_req(4, proj); |
2212 // region->in(4) is set to fast path - the object is rebiased to the current thread. | 2210 // region->in(4) is set to fast path - the object is rebiased to the current thread. |
2213 | 2211 |
2214 // Failed to CAS. | 2212 // Failed to CAS. |
2215 slow_path = new (C, 3) RegionNode(3); | 2213 slow_path = new (C) RegionNode(3); |
2216 Node *slow_mem = new (C, 3) PhiNode( slow_path, Type::MEMORY, TypeRawPtr::BOTTOM); | 2214 Node *slow_mem = new (C) PhiNode( slow_path, Type::MEMORY, TypeRawPtr::BOTTOM); |
2217 | 2215 |
2218 slow_path->init_req(1, not_biased_ctrl); // Capture slow-control | 2216 slow_path->init_req(1, not_biased_ctrl); // Capture slow-control |
2219 slow_mem->init_req(1, proj); | 2217 slow_mem->init_req(1, proj); |
2220 | 2218 |
2221 // Call CAS-based locking scheme (FastLock node). | 2219 // Call CAS-based locking scheme (FastLock node). |
2235 transform_later(slow_mem); | 2233 transform_later(slow_mem); |
2236 // Reset lock's memory edge. | 2234 // Reset lock's memory edge. |
2237 lock->set_req(TypeFunc::Memory, slow_mem); | 2235 lock->set_req(TypeFunc::Memory, slow_mem); |
2238 | 2236 |
2239 } else { | 2237 } else { |
2240 region = new (C, 3) RegionNode(3); | 2238 region = new (C) RegionNode(3); |
2241 // create a Phi for the memory state | 2239 // create a Phi for the memory state |
2242 mem_phi = new (C, 3) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); | 2240 mem_phi = new (C) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); |
2243 | 2241 |
2244 // Optimize test; set region slot 2 | 2242 // Optimize test; set region slot 2 |
2245 slow_path = opt_bits_test(ctrl, region, 2, flock, 0, 0); | 2243 slow_path = opt_bits_test(ctrl, region, 2, flock, 0, 0); |
2246 mem_phi->init_req(2, mem); | 2244 mem_phi->init_req(2, mem); |
2247 } | 2245 } |
2268 region->init_req(1, slow_ctrl); | 2266 region->init_req(1, slow_ctrl); |
2269 // region inputs are now complete | 2267 // region inputs are now complete |
2270 transform_later(region); | 2268 transform_later(region); |
2271 _igvn.replace_node(_fallthroughproj, region); | 2269 _igvn.replace_node(_fallthroughproj, region); |
2272 | 2270 |
2273 Node *memproj = transform_later( new(C, 1) ProjNode(call, TypeFunc::Memory) ); | 2271 Node *memproj = transform_later( new(C) ProjNode(call, TypeFunc::Memory) ); |
2274 mem_phi->init_req(1, memproj ); | 2272 mem_phi->init_req(1, memproj ); |
2275 transform_later(mem_phi); | 2273 transform_later(mem_phi); |
2276 _igvn.replace_node(_memproj_fallthrough, mem_phi); | 2274 _igvn.replace_node(_memproj_fallthrough, mem_phi); |
2277 } | 2275 } |
2278 | 2276 |
2293 Node *mem_phi; | 2291 Node *mem_phi; |
2294 | 2292 |
2295 if (UseOptoBiasInlining) { | 2293 if (UseOptoBiasInlining) { |
2296 // Check for biased locking unlock case, which is a no-op. | 2294 // Check for biased locking unlock case, which is a no-op. |
2297 // See the full description in MacroAssembler::biased_locking_exit(). | 2295 // See the full description in MacroAssembler::biased_locking_exit(). |
2298 region = new (C, 4) RegionNode(4); | 2296 region = new (C) RegionNode(4); |
2299 // create a Phi for the memory state | 2297 // create a Phi for the memory state |
2300 mem_phi = new (C, 4) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); | 2298 mem_phi = new (C) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); |
2301 mem_phi->init_req(3, mem); | 2299 mem_phi->init_req(3, mem); |
2302 | 2300 |
2303 Node* mark_node = make_load(ctrl, mem, obj, oopDesc::mark_offset_in_bytes(), TypeX_X, TypeX_X->basic_type()); | 2301 Node* mark_node = make_load(ctrl, mem, obj, oopDesc::mark_offset_in_bytes(), TypeX_X, TypeX_X->basic_type()); |
2304 ctrl = opt_bits_test(ctrl, region, 3, mark_node, | 2302 ctrl = opt_bits_test(ctrl, region, 3, mark_node, |
2305 markOopDesc::biased_lock_mask_in_place, | 2303 markOopDesc::biased_lock_mask_in_place, |
2306 markOopDesc::biased_lock_pattern); | 2304 markOopDesc::biased_lock_pattern); |
2307 } else { | 2305 } else { |
2308 region = new (C, 3) RegionNode(3); | 2306 region = new (C) RegionNode(3); |
2309 // create a Phi for the memory state | 2307 // create a Phi for the memory state |
2310 mem_phi = new (C, 3) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); | 2308 mem_phi = new (C) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); |
2311 } | 2309 } |
2312 | 2310 |
2313 FastUnlockNode *funlock = new (C, 3) FastUnlockNode( ctrl, obj, box ); | 2311 FastUnlockNode *funlock = new (C) FastUnlockNode( ctrl, obj, box ); |
2314 funlock = transform_later( funlock )->as_FastUnlock(); | 2312 funlock = transform_later( funlock )->as_FastUnlock(); |
2315 // Optimize test; set region slot 2 | 2313 // Optimize test; set region slot 2 |
2316 Node *slow_path = opt_bits_test(ctrl, region, 2, funlock, 0, 0); | 2314 Node *slow_path = opt_bits_test(ctrl, region, 2, funlock, 0, 0); |
2317 | 2315 |
2318 CallNode *call = make_slow_call( (CallNode *) unlock, OptoRuntime::complete_monitor_exit_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_unlocking_C), "complete_monitor_unlocking_C", slow_path, obj, box ); | 2316 CallNode *call = make_slow_call( (CallNode *) unlock, OptoRuntime::complete_monitor_exit_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_unlocking_C), "complete_monitor_unlocking_C", slow_path, obj, box ); |
2333 region->init_req(1, slow_ctrl); | 2331 region->init_req(1, slow_ctrl); |
2334 // region inputs are now complete | 2332 // region inputs are now complete |
2335 transform_later(region); | 2333 transform_later(region); |
2336 _igvn.replace_node(_fallthroughproj, region); | 2334 _igvn.replace_node(_fallthroughproj, region); |
2337 | 2335 |
2338 Node *memproj = transform_later( new(C, 1) ProjNode(call, TypeFunc::Memory) ); | 2336 Node *memproj = transform_later( new(C) ProjNode(call, TypeFunc::Memory) ); |
2339 mem_phi->init_req(1, memproj ); | 2337 mem_phi->init_req(1, memproj ); |
2340 mem_phi->init_req(2, mem); | 2338 mem_phi->init_req(2, mem); |
2341 transform_later(mem_phi); | 2339 transform_later(mem_phi); |
2342 _igvn.replace_node(_memproj_fallthrough, mem_phi); | 2340 _igvn.replace_node(_memproj_fallthrough, mem_phi); |
2343 } | 2341 } |