3351 // an initialization. Returns zero if a check fails. |
3351 // an initialization. Returns zero if a check fails. |
3352 // On success, returns the (constant) offset to which the store applies, |
3352 // On success, returns the (constant) offset to which the store applies, |
3353 // within the initialized memory. |
3353 // within the initialized memory. |
3354 intptr_t InitializeNode::can_capture_store(StoreNode* st, PhaseTransform* phase, bool can_reshape) { |
3354 intptr_t InitializeNode::can_capture_store(StoreNode* st, PhaseTransform* phase, bool can_reshape) { |
3355 const int FAIL = 0; |
3355 const int FAIL = 0; |
3356 if (st->is_unaligned_access()) { |
|
3357 return FAIL; |
|
3358 } |
|
3359 if (st->req() != MemNode::ValueIn + 1) |
3356 if (st->req() != MemNode::ValueIn + 1) |
3360 return FAIL; // an inscrutable StoreNode (card mark?) |
3357 return FAIL; // an inscrutable StoreNode (card mark?) |
3361 Node* ctl = st->in(MemNode::Control); |
3358 Node* ctl = st->in(MemNode::Control); |
3362 if (!(ctl != NULL && ctl->is_Proj() && ctl->in(0) == this)) |
3359 if (!(ctl != NULL && ctl->is_Proj() && ctl->in(0) == this)) |
3363 return FAIL; // must be unconditional after the initialization |
3360 return FAIL; // must be unconditional after the initialization |
3369 AllocateNode* alloc = AllocateNode::Ideal_allocation(adr, phase, offset); |
3366 AllocateNode* alloc = AllocateNode::Ideal_allocation(adr, phase, offset); |
3370 if (alloc == NULL) |
3367 if (alloc == NULL) |
3371 return FAIL; // inscrutable address |
3368 return FAIL; // inscrutable address |
3372 if (alloc != allocation()) |
3369 if (alloc != allocation()) |
3373 return FAIL; // wrong allocation! (store needs to float up) |
3370 return FAIL; // wrong allocation! (store needs to float up) |
|
3371 int size_in_bytes = st->memory_size(); |
|
3372 if ((size_in_bytes != 0) && (offset % size_in_bytes) != 0) { |
|
3373 return FAIL; // mismatched access |
|
3374 } |
3374 Node* val = st->in(MemNode::ValueIn); |
3375 Node* val = st->in(MemNode::ValueIn); |
3375 int complexity_count = 0; |
3376 int complexity_count = 0; |
3376 if (!detect_init_independence(val, complexity_count)) |
3377 if (!detect_init_independence(val, complexity_count)) |
3377 return FAIL; // stored value must be 'simple enough' |
3378 return FAIL; // stored value must be 'simple enough' |
3378 |
3379 |