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 "memory/resourceArea.hpp" 31 #include "opto/c2compiler.hpp" 32 #include "opto/arraycopynode.hpp" 33 #include "opto/callnode.hpp" 34 #include "opto/cfgnode.hpp" 35 #include "opto/compile.hpp" 36 #include "opto/escape.hpp" 37 #include "opto/phaseX.hpp" 38 #include "opto/movenode.hpp" 39 #include "opto/rootnode.hpp" 40 #if INCLUDE_ALL_GCS 41 #include "gc/g1/g1ThreadLocalData.hpp" 42 #endif // INCLUDE_ALL_GCS 43 44 ConnectionGraph::ConnectionGraph(Compile * C, PhaseIterGVN *igvn) : 45 _nodes(C->comp_arena(), C->unique(), C->unique(), NULL), 46 _in_worklist(C->comp_arena()), 47 _next_pidx(0), 48 _collecting(true), 49 _verify(false), 50 _compile(C), 51 _igvn(igvn), 52 _node_map(C->comp_arena()) { 53 // Add unknown java object. 54 add_java_object(C->top(), PointsToNode::GlobalEscape); 55 phantom_obj = ptnode_adr(C->top()->_idx)->as_JavaObject(); 56 // Add ConP(#NULL) and ConN(#NULL) nodes. 57 Node* oop_null = igvn->zerocon(T_OBJECT); 58 assert(oop_null->_idx < nodes_size(), "should be created already"); 59 add_java_object(oop_null, PointsToNode::NoEscape); 60 null_obj = ptnode_adr(oop_null->_idx)->as_JavaObject(); 61 if (UseCompressedOops) { 62 Node* noop_null = igvn->zerocon(T_NARROWOOP); 521 && adr->in(AddPNode::Address)->is_Proj() 522 && adr->in(AddPNode::Address)->in(0)->is_Allocate())) { 523 delayed_worklist->push(n); // Process it later. 524 #ifdef ASSERT 525 assert(adr->is_AddP(), "expecting an AddP"); 526 if (adr_type == TypeRawPtr::NOTNULL) { 527 // Verify a raw address for a store captured by Initialize node. 528 int offs = (int)igvn->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot); 529 assert(offs != Type::OffsetBot, "offset must be a constant"); 530 } 531 #endif 532 } else { 533 // Ignore copy the displaced header to the BoxNode (OSR compilation). 534 if (adr->is_BoxLock()) 535 break; 536 // Stored value escapes in unsafe access. 537 if ((opcode == Op_StoreP) && adr_type->isa_rawptr()) { 538 // Pointer stores in G1 barriers looks like unsafe access. 539 // Ignore such stores to be able scalar replace non-escaping 540 // allocations. 541 if (UseG1GC && adr->is_AddP()) { 542 Node* base = get_addp_base(adr); 543 if (base->Opcode() == Op_LoadP && 544 base->in(MemNode::Address)->is_AddP()) { 545 adr = base->in(MemNode::Address); 546 Node* tls = get_addp_base(adr); 547 if (tls->Opcode() == Op_ThreadLocal) { 548 int offs = (int)igvn->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot); 549 if (offs == in_bytes(G1ThreadLocalData::satb_mark_queue_buffer_offset())) { 550 break; // G1 pre barrier previous oop value store. 551 } 552 if (offs == in_bytes(G1ThreadLocalData::dirty_card_queue_buffer_offset())) { 553 break; // G1 post barrier card address store. 554 } 555 } 556 } 557 } 558 delayed_worklist->push(n); // Process unsafe access later. 559 break; 560 } 561 #ifdef ASSERT 562 n->dump(1); 563 assert(false, "not unsafe or G1 barrier raw StoreP"); 564 #endif 565 } 566 break; 567 } 568 case Op_AryEq: 569 case Op_HasNegatives: 570 case Op_StrComp: 571 case Op_StrEquals: 572 case Op_StrIndexOf: 573 case Op_StrIndexOfChar: 574 case Op_StrInflatedCopy: 575 case Op_StrCompressedCopy: 576 case Op_EncodeISOArray: { 577 add_local_var(n, PointsToNode::ArgEscape); | 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 "memory/resourceArea.hpp" 31 #include "opto/c2compiler.hpp" 32 #include "opto/arraycopynode.hpp" 33 #include "opto/callnode.hpp" 34 #include "opto/cfgnode.hpp" 35 #include "opto/compile.hpp" 36 #include "opto/escape.hpp" 37 #include "opto/phaseX.hpp" 38 #include "opto/movenode.hpp" 39 #include "opto/rootnode.hpp" 40 #if INCLUDE_G1GC 41 #include "gc/g1/g1ThreadLocalData.hpp" 42 #endif // INCLUDE_G1GC 43 44 ConnectionGraph::ConnectionGraph(Compile * C, PhaseIterGVN *igvn) : 45 _nodes(C->comp_arena(), C->unique(), C->unique(), NULL), 46 _in_worklist(C->comp_arena()), 47 _next_pidx(0), 48 _collecting(true), 49 _verify(false), 50 _compile(C), 51 _igvn(igvn), 52 _node_map(C->comp_arena()) { 53 // Add unknown java object. 54 add_java_object(C->top(), PointsToNode::GlobalEscape); 55 phantom_obj = ptnode_adr(C->top()->_idx)->as_JavaObject(); 56 // Add ConP(#NULL) and ConN(#NULL) nodes. 57 Node* oop_null = igvn->zerocon(T_OBJECT); 58 assert(oop_null->_idx < nodes_size(), "should be created already"); 59 add_java_object(oop_null, PointsToNode::NoEscape); 60 null_obj = ptnode_adr(oop_null->_idx)->as_JavaObject(); 61 if (UseCompressedOops) { 62 Node* noop_null = igvn->zerocon(T_NARROWOOP); 521 && adr->in(AddPNode::Address)->is_Proj() 522 && adr->in(AddPNode::Address)->in(0)->is_Allocate())) { 523 delayed_worklist->push(n); // Process it later. 524 #ifdef ASSERT 525 assert(adr->is_AddP(), "expecting an AddP"); 526 if (adr_type == TypeRawPtr::NOTNULL) { 527 // Verify a raw address for a store captured by Initialize node. 528 int offs = (int)igvn->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot); 529 assert(offs != Type::OffsetBot, "offset must be a constant"); 530 } 531 #endif 532 } else { 533 // Ignore copy the displaced header to the BoxNode (OSR compilation). 534 if (adr->is_BoxLock()) 535 break; 536 // Stored value escapes in unsafe access. 537 if ((opcode == Op_StoreP) && adr_type->isa_rawptr()) { 538 // Pointer stores in G1 barriers looks like unsafe access. 539 // Ignore such stores to be able scalar replace non-escaping 540 // allocations. 541 #if INCLUDE_G1GC 542 if (UseG1GC && adr->is_AddP()) { 543 Node* base = get_addp_base(adr); 544 if (base->Opcode() == Op_LoadP && 545 base->in(MemNode::Address)->is_AddP()) { 546 adr = base->in(MemNode::Address); 547 Node* tls = get_addp_base(adr); 548 if (tls->Opcode() == Op_ThreadLocal) { 549 int offs = (int)igvn->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot); 550 if (offs == in_bytes(G1ThreadLocalData::satb_mark_queue_buffer_offset())) { 551 break; // G1 pre barrier previous oop value store. 552 } 553 if (offs == in_bytes(G1ThreadLocalData::dirty_card_queue_buffer_offset())) { 554 break; // G1 post barrier card address store. 555 } 556 } 557 } 558 } 559 #endif 560 delayed_worklist->push(n); // Process unsafe access later. 561 break; 562 } 563 #ifdef ASSERT 564 n->dump(1); 565 assert(false, "not unsafe or G1 barrier raw StoreP"); 566 #endif 567 } 568 break; 569 } 570 case Op_AryEq: 571 case Op_HasNegatives: 572 case Op_StrComp: 573 case Op_StrEquals: 574 case Op_StrIndexOf: 575 case Op_StrIndexOfChar: 576 case Op_StrInflatedCopy: 577 case Op_StrCompressedCopy: 578 case Op_EncodeISOArray: { 579 add_local_var(n, PointsToNode::ArgEscape); |