escape.cpp revision 2375
0N/A * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A "P",
// PointsToEdge 0N/A "D",
// DeferredEdge 0N/A // Add ConP(#NULL) and ConN(#NULL) nodes. 0N/A // don't add a self-referential edge, this can occur during removal of 0N/A // We are computing a raw address for a store captured by an Initialize 0N/A // compute an appropriate address type. AddP cases #3 and #5 (see below). 0N/A "offset must be a constant or it is initialization of array");
0N/A // inline set_escape_state(idx, es); 0N/A // If we are still collecting or there were no non-escaping allocations 0N/A // we don't know the answer yet 0N/A // if the node was created after the escape computation, return 0N/A // if we have already computed a value, return it 0N/A // PointsTo() calls n->uncast() which can return a new ideal node. 0N/A // compute max escape state of anything this node could point to 0N/A // cache the computed escape state 0N/A }
// orig_es could be PointsToNode::UnknownEscape 0N/A // If we have a JavaObject, return just that object 0N/A // ensure that all inputs of a Phi have been processed 0N/A assert(
false,
"neither PointsToEdge or DeferredEdge");
0N/A // no deferred or pointsto edges found. Assume the value was set 0N/A // outside this method. Add the phantom object to the pointsto set. 0N/A // This method is most expensive during ConnectionGraph construction. 0N/A // Reuse vectorSet and an additional growable array for deferred edges. 0N/A // Mark current edges as visited and move deferred edges to separate array. 0N/A // Special case - field set outside (globally escaping). 0N/A// Add an edge to node given by "to_i" from any field of adr_i whose offset 0N/A// matches "offset" A deferred edge is added if to_i is a LocalVar, and 0N/A// a pointsto edge is added if it is a JavaObject 0N/A// Add a deferred edge from node given by "from_i" to any field of adr_i 0N/A// whose offset matches "offset". 0N/A // we have not seen any stores to this field, assume it was set outside this method 0N/A // AddP cases for Base and Address inputs: 0N/A // case #1. Direct object's field reference: 0N/A // Proj #5 ( oop result ) 0N/A // CheckCastPP (cast to instance type) 0N/A // AddP ( base == address ) 0N/A // case #2. Indirect object's field reference: 0N/A // CastPP (cast to instance type) 0N/A // AddP ( base == address ) 0N/A // case #3. Raw object's field reference for Initialize node: 0N/A // Proj #5 ( oop result ) 0N/A // AddP ( base == top ) 0N/A // case #4. Array's element reference: 0N/A // {CheckCastPP | CastPP} 0N/A // | AddP ( array's element offset ) 0N/A // AddP ( array's offset ) 0N/A // case #5. Raw object's field reference for arraycopy stub call: 0N/A // The inline_native_clone() case when the arraycopy stub is called 0N/A // after the allocation before Initialize and CheckCastPP nodes. 0N/A // Proj #5 ( oop result ) 0N/A // AddP ( base == address ) 0N/A // case #6. Constant Pool, ThreadLocal, CastX2P or 0N/A // Raw object's field reference: 0N/A // {ConP, ThreadLocal, CastX2P, raw Load} 0N/A // AddP ( base == top ) 0N/A // case #7. Klass's field reference. 0N/A // AddP ( base == address ) 0N/A // case #8. narrow Klass's field reference. 35N/A // AddP ( base == address ) 0N/A // Case #6 (unsafe access) may have several chained AddP nodes. 0N/A // Find array's offset to push it on worklist first and 0N/A // as result process an array's element offset first (pushed second) 0N/A // to avoid CastPP for the array's offset. 0N/A // Otherwise the inserted CastPP (LocalVar) will point to what 0N/A // the AddP (Field) points to. Which would be wrong since 0N/A // the algorithm expects the CastPP has the same point as 0N/A // as AddP's base CheckCastPP (LocalVar). 0N/A // memProj (from ArrayAllocation CheckCastPP) 0N/A // | || Int (element index) 0N/A // | || | ConI (log(element size)) 0N/A // | AddP (array's element offset) 0N/A // | | ConI (array's offset: #12(32-bits) or #24(64-bits)) 0N/A // AddP (array's offset) 35N/A// Adjust the type and inputs of an AddP which computes the 0N/A// address of a field of an instance 0N/A // We are computing a raw address for a store captured by an Initialize 0N/A // compute an appropriate address type (cases #3 and #5). 0N/A "old type must be non-instance or match new type");
0N/A // The type 't' could be subclass of 'base_t'. 0N/A // As result t->offset() could be large then base_t's size and it will 0N/A // cause the failure in add_offset() with narrow oops since TypeOopPtr() 0N/A // constructor verifies correctness of the offset. 0N/A // It could happened on subclass's branch (from the type profiling 0N/A // inlining) which was not eliminated during parsing since the exactness 0N/A // of the allocation type was not propagated to the subclass type check. 0N/A // Or the type 't' could be not related to 'base_t' at all. 0N/A // It could happened when CHA type is different from MDO type on a dead path 0N/A // (for example, from instanceof check) which is not collapsed during parsing. 0N/A // Do nothing for such AddP node and don't process its users since 0N/A // this code branch will go away. 0N/A return false;
// bail out 0N/A // Do NOT remove the next line: ensure a new alias index is allocated 0N/A // for the instance type. Note: C++ will not remove it since the call 0N/A // record the allocation in the node map 0N/A // Set addp's Base and Address to 'base'. 0N/A // Skip AddP cases #3 and #5. 0N/A // AddP case #4 (adr is array's element offset AddP node) 0N/A // Put on IGVN worklist since at least addp's type was changed above. 0N/A// Create a new version of orig_phi if necessary. Returns either the newly 0N/A// created phi or an existing phi. Sets create_new to indicate whether a new 0N/A// phi was created. Cache the last newly created phi in the node map. 0N/A // nothing to do if orig_phi is bottom memory or matches alias_idx 0N/A // Have we recently created a Phi for this alias index? 0N/A // Previous check may fail when the same wide memory Phi was split into Phis 0N/A // for different memory slices. Search all Phis for this region. 0N/A // Retry compilation without escape analysis. 0N/A // If this is the first failure, the sentinel string will "stick" 0N/A // to the Compile object, and the C2Compiler will see it and retry. 0N/A// Return a new version of Memory Phi "orig_phi" with the inputs having the 0N/A// specified alias index. 0N/A // found an phi for which we created a new split, push current one on worklist and begin 0N/A // processing new one 0N/A // verify that the new Phi has an input for each input of the original 0N/A // Check if all new phi's inputs have specified alias index. 0N/A // Otherwise use old phi. 0N/A // we have finished processing a Phi, see if there are any more to do 0N/A// The next methods are derived from methods in MemNode. 0N/A // TypeOopPtr::NOTNULL+any is an OOP with unknown offset - generally 0N/A // means an array I have not precisely typed yet. Do not do any 0N/A // alias stuff with it any time soon. 0N/A // Update input if it is progress over what we have now 0N/A// Move memory users to their memory slices. 0N/A continue;
// Nothing to do 0N/A // Replace previous general reference to mem node. 0N/A // Don't move related membars. 0N/A continue;
// Nothing to do 0N/A // Move to general memory slice. 0N/A // Don't move related cardmark. 0N/A // Memory nodes should have new memory input. 0N/A "Following memory nodes should have new memory input or be on the same memory slice");
0N/A // Phi nodes should be split and moved already. 0N/A// Search memory chain of "mem" to find a MemNode whose address 0N/A// is the specified alias index. 0N/A break;
// hit one of our sentinels 0N/A break;
// Do not skip store to general memory slice. 0N/A continue;
// don't search further for non-instance types 0N/A // skip over a call which does not affect this memory slice 0N/A break;
// hit one of our sentinels 0N/A // Stop if this is the initialization for the object instance which 0N/A // which contains this memory slice, otherwise skip over it. 0N/A // Didn't find instance memory, search through general slice recursively. 0N/A // Can not bypass initialization of the instance 0N/A // we are looking for. 0N/A // Otherwise skip it (the call updated 'result' value). 0N/A // Push all non-instance Phis on the orig_phis worklist to update inputs 0N/A // during Phase 4 if needed. 0N/A // Create a new Phi with the specified alias index type. 0N/A // the result is either MemNode, PhiNode, InitializeNode. 0N/A// Convert the types of unescaped object to instance types where possible, 0N/A// propagate the new type information through the graph, and update memory 0N/A// edges and MergeMem inputs to reflect the new type. 0N/A// We start with allocations (and calls which may be allocations) on alloc_worklist. 0N/A// The processing is done in 4 phases: 0N/A// Phase 1: Process possible allocations from alloc_worklist. Create instance 0N/A// types for the CheckCastPP for allocations where possible. 0N/A// Propagate the the new types through users as follows: 0N/A// casts and Phi: push users on alloc_worklist 0N/A// AddP: cast Base and Address inputs to the instance type 0N/A// push any AddP users on alloc_worklist and push any memnode 0N/A// users onto memnode_worklist. 0N/A// Phase 2: Process MemNode's from memnode_worklist. compute new address type and 0N/A// search the Memory chain for a store with the appropriate type 0N/A// address type. If a Phi is found, create a new version with 0N/A// the appropriate memory slices from each of the Phi inputs. 0N/A// For stores, process the users as follows: 0N/A// MemNode: push on memnode_worklist 0N/A// MergeMem: push on mergemem_worklist 0N/A// Phase 3: Process MergeMem nodes from mergemem_worklist. Walk each memory slice 0N/A// moving the first node encountered of each instance type to the 0N/A// the input corresponding to its alias index. 0N/A// appropriate memory slice. 0N/A// Phase 4: Update the inputs of non-instance memory Phis and the Memory input of memnodes. 0N/A// In the following example, the CheckCastPP nodes are the cast of allocation 0N/A// results and the allocation of node 29 is unescaped and eligible to be an 0N/A// 19 CheckCastPP "Foo" 0N/A// 20 AddP _ 19 19 10 Foo+12 alias_index=4 0N/A// 29 CheckCastPP "Foo" 0N/A// 30 AddP _ 29 29 10 Foo+12 alias_index=4 0N/A// 40 StoreP 25 7 20 ... alias_index=4 0N/A// 50 StoreP 35 40 30 ... alias_index=4 0N/A// 60 StoreP 45 50 20 ... alias_index=4 0N/A// 70 LoadP _ 60 30 ... alias_index=4 0N/A// 80 Phi 75 50 60 Memory alias_index=4 0N/A// 90 LoadP _ 80 30 ... alias_index=4 0N/A// 100 LoadP _ 80 20 ... alias_index=4 0N/A// Phase 1 creates an instance type for node 29 assigning it an instance id of 24 0N/A// and creating a new alias index for node 30. This gives: 0N/A// 19 CheckCastPP "Foo" 0N/A// 20 AddP _ 19 19 10 Foo+12 alias_index=4 0N/A// 29 CheckCastPP "Foo" iid=24 0N/A// 30 AddP _ 29 29 10 Foo+12 alias_index=6 iid=24 0N/A// 40 StoreP 25 7 20 ... alias_index=4 0N/A// 50 StoreP 35 40 30 ... alias_index=6 0N/A// 60 StoreP 45 50 20 ... alias_index=4 0N/A// 70 LoadP _ 60 30 ... alias_index=6 0N/A// 80 Phi 75 50 60 Memory alias_index=4 0N/A// 90 LoadP _ 80 30 ... alias_index=6 0N/A// 100 LoadP _ 80 20 ... alias_index=4 0N/A// In phase 2, new memory inputs are computed for the loads and stores, 0N/A// And a new version of the phi is created. In phase 4, the inputs to 0N/A// node 80 are updated and then the memory nodes are updated with the 0N/A// values computed in phase 2. This results in: 0N/A// 19 CheckCastPP "Foo" 0N/A// 20 AddP _ 19 19 10 Foo+12 alias_index=4 0N/A// 29 CheckCastPP "Foo" iid=24 0N/A// 30 AddP _ 29 29 10 Foo+12 alias_index=6 iid=24 0N/A// 40 StoreP 25 7 20 ... alias_index=4 0N/A// 50 StoreP 35 7 30 ... alias_index=6 0N/A// 60 StoreP 45 40 20 ... alias_index=4 0N/A// 70 LoadP _ 50 30 ... alias_index=6 0N/A// 80 Phi 75 40 60 Memory alias_index=4 0N/A// 120 Phi 75 50 50 Memory alias_index=6 0N/A// 90 LoadP _ 120 30 ... alias_index=6 0N/A// 100 LoadP _ 80 20 ... alias_index=4 0N/A // Phase 1: Process possible allocations from alloc_worklist. 0N/A // Create instance types for the CheckCastPP for allocations where possible. 0N/A // (Note: don't forget to change the order of the second AddP node on 0N/A // the alloc_worklist if the order of the worklist processing is changed, 0N/A // see the comment in find_second_addp().) 0N/A // copy escape information to call node 0N/A // We have an allocation or call which returns a Java object, 0N/A // see if it is unescaped. 0N/A // Find CheckCastPP for the allocate or for the return value of a call 0N/A if (n ==
NULL) {
// No uses except Initialize node 0N/A // Set the scalar_replaceable flag for allocation 0N/A // so it could be eliminated if it has no uses. 0N/A // The inline code for Object.clone() casts the allocation result to 0N/A // java.lang.Object and then to the actual type of the allocated 0N/A // object. Detect this case and use the second cast. 0N/A // Also detect j.l.reflect.Array.newInstance(jobject, jint) case when 0N/A // the allocation result is cast to java.lang.Object and then 0N/A // to the actual Array type. 0N/A // Non-scalar replaceable if the allocation type is unknown statically 0N/A // (reflection allocation), the object can't be restored during 0N/A // deoptimization without precise type. 0N/A // Set the scalar_replaceable flag for allocation 0N/A // so it could be eliminated. 0N/A // in order for an object to be scalar-replaceable, it must be: 0N/A // - a direct allocation (not a call returning an object) 0N/A // - eligible to be a unique type 0N/A // - not determined to be ineligible by escape analysis 0N/A continue;
// not a TypeInstPtr 0N/A // First, put on the worklist all Field edges from Connection Graph 0N/A // which is more accurate then putting immediate users from Ideal Graph. 0N/A "only AddP nodes are Field edges in CG");
0N/A // An allocation may have an Initialize which has raw stores. Scan 0N/A // the users of the raw allocation result and push AddP users 0N/A // on alloc_worklist. 0N/A continue;
// Assume the value was set outside this method. 0N/A continue;
// already processed 0N/A continue;
// Assume the value was set outside this method. 0N/A continue;
// Skip dead path with different type 0N/A // push allocation's users on appropriate worklist 0N/A // Look for MergeMem nodes for calls which reference unique allocation 0N/A // (through CheckCastPP nodes) even for debug info. 0N/A assert(
false,
"EA: missing allocation reference path");
0N/A // New alias types were created in split_AddP(). 0N/A // Phase 2: Process MemNode's from memnode_worklist. compute new address type and 0N/A // compute new values for Memory inputs (the Memory inputs are not 0N/A // actually updated until phase 4.) 0N/A return;
// nothing to do 0N/A // we don't need to do anything, but the users must be pushed 0N/A // we don't need to do anything, but the users must be pushed 0N/A // We delay the memory edge update since we need old one in 0N/A // MergeMem code below when instances memory slices are separated. 0N/A continue;
// don't push users 0N/A // get the memory projection 0N/A // push user on appropriate worklist 0N/A // Phase 3: Process MergeMem nodes from mergemem_worklist. 0N/A // Walk each memory slice moving the first node encountered of each 0N/A // instance type to the the input corresponding to its alias index. 0N/A // Note: we don't want to use MergeMemStream here because we only want to 0N/A // scan inputs which exist at the start, not ones we add during processing. 0N/A // Note 2: MergeMem may already contains instance memory slices added 0N/A // during find_inst_mem() call when memory nodes were processed above. 0N/A // First, update mergemem by moving memory nodes to corresponding slices 0N/A // if their type became more precise since this mergemem was created. 0N/A // Find any instance of the current type if we haven't encountered 0N/A // already a memory slice of the instance along the memory chain. 0N/A // Find the rest of instances values 0N/A // Didn't find instance memory, search through general slice recursively. 0N/A // Phase 4: Update the inputs of non-instance memory Phis and 0N/A // the Memory input of memnodes 0N/A // First update the inputs of any non-instance Phi's from 0N/A // which we split out an instance Phi. Note we don't have 0N/A // to recursively process Phi's encounted on the input memory 0N/A // chains as is done in split_memory_phi() since they will 0N/A // also be processed here. 0N/A // Update the memory inputs of MemNodes with the value we computed 0N/A // in Phase 2 and move stores memory users to corresponding memory slices. 0N/A // Disable memory split verification code until the fix for 6984348. 0N/A // Currently it produces false negative results since it does not cover all cases. 0N/A#
if 0
// ifdef ASSERT 0N/A#
if 0
// ifdef ASSERT 0N/A // Move memory users of a store first. 0N/A // Now update memory input 0N/A#
if 0
// ifdef ASSERT 0N/A // Verify that memory was split correctly 0N/A // EA brings benefits only when the code has allocations and/or locks which 0N/A // are represented by ideal Macro nodes. 0N/A for(
int i=0; i <
cnt; i++ ) {
0N/A // Add ConP#NULL and ConN#NULL nodes before ConnectionGraph construction 0N/A // to create space for them in ConnectionGraph::_nodes[]. 0N/A // Perform escape analysis 0N/A // There are non escaping objects. 0N/A // 1. Populate Connection Graph (CG) with Ideal nodes. 0N/A // Initialize worklist 0N/A // Push all useful nodes onto CG list and set their type. 0N/A // Only allocations and java static calls results are checked 0N/A // for an escape status. See process_call_result() below. 0N/A // Collect address nodes. Use them during stage 3 below 0N/A // to build initial connection graph field edges. 0N/A // Collect all MergeMem nodes to add memory slices for 0N/A // scalar replaceable objects in split_unique_types(). 0N/A return false;
// Nothing to do. 0N/A // 2. First pass to create simple CG edges (doesn't require to walk CG). 0N/A // 3. Pass to create initial fields edges (JavaObject -F-> AddP) 0N/A // to reduce number of iterations during stage 4 below. 0N/A // 4. Build Connection Graph which need 0N/A // to walk the connection graph. 0N/A if (n !=
NULL) {
// Call, AddP, LoadP, StoreP 0N/A // After IGVN user nodes may have smaller _idx than 0N/A // their inputs so they will be processed first in 0N/A // previous loop. Because of that not all Graph 0N/A // edges will be created. Walk over interesting 0N/A // nodes again until no new edges are created. 0N/A // Normally only 1-3 passes needed to build 0N/A // Connection Graph depending on graph complexity. 0N/A // Set limit to 20 to catch situation when something 0N/A // did go wrong and recompile the method without EA. 0N/A err_msg(
"infinite EA connection graph build with %d nodes and worklist size %d",
0N/A // Possible infinite build_connection_graph loop, 0N/A // retry compilation without escape analysis. 0N/A // 5. Remove deferred edges from the graph and adjust 0N/A // escape state of nonescaping objects. 0N/A // Search for objects which are not scalar replaceable 0N/A // and adjust their escape state. 0N/A // 6. Propagate escape states. 0N/A // push all GlobalEscape nodes on the worklist 0N/A // mark all nodes reachable from GlobalEscape nodes 0N/A // push all ArgEscape nodes on the worklist 0N/A // mark all nodes reachable from ArgEscape nodes 0N/A // push all NoEscape nodes on the worklist 0N/A // mark all nodes reachable from NoEscape nodes 0N/A // Push scalar replaceable allocations on alloc_worklist 0N/A // for processing in split_unique_types(). 0N/A // Now use the escape information to create unique types for 0N/A // scalar replaceable objects. 0N/A tty->
print(
" since there are no scalar replaceable candidates ===");
0N/A// Adjust escape state after Connection Graph is built. 0N/A // Search for objects which are not scalar replaceable. 0N/A // Mark their escape state as ArgEscape to propagate the state 0N/A // to referenced objects. 0N/A // Note: currently there are no difference in compiler optimizations 0N/A // for ArgEscape objects and NoEscape objects which are not 0N/A // scalar replaceable. 0N/A // Check if a oop field's initializing value is recorded and add 0N/A // a corresponding NULL field's value if it is not recorded. 0N/A // Connection Graph does not record a default initialization by NULL 0N/A // captured by Initialize node. 0N/A // Note: it will disable scalar replacement in some cases: 0N/A // Point p[] = new Point[1]; 0N/A // p[0] = new Point(); // Will be not scalar replaced 0N/A // but it will save us from incorrect optimizations in next cases: 0N/A // Point p[] = new Point[1]; 0N/A // if ( x ) p[0] = new Point(); // Will be not scalar replaced 0N/A // Do a simple control flow analysis to distinguish above cases. 0N/A // It does not matter if it is not Allocation node since 0N/A // only non-escaping allocations are scalar replaced. 0N/A // Check only oop fields. 0N/A // Ignore non field load (for example, klass load) 0N/A // Raw pointers are used for initializing stores so skip it. 0N/A // Check for a store which follows allocation without branches. 0N/A // For example, a volatile field store is not collected 0N/A // by Initialize node. TODO: it would be nice to use idom() here. 0N/A // A field's initializing value was not recorded. Add NULL. 0N/A // An object is not scalar replaceable if the field which may point 0N/A // to it has unknown offset (unknown element of an array of objects). 0N/A // Currently an object is not scalar replaceable if a LoadStore node 0N/A // access its field since the field value is unknown after it. 0N/A // An object is not scalar replaceable if the address points 0N/A // to unknown field (unknown element for arrays, offset is OffsetBot). 0N/A // Or the address may point to more then one object. This may produce 0N/A // the false positive result (set scalar_replaceable to false) 0N/A // since the flow-insensitive escape analysis can't separate 0N/A // the case when stores overwrite the field's value from the case 0N/A // when stores happened on different control branches. 0N/A // Stub calls, objects do not escape but they are not scale replaceable. 0N/A // Adjust escape state for outgoing arguments. 0N/A // The inline_native_clone() case when the arraycopy stub is called 0N/A // after the allocation before Initialize and CheckCastPP nodes. 0N/A // Set AddP's base (Allocate) as not scalar replaceable since 0N/A // pointer to the base (with offset) is passed as argument. 0N/A // For a static call, we know exactly what method is being called. 0N/A // Use bytecode estimator to record the call's escape affects 0N/A // fall-through if not a Java method or no analyzer information 0N/A // The argument global escapes, mark everything it could point to 0N/A // The argument itself doesn't escape, but any fields might 0N/A //The argument global escapes, mark everything it could point to 0N/A // The argument itself doesn't escape, but any fields might 0N/A // Fall-through here if not a Java method or no analyzer information 0N/A // or some other type of call, assume the worst case: all arguments 0N/A // adjust escape state for outgoing arguments 0N/A // Not scalar replaceable if the length is not constant or too big. 0N/A // For a static call, we know exactly what method is being called. 0N/A // Use bytecode estimator to record whether the call's return value escapes 0N/A // Note: we use isa_ptr() instead of isa_oopptr() here because the 0N/A // _multianewarray functions return a TypeRawPtr. 0N/A break;
// doesn't return a pointer type 0N/A // not a Java method, assume global escape 0N/A // Returns a newly allocated unescaped object, simply 0N/A // update dependency information. 0N/A // Mark it as NoEscape so that objects referenced by 0N/A // it's fields will be marked as NoEscape at least. 0N/A // determine whether any arguments are returned 0N/A // Returns unknown object. 0N/A // Some other type of call, assume the worst case that the 0N/A // returned value, if any, globally escapes. 0N/A // Note: we use isa_ptr() instead of isa_oopptr() here because the 0N/A // _multianewarray functions return a TypeRawPtr. 0N/A// Populate Connection Graph with Ideal nodes and create simple 0N/A// connection graph edges (do not need to check the node_type of inputs 0N/A// or to call PointsTo() to walk the connection graph). 0N/A return;
// No need to redefine node's state. 0N/A // Arguments to allocation and locking don't escape. 0N/A // Put Lock and Unlock nodes on IGVN worklist to process them during 0N/A // the first IGVN optimization when escape information is still available. 0N/A // Don't mark as processed since call's arguments have to be processed. 0N/A // Check if a call returns an object. 0N/A // Since the called mathod is statically unknown assume 0N/A // the worst case that the returned value globally escapes. 0N/A // Using isa_ptr() instead of isa_oopptr() for LoadP and Phi because 0N/A // ThreadLocal has RawPrt type. 0N/A {
// "Unsafe" memory access. 0N/A // assume all pointer constants globally escape except for null 0N/A // assume all narrow oop constants globally escape except for null 0N/A // assume that all exception objects globally escape 0N/A // We have to assume all input parameters globally escape 0N/A // (Note: passing 'false' since _processed is already set). 0N/A // nothing to do if not an oop or narrow oop 0N/A for (i =
1; i < n->
req() ; i++) {
0N/A continue;
// ignore NULL 0N/A continue;
// ignore top or inputs which go back this node 0N/A // we are only interested in the oop result projection from a call 0N/A // The call may not be registered yet (since not all its inputs are registered) 0N/A // if this is the projection from backbranch edge of Phi. 0N/A // The call's result may need to be processed later if the call 0N/A // returns it's argument and the argument is not processed yet. 0N/A // Treat Return value as LocalVar with GlobalEscape escape state. 0N/A // We are computing a raw address for a store captured 0N/A // by an Initialize compute an appropriate address type. 0N/A // char[] arrays passed to string intrinsics are not scalar replaceable. 0N/A // Don't set processed bit for AddP, LoadP, StoreP since 0N/A // they may need more then one pass to process. 0N/A // Also don't mark as processed Call nodes since their 0N/A // arguments may need more then one pass to process. 0N/A return;
// No need to redefine node's state. 0N/A // Create a field edge to this node from everything base could point to. 0N/A // For everything "adr_base" could point to, create a deferred edge from 0N/A // this node to each field with the same offset. 0N/A continue;
// ignore NULL 0N/A continue;
// ignore top or inputs which go back this node 0N/A // we are only interested in the oop result projection from a call 0N/A "all nodes should be registered");
0N/A // For everything "adr_base" could point to, create a deferred edge 0N/A // to "val" from each field with the same offset. 0N/A // char[] arrays passed to string intrinsic do not escape but 0N/A // they are not scalar replaceable. Adjust escape state for them. 0N/A // Start from in(2) edge since in(1) is memory edge. 0N/A // Mark as ArgEscape everything "adr" could point to. assert(
false,
"Op_ThreadLocal");
// This method should be called only for EA specific nodes. tty->
print(
"======== Connection graph for ");
// Print all locals which reference this allocation // Print all fields which reference this allocation