escape.cpp revision 124
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
#include "incls/_precompiled.incl"
#include "incls/_escape.cpp.incl"
}
}
}
_edges->append_if_missing(v);
}
}
#ifndef PRODUCT
static const char *node_type_names[] = {
"UnknownType",
"JavaObject",
"LocalVar",
"Field"
};
static const char *esc_names[] = {
"UnknownEscape",
"NoEscape",
"ArgEscape",
"GlobalEscape"
};
static const char *edge_type_suffix[] = {
"?", // UnknownEdge
"P", // PointsToEdge
"D", // DeferredEdge
"F" // FieldEdge
};
void PointsToNode::dump() const {
tty->print("%s %s %s [[", node_type_names[(int) nt], esc_names[(int) es], _scalar_replaceable ? "" : "NSR");
for (uint i = 0; i < edge_count(); i++) {
}
else
}
#endif
ConnectionGraph::ConnectionGraph(Compile * C) : _processed(C->comp_arena()), _node_map(C->comp_arena()) {
_collecting = true;
this->_compile = C;
}
assert(f->node_type() != PointsToNode::UnknownType && t->node_type() != PointsToNode::UnknownType, "node types must be set");
assert(f->node_type() == PointsToNode::LocalVar || f->node_type() == PointsToNode::Field, "invalid source of PointsTo edge");
}
assert(f->node_type() != PointsToNode::UnknownType && t->node_type() != PointsToNode::UnknownType, "node types must be set");
assert(f->node_type() == PointsToNode::LocalVar || f->node_type() == PointsToNode::Field, "invalid source of Deferred edge");
assert(t->node_type() == PointsToNode::LocalVar || t->node_type() == PointsToNode::Field, "invalid destination of Deferred edge");
// don't add a self-referential edge, this can occur during removal of
// deferred edges
}
// We are computing a raw address for a store captured by an Initialize
// compute an appropriate address type. AddP cases #3 and #5 (see below).
"offset must be a constant or it is initialization of array");
return offs;
}
}
assert(f->node_type() != PointsToNode::UnknownType && t->node_type() != PointsToNode::UnknownType, "node types must be set");
t->set_offset(offset);
}
}
// inline set_escape_state(idx, es);
if (done)
}
// If we are still collecting or there were no non-escaping allocations
// we don't know the answer yet
if (_collecting || !_has_allocations)
return PointsToNode::UnknownEscape;
// if the node was created after the escape computation, return
// UnknownEscape
return PointsToNode::UnknownEscape;
// if we have already computed a value, return it
return es;
// compute max escape state of anything this node could point to
}
// cache the computed escape state
return es;
}
#ifdef ASSERT
#endif
n = n->uncast();
// If we have a JavaObject, return just that object
return;
}
#ifdef ASSERT
if (orig_n != n)
n->dump();
}
#endif
// ensure that all inputs of a Phi have been processed
int edges_processed = 0;
} else {
assert(false,"neither PointsToEdge or DeferredEdge");
}
}
if (edges_processed == 0) {
// no deferred or pointsto edges found. Assume the value was set
// outside this method. Add the phantom object to the pointsto set.
}
}
}
}
void ConnectionGraph::remove_deferred(uint ni, GrowableArray<uint>* deferred_edges, VectorSet* visited) {
// This method is most expensive during ConnectionGraph construction.
// Reuse vectorSet and an additional growable array for deferred edges.
deferred_edges->clear();
uint i = 0;
// Mark current edges as visited and move deferred edges to separate array.
while (i < ptn->edge_count()) {
#ifdef ASSERT
#else
#endif
deferred_edges->append(t);
} else {
i++;
}
}
continue;
case PointsToNode::PointsToEdge:
if(n1 == _phantom_object) {
// Special case - field set outside (globally escaping).
}
break;
case PointsToNode::DeferredEdge:
break;
case PointsToNode::FieldEdge:
assert(false, "invalid connection graph");
break;
}
}
}
}
// Add an edge to node given by "to_i" from any field of adr_i whose offset
// matches "offset" A deferred edge is added if to_i is a LocalVar, and
// a pointsto edge is added if it is a JavaObject
if (deferred)
else
}
}
}
// Add a deferred edge from node given by "from_i" to any field of adr_i
// whose offset matches "offset".
if (pf.edge_count() == 0) {
// we have not seen any stores to this field, assume it was set outside this method
}
}
}
}
// Helper functions
//
// AddP cases for Base and Address inputs:
// case #1. Direct object's field reference:
// Allocate
// |
// Proj #5 ( oop result )
// |
// CheckCastPP (cast to instance type)
// | |
// AddP ( base == address )
//
// case #2. Indirect object's field reference:
// Phi
// |
// CastPP (cast to instance type)
// | |
// AddP ( base == address )
//
// case #3. Raw object's field reference for Initialize node:
// Allocate
// |
// Proj #5 ( oop result )
// top |
// \ |
// AddP ( base == top )
//
// case #4. Array's element reference:
// {CheckCastPP | CastPP}
// | | |
// | AddP ( array's element offset )
// | |
// AddP ( array's offset )
//
// case #5. Raw object's field reference for arraycopy stub call:
// The inline_native_clone() case when the arraycopy stub is called
// after the allocation before Initialize and CheckCastPP nodes.
// Allocate
// |
// Proj #5 ( oop result )
// | |
// AddP ( base == address )
//
// case #6. Constant Pool, ThreadLocal, CastX2P or
// Raw object's field reference:
// {ConP, ThreadLocal, CastX2P, raw Load}
// top |
// \ |
// AddP ( base == top )
//
// case #7. Klass's field reference.
// LoadKlass
// | |
// AddP ( base == address )
//
}
return base;
}
//
// Find array's offset to push it on worklist first and
// as result process an array's element offset first (pushed second)
// to avoid CastPP for the array's offset.
// Otherwise the inserted CastPP (LocalVar) will point to what
// the AddP (Field) points to. Which would be wrong since
// the algorithm expects the CastPP has the same point as
// as AddP's base CheckCastPP (LocalVar).
//
// ArrayAllocation
// |
// CheckCastPP
// |
// memProj (from ArrayAllocation CheckCastPP)
// | ||
// | || Int (element index)
// | || | ConI (log(element size))
// | || | /
// | || LShift
// | || /
// | AddP (array's element offset)
// | |
// | | ConI (array's offset: #12(32-bits) or #24(64-bits))
// | / /
// AddP (array's offset)
// |
//
return addp2;
}
return NULL;
}
//
// Adjust the type and inputs of an AddP which computes the
// address of a field of an instance
//
if (t == NULL) {
// We are computing a raw address for a store captured by an Initialize
// compute an appropriate address type.
assert(addp->in(AddPNode::Address)->is_Proj(), "base of raw address must be result projection from allocation");
}
"old type must be non-instance or match new type");
// Do NOT remove the next call: ensure an new alias index is allocated
// for the instance type
// record the allocation in the node map
// if the Address input is not the appropriate instance type
// (due to intervening casts,) insert a cast
}
}
// Put on IGVN worklist since at least addp's type was changed above.
}
//
// Create a new version of orig_phi if necessary. Returns either the newly
// created phi or an existing phi. Sets create_new to indicate wheter a new
// phi was created. Cache the last newly created phi in the node map.
//
PhiNode *ConnectionGraph::create_split_phi(PhiNode *orig_phi, int alias_idx, GrowableArray<PhiNode *> &orig_phi_worklist, PhaseGVN *igvn, bool &new_created) {
new_created = false;
// nothing to do if orig_phi is bottom memory or matches alias_idx
if (phi_alias_idx == alias_idx) {
return orig_phi;
}
// have we already created a Phi for this alias index?
return result;
}
if (C->do_escape_analysis() == true && !C->failing()) {
// Retry compilation without escape analysis.
// If this is the first failure, the sentinel string will "stick"
// to the Compile object, and the C2Compiler will see it and retry.
}
return NULL;
}
new_created = true;
return result;
}
//
// Return a new version of Memory Phi "orig_phi" with the inputs having the
// specified alias index.
//
PhiNode *ConnectionGraph::split_memory_phi(PhiNode *orig_phi, int alias_idx, GrowableArray<PhiNode *> &orig_phi_worklist, PhaseGVN *igvn) {
bool new_phi_created;
if (!new_phi_created) {
return result;
}
bool finished = false;
while(!finished) {
PhiNode *newphi = create_split_phi(mem->as_Phi(), alias_idx, orig_phi_worklist, igvn, new_phi_created);
if (new_phi_created) {
// found an phi for which we created a new split, push current one on worklist and begin
// processing new one
idx = 1;
continue;
} else {
}
}
if (C->failing()) {
return NULL;
}
}
#ifdef ASSERT
// verify that the new Phi has an input for each input of the original
#endif
// Check if all new phi's inputs have specified alias index.
// Otherwise use old phi.
}
// we have finished processing a Phi, see if there are any more to do
if (!finished) {
}
}
return result;
}
//
// The next methods are derived from methods in MemNode.
//
// TypeInstPtr::NOTNULL+any is an OOP with unknown offset - generally
// means an array I have not precisely typed yet. Do not do any
// alias stuff with it any time soon.
// Update input if it is progress over what we have now
}
return mem;
}
//
// Search memory chain of "mem" to find a MemNode whose address
// is the specified alias index.
//
Node* ConnectionGraph::find_inst_mem(Node *orig_mem, int alias_idx, GrowableArray<PhiNode *> &orig_phis, PhaseGVN *phase) {
return orig_mem;
break;
}
}
if (!is_instance)
continue; // don't search further for non-instance types
// skip over a call which does not affect this memory slice
}
} else if (proj_in->is_Initialize()) {
// Stop if this is the initialization for the object instance which
// which contains this memory slice, otherwise skip over it.
}
}
} else if (result->is_MergeMem()) {
// Didn't find instance memory, search through general slice recursively.
if (C->failing()) {
return NULL;
}
}
} else {
break;
}
}
}
if (C->get_alias_index(t) != alias_idx) {
}
}
// the result is either MemNode, PhiNode, InitializeNode.
return result;
}
//
// Convert the types of unescaped object to instance types where possible,
// propagate the new type information through the graph, and update memory
// edges and MergeMem inputs to reflect the new type.
//
// We start with allocations (and calls which may be allocations) on alloc_worklist.
// The processing is done in 4 phases:
//
// Phase 1: Process possible allocations from alloc_worklist. Create instance
// types for the CheckCastPP for allocations where possible.
// Propagate the the new types through users as follows:
// casts and Phi: push users on alloc_worklist
// AddP: cast Base and Address inputs to the instance type
// push any AddP users on alloc_worklist and push any memnode
// users onto memnode_worklist.
// Phase 2: Process MemNode's from memnode_worklist. compute new address type and
// search the Memory chain for a store with the appropriate type
// address type. If a Phi is found, create a new version with
// the approriate memory slices from each of the Phi inputs.
// For stores, process the users as follows:
// MemNode: push on memnode_worklist
// MergeMem: push on mergemem_worklist
// Phase 3: Process MergeMem nodes from mergemem_worklist. Walk each memory slice
// moving the first node encountered of each instance type to the
// the input corresponding to its alias index.
// appropriate memory slice.
// Phase 4: Update the inputs of non-instance memory Phis and the Memory input of memnodes.
//
// In the following example, the CheckCastPP nodes are the cast of allocation
// results and the allocation of node 29 is unescaped and eligible to be an
// instance type.
//
// We start with:
//
// 7 Parm #memory
// 10 ConI "12"
// 19 CheckCastPP "Foo"
// 20 AddP _ 19 19 10 Foo+12 alias_index=4
// 29 CheckCastPP "Foo"
// 30 AddP _ 29 29 10 Foo+12 alias_index=4
//
// 40 StoreP 25 7 20 ... alias_index=4
// 50 StoreP 35 40 30 ... alias_index=4
// 60 StoreP 45 50 20 ... alias_index=4
// 70 LoadP _ 60 30 ... alias_index=4
// 80 Phi 75 50 60 Memory alias_index=4
// 90 LoadP _ 80 30 ... alias_index=4
// 100 LoadP _ 80 20 ... alias_index=4
//
//
// Phase 1 creates an instance type for node 29 assigning it an instance id of 24
// and creating a new alias index for node 30. This gives:
//
// 7 Parm #memory
// 10 ConI "12"
// 19 CheckCastPP "Foo"
// 20 AddP _ 19 19 10 Foo+12 alias_index=4
// 29 CheckCastPP "Foo" iid=24
// 30 AddP _ 29 29 10 Foo+12 alias_index=6 iid=24
//
// 40 StoreP 25 7 20 ... alias_index=4
// 50 StoreP 35 40 30 ... alias_index=6
// 60 StoreP 45 50 20 ... alias_index=4
// 70 LoadP _ 60 30 ... alias_index=6
// 80 Phi 75 50 60 Memory alias_index=4
// 90 LoadP _ 80 30 ... alias_index=6
// 100 LoadP _ 80 20 ... alias_index=4
//
// In phase 2, new memory inputs are computed for the loads and stores,
// And a new version of the phi is created. In phase 4, the inputs to
// node 80 are updated and then the memory nodes are updated with the
// values computed in phase 2. This results in:
//
// 7 Parm #memory
// 10 ConI "12"
// 19 CheckCastPP "Foo"
// 20 AddP _ 19 19 10 Foo+12 alias_index=4
// 29 CheckCastPP "Foo" iid=24
// 30 AddP _ 29 29 10 Foo+12 alias_index=6 iid=24
//
// 40 StoreP 25 7 20 ... alias_index=4
// 50 StoreP 35 7 30 ... alias_index=6
// 60 StoreP 45 40 20 ... alias_index=4
// 70 LoadP _ 50 30 ... alias_index=6
// 80 Phi 75 40 60 Memory alias_index=4
// 120 Phi 75 50 50 Memory alias_index=6
// 90 LoadP _ 120 30 ... alias_index=6
// 100 LoadP _ 80 20 ... alias_index=4
//
// Phase 1: Process possible allocations from alloc_worklist.
// Create instance types for the CheckCastPP for allocations where possible.
while (alloc_worklist.length() != 0) {
if (n->is_Call()) {
// copy escape information to call node
// We have an allocation or call which returns a Java object,
// see if it is unescaped.
continue;
if (alloc->is_Allocate()) {
// Set the scalar_replaceable flag before the next check.
}
// find CheckCastPP of call return value
n = alloc->result_cast();
if (n == NULL || // No uses accept Initialize or
!n->is_CheckCastPP()) // not unique CheckCastPP.
continue;
// The inline code for Object.clone() casts the allocation result to
// java.lang.Object and then to the the actual type of the allocated
// object. Detect this case and use the second cast.
if (use->is_CheckCastPP()) {
break;
}
}
n = cast2;
} else {
continue;
}
}
// in order for an object to be stackallocatable, it must be:
// - a direct allocation (not a call returning an object)
// - non-escaping
// - eligible to be a unique type
// - not determined to be ineligible by escape analysis
if (t == NULL)
continue; // not a TypeInstPtr
igvn->hash_delete(n);
n->raise_bottom_type(tinst);
igvn->hash_insert(n);
(t->isa_instptr() || t->isa_aryptr())) {
// An allocation may have an Initialize which has raw stores. Scan
// the users of the raw allocation result and push AddP users
// on alloc_worklist.
}
} else if (use->is_Initialize()) {
}
}
}
} else if (n->is_AddP()) {
if (elem == _phantom_object)
continue; // Assume the value was set outside this method.
} else if (n->is_Phi() ||
n->is_CheckCastPP() ||
continue; // already processed
}
if (elem == _phantom_object)
continue; // Assume the value was set outside this method.
}
}
} else {
continue;
}
// push users on appropriate worklist
} else if (use->is_Initialize()) {
} else if (use->is_MergeMem()) {
// Look for MergeMem nodes for calls which reference unique allocation
// (through CheckCastPP nodes) even for debug info.
}
if (m->is_MergeMem()) {
}
}
use->is_CheckCastPP() ||
}
}
}
// New alias types were created in split_AddP().
// Phase 2: Process MemNode's from memnode_worklist. compute new address type and
// compute new values for Memory inputs (the Memory inputs are not
// actually updated until phase 4.)
if (memnode_worklist.length() == 0)
return; // nothing to do
while (memnode_worklist.length() != 0) {
continue;
if (n->is_Phi()) {
// we don't need to do anything, but the users must be pushed if we haven't processed
// this Phi before
} else if (n->is_Initialize()) {
// we don't need to do anything, but the users of the memory projection must be pushed
if (n == NULL)
continue;
} else {
continue;
return;
}
}
if (n->is_Load()) {
continue; // don't push users
} else if (n->is_LoadStore()) {
// get the memory projection
n = use;
break;
}
}
}
}
// push user on appropriate worklist
} else if (use->is_Initialize()) {
} else if (use->is_MergeMem()) {
}
}
}
// Phase 3: Process MergeMem nodes from mergemem_worklist.
// Walk each memory moving the first node encountered of each
// instance type to the the input corresponding to its alias index.
while (mergemem_worklist.length() != 0) {
continue;
// Note: we don't want to use MergeMemStream here because we only want to
// scan inputs which exist at the start, not ones we add during processing.
continue;
if (idx == i) {
} else {
}
}
}
}
// Find any instance of the current type if we haven't encountered
// a value of the instance along the chain.
if (nmm->is_empty_memory(m)) {
return;
}
}
}
}
}
// Find the rest of instances values
// Didn't find instance memory, search through general slice recursively.
return;
}
}
}
// Propagate new memory slices to following MergeMem nodes.
if (mm->is_MergeMem()) {
}
}
}
if (use->is_Allocate()) {
continue;
}
}
}
if (use->is_Initialize()) {
if (mm->is_MergeMem()) {
}
}
}
}
}
}
// Phase 4: Update the inputs of non-instance memory Phis and
// the Memory input of memnodes
// First update the inputs of any non-instance Phi's from
// which we split out an instance Phi. Note we don't have
// to recursively process Phi's encounted on the input memory
// chains as is done in split_memory_phi() since they will
// also be processed here.
return;
}
}
}
}
// Update the memory inputs of MemNodes with the value we computed
// in Phase 2.
igvn->hash_delete(n);
igvn->hash_insert(n);
}
}
}
}
void ConnectionGraph::compute_escape() {
// 1. Populate Connection Graph with Ideal nodes.
// Initialize worklist
}
bool has_allocations = false;
// Push all useful nodes onto CG list and set their type.
if (n->is_Call() &&
has_allocations = true;
}
if(n->is_AddP())
worklist_init.push(m);
}
}
if (has_allocations) {
_has_allocations = true;
} else {
_has_allocations = false;
_collecting = false;
return; // Nothing to do.
}
// 2. First pass to create simple CG edges (doesn't require to walk CG).
}
// 3. Pass to create fields edges (Allocate -F-> AddP).
}
cg_worklist.clear();
// 4. Build Connection Graph which need
// to walk the connection graph.
if (n != NULL) { // Call, AddP, LoadP, StoreP
}
}
// remove deferred edges from the graph and collect
// information we will need for type splitting
if (n->is_AddP()) {
// If this AddP computes an address which may point to more that one
// object, nothing the address points to can be scalar replaceable.
}
}
}
// Push call on alloc_worlist (alocations are calls)
// for processing by split_unique_types().
alloc_worklist.append(n);
}
}
// push all GlobalEscape nodes on the worklist
}
// mark all node reachable from GlobalEscape nodes
}
}
}
// push all ArgEscape nodes on the worklist
}
// mark all node reachable from ArgEscape nodes
}
}
}
// push all NoEscape nodes on the worklist
}
// mark all node reachable from NoEscape nodes
}
}
}
_collecting = false;
has_allocations = false; // Are there scalar replaceable allocations?
has_allocations = true;
break;
}
}
if (!has_allocations) {
return; // Nothing to do.
}
// Now use the escape information to create unique types for
// unescaped objects
// Clean up after split unique types.
#ifdef ASSERT
} else if (PrintEscapeAnalysis || PrintEliminateAllocations) {
C()->method()->print_short_name();
if(!EliminateAllocations) {
}
#endif
}
}
#ifdef ASSERT
case Op_Allocate:
case Op_AllocateArray:
case Op_Lock:
case Op_Unlock:
assert(false, "should be done already");
break;
#endif
case Op_CallLeafNoFP:
{
// Stub calls, objects do not escape but they are not scale replaceable.
// Adjust escape state for outgoing arguments.
//
// The inline_native_clone() case when the arraycopy stub is called
// after the allocation before Initialize and CheckCastPP nodes.
//
// Set AddP's base (Allocate) as not scalar replaceable since
// pointer to the base (with offset) is passed as argument.
//
}
}
}
}
break;
}
case Op_CallStaticJava:
// For a static call, we know exactly what method is being called.
// Use bytecode estimator to record the call's escape affects
{
// fall-through if not a Java method or no analyzer information
if (call_analyzer != NULL) {
bool copy_dependencies = false;
bool global_escapes = false;
bool fields_escapes = false;
if (!call_analyzer->is_arg_stack(k)) {
// The argument global escapes, mark everything it could point to
global_escapes = true;
} else {
if (!call_analyzer->is_arg_local(k)) {
// The argument itself doesn't escape, but any fields might
fields_escapes = true;
}
copy_dependencies = true;
}
if (global_escapes) {
//The argument global escapes, mark everything it could point to
} else {
if (fields_escapes) {
// The argument itself doesn't escape, but any fields might
}
}
}
}
}
if (copy_dependencies)
break;
}
}
default:
// Fall-through here if not a Java method or no analyzer information
// or some other type of call, assume the worst case: all arguments
// globally escape.
{
// adjust escape state for outgoing arguments
}
}
}
}
}
}
case Op_Allocate:
{
const TypeKlassPtr *kt;
if (k->Opcode() == Op_LoadKlass) {
} else {
}
} else {
}
break;
}
case Op_AllocateArray:
{
// Not scalar replaceable if the length is not constant or too big.
ptadr->_scalar_replaceable = false;
}
break;
}
case Op_CallStaticJava:
// For a static call, we know exactly what method is being called.
// Use bytecode estimator to record whether the call's return value escapes
{
bool done = true;
// Note: we use isa_ptr() instead of isa_oopptr() here because the
// _multianewarray functions return a TypeRawPtr.
break; // doesn't return a pointer type
}
// not a Java method, assume global escape
} else {
bool copy_dependencies = false;
if (call_analyzer->is_return_allocated()) {
// Returns a newly allocated unescaped object, simply
// update dependency information.
// Mark it as NoEscape so that objects referenced by
// it's fields will be marked as NoEscape at least.
copy_dependencies = true;
// determine whether any arguments are returned
done = false;
else
arg_esp->_hidden_alias = true;
}
}
}
copy_dependencies = true;
} else {
arg_esp->_hidden_alias = true;
}
}
}
if (copy_dependencies)
}
if (done)
break;
}
default:
// Some other type of call, assume the worst case that the
// returned value, if any, globally escapes.
{
// Note: we use isa_ptr() instead of isa_oopptr() here because the
// _multianewarray functions return a TypeRawPtr.
}
}
}
}
}
// Populate Connection Graph with Ideal nodes and create simple
// connection graph edges (do not need to check the node_type of inputs
// or to call PointsTo() to walk the connection graph).
return; // No need to redefine node's state.
if (n->is_Call()) {
// Arguments to allocation and locking don't escape.
if (n->is_Allocate()) {
// Put Lock and Unlock nodes on IGVN worklist to process them during
// the first IGVN optimization when escape information is still available.
} else {
// Have to process call's arguments first.
// Check if a call returns an object.
// Note: use isa_ptr() instead of isa_oopptr() here because
// the _multianewarray functions return a TypeRawPtr.
}
}
}
return;
}
// Using isa_ptr() instead of isa_oopptr() for LoadP and Phi because
// ThreadLocal has RawPrt type.
switch (n->Opcode()) {
case Op_AddP:
{
break;
}
case Op_CastX2P:
{ // "Unsafe" memory access.
break;
}
case Op_CastPP:
case Op_CheckCastPP:
case Op_EncodeP:
case Op_DecodeN:
{
break;
} else {
}
break;
}
case Op_ConP:
{
// assume all pointer constants globally escape except for null
else
break;
}
case Op_ConN:
{
// assume all narrow oop constants globally escape except for null
else
break;
}
case Op_CreateEx:
{
// assume that all exception objects globally escape
break;
}
case Op_LoadKlass:
{
break;
}
case Op_LoadP:
case Op_LoadN:
{
return;
}
break;
}
case Op_Parm:
{
return;
return;
// We have to assume all input parameters globally escape
// (Note: passing 'false' since _processed is already set).
break;
}
case Op_Phi:
{
// nothing to do if not an oop
return;
}
uint i;
for (i = 1; i < n->req() ; i++) {
continue; // ignore NULL
continue; // ignore top or inputs which go back this node
break;
} else {
}
}
if (i >= n->req())
else
break;
}
case Op_Proj:
{
// we are only interested in the result projection from a call
// The call's result may need to be processed later if the call
// returns it's argument and the argument is not processed yet.
}
} else {
}
break;
}
case Op_Return:
{
// Treat Return value as LocalVar with GlobalEscape escape state.
break;
} else {
}
}
break;
}
case Op_StoreP:
case Op_StoreN:
{
if (adr_type->isa_narrowoop()) {
}
if (adr_type->isa_oopptr()) {
} else {
// We are computing a raw address for a store captured
// by an Initialize compute an appropriate address type.
} else {
return;
}
}
break;
}
case Op_StorePConditional:
case Op_CompareAndSwapP:
case Op_CompareAndSwapN:
{
if (adr_type->isa_narrowoop()) {
}
if (adr_type->isa_oopptr()) {
} else {
return;
}
break;
}
case Op_ThreadLocal:
{
break;
}
default:
;
// nothing to do
}
return;
}
// Don't set processed bit for AddP, LoadP, StoreP since
// they may need more then one pass to process.
return; // No need to redefine node's state.
if (n->is_Call()) {
return;
}
switch (n->Opcode()) {
case Op_AddP:
{
// Create a field edge to this node from everything base could point to.
}
break;
}
case Op_CastX2P:
{
assert(false, "Op_CastX2P");
break;
}
case Op_CastPP:
case Op_CheckCastPP:
case Op_EncodeP:
case Op_DecodeN:
{
} else {
}
break;
}
case Op_ConP:
{
assert(false, "Op_ConP");
break;
}
case Op_CreateEx:
{
assert(false, "Op_CreateEx");
break;
}
case Op_LoadKlass:
{
assert(false, "Op_LoadKlass");
break;
}
case Op_LoadP:
case Op_LoadN:
{
#ifdef ASSERT
assert(false, "Op_LoadP");
#endif
} else {
}
// For everything "adr_base" could point to, create a deferred edge from
// this node to each field with the same offset.
}
break;
}
case Op_Parm:
{
assert(false, "Op_Parm");
break;
}
case Op_Phi:
{
#ifdef ASSERT
assert(false, "Op_Phi");
#endif
continue; // ignore NULL
continue; // ignore top or inputs which go back this node
} else {
}
}
break;
}
case Op_Proj:
{
// we are only interested in the result projection from a call
} else {
assert(false, "Op_Proj");
}
break;
}
case Op_Return:
{
#ifdef ASSERT
assert(false, "Op_Return");
}
#endif
} else {
}
break;
}
case Op_StoreP:
case Op_StoreN:
case Op_StorePConditional:
case Op_CompareAndSwapP:
case Op_CompareAndSwapN:
{
if (adr_type->isa_narrowoop()) {
}
#ifdef ASSERT
if (!adr_type->isa_oopptr())
#endif
// For everything "adr_base" could point to, create a deferred edge
// to "val" from each field with the same offset.
}
break;
}
case Op_ThreadLocal:
{
assert(false, "Op_ThreadLocal");
break;
}
default:
;
// nothing to do
}
}
#ifndef PRODUCT
void ConnectionGraph::dump() {
bool first = true;
continue;
if (first) {
C()->method()->print_short_name();
first = false;
}
// Print all locals which reference this allocation
}
}
if (Verbose) {
// Print all fields which reference this allocation
}
}
}
}
}
#endif