< prev index next >

src/share/vm/opto/escape.cpp

Print this page




  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "ci/bcEscapeAnalyzer.hpp"
  27 #include "compiler/compileLog.hpp"
  28 #include "libadt/vectset.hpp"
  29 #include "memory/allocation.hpp"
  30 #include "opto/c2compiler.hpp"
  31 #include "opto/callnode.hpp"
  32 #include "opto/cfgnode.hpp"
  33 #include "opto/compile.hpp"
  34 #include "opto/escape.hpp"
  35 #include "opto/phaseX.hpp"
  36 #include "opto/rootnode.hpp"



  37 
  38 ConnectionGraph::ConnectionGraph(Compile * C, PhaseIterGVN *igvn) :
  39   _nodes(C->comp_arena(), C->unique(), C->unique(), NULL),
  40   _in_worklist(C->comp_arena()),
  41   _next_pidx(0),
  42   _collecting(true),
  43   _verify(false),
  44   _compile(C),
  45   _igvn(igvn),
  46   _node_map(C->comp_arena()) {
  47   // Add unknown java object.
  48   add_java_object(C->top(), PointsToNode::GlobalEscape);
  49   phantom_obj = ptnode_adr(C->top()->_idx)->as_JavaObject();
  50   // Add ConP(#NULL) and ConN(#NULL) nodes.
  51   Node* oop_null = igvn->zerocon(T_OBJECT);
  52   assert(oop_null->_idx < nodes_size(), "should be created already");
  53   add_java_object(oop_null, PointsToNode::NoEscape);
  54   null_obj = ptnode_adr(oop_null->_idx)->as_JavaObject();
  55   if (UseCompressedOops) {
  56     Node* noop_null = igvn->zerocon(T_NARROWOOP);


 506                          adr->in(AddPNode::Address)->is_Proj() &&
 507                          adr->in(AddPNode::Address)->in(0)->is_Allocate())) {
 508         delayed_worklist->push(n); // Process it later.
 509 #ifdef ASSERT
 510         assert(adr->is_AddP(), "expecting an AddP");
 511         if (adr_type == TypeRawPtr::NOTNULL) {
 512           // Verify a raw address for a store captured by Initialize node.
 513           int offs = (int)igvn->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot);
 514           assert(offs != Type::OffsetBot, "offset must be a constant");
 515         }
 516 #endif
 517       } else {
 518         // Ignore copy the displaced header to the BoxNode (OSR compilation).
 519         if (adr->is_BoxLock())
 520           break;
 521         // Stored value escapes in unsafe access.
 522         if ((opcode == Op_StoreP) && (adr_type == TypeRawPtr::BOTTOM)) {
 523           // Pointer stores in G1 barriers looks like unsafe access.
 524           // Ignore such stores to be able scalar replace non-escaping
 525           // allocations.
 526           if (UseG1GC && adr->is_AddP()) {
 527             Node* base = get_addp_base(adr);
 528             if (base->Opcode() == Op_LoadP &&
 529                 base->in(MemNode::Address)->is_AddP()) {
 530               adr = base->in(MemNode::Address);
 531               Node* tls = get_addp_base(adr);
 532               if (tls->Opcode() == Op_ThreadLocal) {
 533                 int offs = (int)igvn->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot);
 534                 if (offs == in_bytes(JavaThread::satb_mark_queue_offset() +
 535                                      PtrQueue::byte_offset_of_buf())) {
 536                   break; // G1 pre barier previous oop value store.
 537                 }
 538                 if (offs == in_bytes(JavaThread::dirty_card_queue_offset() +
 539                                      PtrQueue::byte_offset_of_buf())) {
 540                   break; // G1 post barier card address store.
 541                 }
 542               }
 543             }
 544           }
 545           delayed_worklist->push(n); // Process unsafe access later.
 546           break;


 548 #ifdef ASSERT
 549         n->dump(1);
 550         assert(false, "not unsafe or G1 barrier raw StoreP");
 551 #endif
 552       }
 553       break;
 554     }
 555     case Op_AryEq:
 556     case Op_StrComp:
 557     case Op_StrEquals:
 558     case Op_StrIndexOf:
 559     case Op_EncodeISOArray: {
 560       add_local_var(n, PointsToNode::ArgEscape);
 561       delayed_worklist->push(n); // Process it later.
 562       break;
 563     }
 564     case Op_ThreadLocal: {
 565       add_java_object(n, PointsToNode::ArgEscape);
 566       break;
 567     }





 568     default:
 569       ; // Do nothing for nodes not related to EA.
 570   }
 571   return;
 572 }
 573 
 574 #ifdef ASSERT
 575 #define ELSE_FAIL(name)                               \
 576       /* Should not be called for not pointer type. */  \
 577       n->dump(1);                                       \
 578       assert(false, name);                              \
 579       break;
 580 #else
 581 #define ELSE_FAIL(name) \
 582       break;
 583 #endif
 584 
 585 // Add final simple edges to graph.
 586 void ConnectionGraph::add_final_edges(Node *n) {
 587   PointsToNode* n_ptn = ptnode_adr(n->_idx);


 742     case Op_EncodeISOArray: {
 743       // char[] arrays passed to string intrinsic do not escape but
 744       // they are not scalar replaceable. Adjust escape state for them.
 745       // Start from in(2) edge since in(1) is memory edge.
 746       for (uint i = 2; i < n->req(); i++) {
 747         Node* adr = n->in(i);
 748         const Type* at = _igvn->type(adr);
 749         if (!adr->is_top() && at->isa_ptr()) {
 750           assert(at == Type::TOP || at == TypePtr::NULL_PTR ||
 751                  at->isa_ptr() != NULL, "expecting a pointer");
 752           if (adr->is_AddP()) {
 753             adr = get_addp_base(adr);
 754           }
 755           PointsToNode* ptn = ptnode_adr(adr->_idx);
 756           assert(ptn != NULL, "node should be registered");
 757           add_edge(n_ptn, ptn);
 758         }
 759       }
 760       break;
 761     }
 762     default: {





 763       // This method should be called only for EA specific nodes which may
 764       // miss some edges when they were created.
 765 #ifdef ASSERT
 766       n->dump(1);
 767 #endif
 768       guarantee(false, "unknown node");
 769     }
 770   }
 771   return;
 772 }
 773 
 774 void ConnectionGraph::add_call_node(CallNode* call) {
 775   assert(call->returns_pointer(), "only for call which returns pointer");
 776   uint call_idx = call->_idx;
 777   if (call->is_Allocate()) {
 778     Node* k = call->in(AllocateNode::KlassNode);
 779     const TypeKlassPtr* kt = k->bottom_type()->isa_klassptr();
 780     assert(kt != NULL, "TypeKlassPtr  required.");
 781     ciKlass* cik = kt->klass();
 782     PointsToNode::EscapeState es = PointsToNode::NoEscape;


 930                               (aat->isa_oopptr()->klass() == NULL || aat->isa_instptr() ||
 931                                (aat->isa_aryptr() && aat->isa_aryptr()->klass()->is_obj_array_klass()));
 932           if (i == TypeFunc::Parms) {
 933             src_has_oops = arg_has_oops;
 934           }
 935           //
 936           // src or dst could be j.l.Object when other is basic type array:
 937           //
 938           //   arraycopy(char[],0,Object*,0,size);
 939           //   arraycopy(Object*,0,char[],0,size);
 940           //
 941           // Don't add edges in such cases.
 942           //
 943           bool arg_is_arraycopy_dest = src_has_oops && is_arraycopy &&
 944                                        arg_has_oops && (i > TypeFunc::Parms);
 945 #ifdef ASSERT
 946           if (!(is_arraycopy ||
 947                 (call->as_CallLeaf()->_name != NULL &&
 948                  (strcmp(call->as_CallLeaf()->_name, "g1_wb_pre")  == 0 ||
 949                   strcmp(call->as_CallLeaf()->_name, "g1_wb_post") == 0 ||


 950                   strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32") == 0 ||
 951                   strcmp(call->as_CallLeaf()->_name, "aescrypt_encryptBlock") == 0 ||
 952                   strcmp(call->as_CallLeaf()->_name, "aescrypt_decryptBlock") == 0 ||
 953                   strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_encryptAESCrypt") == 0 ||
 954                   strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_decryptAESCrypt") == 0 ||
 955                   strcmp(call->as_CallLeaf()->_name, "ghash_processBlocks") == 0 ||
 956                   strcmp(call->as_CallLeaf()->_name, "sha1_implCompress") == 0 ||
 957                   strcmp(call->as_CallLeaf()->_name, "sha1_implCompressMB") == 0 ||
 958                   strcmp(call->as_CallLeaf()->_name, "sha256_implCompress") == 0 ||
 959                   strcmp(call->as_CallLeaf()->_name, "sha256_implCompressMB") == 0 ||
 960                   strcmp(call->as_CallLeaf()->_name, "sha512_implCompress") == 0 ||
 961                   strcmp(call->as_CallLeaf()->_name, "sha512_implCompressMB") == 0 ||
 962                   strcmp(call->as_CallLeaf()->_name, "multiplyToLen") == 0 ||
 963                   strcmp(call->as_CallLeaf()->_name, "squareToLen") == 0 ||
 964                   strcmp(call->as_CallLeaf()->_name, "mulAdd") == 0 ||
 965                   strcmp(call->as_CallLeaf()->_name, "montgomery_multiply") == 0 ||
 966                   strcmp(call->as_CallLeaf()->_name, "montgomery_square") == 0)
 967                  ))) {
 968             call->dump();
 969             fatal(err_msg_res("EA unexpected CallLeaf %s", call->as_CallLeaf()->_name));


2259   // case #8. narrow Klass's field reference.
2260   //      LoadNKlass
2261   //       |
2262   //      DecodeN
2263   //       | |
2264   //       AddP  ( base == address )
2265   //
2266   Node *base = addp->in(AddPNode::Base);
2267   if (base->uncast()->is_top()) { // The AddP case #3 and #6.
2268     base = addp->in(AddPNode::Address);
2269     while (base->is_AddP()) {
2270       // Case #6 (unsafe access) may have several chained AddP nodes.
2271       assert(base->in(AddPNode::Base)->uncast()->is_top(), "expected unsafe access address only");
2272       base = base->in(AddPNode::Address);
2273     }
2274     Node* uncast_base = base->uncast();
2275     int opcode = uncast_base->Opcode();
2276     assert(opcode == Op_ConP || opcode == Op_ThreadLocal ||
2277            opcode == Op_CastX2P || uncast_base->is_DecodeNarrowPtr() ||
2278            (uncast_base->is_Mem() && (uncast_base->bottom_type()->isa_rawptr() != NULL)) ||
2279            (uncast_base->is_Proj() && uncast_base->in(0)->is_Allocate()), "sanity");


2280   }
2281   return base;
2282 }
2283 
2284 Node* ConnectionGraph::find_second_addp(Node* addp, Node* n) {
2285   assert(addp->is_AddP() && addp->outcnt() > 0, "Don't process dead nodes");
2286   Node* addp2 = addp->raw_out(0);
2287   if (addp->outcnt() == 1 && addp2->is_AddP() &&
2288       addp2->in(AddPNode::Base) == n &&
2289       addp2->in(AddPNode::Address) == addp) {
2290     assert(addp->in(AddPNode::Base) == n, "expecting the same base");
2291     //
2292     // Find array's offset to push it on worklist first and
2293     // as result process an array's element offset first (pushed second)
2294     // to avoid CastPP for the array's offset.
2295     // Otherwise the inserted CastPP (LocalVar) will point to what
2296     // the AddP (Field) points to. Which would be wrong since
2297     // the algorithm expects the CastPP has the same point as
2298     // as AddP's base CheckCastPP (LocalVar).
2299     //




  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "ci/bcEscapeAnalyzer.hpp"
  27 #include "compiler/compileLog.hpp"
  28 #include "libadt/vectset.hpp"
  29 #include "memory/allocation.hpp"
  30 #include "opto/c2compiler.hpp"
  31 #include "opto/callnode.hpp"
  32 #include "opto/cfgnode.hpp"
  33 #include "opto/compile.hpp"
  34 #include "opto/escape.hpp"
  35 #include "opto/phaseX.hpp"
  36 #include "opto/rootnode.hpp"
  37 #if INCLUDE_ALL_GCS
  38 #include "gc_implementation/shenandoah/shenandoahSupport.hpp"
  39 #endif
  40 
  41 ConnectionGraph::ConnectionGraph(Compile * C, PhaseIterGVN *igvn) :
  42   _nodes(C->comp_arena(), C->unique(), C->unique(), NULL),
  43   _in_worklist(C->comp_arena()),
  44   _next_pidx(0),
  45   _collecting(true),
  46   _verify(false),
  47   _compile(C),
  48   _igvn(igvn),
  49   _node_map(C->comp_arena()) {
  50   // Add unknown java object.
  51   add_java_object(C->top(), PointsToNode::GlobalEscape);
  52   phantom_obj = ptnode_adr(C->top()->_idx)->as_JavaObject();
  53   // Add ConP(#NULL) and ConN(#NULL) nodes.
  54   Node* oop_null = igvn->zerocon(T_OBJECT);
  55   assert(oop_null->_idx < nodes_size(), "should be created already");
  56   add_java_object(oop_null, PointsToNode::NoEscape);
  57   null_obj = ptnode_adr(oop_null->_idx)->as_JavaObject();
  58   if (UseCompressedOops) {
  59     Node* noop_null = igvn->zerocon(T_NARROWOOP);


 509                          adr->in(AddPNode::Address)->is_Proj() &&
 510                          adr->in(AddPNode::Address)->in(0)->is_Allocate())) {
 511         delayed_worklist->push(n); // Process it later.
 512 #ifdef ASSERT
 513         assert(adr->is_AddP(), "expecting an AddP");
 514         if (adr_type == TypeRawPtr::NOTNULL) {
 515           // Verify a raw address for a store captured by Initialize node.
 516           int offs = (int)igvn->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot);
 517           assert(offs != Type::OffsetBot, "offset must be a constant");
 518         }
 519 #endif
 520       } else {
 521         // Ignore copy the displaced header to the BoxNode (OSR compilation).
 522         if (adr->is_BoxLock())
 523           break;
 524         // Stored value escapes in unsafe access.
 525         if ((opcode == Op_StoreP) && (adr_type == TypeRawPtr::BOTTOM)) {
 526           // Pointer stores in G1 barriers looks like unsafe access.
 527           // Ignore such stores to be able scalar replace non-escaping
 528           // allocations.
 529           if ((UseG1GC || UseShenandoahGC) && adr->is_AddP()) {
 530             Node* base = get_addp_base(adr);
 531             if (base->Opcode() == Op_LoadP &&
 532                 base->in(MemNode::Address)->is_AddP()) {
 533               adr = base->in(MemNode::Address);
 534               Node* tls = get_addp_base(adr);
 535               if (tls->Opcode() == Op_ThreadLocal) {
 536                 int offs = (int)igvn->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot);
 537                 if (offs == in_bytes(JavaThread::satb_mark_queue_offset() +
 538                                      PtrQueue::byte_offset_of_buf())) {
 539                   break; // G1 pre barier previous oop value store.
 540                 }
 541                 if (offs == in_bytes(JavaThread::dirty_card_queue_offset() +
 542                                      PtrQueue::byte_offset_of_buf())) {
 543                   break; // G1 post barier card address store.
 544                 }
 545               }
 546             }
 547           }
 548           delayed_worklist->push(n); // Process unsafe access later.
 549           break;


 551 #ifdef ASSERT
 552         n->dump(1);
 553         assert(false, "not unsafe or G1 barrier raw StoreP");
 554 #endif
 555       }
 556       break;
 557     }
 558     case Op_AryEq:
 559     case Op_StrComp:
 560     case Op_StrEquals:
 561     case Op_StrIndexOf:
 562     case Op_EncodeISOArray: {
 563       add_local_var(n, PointsToNode::ArgEscape);
 564       delayed_worklist->push(n); // Process it later.
 565       break;
 566     }
 567     case Op_ThreadLocal: {
 568       add_java_object(n, PointsToNode::ArgEscape);
 569       break;
 570     }
 571 #if INCLUDE_ALL_GCS
 572     case Op_ShenandoahLoadReferenceBarrier:
 573       add_local_var_and_edge(n, PointsToNode::NoEscape, n->in(ShenandoahLoadReferenceBarrierNode::ValueIn), delayed_worklist);
 574       break;
 575 #endif
 576     default:
 577       ; // Do nothing for nodes not related to EA.
 578   }
 579   return;
 580 }
 581 
 582 #ifdef ASSERT
 583 #define ELSE_FAIL(name)                               \
 584       /* Should not be called for not pointer type. */  \
 585       n->dump(1);                                       \
 586       assert(false, name);                              \
 587       break;
 588 #else
 589 #define ELSE_FAIL(name) \
 590       break;
 591 #endif
 592 
 593 // Add final simple edges to graph.
 594 void ConnectionGraph::add_final_edges(Node *n) {
 595   PointsToNode* n_ptn = ptnode_adr(n->_idx);


 750     case Op_EncodeISOArray: {
 751       // char[] arrays passed to string intrinsic do not escape but
 752       // they are not scalar replaceable. Adjust escape state for them.
 753       // Start from in(2) edge since in(1) is memory edge.
 754       for (uint i = 2; i < n->req(); i++) {
 755         Node* adr = n->in(i);
 756         const Type* at = _igvn->type(adr);
 757         if (!adr->is_top() && at->isa_ptr()) {
 758           assert(at == Type::TOP || at == TypePtr::NULL_PTR ||
 759                  at->isa_ptr() != NULL, "expecting a pointer");
 760           if (adr->is_AddP()) {
 761             adr = get_addp_base(adr);
 762           }
 763           PointsToNode* ptn = ptnode_adr(adr->_idx);
 764           assert(ptn != NULL, "node should be registered");
 765           add_edge(n_ptn, ptn);
 766         }
 767       }
 768       break;
 769     }
 770 #if INCLUDE_ALL_GCS
 771     case Op_ShenandoahLoadReferenceBarrier:
 772       add_local_var_and_edge(n, PointsToNode::NoEscape, n->in(ShenandoahLoadReferenceBarrierNode::ValueIn), NULL);
 773       break;
 774 #endif
 775   default: {
 776       // This method should be called only for EA specific nodes which may
 777       // miss some edges when they were created.
 778 #ifdef ASSERT
 779       n->dump(1);
 780 #endif
 781       guarantee(false, "unknown node");
 782     }
 783   }
 784   return;
 785 }
 786 
 787 void ConnectionGraph::add_call_node(CallNode* call) {
 788   assert(call->returns_pointer(), "only for call which returns pointer");
 789   uint call_idx = call->_idx;
 790   if (call->is_Allocate()) {
 791     Node* k = call->in(AllocateNode::KlassNode);
 792     const TypeKlassPtr* kt = k->bottom_type()->isa_klassptr();
 793     assert(kt != NULL, "TypeKlassPtr  required.");
 794     ciKlass* cik = kt->klass();
 795     PointsToNode::EscapeState es = PointsToNode::NoEscape;


 943                               (aat->isa_oopptr()->klass() == NULL || aat->isa_instptr() ||
 944                                (aat->isa_aryptr() && aat->isa_aryptr()->klass()->is_obj_array_klass()));
 945           if (i == TypeFunc::Parms) {
 946             src_has_oops = arg_has_oops;
 947           }
 948           //
 949           // src or dst could be j.l.Object when other is basic type array:
 950           //
 951           //   arraycopy(char[],0,Object*,0,size);
 952           //   arraycopy(Object*,0,char[],0,size);
 953           //
 954           // Don't add edges in such cases.
 955           //
 956           bool arg_is_arraycopy_dest = src_has_oops && is_arraycopy &&
 957                                        arg_has_oops && (i > TypeFunc::Parms);
 958 #ifdef ASSERT
 959           if (!(is_arraycopy ||
 960                 (call->as_CallLeaf()->_name != NULL &&
 961                  (strcmp(call->as_CallLeaf()->_name, "g1_wb_pre")  == 0 ||
 962                   strcmp(call->as_CallLeaf()->_name, "g1_wb_post") == 0 ||
 963                   strcmp(call->as_CallLeaf()->_name, "shenandoah_clone_barrier")  == 0 ||
 964                   strcmp(call->as_CallLeaf()->_name, "shenandoah_cas_obj")  == 0 ||
 965                   strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32") == 0 ||
 966                   strcmp(call->as_CallLeaf()->_name, "aescrypt_encryptBlock") == 0 ||
 967                   strcmp(call->as_CallLeaf()->_name, "aescrypt_decryptBlock") == 0 ||
 968                   strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_encryptAESCrypt") == 0 ||
 969                   strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_decryptAESCrypt") == 0 ||
 970                   strcmp(call->as_CallLeaf()->_name, "ghash_processBlocks") == 0 ||
 971                   strcmp(call->as_CallLeaf()->_name, "sha1_implCompress") == 0 ||
 972                   strcmp(call->as_CallLeaf()->_name, "sha1_implCompressMB") == 0 ||
 973                   strcmp(call->as_CallLeaf()->_name, "sha256_implCompress") == 0 ||
 974                   strcmp(call->as_CallLeaf()->_name, "sha256_implCompressMB") == 0 ||
 975                   strcmp(call->as_CallLeaf()->_name, "sha512_implCompress") == 0 ||
 976                   strcmp(call->as_CallLeaf()->_name, "sha512_implCompressMB") == 0 ||
 977                   strcmp(call->as_CallLeaf()->_name, "multiplyToLen") == 0 ||
 978                   strcmp(call->as_CallLeaf()->_name, "squareToLen") == 0 ||
 979                   strcmp(call->as_CallLeaf()->_name, "mulAdd") == 0 ||
 980                   strcmp(call->as_CallLeaf()->_name, "montgomery_multiply") == 0 ||
 981                   strcmp(call->as_CallLeaf()->_name, "montgomery_square") == 0)
 982                  ))) {
 983             call->dump();
 984             fatal(err_msg_res("EA unexpected CallLeaf %s", call->as_CallLeaf()->_name));


2274   // case #8. narrow Klass's field reference.
2275   //      LoadNKlass
2276   //       |
2277   //      DecodeN
2278   //       | |
2279   //       AddP  ( base == address )
2280   //
2281   Node *base = addp->in(AddPNode::Base);
2282   if (base->uncast()->is_top()) { // The AddP case #3 and #6.
2283     base = addp->in(AddPNode::Address);
2284     while (base->is_AddP()) {
2285       // Case #6 (unsafe access) may have several chained AddP nodes.
2286       assert(base->in(AddPNode::Base)->uncast()->is_top(), "expected unsafe access address only");
2287       base = base->in(AddPNode::Address);
2288     }
2289     Node* uncast_base = base->uncast();
2290     int opcode = uncast_base->Opcode();
2291     assert(opcode == Op_ConP || opcode == Op_ThreadLocal ||
2292            opcode == Op_CastX2P || uncast_base->is_DecodeNarrowPtr() ||
2293            (uncast_base->is_Mem() && (uncast_base->bottom_type()->isa_rawptr() != NULL)) ||
2294            (uncast_base->is_Proj() && uncast_base->in(0)->is_Allocate()) ||
2295            (uncast_base->is_Phi() && (uncast_base->bottom_type()->isa_rawptr() != NULL)) ||
2296            uncast_base->Opcode() == Op_ShenandoahLoadReferenceBarrier, "sanity");
2297   }
2298   return base;
2299 }
2300 
2301 Node* ConnectionGraph::find_second_addp(Node* addp, Node* n) {
2302   assert(addp->is_AddP() && addp->outcnt() > 0, "Don't process dead nodes");
2303   Node* addp2 = addp->raw_out(0);
2304   if (addp->outcnt() == 1 && addp2->is_AddP() &&
2305       addp2->in(AddPNode::Base) == n &&
2306       addp2->in(AddPNode::Address) == addp) {
2307     assert(addp->in(AddPNode::Base) == n, "expecting the same base");
2308     //
2309     // Find array's offset to push it on worklist first and
2310     // as result process an array's element offset first (pushed second)
2311     // to avoid CastPP for the array's offset.
2312     // Otherwise the inserted CastPP (LocalVar) will point to what
2313     // the AddP (Field) points to. Which would be wrong since
2314     // the algorithm expects the CastPP has the same point as
2315     // as AddP's base CheckCastPP (LocalVar).
2316     //


< prev index next >