8184762: ZapStackSegments should use optimized memset
authorshade
Tue, 18 Jul 2017 09:53:54 +0200
changeset 46682 b646732e1473
parent 46681 f17cefd211b4
child 46683 33808f7eadd5
child 46685 b218dfc2853a
8184762: ZapStackSegments should use optimized memset Reviewed-by: rkennke, mgerdin
hotspot/src/share/vm/utilities/globalDefinitions.hpp
hotspot/src/share/vm/utilities/stack.inline.hpp
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Mon Jul 17 09:30:07 2017 +0200
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Tue Jul 18 09:53:54 2017 +0200
@@ -949,6 +949,7 @@
 const long     badAddressVal    = -2;                       // generic "bad address" value
 const long     badOopVal        = -1;                       // generic "bad oop" value
 const intptr_t badHeapOopVal    = (intptr_t) CONST64(0x2BAD4B0BBAADBABE); // value used to zap heap after GC
+const int      badStackSegVal   = 0xCA;                     // value used to zap stack segments
 const int      badHandleValue   = 0xBC;                     // value used to zap vm handle area
 const int      badResourceValue = 0xAB;                     // value used to zap resource area
 const int      freeBlockPad     = 0xBA;                     // value used to pad freed blocks.
--- a/hotspot/src/share/vm/utilities/stack.inline.hpp	Mon Jul 17 09:30:07 2017 +0200
+++ b/hotspot/src/share/vm/utilities/stack.inline.hpp	Tue Jul 18 09:53:54 2017 +0200
@@ -27,6 +27,7 @@
 
 #include "utilities/align.hpp"
 #include "utilities/stack.hpp"
+#include "utilities/copy.hpp"
 
 template <MEMFLAGS F> StackBase<F>::StackBase(size_t segment_size, size_t max_cache_size,
                      size_t max_size):
@@ -233,11 +234,7 @@
 {
   if (!ZapStackSegments) return;
   const size_t zap_bytes = segment_bytes() - (zap_link_field ? 0 : sizeof(E*));
-  uint32_t* cur = (uint32_t*)seg;
-  const uint32_t* end = cur + zap_bytes / sizeof(uint32_t);
-  while (cur < end) {
-    *cur++ = 0xfadfaded;
-  }
+  Copy::fill_to_bytes(seg, zap_bytes, badStackSegVal);
 }
 #endif