RFR(M): 8026796: Make replace_in_map() on parent maps generic

Vladimir Kozlov vladimir.kozlov at oracle.com
Mon May 19 23:37:58 UTC 2014

Why previous code 8024069 does not work?

'before', 'after' may not good names. You call new nodes 'improved' in 
the comment you should use it.

You meaningful names (not o,n) in record(Node* o, Node* n).

It would be nice to use getter/setter functions:

ReplacedNodes r = kit.map()->_replaced_nodes;
kit.map()->_replaced_nodes = r;

Do you have cases when ReplacedNodes could be repopulated? So that we 
reset length GrowableArray::clear() instead of trashing pointer:

+void ReplacedNodes::reset() {
+  _replaced_nodes = NULL;

I don't see cleanup of ReplacedNodes in Node::destruct() and other 
places where we clean up expensive nodes, for example.

Is the code in Parse::create_entry_map() correct? First, you destroy 


then you used it to initialize new map:

   SafePointNode* inmap = _caller->map();
   map()->transfer_replaced_nodes_from(inmap, _new_idx);


On 5/19/14 4:37 AM, Roland Westrelin wrote:
> I forgot the webrev:
> http://cr.openjdk.java.net/~roland/8026796/webrev.00/
> Roland.
> On May 19, 2014, at 1:01 PM, Roland Westrelin <roland.westrelin at oracle.com> wrote:
>> This change reverts:
>> https://bugs.openjdk.java.net/browse/JDK-8024069
>> and propagates replacements in replace_in_map() to callers in a generic way. Every time replace_in_map() is called, the pair of nodes passed to replace_in_map is pushed on a list that the current map carries. When control flow paths merge, the lists for each of the control flow path’s maps are also merged. When parsing exits a method to return to a caller, the replaced nodes on the exit path are used to update the caller's map. This change also propagates replaced nodes after late inlining.
>> Roland.

More information about the hotspot-compiler-dev mailing list