src/share/vm/opto/escape.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/src/share/vm/opto/escape.hpp	Fri Oct 10 20:33:08 2014
--- new/src/share/vm/opto/escape.hpp	Fri Oct 10 20:33:08 2014

*** 123,132 **** --- 123,134 ---- class JavaObjectNode; class LocalVarNode; class FieldNode; class ArraycopyNode; + class ConnectionGraph; + // ConnectionGraph nodes class PointsToNode : public ResourceObj { GrowableArray<PointsToNode*> _edges; // List of nodes this node points to GrowableArray<PointsToNode*> _uses; // List of nodes which point to this node
*** 135,144 **** --- 137,147 ---- u1 _escape; // EscapeState of object u1 _fields_escape; // EscapeState of object's fields Node* const _node; // Ideal node corresponding to this PointsTo node. const int _idx; // Cached ideal node's _idx + const uint _pidx; // Index of this node public: typedef enum { UnknownType = 0, JavaObject = 1,
*** 163,183 **** --- 166,178 ---- ArraycopySrc = 4, // Has edge from Arraycopy node ArraycopyDst = 8 // Has edge to Arraycopy node } NodeFlags; PointsToNode(Compile *C, Node* n, EscapeState es, NodeType type): _edges(C->comp_arena(), 2, 0, NULL), _uses (C->comp_arena(), 2, 0, NULL), _node(n), _idx(n->_idx), _type((u1)type), _escape((u1)es), _fields_escape((u1)es), _flags(ScalarReplaceable) { assert(n != NULL && es != UnknownEscape, "sanity"); } + inline PointsToNode(ConnectionGraph* CG, Node* n, EscapeState es, NodeType type); + + uint pidx() const { return _pidx; } Node* ideal_node() const { return _node; } int idx() const { return _idx; } bool is_JavaObject() const { return _type == (u1)JavaObject; }
*** 241,258 **** --- 236,253 ---- }; class LocalVarNode: public PointsToNode { public: ! LocalVarNode(Compile *C, Node* n, EscapeState es): ! PointsToNode(C, n, es, LocalVar) {} ! LocalVarNode(ConnectionGraph *CG, Node* n, EscapeState es): ! PointsToNode(CG, n, es, LocalVar) {} }; class JavaObjectNode: public PointsToNode { public: ! JavaObjectNode(Compile *C, Node* n, EscapeState es): ! PointsToNode(C, n, es, JavaObject) { ! JavaObjectNode(ConnectionGraph *CG, Node* n, EscapeState es): ! PointsToNode(CG, n, es, JavaObject) { if (es > NoEscape) set_scalar_replaceable(false); } };
*** 260,271 **** --- 255,266 ---- GrowableArray<PointsToNode*> _bases; // List of JavaObject nodes which point to this node const int _offset; // Field's offset. const bool _is_oop; // Field points to object bool _has_unknown_base; // Has phantom_object base public: ! FieldNode(Compile *C, Node* n, EscapeState es, int offs, bool is_oop): ! PointsToNode(C, n, es, Field), ! FieldNode(ConnectionGraph *CG, Node* n, EscapeState es, int offs, bool is_oop): ! PointsToNode(CG, n, es, Field), _offset(offs), _is_oop(is_oop), _has_unknown_base(false) {} int offset() const { return _offset;} bool is_oop() const { return _is_oop;}
*** 282,293 **** --- 277,288 ---- }; class ArraycopyNode: public PointsToNode { public: ! ArraycopyNode(Compile *C, Node* n, EscapeState es): ! PointsToNode(C, n, es, Arraycopy) {} ! ArraycopyNode(ConnectionGraph *CG, Node* n, EscapeState es): ! PointsToNode(CG, n, es, Arraycopy) {} }; // Iterators for PointsTo node's edges: // for (EdgeIterator i(n); i.has_next(); i.next()) { // PointsToNode* u = i.get();
*** 321,335 **** --- 316,333 ---- inline PointsToNode* get() const { return ((PointsToNode*)node)->as_Field()->base(i); } }; class ConnectionGraph: public ResourceObj { + friend class PointsToNode; private: GrowableArray<PointsToNode*> _nodes; // Map from ideal nodes to // ConnectionGraph nodes. GrowableArray<PointsToNode*> _worklist; // Nodes to be processed + VectorSet _in_worklist; + uint _next_pidx; bool _collecting; // Indicates whether escape information // is still being collected. If false, // no new nodes will be processed.
*** 351,360 **** --- 349,360 ---- // growableArray::at() will throw assert otherwise. return _nodes.at(idx); } uint nodes_size() const { return _nodes.length(); } + uint next_pidx() { return _next_pidx++; } + // Add nodes to ConnectionGraph. void add_local_var(Node* n, PointsToNode::EscapeState es); void add_java_object(Node* n, PointsToNode::EscapeState es); void add_field(Node* n, PointsToNode::EscapeState es, int offset); void add_arraycopy(Node* n, PointsToNode::EscapeState es, PointsToNode* src, PointsToNode* dst);
*** 394,412 **** --- 394,420 ---- // Add all references to this JavaObject node. int add_java_object_edges(JavaObjectNode* jobj, bool populate_worklist); // Put node on worklist if it is (or was) not there. ! inline void add_to_worklist(PointsToNode* pt) { ! _worklist.push(pt); ! return; ! PointsToNode* ptf = pt; ! uint pidx_bias = 0; + if (PointsToNode::is_base_use(pt)) { + ptf = PointsToNode::get_use_node(pt)->as_Field(); + pidx_bias = _next_pidx; + } + if (!_in_worklist.test_set(ptf->pidx() + pidx_bias)) { + _worklist.append(pt); + } } // Put on worklist all uses of this node. ! inline void add_uses_to_worklist(PointsToNode* pt) { ! for (UseIterator i(pt); i.has_next(); i.next()) { ! _worklist.push(i.get()); ! add_to_worklist(i.get()); + } } // Put on worklist all field's uses and related field nodes. void add_field_uses_to_worklist(FieldNode* field);
*** 585,590 **** --- 593,611 ---- #ifndef PRODUCT void dump(GrowableArray<PointsToNode*>& ptnodes_worklist); #endif }; + inline PointsToNode::PointsToNode(ConnectionGraph *CG, Node* n, EscapeState es, NodeType type): + _edges(CG->_compile->comp_arena(), 2, 0, NULL), + _uses (CG->_compile->comp_arena(), 2, 0, NULL), + _node(n), + _idx(n->_idx), + _pidx(CG->next_pidx()), + _type((u1)type), + _escape((u1)es), + _fields_escape((u1)es), + _flags(ScalarReplaceable) { + assert(n != NULL && es != UnknownEscape, "sanity"); + } + #endif // SHARE_VM_OPTO_ESCAPE_HPP

src/share/vm/opto/escape.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File