Request for reviews (L): 6674588: Escape Analysis: Improve Escape Analysis code

John Rose John.Rose at Sun.COM
Thu Mar 13 20:29:05 PDT 2008

On Mar 13, 2008, at 2:42 PM, Vladimir Kozlov wrote:

> I updated changes and webrev.

Here's the rest of my review.  I hope it helps!

-- John

--- escape.cpp

+        // See comments above.
+        Node* unique_use = use->raw_out(0);

That looks like a factorization opportunity:
    // big comment ...
    Node* find_second_addp(Node* use) { if (...)  return use- 
 >unique_out(); else return NULL; }

+    if(!_processed.test(n->_idx) && n->is_AddP())
+      cg_worklist.append(n->_idx);

I looked but did not find how _processed could be set for the AddP node.
What sorts of a AddPs are already processed at this early point?

+void ConnectionGraph::record_for_escape_analysis(Node *n,  
PhaseTransform *phase) {
+  switch (n->Opcode()) {

It seems like almost every case in that big switch includes the  
    ptadr->_node = n;
    set_escape_state(n->_idx, PointsToNode::(something else));

Can those steps be factored out of the switch somehow,
so it's easy to tell where the irregularities are (if there are any)?
(It looks like you found on on case Op_LoadKlass.)
The pattern could be:

    int ntype = (something default);
    int estate = (something else default);
    bool defer = false;
    switch (n->Opcode()) {
      default:  return;  // nothing to do
    ptadr->_node = n;
    set_escape_state(n->_idx, estate);
    if (defer) {

By the way, the name _deferred confuses me because it makes me think  
of a kind of CG edge.
Should be "_delayed_worklist" or "_pass_2_worklist" or some such.

+        process_call_result(n->as_Proj(), phase);
+        if (!_processed.test(n->_idx)) {
+          _deferred.push(n);

Can _processed.test(n) ever be true here?
(I.e., isn't this an unconditional push to _deferred?)

+        add_deferred_edge_to_fields(n->_idx, pt, address_offset(adr,  

FWIW, address_offset(adr, phase) is loop invariant here.

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the hotspot-compiler-dev mailing list