42 #include "opto/memnode.hpp" |
42 #include "opto/memnode.hpp" |
43 #include "opto/mulnode.hpp" |
43 #include "opto/mulnode.hpp" |
44 #include "opto/narrowptrnode.hpp" |
44 #include "opto/narrowptrnode.hpp" |
45 #include "opto/phaseX.hpp" |
45 #include "opto/phaseX.hpp" |
46 #include "opto/regmask.hpp" |
46 #include "opto/regmask.hpp" |
|
47 #include "opto/rootnode.hpp" |
47 #include "utilities/align.hpp" |
48 #include "utilities/align.hpp" |
48 #include "utilities/copy.hpp" |
49 #include "utilities/copy.hpp" |
49 #include "utilities/macros.hpp" |
50 #include "utilities/macros.hpp" |
50 #include "utilities/vmError.hpp" |
51 #include "utilities/vmError.hpp" |
51 #if INCLUDE_ZGC |
52 #if INCLUDE_ZGC |
325 } |
326 } |
326 |
327 |
327 Node *address = in(MemNode::Address); |
328 Node *address = in(MemNode::Address); |
328 const Type *t_adr = phase->type(address); |
329 const Type *t_adr = phase->type(address); |
329 if (t_adr == Type::TOP) return NodeSentinel; // caller will return NULL |
330 if (t_adr == Type::TOP) return NodeSentinel; // caller will return NULL |
|
331 |
|
332 if (can_reshape && is_unsafe_access() && (t_adr == TypePtr::NULL_PTR)) { |
|
333 // Unsafe off-heap access with zero address. Remove access and other control users |
|
334 // to not confuse optimizations and add a HaltNode to fail if this is ever executed. |
|
335 assert(ctl != NULL, "unsafe accesses should be control dependent"); |
|
336 for (DUIterator_Fast imax, i = ctl->fast_outs(imax); i < imax; i++) { |
|
337 Node* u = ctl->fast_out(i); |
|
338 if (u != ctl) { |
|
339 igvn->rehash_node_delayed(u); |
|
340 int nb = u->replace_edge(ctl, phase->C->top()); |
|
341 --i, imax -= nb; |
|
342 } |
|
343 } |
|
344 Node* frame = igvn->transform(new ParmNode(phase->C->start(), TypeFunc::FramePtr)); |
|
345 Node* halt = igvn->transform(new HaltNode(ctl, frame)); |
|
346 phase->C->root()->add_req(halt); |
|
347 return this; |
|
348 } |
330 |
349 |
331 if (can_reshape && igvn != NULL && |
350 if (can_reshape && igvn != NULL && |
332 (igvn->_worklist.member(address) || |
351 (igvn->_worklist.member(address) || |
333 (igvn->_worklist.size() > 0 && t_adr != adr_type())) ) { |
352 (igvn->_worklist.size() > 0 && t_adr != adr_type())) ) { |
334 // The address's base and type may change when the address is processed. |
353 // The address's base and type may change when the address is processed. |