comparison src/share/vm/opto/macro.cpp @ 4894:b9bc6cae88f2

7143491: G1 C2 CTW: assert(p2x->outcnt() == 2) failed: expects 2 users: Xor and URShift nodes Summary: Adjust the assert and code in eliminate_card_mark() method for case when stored value is NULL. Reviewed-by: iveresov, never
author kvn
date Tue, 07 Feb 2012 16:33:43 -0800
parents 89d0a5d40008
children 5e990493719e
comparison
equal deleted inserted replaced
4893:5e9fba4e8718 4894:b9bc6cae88f2
232 assert(mem->is_Store(), "store required"); 232 assert(mem->is_Store(), "store required");
233 _igvn.replace_node(mem, mem->in(MemNode::Memory)); 233 _igvn.replace_node(mem, mem->in(MemNode::Memory));
234 } 234 }
235 } else { 235 } else {
236 // G1 pre/post barriers 236 // G1 pre/post barriers
237 assert(p2x->outcnt() == 2, "expects 2 users: Xor and URShift nodes"); 237 assert(p2x->outcnt() <= 2, "expects 1 or 2 users: Xor and URShift nodes");
238 // It could be only one user, URShift node, in Object.clone() instrinsic 238 // It could be only one user, URShift node, in Object.clone() instrinsic
239 // but the new allocation is passed to arraycopy stub and it could not 239 // but the new allocation is passed to arraycopy stub and it could not
240 // be scalar replaced. So we don't check the case. 240 // be scalar replaced. So we don't check the case.
241
242 // An other case of only one user (Xor) is when the value check for NULL
243 // in G1 post barrier is folded after CCP so the code which used URShift
244 // is removed.
245
246 // Take Region node before eliminating post barrier since it also
247 // eliminates CastP2X node when it has only one user.
248 Node* this_region = p2x->in(0);
249 assert(this_region != NULL, "");
241 250
242 // Remove G1 post barrier. 251 // Remove G1 post barrier.
243 252
244 // Search for CastP2X->Xor->URShift->Cmp path which 253 // Search for CastP2X->Xor->URShift->Cmp path which
245 // checks if the store done to a different from the value's region. 254 // checks if the store done to a different from the value's region.
261 _igvn.replace_node(cmpx, makecon(TypeInt::CC_EQ)); 270 _igvn.replace_node(cmpx, makecon(TypeInt::CC_EQ));
262 271
263 // Remove G1 pre barrier. 272 // Remove G1 pre barrier.
264 273
265 // Search "if (marking != 0)" check and set it to "false". 274 // Search "if (marking != 0)" check and set it to "false".
266 Node* this_region = p2x->in(0);
267 assert(this_region != NULL, "");
268 // There is no G1 pre barrier if previous stored value is NULL 275 // There is no G1 pre barrier if previous stored value is NULL
269 // (for example, after initialization). 276 // (for example, after initialization).
270 if (this_region->is_Region() && this_region->req() == 3) { 277 if (this_region->is_Region() && this_region->req() == 3) {
271 int ind = 1; 278 int ind = 1;
272 if (!this_region->in(ind)->is_IfFalse()) { 279 if (!this_region->in(ind)->is_IfFalse()) {
290 } 297 }
291 } 298 }
292 } 299 }
293 // Now CastP2X can be removed since it is used only on dead path 300 // Now CastP2X can be removed since it is used only on dead path
294 // which currently still alive until igvn optimize it. 301 // which currently still alive until igvn optimize it.
295 assert(p2x->unique_out()->Opcode() == Op_URShiftX, ""); 302 assert(p2x->outcnt() == 0 || p2x->unique_out()->Opcode() == Op_URShiftX, "");
296 _igvn.replace_node(p2x, top()); 303 _igvn.replace_node(p2x, top());
297 } 304 }
298 } 305 }
299 306
300 // Search for a memory operation for the specified memory slice. 307 // Search for a memory operation for the specified memory slice.