8179019: Correct range checks for command-line options ArraycopySrcPrefetchDistance and ArraycopyDstPrefetchDistance
authorzmajo
Fri, 28 Apr 2017 09:50:47 +0200
changeset 46422 6ecc7cc67619
parent 46421 6365d86cf722
child 46423 62fac1c2c841
8179019: Correct range checks for command-line options ArraycopySrcPrefetchDistance and ArraycopyDstPrefetchDistance Summary: Update constraint for the command-line options. Change stubs to use register values instead of immediates. Reviewed-by: kvn
hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp
hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp
--- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Thu Apr 27 14:15:30 2017 +0000
+++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Fri Apr 28 09:50:47 2017 +0200
@@ -968,10 +968,11 @@
         // than prefetch distance.
         __ set(prefetch_count, O4);
         __ cmp_and_brx_short(count, O4, Assembler::less, Assembler::pt, L_block_copy);
-        __ sub(count, prefetch_count, count);
+        __ sub(count, O4, count);
 
         (this->*copy_loop_func)(from, to, count, count_dec, L_block_copy_prefetch, true, true);
-        __ add(count, prefetch_count, count); // restore count
+        __ set(prefetch_count, O4);
+        __ add(count, O4, count);
 
       } // prefetch_count > 0
 
@@ -992,11 +993,12 @@
       // than prefetch distance.
       __ set(prefetch_count, O4);
       __ cmp_and_brx_short(count, O4, Assembler::lessUnsigned, Assembler::pt, L_copy);
-      __ sub(count, prefetch_count, count);
+      __ sub(count, O4, count);
 
       Label L_copy_prefetch;
       (this->*copy_loop_func)(from, to, count, count_dec, L_copy_prefetch, true, false);
-      __ add(count, prefetch_count, count); // restore count
+      __ set(prefetch_count, O4);
+      __ add(count, O4, count);
 
     } // prefetch_count > 0
 
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp	Thu Apr 27 14:15:30 2017 +0000
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp	Fri Apr 28 09:50:47 2017 +0200
@@ -289,10 +289,10 @@
 }
 
 Flag::Error ArraycopyDstPrefetchDistanceConstraintFunc(uintx value, bool verbose) {
-  if (value != 0) {
+  if (value >= 4032) {
     CommandLineError::print(verbose,
-                            "ArraycopyDstPrefetchDistance (" UINTX_FORMAT ") must be 0\n",
-                            value);
+                            "ArraycopyDstPrefetchDistance (" UINTX_FORMAT ") must be"
+                            "between 0 and 4031\n", value);
     return Flag::VIOLATES_CONSTRAINT;
   }
 
@@ -300,10 +300,10 @@
 }
 
 Flag::Error ArraycopySrcPrefetchDistanceConstraintFunc(uintx value, bool verbose) {
-  if (value != 0) {
+  if (value >= 4032) {
     CommandLineError::print(verbose,
-                            "ArraycopySrcPrefetchDistance (" UINTX_FORMAT ") must be 0\n",
-                            value);
+                            "ArraycopySrcPrefetchDistance (" UINTX_FORMAT ") must be"
+                            "between 0 and 4031\n", value);
     return Flag::VIOLATES_CONSTRAINT;
   }