# HG changeset patch # User shade # Date 1500364434 -7200 # Tue Jul 18 09:53:54 2017 +0200 # Node ID 88d0a1147933c6bfd2fd3746b5420494cfa6bf10 # Parent 5e9c41536bd2f4eb9f991cfa37bff82a0240cea7 8184762: ZapStackSegments should use optimized memset Reviewed-by: rkennke, mgerdin diff -r 5e9c41536bd2 -r 88d0a1147933 src/share/vm/utilities/globalDefinitions.hpp --- a/src/share/vm/utilities/globalDefinitions.hpp Mon Jul 17 16:31:51 2017 -0700 +++ b/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. diff -r 5e9c41536bd2 -r 88d0a1147933 src/share/vm/utilities/stack.inline.hpp --- a/src/share/vm/utilities/stack.inline.hpp Mon Jul 17 16:31:51 2017 -0700 +++ b/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 StackBase::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