8193518: C2: Vector registers sometimes corrupted at safepoint
authorroland
Fri, 15 Dec 2017 10:26:45 -0800
changeset 48370 cfde2a53d393
parent 48369 8647aa05d094
child 48371 291020144f22
8193518: C2: Vector registers sometimes corrupted at safepoint Reviewed-by: neliasso, thartmann, kvn
src/hotspot/share/opto/compile.hpp
src/hotspot/share/opto/superword.cpp
--- a/src/hotspot/share/opto/compile.hpp	Fri Dec 15 16:38:40 2017 +0000
+++ b/src/hotspot/share/opto/compile.hpp	Fri Dec 15 10:26:45 2017 -0800
@@ -378,7 +378,7 @@
   bool                  _has_stringbuilder;     // True StringBuffers or StringBuilders are allocated
   bool                  _has_boxed_value;       // True if a boxed object is allocated
   bool                  _has_reserved_stack_access; // True if the method or an inlined method is annotated with ReservedStackAccess
-  int                   _max_vector_size;       // Maximum size of generated vectors
+  uint                  _max_vector_size;       // Maximum size of generated vectors
   uint                  _trap_hist[trapHistLength];  // Cumulative traps
   bool                  _trap_can_recompile;    // Have we emitted a recompiling trap?
   uint                  _decompile_count;       // Cumulative decompilation counts.
@@ -656,8 +656,8 @@
   void          set_has_boxed_value(bool z)     { _has_boxed_value = z; }
   bool              has_reserved_stack_access() const { return _has_reserved_stack_access; }
   void          set_has_reserved_stack_access(bool z) { _has_reserved_stack_access = z; }
-  int               max_vector_size() const     { return _max_vector_size; }
-  void          set_max_vector_size(int s)      { _max_vector_size = s; }
+  uint               max_vector_size() const    { return _max_vector_size; }
+  void          set_max_vector_size(uint s)     { _max_vector_size = s; }
   void          set_trap_count(uint r, uint c)  { assert(r < trapHistLength, "oob");        _trap_hist[r] = c; }
   uint              trap_count(uint r) const    { assert(r < trapHistLength, "oob"); return _trap_hist[r]; }
   bool              trap_can_recompile() const  { return _trap_can_recompile; }
--- a/src/hotspot/share/opto/superword.cpp	Fri Dec 15 16:38:40 2017 +0000
+++ b/src/hotspot/share/opto/superword.cpp	Fri Dec 15 10:26:45 2017 -0800
@@ -2442,7 +2442,9 @@
     }
   }//for (int i = 0; i < _block.length(); i++)
 
-  C->set_max_vector_size(max_vlen_in_bytes);
+  if (max_vlen_in_bytes > C->max_vector_size()) {
+    C->set_max_vector_size(max_vlen_in_bytes);
+  }
   if (max_vlen_in_bytes > 0) {
     cl->mark_loop_vectorized();
   }