changeset 9172:34799214056c

8224580: Matcher can cause oop field/array element to be reloaded Reviewed-by: neliasso, rkennke, dlong
author roland
date Tue, 21 May 2019 09:08:01 +0200
parents bfff0a0ccb0e
children c963a2881865
files src/share/vm/opto/matcher.cpp
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/opto/matcher.cpp	Thu Jul 25 16:23:36 2019 +0100
+++ b/src/share/vm/opto/matcher.cpp	Tue May 21 09:08:01 2019 +0200
@@ -2043,6 +2043,12 @@
         // Node is shared and has no reason to clone.  Flag it as shared.
         // This causes it to match into a register for the sharing.
         set_shared(n);       // Flag as shared and
+        if (n->is_DecodeNarrowPtr()) {
+          // Oop field/array element loads must be shared but since
+          // they are shared through a DecodeN they may appear to have
+          // a single use so force sharing here.
+          set_shared(n->in(1));
+        }
         mstack.pop();        // remove node from stack
         continue;
       }
@@ -2165,13 +2171,6 @@
           continue; // for(int i = ...)
         }
 
-        if( mop == Op_AddP && m->in(AddPNode::Base)->is_DecodeNarrowPtr()) {
-          // Bases used in addresses must be shared but since
-          // they are shared through a DecodeN they may appear
-          // to have a single use so force sharing here.
-          set_shared(m->in(AddPNode::Base)->in(1));
-        }
-
         // if 'n' and 'm' are part of a graph for BMI instruction, clone this node.
 #ifdef X86
         if (UseBMI1Instructions && is_bmi_pattern(n, m)) {